Beispiel #1
0
 /**
  * @param null $customPath
  * @return array|mixed
  */
 public static function getBrickDirectories($customPath = null)
 {
     $cacheKey = "brick_directories";
     if ($customPath) {
         $cacheKey .= "_" . crc32($customPath);
     }
     $areas = array();
     try {
         $areas = \Zend_Registry::get($cacheKey);
     } catch (\Exception $e) {
         if ($customPath) {
             $areaRepositories = array($customPath);
         } else {
             $areaRepositories = array(PIMCORE_WEBSITE_PATH . "/views/areas", PIMCORE_WEBSITE_VAR . "/areas");
         }
         // include area repositories from active plugins
         $configs = ExtensionManager::getPluginConfigs();
         foreach ($configs as $config) {
             $className = $config["plugin"]["pluginClassName"];
             if (!empty($className)) {
                 $isEnabled = ExtensionManager::isEnabled("plugin", $config["plugin"]["pluginName"]);
                 $areaDir = PIMCORE_PLUGINS_PATH . "/" . $config["plugin"]["pluginName"] . "/views/areas";
                 if ($isEnabled && file_exists($areaDir)) {
                     $areaRepositories[] = $areaDir;
                 }
             }
         }
         // get directories
         foreach ($areaRepositories as $respository) {
             if (is_dir($respository) && is_readable($respository)) {
                 $blockDirs = scandir($respository);
                 foreach ($blockDirs as $blockDir) {
                     if (is_dir($respository . "/" . $blockDir)) {
                         if (is_file($respository . "/" . $blockDir . "/area.xml")) {
                             $areas[$blockDir] = $respository . "/" . $blockDir;
                         }
                     }
                 }
             }
         }
         \Zend_Registry::set($cacheKey, $areas);
     }
     return $areas;
 }