X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FComponent.php;h=85c69308675466cdbdfeec609a8ae5ea497de122;hb=5c4d65599fee6dfdf661b4932d12c5905e60ac90;hp=e6dbbf8b0d3bce367c782d1284b6a2143a2a8a69;hpb=c52174d854bcc01af1e112d3bb0eee0e201d65e6;p=civicrm-core.git diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index e6dbbf8b0d..85c6930867 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -1,7 +1,7 @@ info); @@ -99,7 +99,7 @@ class CRM_Core_Component { $cr->find(FALSE); while ($cr->fetch()) { $infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS; - require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php'); + require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php'; $infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id); if ($infoObject->info['name'] !== $cr->name) { CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name})."); @@ -151,7 +151,7 @@ class CRM_Core_Component { * * @return bool */ - static function invoke(&$args, $type) { + public static function invoke(&$args, $type) { $info = self::_info(); $config = CRM_Core_Config::singleton(); @@ -186,7 +186,7 @@ class CRM_Core_Component { /** * @return array */ - static function xmlMenu() { + public static function xmlMenu() { // lets build the menu for all components $info = self::getComponents(TRUE); @@ -204,7 +204,7 @@ class CRM_Core_Component { /** * @return array */ - static function &menu() { + public static function &menu() { $info = self::_info(); $items = array(); foreach ($info as $name => $comp) { @@ -223,14 +223,14 @@ class CRM_Core_Component { * @param $config * @param bool $oldMode */ - static function addConfig(&$config, $oldMode = FALSE) { + public static function addConfig(&$config, $oldMode = FALSE) { $info = self::_info(); foreach ($info as $name => $comp) { $cfg = $comp->getConfigObject(); $cfg->add($config, $oldMode); } - return; + return NULL; } /** @@ -238,7 +238,7 @@ class CRM_Core_Component { * * @return mixed */ - static function getComponentID($componentName) { + public static function getComponentID($componentName) { $info = self::_info(); if (!empty($info[$componentName])) { return $info[$componentName]->componentID; @@ -253,7 +253,7 @@ class CRM_Core_Component { * * @return int|null|string */ - static function getComponentName($componentID) { + public static function getComponentName($componentID) { $info = self::_info(); $componentName = NULL; @@ -270,13 +270,13 @@ class CRM_Core_Component { /** * @return array */ - static function &getQueryFields() { + public static function &getQueryFields() { $info = self::_info(); $fields = array(); foreach ($info as $name => $comp) { if ($comp->usesSearch()) { - $bqr = $comp->getBAOQueryObject(); - $flds = $bqr->getFields(); + $bqr = $comp->getBAOQueryObject(); + $flds = $bqr->getFields(); $fields = array_merge($fields, $flds); } } @@ -287,7 +287,7 @@ class CRM_Core_Component { * @param $query * @param string $fnName */ - static function alterQuery(&$query, $fnName) { + public static function alterQuery(&$query, $fnName) { $info = self::_info(); foreach ($info as $name => $comp) { @@ -305,7 +305,7 @@ class CRM_Core_Component { * * @return null */ - static function from($fieldName, $mode, $side) { + public static function from($fieldName, $mode, $side) { $info = self::_info(); $from = NULL; @@ -327,7 +327,8 @@ class CRM_Core_Component { * * @return null */ - static function &defaultReturnProperties($mode, + public static function &defaultReturnProperties( + $mode, $includeCustomFields = TRUE ) { $info = self::_info(); @@ -348,7 +349,7 @@ class CRM_Core_Component { /** * @param CRM_Core_Form $form */ - static function &buildSearchForm(&$form) { + public static function &buildSearchForm(&$form) { $info = self::_info(); foreach ($info as $name => $comp) { @@ -363,7 +364,7 @@ class CRM_Core_Component { * @param $row * @param int $id */ - static function searchAction(&$row, $id) { + public static function searchAction(&$row, $id) { $info = self::_info(); foreach ($info as $name => $comp) { @@ -377,7 +378,7 @@ class CRM_Core_Component { /** * @return array|null */ - static function &contactSubTypes() { + public static function &contactSubTypes() { if (self::$_contactSubTypes == NULL) { self::$_contactSubTypes = array(); } @@ -391,7 +392,7 @@ class CRM_Core_Component { * * @return null */ - static function &contactSubTypeProperties($subType, $op) { + public static function &contactSubTypeProperties($subType, $op) { $properties = self::contactSubTypes(); if (array_key_exists($subType, $properties) && array_key_exists($op, $properties[$subType]) @@ -404,7 +405,7 @@ class CRM_Core_Component { /** * FIXME: This function does not appear to do anything. The is_array() check runs on a bunch of objects and (always?) returns false */ - static function &taskList() { + public static function &taskList() { $info = self::_info(); $tasks = array(); @@ -419,13 +420,11 @@ class CRM_Core_Component { /** * Handle table dependencies of components * - * @param array $tables array of tables + * @param array $tables + * Array of tables. * - * @return null - * @access public - * @static */ - static function tableNames(&$tables) { + public static function tableNames(&$tables) { $info = self::_info(); foreach ($info as $name => $comp) { @@ -438,13 +437,11 @@ class CRM_Core_Component { /** * Get components info from info file - * */ - static function getComponentsFromFile($crmFolderDir) { + public static function getComponentsFromFile($crmFolderDir) { $components = array(); //traverse CRM folder and check for Info file - if (is_dir($crmFolderDir)) { - $dir = opendir($crmFolderDir); + if (is_dir($crmFolderDir) && $dir = opendir($crmFolderDir)) { while ($subDir = readdir($dir)) { // skip the extensions diretory since it has an Info.php file also if ($subDir == 'Extension') { @@ -454,7 +451,7 @@ class CRM_Core_Component { $infoFile = $crmFolderDir . "/{$subDir}/" . self::COMPONENT_INFO_CLASS . '.php'; if (file_exists($infoFile)) { $infoClass = 'CRM_' . $subDir . '_' . self::COMPONENT_INFO_CLASS; - require_once (str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php'); + require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php'; $infoObject = new $infoClass(NULL, NULL, NULL); $components[$infoObject->info['name']] = $infoObject; unset($infoObject); @@ -464,5 +461,5 @@ class CRM_Core_Component { return $components; } -} +}