本文整理汇总了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");
}
}
}
}
示例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);
}
}
}