<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
* module-extensions.
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
protected $civicrmUrl;
+ /**
+ * @param CRM_Extension_Container_Interface $container
+ * @param CRM_Utils_Cache_Interface $cache
+ * @param null $cacheKey
+ * @param null $civicrmPath
+ * @param null $civicrmUrl
+ */
public function __construct(CRM_Extension_Container_Interface $container, CRM_Utils_Cache_Interface $cache = NULL, $cacheKey = NULL, $civicrmPath = NULL, $civicrmUrl = NULL) {
$this->container = $container;
$this->cache = $cache;
*
* @access public
*
- * @param string $key extension key
+ * @param $clazz
+ *
+ * @internal param string $key extension key
*
* @return string full path the extension .php file
*/
/**
* @param string $key extension fully-qualified-name
+ * @param bool $fresh
+ *
+ * @throws CRM_Extension_Exception
+ * @throws Exception
* @return object CRM_Extension_Info
*/
public function keyToInfo($key, $fresh = FALSE) {
*/
public function keyToUrl($key) {
if ($key == 'civicrm') {
+ // CRM-12130 Workaround: If the domain's config_backend is NULL at the start of the request,
+ // then the Mapper is wrongly constructed with an empty value for $this->civicrmUrl.
if (empty($this->civicrmUrl)) {
$config = CRM_Core_Config::singleton();
return rtrim($config->resourceBase, '/');
return $moduleExtensions;
}
+ /**
+ * Get a list of base URLs for all active modules
+ *
+ * @return array (string $extKey => string $baseUrl)
+ */
+ public function getActiveModuleUrls() {
+ // TODO optimization/caching
+ $urls = array();
+ $urls['civicrm'] = $this->keyToUrl('civicrm');
+ foreach ($this->getModules() as $module) {
+ /** @var $module CRM_Core_Module */
+ if ($module->is_active) {
+ $urls[$module->name] = $this->keyToUrl($module->name);
+ }
+ }
+ return $urls;
+ }
+
+ /**
+ * @param $name
+ *
+ * @return bool
+ */
public function isActiveModule($name) {
$activeModules = $this->getActiveModuleFiles();
foreach ($activeModules as $activeModule) {