示例#1
0
 public function templatesDataProvider()
 {
     $templates = array();
     $themes = $this->_getDesignThemes();
     foreach ($themes as $view) {
         list($area, $package, $theme) = explode('/', $view);
         $layoutUpdate = new Mage_Core_Model_Layout_Merge(array('area' => $area, 'package' => $package, 'theme' => $theme));
         $layoutTemplates = $this->_getLayoutTemplates($layoutUpdate->getFileLayoutUpdatesXml());
         foreach ($layoutTemplates as $templateData) {
             $templates[] = array_merge(array($area, $package, $theme), $templateData);
         }
     }
     return $templates;
 }
示例#2
0
 /**
  * Cleanup circular references between layout & blocks
  *
  * Destructor should be called explicitly in order to work around the PHP bug
  * https://bugs.php.net/bug.php?id=62468
  */
 public function __destruct()
 {
     if (isset($this->_update) && is_object($this->_update)) {
         $this->_update->__destruct();
         $this->_update = null;
     }
     $this->_blocks = array();
     $this->_xml = null;
 }
示例#3
0
 /**
  * @magentoConfigFixture current_store advanced/modules_disable_output/Mage_Catalog true
  * @magentoConfigFixture current_store advanced/modules_disable_output/Mage_Page    true
  */
 public function testGetFileLayoutUpdatesXmlDisabledOutput()
 {
     $this->_replaceConfigLayoutUpdates('
         <catalog module="Mage_Catalog">
             <file>layout.xml</file>
         </catalog>
         <core module="Mage_Core">
             <file>layout.xml</file>
         </core>
         <page module="Mage_Page">
             <file>layout.xml</file>
         </page>
     ');
     $expectedXmlStr = $this->_readLayoutFileContents(__DIR__ . '/../_files/design/frontend/test/default/Mage_Core/layout.xml');
     $actualXml = $this->_model->getFileLayoutUpdatesXml();
     $this->assertXmlStringEqualsXmlString($expectedXmlStr, $actualXml->asNiceXml());
 }
示例#4
0
 /**
  * Collect getSkinUrl() from theme templates
  *
  * @param string    $area
  * @param string    $package
  * @param string    $theme
  * @param array     &$files
  */
 protected function _collectGetSkinUrlInvokes($area, $package, $theme, &$files)
 {
     $searchDir = Mage::getBaseDir('design') . DIRECTORY_SEPARATOR . $area . DIRECTORY_SEPARATOR . $package . DIRECTORY_SEPARATOR . $theme;
     $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->_findReferencesToSkinFile($fileInfo) as $file) {
             $files[$area][$package][$theme][] = $file;
         }
     }
     // Collect "addCss" and "addJs" from theme layout
     $layoutUpdate = new Mage_Core_Model_Layout_Merge(array('area' => $area, 'package' => $package, 'theme' => $theme));
     $fileLayoutUpdates = $layoutUpdate->getFileLayoutUpdatesXml();
     $elements = $fileLayoutUpdates->xpath('//action[@method="addCss" or @method="addJs"]/*[1]');
     if ($elements) {
         foreach ($elements as $filenameNode) {
             $skinFile = (string) $filenameNode;
             if ($this->_isFileForDisabledModule($skinFile)) {
                 continue;
             }
             $files[$area][$package][$theme][] = $skinFile;
         }
     }
 }
示例#5
0
 /**
  * Composes full layout xml for designated parameters
  *
  * @param string $area
  * @param string $package
  * @param string $theme
  * @return Mage_Core_Model_Layout_Element
  */
 protected function _composeXml($area, $package, $theme)
 {
     $layoutUpdate = new Mage_Core_Model_Layout_Merge(array('area' => $area, 'package' => $package, 'theme' => $theme));
     return $layoutUpdate->getFileLayoutUpdatesXml();
 }