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


PHP Administration::Configuration方法代码示例

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


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

示例1: savePresets

 /**
  * Save the presets
  * @param $context
  */
 public function savePresets($context)
 {
     if (isset($_POST['ckeditor_sections'])) {
         // Save the sections to the config-file
         $sectionStr = implode(',', $_POST['ckeditor_sections']);
         Symphony::Configuration()->set('sections', $sectionStr, 'ckeditor');
         if (version_compare(Administration::Configuration()->get('version', 'symphony'), '2.2.5', '>')) {
             // 2.3 and up:
             Symphony::Configuration()->write();
         } else {
             // Earlier versions:
             Administration::instance()->saveConfig();
         }
     } else {
         // If no sections are selected, delete the file:
         Symphony::Configuration()->remove('sections', 'ckeditor');
         Administration::instance()->saveConfig();
     }
     if (isset($_POST['ckeditor_link_templates'])) {
         // Save the link templates to the database:
         Symphony::Database()->query("DELETE FROM `tbl_ckeditor_link_templates`");
         $shortcuts = $_POST['ckeditor_link_templates'];
         unset($_POST['ckeditor_link_templates']);
         if (!empty($shortcuts)) {
             foreach ($shortcuts as $i => $shortcut) {
                 Symphony::Database()->insert($shortcut, "tbl_ckeditor_link_templates");
             }
         }
     }
 }
开发者ID:renansantos,项目名称:ckeditor,代码行数:34,代码来源:extension.driver.php

示例2: savePresets

 /**
  * Save the presets
  * @param $context
  */
 public function savePresets($context)
 {
     if (isset($_POST['ckeditor_sections'])) {
         // Save the sections to the config-file
         $sectionStr = implode(',', $_POST['ckeditor_sections']);
         Symphony::Configuration()->set('sections', $sectionStr, 'ckeditor');
         if (version_compare(Administration::Configuration()->get('version', 'symphony'), '2.2.5', '>')) {
             // 2.3 and up:
             Symphony::Configuration()->write();
         } else {
             // Earlier versions:
             Symphony::Configuration()->write();
         }
     } else {
         // If no sections are selected, delete the file:
         Symphony::Configuration()->remove('sections', 'ckeditor');
         Symphony::Configuration()->write();
     }
     if (isset($_POST['ckeditor_link_templates'])) {
         // Save the link templates to the database:
         Symphony::Database()->query("DELETE FROM `tbl_ckeditor_link_templates`");
         $shortcuts = $_POST['ckeditor_link_templates'];
         unset($_POST['ckeditor_link_templates']);
         if (!empty($shortcuts)) {
             foreach ($shortcuts as $i => $shortcut) {
                 Symphony::Database()->insert($shortcut, "tbl_ckeditor_link_templates");
             }
         }
     }
     if (isset($_POST['ckeditor']['styles'])) {
         Symphony::Configuration()->set('styles', General::sanitize($_POST['ckeditor']['styles']), 'ckeditor');
         Symphony::Configuration()->write();
     } else {
         Symphony::Configuration()->remove('styles', 'ckeditor');
         Symphony::Configuration()->write();
     }
     // Presets:
     if (isset($_POST['ckeditor_presets'])) {
         // Delete formatter references from DB:
         Symphony::Database()->query("DELETE FROM `tbl_ckeditor_presets`");
         // Delete formatter files:
         $formatters = glob(EXTENSIONS . '/ckeditor/text-formatters/formatter.*.php');
         foreach ($formatters as $formatter) {
             unlink($formatter);
         }
         // Create it all new:
         foreach ($_POST['ckeditor_presets'] as $preset) {
             Symphony::Database()->insert($preset, 'tbl_ckeditor_presets');
             // Create text formatter file:
             $str = file_get_contents(EXTENSIONS . '/ckeditor/text-formatters/template.ckeditor.php');
             $handle = 'ckeditor_' . General::createHandle($preset['name'], 255, '_');
             $str = str_replace(array('{{NAME}}', '{{HANDLE}}'), array($preset['name'], $handle), $str);
             file_put_contents(EXTENSIONS . '/ckeditor/text-formatters/formatter.' . $handle . '.php', $str);
         }
     }
 }
开发者ID:TwistedInteractive,项目名称:ckeditor,代码行数:60,代码来源:extension.driver.php


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