예제 #1
0
파일: FileResolver.php 프로젝트: acp3/core
 /**
  * @param string $modulePath
  * @param string $designPath
  * @param string $dir
  * @param string $file
  *
  * @return string
  */
 private function resolveAssetPath($modulePath, $designPath, $dir, $file)
 {
     if ($this->designAssetsPath === null) {
         $this->designAssetsPath = $this->appPath->getDesignPathInternal();
     }
     $assetPath = '';
     $designAssetPath = $this->designAssetsPath . $designPath . $dir . $file;
     // A theme has overridden a static asset of a module
     if (is_file($designAssetPath) === true) {
         $assetPath = $designAssetPath;
     } else {
         $designInfo = $this->xml->parseXmlFile($this->designAssetsPath . '/info.xml', '/design');
         // Recursively iterate over the nested themes
         if (!empty($designInfo['parent'])) {
             $this->designAssetsPath = $this->appPath->getDesignRootPathInternal() . $designInfo['parent'] . '/';
             $assetPath = $this->getStaticAssetPath($modulePath, $designPath, $dir, $file);
             $this->designAssetsPath = $this->appPath->getDesignPathInternal();
             return $assetPath;
         }
         // No overrides have been found -> iterate over all possible module namespaces
         foreach (array_reverse($this->vendors->getVendors()) as $vendor) {
             $moduleAssetPath = $this->appPath->getModulesDir() . $vendor . '/' . $modulePath . $dir . $file;
             if (is_file($moduleAssetPath) === true) {
                 $assetPath = $moduleAssetPath;
                 break;
             }
         }
     }
     $systemAssetPath = $this->appPath->getModulesDir() . $modulePath . $dir . $file;
     $this->cachedPaths[$systemAssetPath] = $assetPath;
     $this->newAssetPathsAdded = true;
     return $assetPath;
 }
예제 #2
0
파일: Assets.php 프로젝트: acp3/core
 /**
  * Checks, whether the current design uses Bootstrap or not
  *
  * @param \ACP3\Core\Environment\ApplicationPath $appPath
  * @param Libraries $libraries
  */
 public function __construct(ApplicationPath $appPath, Libraries $libraries)
 {
     $this->designXml = simplexml_load_file($appPath->getDesignPathInternal() . 'info.xml');
     $this->libraries = $libraries;
     if (isset($this->designXml->use_bootstrap) && (string) $this->designXml->use_bootstrap === 'true') {
         $this->enableLibraries(['bootstrap']);
     }
     $this->libraries->dispatchAddLibraryEvent();
 }