本文整理汇总了PHP中Kwc_Abstract::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwc_Abstract::getSetting方法的具体用法?PHP Kwc_Abstract::getSetting怎么用?PHP Kwc_Abstract::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwc_Abstract
的用法示例。
在下文中一共展示了Kwc_Abstract::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplateVars
public function getTemplateVars()
{
$ret = parent::getTemplateVars();
$ret['image'] = $this->getData();
$imageCaptionSetting = Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'imageCaption');
if ($imageCaptionSetting) {
$ret['image_caption'] = $this->getRow()->image_caption;
}
$ret['baseUrl'] = $this->getBaseImageUrl();
if ($this->getRow()->own_image) {
$imageData = $this->getImageData();
if ($imageData) {
$steps = Kwf_Media_Image::getResponsiveWidthSteps($this->getImageDimensions(), $imageData['file']);
$ret['minWidth'] = $steps[0];
$ret['maxWidth'] = end($steps);
}
}
if (Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'altText')) {
$ret['altText'] = $this->_getRow()->alt_text;
}
if (Kwc_Abstract::getSetting($this->_getSetting('masterComponentClass'), 'titleText')) {
$ret['imgAttributes']['title'] = $this->_getRow()->title_text;
}
return $ret;
}
示例2: componentWithMaster
public function componentWithMaster(array $componentWithMaster)
{
$last = array_pop($componentWithMaster);
$component = $last['data'];
if ($last['type'] == 'master') {
$innerComponent = $componentWithMaster[0]['data'];
$vars = $component->getComponent()->getMasterTemplateVars($innerComponent, $this->_getRenderer());
$vars['componentWithMaster'] = $componentWithMaster;
if (Kwc_Abstract::hasSetting($component->componentClass, 'masterTemplate')) {
$masterTemplate = Kwc_Abstract::getSetting($component->componentClass, 'masterTemplate');
} else {
$masterTemplate = $this->_getRenderer()->getTemplate($component, 'Master');
}
if (substr($masterTemplate, -4) == '.tpl') {
$view = new Kwf_Component_View($this->_getRenderer());
$view->assign($vars);
$ret = $view->render($masterTemplate);
} else {
$twig = new Kwf_Component_Renderer_Twig_Environment($this->_getRenderer());
$ret = $twig->render($masterTemplate, $vars);
}
$ret = $this->_replaceKwfUp($ret);
return $ret;
} else {
if ($last['type'] == 'component') {
$helper = new Kwf_Component_View_Helper_Component();
$helper->setRenderer($this->_getRenderer());
return '<div class="kwfMainContent">' . "\n " . $helper->component($component) . "\n" . '</div>' . "\n";
} else {
throw new Kwf_Exception("invalid type");
}
}
}
示例3: getTemplateVars
public function getTemplateVars()
{
$ret = parent::getTemplateVars();
$ret['sources'] = null;
//mp3
$url = Kwf_Media::getUrl($this->getData()->componentClass, $this->getData()->componentId, 'mp3', 'audio.mp3');
if ($url) {
$ret['source'] = array('src' => $url, 'type' => 'audio/mp3', 'title' => 'mp3');
}
$ret['config'] = Kwc_Abstract::getSetting($this->getData()->componentClass, 'audio');
$row = $this->getRow();
if ($row->audio_width) {
$ret['config']['audioWidth'] = $row->audio_width;
}
if ($row->audio_height) {
$ret['config']['audioHeight'] = $row->audio_height;
}
if ($row->auto_play) {
$ret['config']['autoPlay'] = true;
}
if ($row->loop) {
$ret['config']['loop'] = true;
}
return $ret;
}
示例4: _graphData
private function _graphData($class, $parent = '')
{
if (is_instance_of($class, 'Kwc_Paragraphs_Component')) {
return;
}
static $processed = array();
$ret = '';
$last = $class . $parent;
foreach (Kwc_Abstract::getSetting($class, 'generators') as $generatorKey => $generator) {
$g = $this->_getGenerator($class, $generatorKey);
$shape = $this->_getShape($g);
foreach ($this->_getChildren($generator) as $child) {
$color = $this->_getColor($child);
$fontcolor = in_array($child, $processed) ? 'grey40' : 'black';
$classname = $this->_getClassName($child, $class);
$label = '';
if ($g->getGeneratorFlag('table')) {
$label = 'headlabel = "*"';
}
$name = $child . $class;
$node = "Node_{$name}";
$ret .= "{ {$name} [label=\"{$classname}\" shape={$shape} color={$color} fontcolor=\"{$fontcolor}\" fontsize=12] } \n";
$ret .= "{ {$node} [shape=point] }\n";
$ret .= "{ {$node} -> {$name} [arrowhead=none {$label}] }\n";
$ret .= "{ {$last} -> {$node} [arrowhead=none] rank=same }\n";
$ret .= "\n";
$last = $node;
if (!in_array($child, $processed)) {
$processed[] = $child;
$ret .= $this->_graphData($child, $class);
}
}
}
return $ret;
}
示例5: _initFields
protected function _initFields()
{
$modelName = Kwc_Abstract::getSetting($this->_getParam('class'), 'projectsModel');
$this->_form->setModel(Kwf_Model_Abstract::getInstance($modelName));
$this->_form->add(new Kwf_Form_Field_TextField('text', trlKwf('Text')));
$this->_form->add(new Kwf_Form_Field_Checkbox('visible', trlKwf('Visible')));
}
示例6: testSlave
public function testSlave()
{
$cc = Kwc_Abstract::getChildComponentClasses('Kwf_Component_ChainedNeedsParentCc_Chained_Component.Kwf_Component_ChainedNeedsParentCc_Master_Component');
$m = Kwc_Abstract::getSetting($cc[0], 'masterComponentClass');
$pc = Kwc_Abstract::getSetting($m, 'parentComponentClass');
$this->assertEquals($pc, 'Kwf_Component_ChainedNeedsParentCc_Master_Component');
}
示例7: _initColumns
protected function _initColumns()
{
parent::_initColumns();
$this->_columns->add(new Kwf_Grid_Column('id'));
//shows editDialog
$this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties'));
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfig';
} else {
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfigControllerIndex';
}
}
$extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
$extConfig = $extConfig['items'];
if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) {
throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"');
}
$i = 0;
foreach ($extConfig['contentEditComponents'] as $ec) {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
$icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
$icon = new Kwf_Asset($icon);
$this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name));
$i++;
}
}
示例8: _render
protected function _render($includeMaster, &$hasDynamicParts)
{
$lightboxContent = $this->_data->render(null, false, $hasDynamicParts);
$kwfUniquePrefix = Kwf_Config::getValue('application.uniquePrefix');
if ($kwfUniquePrefix) {
$kwfUniquePrefix = $kwfUniquePrefix . '-';
}
if ($includeMaster) {
$parent = $this->_getParent();
$parentContentSender = Kwc_Abstract::getSetting($parent->componentClass, 'contentSender');
$parentContentSender = new $parentContentSender($parent);
$parentContent = $parentContentSender->_render($includeMaster, $hasDynamicParts);
//remove main content to avoid duplicate content for search engines
//content will be loaded using ajax
$startPos = strpos($parentContent, '<main class="' . $kwfUniquePrefix . 'kwfMainContent">');
$endPos = strpos($parentContent, '</main><!--/' . $kwfUniquePrefix . 'kwfMainContent-->');
$parentContent = substr($parentContent, 0, $startPos) . '<main class="' . $kwfUniquePrefix . 'kwfMainContent" data-kwc-component-id="' . $parent->componentId . '">' . substr($parentContent, $endPos);
foreach ($this->_data->getRecursiveChildComponents(array('flag' => 'hasInjectIntoRenderedHtml')) as $component) {
$box = $component;
$isInBox = false;
while (!$isInBox && $box) {
if (isset($box->box)) {
$isInBox = true;
}
$box = $box->parent;
}
if ($isInBox) {
$parentContent = $component->getComponent()->injectIntoRenderedHtml($parentContent);
}
}
//append lightbox after <body> in parent
$options = $this->_getOptions();
$style = '';
if (isset($options['width'])) {
$style .= "width: {$options['width']}px;";
}
if (isset($options['height'])) {
$style .= "height: {$options['height']}px";
}
$class = $kwfUniquePrefix . 'kwfLightbox';
$class .= " " . $kwfUniquePrefix . "kwfLightbox{$options['style']}";
if (isset($options['cssClass'])) {
$class .= " {$options['cssClass']}";
}
if (isset($options['adaptHeight']) && $options['adaptHeight']) {
$class .= " adaptHeight";
}
$options = htmlspecialchars(json_encode($options));
$lightboxContent = "<div class=\"{$class} " . $kwfUniquePrefix . "kwfLightboxOpen\">\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxScrollOuter\">\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxScroll\">\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetween\">\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxBetweenInner\">\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxInner\" style=\"{$style}\">\n" . " <input type=\"hidden\" class=\"options\" value=\"{$options}\" />\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxContent\">\n" . " {$lightboxContent}\n" . " </div>\n" . " <a class=\"" . $kwfUniquePrefix . "closeButton\" href=\"{$parent->url}\"><span class=\"" . $kwfUniquePrefix . "innerCloseButton\">" . $this->_data->trlKwf('Close') . "</span></a>\n" . " </div>\n" . " </div>\n" . " </div>\n" . " </div>\n" . " <div class=\"" . $kwfUniquePrefix . "kwfLightboxMask " . $kwfUniquePrefix . "kwfLightboxMaskOpen\"></div>\n" . " </div>\n" . "</div>\n";
$ret = preg_replace('#(<body[^>]*>)#', "\\1\n" . $lightboxContent, $parentContent);
if (preg_match('#<html[^>]* class#', $ret)) {
$ret = preg_replace('#(<html[^>]*?)( class="([^"]*)")#', "\\1 class=\"\\3 " . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
} else {
$ret = preg_replace('#(<html[^>]*)#', "\\1 class=\"\\3" . $kwfUniquePrefix . "kwfLightboxActive\"", $ret);
}
return $ret;
} else {
return $lightboxContent;
}
}
示例9: getSettings
public static function getSettings($menuComponentClass = null)
{
$ret = parent::getSettings($menuComponentClass);
$ret['menuComponentClass'] = $menuComponentClass;
$ret['viewCache'] = Kwc_Abstract::getSetting($menuComponentClass, 'viewCache');
return $ret;
}
示例10: onRowUpdate
public function onRowUpdate(Kwf_Events_Event_Row_Updated $event)
{
parent::onRowUpdate($event);
$value = $event->row->publish_date;
$cleanValue = $event->row->getCleanValue('publish_date');
$date = date('Y-m-d');
if ($value > $date && $cleanValue <= $date) {
$this->_fireAddedRemovedEvents($event->row, 'Added');
} else {
if ($value <= $date && $cleanValue > $date) {
$this->_fireAddedRemovedEvents($event->row, 'Removed');
}
}
if (Kwc_Abstract::getSetting($this->_class, 'enableExpireDate')) {
$value = $event->row->expiry_date;
$cleanValue = $event->row->getCleanValue('expiry_date');
$date = date('Y-m-d');
if ($value <= $date && $cleanValue > $date) {
$this->_fireAddedRemovedEvents($event->row, 'Added');
} else {
if ($value >= $date && $cleanValue < $date) {
$this->_fireAddedRemovedEvents($event->row, 'Removed');
}
}
}
}
示例11: _initFields
protected function _initFields()
{
parent::_initFields();
$this->setCreateMissingRow(true);
if (!$this->getClass()) {
return;
}
$generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
$classes = $generators['child']['component'];
foreach ($classes as $key => $class) {
if (!$class) {
continue;
}
$form = Kwc_Abstract_Form::createChildComponentForm($this->getClass(), "-{$key}", $key);
if ($form && count($form->fields)) {
if ($this->_getIdTemplateForChild($key)) {
$form->setIdTemplate($this->_getIdTemplateForChild($key));
}
if (!$this->_createFieldsets || !Kwc_Abstract::hasSetting($class, 'componentName')) {
$this->add($form);
} else {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($class, 'componentName'));
$name = str_replace('.', ' ', $name);
$this->add(new Kwf_Form_Container_FieldSet($name))->setName($key)->add($form);
}
}
}
}
示例12: _initSettings
protected function _initSettings()
{
$masterComponentClass = Kwc_Abstract::getSetting($this->_class, 'masterComponentClass');
$masterMenuComponentClass = Kwc_Abstract::getSetting($masterComponentClass, 'menuComponentClass');
$trlMenuComponentClass = Kwc_Chained_Abstract_Component::getChainedComponentClass($masterMenuComponentClass, 'Trl');
$this->_menuComponentClass = $trlMenuComponentClass;
}
示例13: addResources
public function addResources(Kwf_Acl $acl)
{
parent::addResources($acl);
$name = Kwc_Abstract::getSetting($this->_class, 'componentName');
$icon = Kwc_Abstract::getSetting($this->_class, 'componentIcon');
$acl->add(new Kwf_Acl_Resource_ComponentClass_MenuUrl($this->_class, array('text' => $name, 'icon' => $icon), Kwc_Admin::getInstance($this->_class)->getControllerUrl()), 'kwf_component_root');
}
示例14: _initFields
protected function _initFields()
{
parent::_initFields();
$masterCC = Kwc_Abstract::getSetting($this->getClass(), 'masterComponentClass');
if (Kwc_Abstract::getSetting($masterCC, 'imageCaption')) {
$this->add(new Kwf_Form_Field_ShowField('original_image_caption', trlKwf('Original Image caption')))->setData(new Kwf_Data_Trl_OriginalComponent('image_caption'));
$this->add(new Kwf_Form_Field_TextField('image_caption', trlKwf('Image caption')))->setWidth(300);
}
if (Kwc_Abstract::getSetting($masterCC, 'editFilename') || Kwc_Abstract::getSetting($masterCC, 'altText') || Kwc_Abstract::getSetting($masterCC, 'titleText')) {
$fs = $this->add(new Kwf_Form_Container_FieldSet('SEO'));
$fs->setCollapsible(true);
$fs->setCollapsed(true);
}
if (Kwc_Abstract::getSetting($masterCC, 'editFilename')) {
$fs->add(new Kwf_Form_Field_ShowField('original_filename', trlKwf('Original {0}', trlKwf('Filename'))))->setData(new Kwf_Data_Trl_OriginalComponent('filename'));
$fs->add(new Kwf_Form_Field_TextField('filename', trlKwf('Filename')))->setWidth(300)->setHelpText(trlKwf('Talking filename ("lorem-ipsum-2015"), hyphens and underscores are allowed.'));
}
if (Kwc_Abstract::getSetting($masterCC, 'altText')) {
$fs->add(new Kwf_Form_Field_ShowField('original_alt_text', trlKwf('Original {0}', 'ALT Text')))->setData(new Kwf_Data_Trl_OriginalComponent('alt_text'));
$fs->add(new Kwf_Form_Field_TextField('alt_text', 'ALT Text'))->setWidth(300)->setHelpText(trlKwf('Short, meaningful description of the image content.'));
}
if (Kwc_Abstract::getSetting($masterCC, 'titleText')) {
$fs->add(new Kwf_Form_Field_ShowField('original_title_text', trlKwf('Original {0}', 'ALT Text')))->setData(new Kwf_Data_Trl_OriginalComponent('title_text'));
$fs->add(new Kwf_Form_Field_TextField('title_text', 'IMG Title'))->setWidth(300)->setHelpText(trlKwf('Some browsers show the text as a tooltip when the mouse pointer is hovering the image.'));
}
$this->add(new Kwf_Form_Field_ShowField('image', trlKwf('Original Image')))->setData(new Kwc_Abstract_Image_Trl_Form_ImageData());
$fs = $this->add(new Kwf_Form_Container_FieldSet(trlKwf('Own Image')));
$fs->setCheckboxToggle(true);
$fs->setCheckboxName('own_image');
$fs->add(Kwc_Abstract_Form::createChildComponentForm($this->getClass(), '-image', 'image'));
}
示例15: getListeners
public function getListeners()
{
$ret = parent::getListeners();
$generators = Kwc_Abstract::getSetting($this->_class, 'generators');
$ret[] = array('class' => $generators['child']['component'], 'event' => 'Kwf_Component_Event_Component_HasContentChanged', 'callback' => 'onChildHasContentChange');
return $ret;
}