<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* This class proivdes various helper functions for locating extensions
/**
* An URL for public extensions repository
*/
- //CONST DEFAULT_EXTENSIONS_REPOSITORY = 'http://civicrm.org/extdir/ver={ver}|cms={uf}';
+ //const DEFAULT_EXTENSIONS_REPOSITORY = 'http://civicrm.org/extdir/ver={ver}|cms={uf}';
/**
* Extension info file name
$this->cacheKey = $cacheKey;
if ($civicrmUrl) {
$this->civicrmUrl = rtrim($civicrmUrl, '/');
- } else {
+ }
+ else {
$config = CRM_Core_Config::singleton();
$this->civicrmUrl = rtrim($config->resourceBase, '/');
}
if ($civicrmPath) {
- $this->civicrmPath = rtrim($civicrmPath,'/');
- } else {
+ $this->civicrmPath = rtrim($civicrmPath, '/');
+ }
+ else {
global $civicrm_root;
- $this->civicrmPath = rtrim($civicrm_root,'/');
+ $this->civicrmPath = rtrim($civicrm_root, '/');
}
}
/**
* Given the class, provides extension's key.
*
- * @access public
*
- * @param string $clazz extension class name
+ * @param string $clazz
+ * Extension class name.
*
- * @return string name of extension key
+ * @return string
+ * name of extension key
*/
public function classToKey($clazz) {
return str_replace('_', '.', $clazz);
/**
* Given the class, provides extension path.
*
- * @access public
*
* @param $clazz
*
- * @return string full path the extension .php file
+ * @return string
+ * full path the extension .php file
*/
public function classToPath($clazz) {
$elements = explode('_', $clazz);
/**
* Given the string, returns true or false if it's an extension key.
*
- * @access public
*
- * @param string $key a string which might be an extension key
+ * @param string $key
+ * A string which might be an extension key.
*
- * @return boolean true if given string is an extension name
+ * @return bool
+ * true if given string is an extension name
*/
public function isExtensionKey($key) {
// check if the string is an extension name or the class
/**
* Given the string, returns true or false if it's an extension class name.
*
- * @access public
*
- * @param string $clazz a string which might be an extension class name
+ * @param string $clazz
+ * A string which might be an extension class name.
*
- * @return boolean true if given string is an extension class name
+ * @return bool
+ * true if given string is an extension class name
*/
public function isExtensionClass($clazz) {
}
/**
- * @param string $key extension fully-qualified-name
+ * @param string $key
+ * Extension fully-qualified-name.
* @param bool $fresh
*
* @throws CRM_Extension_Exception
if ($fresh || !array_key_exists($key, $this->infos)) {
try {
$this->infos[$key] = CRM_Extension_Info::loadFromFile($this->container->getPath($key) . DIRECTORY_SEPARATOR . CRM_Extension_Info::FILENAME);
- } catch (CRM_Extension_Exception $e) {
+ }
+ catch (CRM_Extension_Exception $e) {
// file has more detailed info, but we'll fallback to DB if it's missing -- DB has enough info to uninstall
$this->infos[$key] = CRM_Extension_System::singleton()->getManager()->createInfoFromDB($key);
if (!$this->infos[$key]) {
/**
* Given the key, provides extension's class name.
*
- * @access public
*
- * @param string $key extension key
+ * @param string $key
+ * Extension key.
*
- * @return string name of extension's main class
+ * @return string
+ * name of extension's main class
*/
public function keyToClass($key) {
return str_replace('.', '_', $key);
* Given the key, provides the path to file containing
* extension's main class.
*
- * @access public
*
- * @param string $key extension key
+ * @param string $key
+ * Extension key.
*
- * @return string path to file containing extension's main class
+ * @return string
+ * path to file containing extension's main class
*/
public function keyToPath($key) {
$info = $this->keyToInfo($key);
* Given the key, provides the path to file containing
* extension's main class.
*
- * @access public
- * @param string $key extension key
- * @return string local path of the extension source tree
+ * @param string $key
+ * Extension key.
+ * @return string
+ * local path of the extension source tree
*/
public function keyToBasePath($key) {
if ($key == 'civicrm') {
* Given the key, provides the path to file containing
* extension's main class.
*
- * @access public
*
- * @param string $key extension key
+ * @param string $key
+ * Extension key.
*
- * @return string url for resources in this extension
+ * @return string
+ * url for resources in this extension
*/
public function keyToUrl($key) {
if ($key == 'civicrm') {
/**
* Fetch the list of active extensions of type 'module'
*
- * @param $fresh bool whether to forcibly reload extensions list from canonical store
- * @return array - array(array('prefix' => $, 'file' => $))
+ * @param bool $fresh
+ * whether to forcibly reload extensions list from canonical store.
+ * @return array
+ * array(array('prefix' => $, 'file' => $))
*/
public function getActiveModuleFiles($fresh = FALSE) {
$config = CRM_Core_Config::singleton();
'prefix' => $dao->file,
'filePath' => $this->keyToPath($dao->full_name),
);
- } catch (CRM_Extension_Exception $e) {
+ }
+ catch (CRM_Extension_Exception $e) {
// Putting a stub here provides more consistency
// in how getActiveModuleFiles when racing between
// dirty file-removals and cache-clears.
/**
* Get a list of base URLs for all active modules
*
- * @return array (string $extKey => string $baseUrl)
+ * @return array
+ * (string $extKey => string $baseUrl)
*/
public function getActiveModuleUrls() {
// TODO optimization/caching
}
/**
- * @param $name
+ * @param string $name
*
* @return bool
*/
/**
* Get a list of all installed modules, including enabled and disabled ones
*
- * @return array CRM_Core_Module
+ * @return array
+ * CRM_Core_Module
*/
public function getModules() {
$result = array();
/**
* Given the class, provides the template path.
*
- * @access public
*
- * @param string $clazz extension class name
+ * @param string $clazz
+ * Extension class name.
*
- * @return string path to extension's templates directory
+ * @return string
+ * path to extension's templates directory
*/
public function getTemplatePath($clazz) {
$path = $this->container->getPath($this->classToKey($clazz));
$pathElm = explode(DIRECTORY_SEPARATOR, $path);
array_pop($pathElm);
return implode(DIRECTORY_SEPARATOR, $pathElm) . DIRECTORY_SEPARATOR . self::EXT_TEMPLATES_DIRNAME;
- */
+ */
}
/**
* Given te class, provides the template name.
* @todo consider multiple templates, support for one template for now
*
- * @access public
*
- * @param string $clazz extension class name
+ * @param string $clazz
+ * Extension class name.
*
- * @return string extension's template name
+ * @return string
+ * extension's template name
*/
public function getTemplateName($clazz) {
$info = $this->keyToInfo($this->classToKey($clazz));
$this->cache->delete($this->cacheKey . '/moduleFiles');
}
}
+
}