当前位置: 首页>>代码示例>>PHP>>正文


PHP Symphony::isXSRFEnabled方法代码示例

本文整理汇总了PHP中Symphony::isXSRFEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Symphony::isXSRFEnabled方法的具体用法?PHP Symphony::isXSRFEnabled怎么用?PHP Symphony::isXSRFEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symphony的用法示例。


在下文中一共展示了Symphony::isXSRFEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 public function view()
 {
     if (isset($_POST['action']['submit'])) {
         $this->panelErrors = Extension_Dashboard::validatePanelOptions($this->panelType, $this->panelId);
         if (empty($this->panelErrors)) {
             $this->panelId = Extension_Dashboard::savePanel(array('id' => $this->panelId, 'label' => $this->panelLabel, 'placement' => $this->panelPlacement, 'type' => $this->panelType), $this->panelConfig);
         }
     } else {
         if (isset($_POST['action']['delete'])) {
             Extension_Dashboard::deletePanel($this->panelId);
             $this->_Result->setAttribute('id', $this->panelId);
             $this->_Result->setAttribute('placement', $this->panelPlacement);
             return;
         }
     }
     if (isset($this->panelId) && !empty($this->panelId)) {
         $this->panelConfig = Extension_Dashboard::getPanel($this->panelId);
         $this->panelLabel = $this->panelConfig['label'];
         $this->panelPlacement = $this->panelConfig['placement'];
     }
     if (isset($_POST['action']['submit']) && empty($this->panelErrors)) {
         $html = Extension_Dashboard::buildPanelHTML($this->panelConfig);
         $class = $html->getAttribute('class');
         $html->setAttribute('class', $class . ' new-panel');
         $this->_Result->setAttribute('id', $this->panelId);
         $this->_Result->setAttribute('placement', $this->panelPlacement);
         $this->_Result->setValue(sprintf('<![CDATA[%s]]>', $html->generate()));
     } else {
         $this->addHeaderToPage('Content-Type', 'text/html');
         $container = new XMLElement('form');
         $container->setAttribute('id', 'save-panel');
         $container->appendChild(new XMLElement('div', NULL, array('class' => 'top')));
         $heading = new XMLElement('h3', __('Configuration') . ' <span>' . (isset($this->panelLabel) ? $this->panelLabel : __('Untitled Panel')) . '<span>');
         $container->appendChild($heading);
         $config_options = Extension_Dashboard::buildPanelOptions($this->panelType, $this->panelId, $this->panelErrors);
         $primary = new XMLElement('div', NULL, array('class' => 'panel-config'));
         $fieldset = new XMLElement('fieldset', NULL, array('class' => 'settings'));
         $legend = new XMLElement('legend', __('General'));
         $fieldset->appendChild($legend);
         $group = new XMLElement('div', NULL, array('class' => 'group'));
         $group->appendChild(Widget::Label(__('Name'), Widget::Input('label', $this->panelLabel)));
         $group->appendChild(Widget::Label(__('Placement'), Widget::Select('placement', array(array('primary', $this->panelPlacement == 'primary', __('Main content')), array('secondary', $this->panelPlacement == 'secondary', __('Sidebar'))))));
         $fieldset->appendChild($group);
         $primary->appendChild($fieldset);
         if ($config_options) {
             $primary->appendChild($config_options);
         }
         $actions = new XMLElement('div', NULL, array('class' => 'actions'));
         $actions->appendChild(Widget::Input('action[submit]', __('Save Panel'), 'submit', array('class' => 'button create')));
         $actions->appendChild(Widget::Input('action[cancel]', __('Cancel'), 'submit'));
         if ($this->panelId) {
             $actions->appendChild(new XMLElement('button', __('Delete Panel'), array('class' => 'delete', 'name' => 'action[delete]')));
         }
         $primary->appendChild($actions);
         $primary->appendChild(Widget::Input('id', $this->panelId, 'hidden'));
         $primary->appendChild(Widget::Input('type', $this->panelType, 'hidden'));
         $container->appendChild($primary);
         if (Symphony::isXSRFEnabled()) {
             $container->prependChild(XSRF::formToken());
         }
         $this->_Result = $container;
     }
 }
开发者ID:korelogic,项目名称:dashboard,代码行数:63,代码来源:content.panel_config.php


注:本文中的Symphony::isXSRFEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。