protected function _build($options)
 {
     echo "\nsettings...\n";
     if (!file_exists('build/component')) {
         mkdir('build/component');
     }
     Kwf_Component_Settings::resetSettingsCache();
     foreach (glob('build/component/*') as $f) {
         unlink($f);
     }
     $fileName = 'build/component/settings';
     try {
         $data = Kwf_Component_Settings::_getSettingsCached();
     } catch (Kwf_Trl_BuildFileMissingException $e) {
         $originatingException = $e->getSettingsNonStaticTrlException();
         if ($originatingException) {
             throw $originatingException;
         }
         throw $e;
     }
     foreach ($data as $cmp => $settings) {
         self::_checkSettings($cmp, $settings);
     }
     file_put_contents($fileName, serialize($data));
     $componentClasses = Kwc_Abstract::getComponentClasses();
     echo "masterLayouts...\n";
     Kwf_Component_MasterLayout_Abstract::_buildAll($componentClasses);
     echo "layouts...\n";
     Kwf_Component_Layout_Abstract::_buildAll($componentClasses);
 }
Пример #2
0
 public function getContentWidth(Kwf_Component_Data $data)
 {
     if ($this->_hasSetting('contentWidth')) {
         return $this->_getSetting('contentWidth');
     }
     if ($data->isPage || isset($data->box)) {
         $componentWithMaster = Kwf_Component_View_Helper_Master::getComponentsWithMasterTemplate($data);
         $last = array_pop($componentWithMaster);
         if ($last && $last['type'] == 'master') {
             $p = $last['data'];
         } else {
             $p = Kwf_Component_Data_Root::getInstance();
             // for tests
         }
         return Kwf_Component_MasterLayout_Abstract::getInstance($p->componentClass)->getContentWidth($data);
     } else {
         if (!$data->parent) {
             throw new Kwf_Exception("Can't detect contentWidth, use contentWidth setting for '" . $data->componentClass . "'");
         }
         return self::getInstance($data->parent->componentClass)->getChildContentWidth($data->parent, $data);
     }
 }
Пример #3
0
 private static function _loadFromBuild()
 {
     if (!isset(self::$_supportedContexts)) {
         if (file_exists('build/component/masterlayoutcontexts')) {
             $data = unserialize(file_get_contents('build/component/masterlayoutcontexts'));
             self::$_supportedContexts = $data['contexts'];
             self::$_supportedBoxContexts = $data['boxContexts'];
         } else {
             self::$_supportedContexts = array();
             self::$_supportedBoxContexts = array();
         }
     }
 }