test fix to compensate for not truncating status anymore
[civicrm-core.git] / CRM / Extension / Mapper.php
index 1e5e5bf0c51e45a0968053ef66a810f19e85c2ae..e393d8ee7874ba49a2fe3fbd39c07d64b523e5a2 100755 (executable)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -42,7 +42,7 @@
  * module-extensions.
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -84,6 +84,13 @@ class CRM_Extension_Mapper {
 
   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;
@@ -120,7 +127,9 @@ class CRM_Extension_Mapper {
    *
    * @access public
    *
-   * @param string $key extension key
+   * @param $clazz
+   *
+   * @internal param string $key extension key
    *
    * @return string full path the extension .php file
    */
@@ -163,6 +172,10 @@ class CRM_Extension_Mapper {
 
   /**
    * @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) {
@@ -299,6 +312,29 @@ class CRM_Extension_Mapper {
     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) {