本文整理汇总了PHP中Plugin::setAllSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::setAllSettings方法的具体用法?PHP Plugin::setAllSettings怎么用?PHP Plugin::setAllSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::setAllSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settings
public function settings()
{
$errors = false;
if (get_request_method() == 'POST') {
$data = $_POST['settings'];
$settings = array();
$settings['filemanager_base'] = preg_replace('/\\s+/', '', $data['filemanager_base']);
$settings['filemanager_base'] = trim($settings['filemanager_base'], '/');
$settings['filemanager_view'] = isset($data['filemanager_view']) ? $data['filemanager_view'] : 'grid';
// image extensions
if (isset($data['filemanager_images'])) {
$settings['filemanager_images'] = serialize($data['filemanager_images']);
} else {
$errors[] = __("You need to select at least one image extension!");
}
$settings['filemanager_upload_size'] = !empty($data['filemanager_upload_size']) && is_numeric($data['filemanager_upload_size']) ? $data['filemanager_upload_size'] : '0';
$settings['filemanager_dateformat'] = !empty($data['filemanager_dateformat']) ? trim($data['filemanager_dateformat']) : 'd M Y H:i';
$booleans = array('filemanager_enabled', 'filemanager_browse_only', 'filemanager_upload_overwrite', 'filemanager_upload_images_only');
foreach ($booleans as $bool) {
$settings[$bool] = isset($data[$bool]) && $data[$bool] == 1 ? '1' : '0';
}
if (Plugin::setAllSettings($settings, 'ckeditor')) {
Flash::setNow('success', 'Settings were updated successfully');
} else {
$errors[] = __("There was a problem saving the settings.");
}
} else {
$settings = Plugin::getAllSettings('ckeditor');
}
if ($errors !== false) {
Flash::setNow('error', implode('<br/>', $errors));
}
$this->display('settings', array('settings' => $settings));
}
示例2: save
/**
* Save the settings
*
* @todo Add a sanity check for input.
*/
function save()
{
$settings = $_POST['settings'];
$ret = Plugin::setAllSettings($settings, 'multi_lang');
if ($ret) {
Flash::set('success', __('The settings have been updated.'));
} else {
Flash::set('error', 'An error has occurred while trying to save the settings.');
}
redirect(get_url('plugin/multi_lang/settings'));
}
示例3: save
function save()
{
$options = $_POST['options'];
$ret = Plugin::setAllSettings($options, 'easysnippet');
if ($ret) {
Flash::set('success', __('The settings have been updated.'));
} else {
Flash::set('error', 'An error has occurred while trying to save the settings.');
}
redirect(get_url('plugin/easysnippet/settings'));
}
示例4: save
function save()
{
if (isset($_POST['settings'])) {
if (Plugin::setAllSettings($_POST['settings'], 'archive')) {
Flash::set('success', __('The settings have been saved.'));
} else {
Flash::set('error', __('An error occured trying to save the settings.'));
}
} else {
Flash::set('error', __('Could not save settings, no settings found.'));
}
redirect(get_url('plugin/archive/settings'));
}
示例5: edit_settings
public function edit_settings()
{
if (isset($_POST['settings'])) {
if (Plugin::setAllSettings($_POST['settings'], 'registered_users')) {
Flash::set('success', __('The settings have been saved.'));
} else {
Flash::set('error', __('An error occured trying to save the settings.'));
}
} else {
Flash::set('error', __('Could not save settings, no settings found.'));
}
redirect(get_url('plugin/registered_users/settings'));
}
示例6: save
function save()
{
if (isset($_POST['settings'])) {
$settings = $_POST['settings'];
$ret = Plugin::setAllSettings($settings, 'backup_restore');
if ($ret) {
Flash::set('success', __('The settings have been saved.'));
} else {
Flash::set('error', 'An error occured trying to save the settings.');
}
} else {
Flash::set('error', 'Could not save settings, no settings found.');
}
redirect(get_url('plugin/backup_restore/settings'));
}
示例7: save
function save()
{
if (isset($_POST['settings'])) {
$settings = $_POST['settings'];
foreach ($settings as $key => $value) {
$settings[$key] = mysql_escape_string($value);
}
$ret = Plugin::setAllSettings($settings, 'archive');
if ($ret) {
Flash::set('success', __('The settings have been saved.'));
} else {
Flash::set('error', 'An error occured trying to save the settings.');
}
} else {
Flash::set('error', 'Could not save settings, no settings found.');
}
redirect(get_url('plugin/archive/settings'));
}
示例8: settings
public function settings($save=false) {
self::__checkPermission('redirector_settings');
if ( $save ) {
$settings['threshold'] = (int)$_POST['threshold'];
$settings['expireafter'] = (int)$_POST['expireafter'];
if ( ! Plugin::setAllSettings($settings, 'redirector') )
Flash::set('error',__('Could not save settings!'));
redirect( get_url('plugin/redirector/settings') );
}
$this->display('redirector/views/settings', $this->settings);
}
示例9: strtolower
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/**
* The multi lang plugin redirects users to a page with content in their language.
*
* The redirect only occurs when a user's indicated preferred language is
* available. There are multiple methods to determine the desired language.
* These are:
*
* - HTTP_ACCEPT_LANG header
* - URI based language hint (for example: http://www.example.com/en/page.html
* - Preferred language setting of logged in users
*
* @package Plugins
* @subpackage multi-lang
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2010
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// Store settings
$settings = array('style' => 'tab', 'langsource' => 'header');
Plugin::setAllSettings($settings, 'multi_lang');
示例10: save
public function save()
{
if (!$this->_isInternal()) {
page_not_found();
}
$imgPath = array_key_exists('img-path', $_POST) ? $_POST['img-path'] : '';
if ($imgPath === '/' or $imgPath === '\\') {
$imgPath = '';
}
$settings = array('path' => $imgPath);
if (Plugin::setAllSettings($settings, 'image')) {
Flash::set('success', 'Image - ' . __('plugin settings saved.'));
} else {
Flash::set('error', 'Image - ' . __('plugin settings not saved!'));
}
redirect(get_url('plugin/image/settings'));
}
示例11: save
public function save()
{
$tablename = TABLE_PREFIX . 'tinymce';
if (!array_key_exists('listhidden', $_POST)) {
$listhidden = '0';
} else {
$listhidden = '1';
}
if (!array_key_exists('imagesdir', $_POST) || !array_key_exists('imagesuri', $_POST) || !array_key_exists('cssuri', $_POST)) {
Flash::set('error', 'TinyMCE - ' . __('form was not posted.'));
redirect(get_url('plugin/tinymce'));
} else {
$imagesdir = $_POST['imagesdir'];
$imagesuri = $_POST['imagesuri'];
$cssuri = $_POST['cssuri'];
if ($imagesdir[strlen($imagesdir) - 1] == '/' || $imagesdir[strlen($imagesdir) - 1] == '\\') {
$imagesdir = substr($imagesdir, 0, strlen($imagesdir) - 1);
}
if ($imagesuri[strlen($imagesuri) - 1] == '/' || $imagesuri[strlen($imagesuri) - 1] == '\\') {
$imagesuri = substr($imagesuri, 0, strlen($imagesuri) - 1);
}
}
if (empty($imagesdir) || empty($imagesuri) || empty($cssuri)) {
Flash::set('error', 'TinyMCE - ' . __('one of the fields was empty, please try again!'));
redirect(get_url('plugin/tinymce'));
} else {
$settings = array('listhidden' => $listhidden, 'imagesdir' => $imagesdir, 'imagesuri' => $imagesuri, 'cssuri' => $cssuri);
if (Plugin::setAllSettings($settings, 'tinymce')) {
Flash::set('success', 'TinyMCE - ' . __('plugin settings saved.'));
} else {
Flash::set('error', 'TinyMCE - ' . __('plugin settings not saved!'));
}
redirect(get_url('plugin/tinymce/settings'));
}
}
示例12: settings_save
public function settings_save()
{
AuthUser::load();
if (!AuthUser::isLoggedIn()) {
redirect(get_url('login'));
} else {
if (!AuthUser::hasPermission('admin_edit')) {
Flash::set('error', __('You do not have permission to access the requested page!'));
redirect(get_url());
}
}
if (!isset($_POST['settings'])) {
Flash::set('error', 'File Manager - ' . __('form was not posted.'));
redirect(get_url('plugin/file_manager/settings'));
} else {
$settings = $_POST['settings'];
if ($settings['umask'] == 0) {
$settings['umask'] = 0;
} elseif (!preg_match('/^0?[0-7]{3}$/', $settings['umask'])) {
$settings['umask'] = 0;
}
if (strlen($settings['umask']) === 3) {
$settings['umask'] = '0' . $settings['umask'];
} elseif (strlen($settings['umask']) !== 4 && $settings['umask'] != 0) {
$settings['umask'] = 0;
}
if (!preg_match('/^0?[0-7]{3}$/', $settings['dirmode'])) {
$settings['dirmode'] = '0755';
}
if (strlen($settings['dirmode']) === 3) {
$settings['dirmode'] = '0' . $settings['dirmode'];
}
if (!preg_match('/^0?[0-7]{3}$/', $settings['filemode'])) {
$settings['filemode'] = '0755';
}
if (strlen($settings['filemode']) === 3) {
$settings['filemode'] = '0' . $settings['filemode'];
}
}
if (Plugin::setAllSettings($settings, 'file_manager')) {
Flash::setNow('success', 'File Manager - ' . __('plugin settings saved.'));
} else {
Flash::setNow('error', 'File Manager - ' . __('plugin settings not saved!'));
}
$this->display('file_manager/views/settings', array('settings' => $settings));
}
示例13: array
<?php
/*
* Wolf CMS - Content Management Simplified. <http://www.wolfcms.org>
* Copyright (C) 2009-2011 Martijn van der Kleijn <martijn.niji@gmail.com>
*
* This file is part of Wolf CMS. Wolf CMS is licensed under the GNU GPLv3 license.
* Please see license.txt for the full license text.
*/
/* Security measure */
if (!defined('IN_CMS')) {
exit;
}
/**
* The BackupRestore plugin provides administrators with the option of backing
* up their pages and settings to an XML file.
*
* @package Plugins
* @subpackage backup_restore
*
* @author Martijn van der Kleijn <martijn.niji@gmail.com>
* @copyright Martijn van der Kleijn, 2009-2011
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
// Check if the plugin's settings already exist and create them if not.
if (Plugin::getSetting('zip', 'backup_restore') === false) {
// Store settings new style
$settings = array('zip' => '1', 'pwd' => '1', 'default_pwd' => 'pswpsw123', 'stamp' => 'Ymd', 'extension' => 'xml', 'wolfversion' => '0.6.0');
Plugin::setAllSettings($settings, 'backup_restore');
}
示例14: strtolower
* @copyright Philippe Archambault & Martijn van der Kleijn, 2008
* @license http://www.gnu.org/licenses/gpl.html GPLv3 license
*/
$PDO = Record::getConnection();
$driver = strtolower($PDO->getAttribute(Record::ATTR_DRIVER_NAME));
// Setup table structure
if ($driver == 'mysql') {
$PDO->exec("CREATE TABLE " . TABLE_PREFIX . "comment (\n\t id int(11) unsigned NOT NULL auto_increment,\n\t page_id int(11) unsigned NOT NULL default '0',\n\t body text,\n\t author_name varchar(50) default NULL,\n\t author_email varchar(100) default NULL,\n\t author_link varchar(100) default NULL,\n ip char(100) NOT NULL default '0',\n\t is_approved tinyint(1) unsigned NOT NULL default '1',\n\t created_on datetime default NULL,\n\t PRIMARY KEY (id),\n\t KEY page_id (page_id),\n\t KEY created_on (created_on)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8");
$PDO->exec("ALTER TABLE " . TABLE_PREFIX . "page ADD comment_status tinyint(1) NOT NULL default '0' AFTER status_id");
} else {
if ($driver == 'sqlite') {
$PDO->exec("CREATE TABLE comment (\n id INTEGER NOT NULL PRIMARY KEY,\n page_id int(11) NOT NULL default '0',\n body text ,\n author_name varchar(50) default NULL ,\n author_email varchar(100) default NULL ,\n author_link varchar(100) default NULL ,\n ip char(100) NOT NULL default '0' ,\n is_approved tinyint(1) NOT NULL default '1' ,\n created_on datetime default NULL\n )");
$PDO->exec("CREATE INDEX comment_page_id ON comment (page_id)");
$PDO->exec("CREATE INDEX comment_created_on ON comment (created_on)");
$PDO->exec("ALTER TABLE page ADD comment_status tinyint(1) NOT NULL default '0'");
} else {
if ($driver == 'pgsql') {
$PDO->exec("CREATE TABLE " . TABLE_PREFIX . "comment (\n id serial,\n page_id integer NOT NULL DEFAULT 0,\n body text,\n author_name character varying(50) DEFAULT NULL,\n author_email character varying(100) DEFAULT NULL,\n author_link character varying(100) DEFAULT NULL,\n ip char(100) NOT NULL default '0',\n is_approved integer NOT NULL default 1,\n created_on timestamp DEFAULT NULL,\n PRIMARY KEY (id)\n )");
$PDO->exec("CREATE INDEX comment_page_id ON comment (page_id)");
$PDO->exec("CREATE INDEX comment_created_on ON comment (created_on)");
$PDO->exec("ALTER TABLE " . TABLE_PREFIX . "page ADD comment_status integer NOT NULL DEFAULT 0");
}
}
}
// Install snippets
$PDO->exec("INSERT INTO " . TABLE_PREFIX . "snippet (name, filter_id, content, content_html, created_on, created_by_id) VALUES ('comment-form', '', '<form action=\"<?php echo \$this->url(); ?>\" method=\"post\" id=\"comment_form\"> \r\n<p>\r\n\t<input class=\"comment-form-name\" type=\"text\" name=\"comment[author_name]\" id=\"comment_form_name\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_name\"> Name (required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-email\" type=\"text\" name=\"comment[author_email]\" id=\"comment_form_email\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_email\"> Email (will not be published; required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-link\" type=\"text\" name=\"comment[author_link]\" id=\"comment_form_link\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_link\"> Website</label>\r\n</p>\r\n<p>\r\n\t<?php captcha(); ?>\r\n</p>\r\n<p>\r\n\t<textarea class=\"comment-form-body\" id=\"comment_form_body\" name=\"comment[body]\" cols=\"100%\" rows=\"10\"></textarea>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-submit\" type=\"submit\" name=\"commit-comment\" id=\"comment_form_submit\" value=\"Submit comment\" />\r\n</p>\r\n</form>', '<form action=\"<?php echo \$this->url(); ?>\" method=\"post\" id=\"comment_form\"> \r\n<p>\r\n\t<input class=\"comment-form-name\" type=\"text\" name=\"comment[author_name]\" id=\"comment_form_name\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_name\"> Name (required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-email\" type=\"text\" name=\"comment[author_email]\" id=\"comment_form_email\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_email\"> Email (will not be published; required)</label>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-link\" type=\"text\" name=\"comment[author_link]\" id=\"comment_form_link\" value=\"\" size=\"22\" /> \r\n\t<label for=\"comment_form_link\"> Website</label>\r\n</p>\r\n<p>\r\n <?php captcha(); ?>\r\n</p>\r\n<p>\r\n\t<textarea class=\"comment-form-body\" id=\"comment_form_body\" name=\"comment[body]\" cols=\"100%\" rows=\"10\"></textarea>\r\n</p>\r\n<p>\r\n\t<input class=\"comment-form-submit\" type=\"submit\" name=\"commit-comment\" id=\"comment_form_submit\" value=\"Submit comment\" />\r\n</p>\r\n</form>', '" . date('Y-m-d H:i:s') . "', 1);");
$PDO->exec("INSERT INTO " . TABLE_PREFIX . "snippet (name, filter_id, content, content_html, created_on, created_by_id) VALUES ('comment-each', '', '<p><strong><?php echo \$num_comments = comments_count(\$this); ?></strong> comment<?php if (\$num_comments != 1) { echo ''s''; } ?></p>\r\n<?php \$comments = comments(\$this); ?>\r\n<ol class=\"comments\">\r\n<?php foreach (\$comments as \$comment): ?>\r\n <li class=\"comment\">\r\n <p><?php echo nl2br(\$comment->body()); ?></p>\r\n <p> — <?php echo \$comment->name(); ?> <small class=\"comment-date\"><?php echo \$comment->date(); ?></small></p>\r\n </li>\r\n<?php endforeach; // comments; ?>\r\n</ol>', '<p><strong><?php echo \$num_comments = comments_count(\$this); ?></strong> comment<?php if (\$num_comments != 1) { echo ''s''; } ?></p>\r\n<?php \$comments = comments(\$this); ?>\r\n<ol class=\"comments\">\r\n<?php foreach (\$comments as \$comment): ?>\r\n <li class=\"comment\">\r\n <p><?php echo nl2br(\$comment->body()); ?></p>\r\n <p> — <?php echo \$comment->name(); ?> <small class=\"comment-date\"><?php echo \$comment->date(); ?></small></p>\r\n </li>\r\n<?php endforeach; // comments; ?>\r\n</ol>', '" . date('Y-m-d H:i:s') . "', 1)");
// Store settings new style
$settings = array('auto_approve_comment' => '0', 'use_captcha' => '1', 'rowspage' => '15', 'numlabel' => '1');
Plugin::setAllSettings($settings, 'comment');
示例15: defined
<?php
defined('IN_CMS') || exit;
$images = serialize(array('gif', 'jpg', 'jpeg', 'png'));
$settings = array('version' => '2.1.0', 'filemanager_enabled' => '1', 'filemanager_base' => 'public/images', 'filemanager_view' => 'grid', 'filemanager_images' => $images, 'filemanager_dateformat' => 'd M Y H:i', 'filemanager_browse_only' => '0', 'filemanager_upload_overwrite' => '0', 'filemanager_upload_images_only' => '0', 'filemanager_upload_size' => '0');
$old = Plugin::getAllSettings('ckeditor');
//Other ckeditor filter
if (isset($old['fileBrowserRootUri'])) {
$settings['filemanager_base'] = trim($old['fileBrowserRootUri'], '/');
} else {
if (isset($old['filemanager_base'])) {
$settings = $old;
$settings['version'] = '2.1.0';
}
}
// Remove all settings from db
Plugin::deleteAllSettings('ckeditor');
// Insert the new ones
if (Plugin::setAllSettings($settings, 'ckeditor')) {
Flash::setNow('success', __('CKEditor - plugin settings initialized.'));
}
if (!defined('USE_MOD_REWRITE') || !USE_MOD_REWRITE) {
Flash::set('info', __('FileManager will not ne ebabled if "MOD_REWRITE" is set to false'));
} else {
Flash::setNow('error', __('CKEditor - unable to store plugin settings!'));
}