bool) */ protected $addedCoreResources = array(); /** * @var array ($regionName => bool) */ protected $addedCoreStyles = array(); /** * @var string a value to append to JS/CSS URLs to coerce cache resets */ protected $cacheCode = NULL; /** * @var string the name of a setting which persistently stores the cacheCode */ protected $cacheCodeKey = NULL; /** * Get or set the single instance of CRM_Core_Resources * * @param $instance CRM_Core_Resources, new copy of the manager * @return CRM_Core_Resources */ static public function singleton(CRM_Core_Resources $instance = NULL) { if ($instance !== NULL) { self::$_singleton = $instance; } if (self::$_singleton === NULL) { $sys = CRM_Extension_System::singleton(); $cache = new CRM_Utils_Cache_SqlGroup(array( 'group' => 'js-strings', 'prefetch' => FALSE, )); self::$_singleton = new CRM_Core_Resources( $sys->getMapper(), $cache, CRM_Core_Config::isUpgradeMode() ? NULL : 'resCacheCode' ); } return self::$_singleton; } /** * Construct a resource manager * * @param CRM_Extension_Mapper $extMapper Map extension names to their base path or URLs. */ public function __construct($extMapper, $cache, $cacheCodeKey = NULL) { $this->extMapper = $extMapper; $this->cache = $cache; $this->cacheCodeKey = $cacheCodeKey; if ($cacheCodeKey !== NULL) { $this->cacheCode = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $cacheCodeKey); } if (!$this->cacheCode) { $this->resetCacheCode(); } } /** * Add a JavaScript file to the current page using