public static function getSettings() { $ret = parent::getSettings(); $ret['componentName'] = trlKwfStatic('Vouchers'); $ret['assetsAdmin']['files'][] = 'kwf/Kwc/Shop/Cart/Plugins/Voucher/Panel.js'; $ret['extConfig'] = 'Kwc_Shop_Cart_Plugins_Voucher_ExtConfig'; $ret['menuConfig'] = 'Kwc_Shop_Cart_Plugins_Voucher_MenuConfig'; return $ret; }
public static function __getProcessInputComponents($data) { $showInvisible = Kwf_Component_Data_Root::getShowInvisible(); $cacheId = 'procI-' . $data->componentId; $success = false; if (!$showInvisible) { //don't cache in preview $cacheContents = Kwf_Cache_Simple::fetch($cacheId, $success); //cache is cleared in Kwf_Component_Events_ProcessInputCache } if (!$success) { $datas = array(); foreach (self::_findProcessInputComponents($data) as $p) { $plugins = array(); $c = $p; do { foreach ($c->getPlugins('Kwf_Component_Plugin_Interface_SkipProcessInput') as $i) { $plugins[] = array('pluginClass' => $i, 'componentId' => $c->componentId); } $isPage = $c->isPage; $c = $c->parent; } while ($c && !$isPage); $datas[] = array('data' => $p, 'plugins' => $plugins); } if (!$showInvisible) { $cacheContents = array(); foreach ($datas as $p) { $cacheContents[] = array('data' => $p['data']->kwfSerialize(), 'plugins' => $p['plugins']); } Kwf_Cache_Simple::add($cacheId, $cacheContents); } } else { $datas = array(); foreach ($cacheContents as $d) { $datas[] = array('data' => Kwf_Component_Data::kwfUnserialize($d['data']), 'plugins' => $d['plugins']); } } //ask SkipProcessInput plugins if it should be skipped //evaluated every time $process = array(); foreach ($datas as $d) { foreach ($d['plugins'] as $p) { $plugin = Kwf_Component_Plugin_Abstract::getInstance($p['pluginClass'], $p['componentId']); $result = $plugin->skipProcessInput(); if ($result === Kwf_Component_Plugin_Interface_SkipProcessInput::SKIP_SELF_AND_CHILDREN) { continue 2; } if ($result === Kwf_Component_Plugin_Interface_SkipProcessInput::SKIP_SELF && $p['componentId'] == $d['data']->componentId) { continue 2; } } $process[] = $d['data']; } return $process; }
protected function _render($includeMaster, &$hasDynamicParts) { $component = $this->_data->parent->getComponent(); $largeContent = $component->getLargeComponent($this->_data); if ($includeMaster) { $plugin = Kwf_Component_Plugin_Abstract::getInstance('Kwc_List_Switch_LargeContentPlugin', $this->_data->parent->componentId); $plugin->setCurrentItem($largeContent); $plugin->setCurrentPreview($component->getPreviewComponent($this->_data)); //render parent, will include largeContent $data = $this->_data->getParentPage(); } else { //render large $data = $largeContent; } if ($data == $this->_data) { return parent::_render($includeMaster, $hasDynamicParts); } else { $parentContentSender = Kwc_Abstract::getSetting($data->componentClass, 'contentSender'); $parentContentSender = new $parentContentSender($data); return $parentContentSender->_render($includeMaster, $hasDynamicParts); } }
public static function getSettings() { $ret = parent::getSettings(); $ret['generators']['loginForm'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => null); return $ret; }
public static function getSettings() { $ret = parent::getSettings(); $ret['generators']['pluginChild'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwf_Component_Output_Plugin_Plugin_Child_Component'); return $ret; }
public static function getSettings() { $ret = parent::getSettings(); $ret['generators']['form'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwf_Component_Plugin_AccessByMail_Form_Component'); return $ret; }
public static function getSettings($param = null) { $ret = parent::getSettings($param); $ret['componentName'] = trlKwfStatic('Discount'); return $ret; }
public static function getSettings($param = null) { $ret = parent::getSettings($param); $ret['validUserRoles'] = null; return $ret; }
private function _renderAndCache($componentId, $type, $value, $config, $addPluginPlaceholders, &$cacheSaved = true) { $plugins = array(); if ($type == 'component') { $c = Kwf_Component_Data_Root::getInstance()->getComponentById($componentId, array('ignoreVisible' => true)); $plugins = $this->_getGroupedViewPlugins($c); } $cacheSaved = true; if (isset($plugins['useCache'])) { foreach ($plugins['useCache'] as $p) { $p = Kwf_Component_Plugin_Abstract::getInstance($p, $componentId); if (!$p->useViewCache($this)) { $cacheSaved = false; } } } $content = null; if (!$cacheSaved || !$this->_enableCache) { //we can't save cache replace before rendering $content = $this->_executePlugins($content, $plugins, $componentId, array('replace')); } if (is_null($content)) { //render if not replaced $content = $this->_getHelper($type)->render($componentId, $config); $content = $this->_executePlugins($content, $plugins, $componentId, array('beforeCache')); } //after plugin always as placeholder to execute later $content = $this->_addPluginPlaceholders($content, $plugins, $componentId, array('after')); $cacheContent = $content; if ($cacheSaved && $this->_enableCache) { $viewCacheSettings = $this->_getHelper($type)->getViewCacheSettings($componentId); if (!is_bool($viewCacheSettings['enabled'])) { //dynamic (callback) cache enabled setting if (!call_user_func_array($viewCacheSettings['enabled']['callback'], $viewCacheSettings['enabled']['args'])) { $cacheSaved = false; } else { $cacheContent = '<useCacheDynamic ' . $componentId . ' ' . $type . ' ' . base64_encode(serialize($config)) . ' ' . serialize($viewCacheSettings['enabled']) . '>' . $cacheContent . '</useCacheDynamic ' . $componentId . '>'; } } } if ($cacheSaved && $this->_enableCache) { //if saving to cache add placeholders $cacheContent = $this->_addPluginPlaceholders($cacheContent, $plugins, $componentId, array('replace', 'before', 'useCache')); $this->_cacheSave($componentId, $type, $value, $cacheContent); if ($addPluginPlaceholders) { //return cached content to be able to re-execute plugins in pass2 $content = $cacheContent; } else { $content = $this->_executePlugins($content, $plugins, $componentId, array('before', 'replace')); } } else { //if not saving to cache execute plugins now (replace and useCache are already executed) $content = $this->_executePlugins($content, $plugins, $componentId, array('before')); } return $content; }
public static function getSettings() { $ret = parent::getSettings(); $ret['generators']['pluginStatic'] = array('class' => 'Kwf_Component_Generator_Static', 'component' => 'Kwc_Basic_Line_Component'); return $ret; }