X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FComponent.php;h=3fe0ed7db776293e4e0dffb6479d851cb0a34995;hb=a8a98777b42aacb9df7d1d39ec29ff479d59d421;hp=7d8b051f419a5fa846c394e0f2a1bbb308b2def6;hpb=b18e2d7c83a0957e6fbcfc0d0d478cdfb45ae5e5;p=civicrm-core.git diff --git a/CRM/Core/Component.php b/CRM/Core/Component.php index 7d8b051f41..3fe0ed7db7 100644 --- a/CRM/Core/Component.php +++ b/CRM/Core/Component.php @@ -42,7 +42,10 @@ class CRM_Core_Component { */ const COMPONENT_INFO_CLASS = 'Info'; - static $_contactSubTypes = NULL; + /** + * @var array + */ + public static $_contactSubTypes = NULL; /** * @param bool $force @@ -51,8 +54,8 @@ class CRM_Core_Component { */ private static function &_info($force = FALSE) { if (!isset(Civi::$statics[__CLASS__]['info'])|| $force) { - Civi::$statics[__CLASS__]['info'] = array(); - $c = array(); + Civi::$statics[__CLASS__]['info'] = []; + $c = []; $config = CRM_Core_Config::singleton(); $c = self::getComponents(); @@ -89,7 +92,7 @@ class CRM_Core_Component { */ public static function &getComponents($force = FALSE) { if (!isset(Civi::$statics[__CLASS__]['all']) || $force) { - Civi::$statics[__CLASS__]['all'] = array(); + Civi::$statics[__CLASS__]['all'] = []; $cr = new CRM_Core_DAO_Component(); $cr->find(FALSE); @@ -117,7 +120,7 @@ class CRM_Core_Component { * Array(string $name => int $id). */ public static function &getComponentIDs() { - $componentIDs = array(); + $componentIDs = []; $cr = new CRM_Core_DAO_Component(); $cr->find(FALSE); @@ -128,18 +131,18 @@ class CRM_Core_Component { return $componentIDs; } - /** * @param bool $force * * @return CRM_Core_Component_Info[] */ - static public function &getEnabledComponents($force = FALSE) { + public static function &getEnabledComponents($force = FALSE) { return self::_info($force); } - static public function flushEnabledComponents() { + public static function flushEnabledComponents() { unset(Civi::$statics[__CLASS__]); + CRM_Core_BAO_Navigation::resetNavigation(); } /** @@ -150,7 +153,7 @@ class CRM_Core_Component { public static function &getNames($translated = FALSE) { $allComponents = self::getComponents(); - $names = array(); + $names = []; foreach ($allComponents as $name => $comp) { if ($translated) { $names[$comp->componentID] = $comp->info['translatedName']; @@ -208,7 +211,7 @@ class CRM_Core_Component { // lets build the menu for all components $info = self::getComponents(TRUE); - $files = array(); + $files = []; foreach ($info as $name => $comp) { $files = array_merge($files, $comp->menuFiles() @@ -223,7 +226,7 @@ class CRM_Core_Component { */ public static function &menu() { $info = self::_info(); - $items = array(); + $items = []; foreach ($info as $name => $comp) { $mnu = $comp->getMenuObject(); @@ -275,7 +278,7 @@ class CRM_Core_Component { */ public static function &getQueryFields($checkPermission = TRUE) { $info = self::_info(); - $fields = array(); + $fields = []; foreach ($info as $name => $comp) { if ($comp->usesSearch()) { $bqr = $comp->getBAOQueryObject(); @@ -383,12 +386,11 @@ class CRM_Core_Component { */ public static function &contactSubTypes() { if (self::$_contactSubTypes == NULL) { - self::$_contactSubTypes = array(); + self::$_contactSubTypes = []; } return self::$_contactSubTypes; } - /** * @param $subType * @param $op @@ -431,7 +433,7 @@ class CRM_Core_Component { * @return array */ public static function getComponentsFromFile($crmFolderDir) { - $components = array(); + $components = []; //traverse CRM folder and check for Info file if (is_dir($crmFolderDir) && $dir = opendir($crmFolderDir)) { while ($subDir = readdir($dir)) {