Esempio n. 1
0
 /**
  * Collect getViewUrl() from theme templates
  *
  * @param Mage_Core_Model_Theme $theme
  * @param array &$files
  */
 protected function _collectGetViewUrlInvokes($theme, &$files)
 {
     $themePath = str_replace(Mage_Core_Model_Theme::PATH_SEPARATOR, DIRECTORY_SEPARATOR, $theme->getThemePath());
     $searchDir = Mage::getBaseDir('design') . DIRECTORY_SEPARATOR . $theme->getArea() . DIRECTORY_SEPARATOR . $themePath;
     $dirLength = strlen($searchDir);
     foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($searchDir)) as $fileInfo) {
         // Check that file path is valid
         $relativePath = substr($fileInfo->getPath(), $dirLength);
         if (!$this->_validateTemplatePath($relativePath)) {
             continue;
         }
         // Scan file for references to other files
         foreach ($this->_findReferencesToViewFile($fileInfo) as $file) {
             $files[$theme->getArea()][$theme->getId()][] = $file;
         }
     }
     // Collect "addCss" and "addJs" from theme layout
     $layoutUpdate = Mage::getModel('Mage_Core_Model_Layout_Merge', array('arguments' => array('area' => $theme->getArea(), 'theme' => $theme->getId())));
     $fileLayoutUpdates = $layoutUpdate->getFileLayoutUpdatesXml();
     $elements = $fileLayoutUpdates->xpath('//action[@method="addCss" or @method="addJs"]/*[1]');
     if ($elements) {
         foreach ($elements as $filenameNode) {
             $viewFile = (string) $filenameNode;
             if ($this->_isFileForDisabledModule($viewFile)) {
                 continue;
             }
             $files[$theme->getArea()][$theme->getId()][] = $viewFile;
         }
     }
 }
Esempio n. 2
0
 /**
  * Get the name of the inherited theme
  *
  * If the specified theme inherits other theme the result is the name of inherited theme.
  * If the specified theme does not inherit other theme the result is null.
  *
  * @param Mage_Core_Model_Theme $themeModel
  * @return string|null
  */
 protected function _getInheritedTheme($themeModel)
 {
     $themePath = $themeModel->getThemePath();
     return $themePath ? explode('/', $themePath) : null;
 }