本文整理匯總了PHP中Preferences::site_prefs方法的典型用法代碼示例。如果您正苦於以下問題:PHP Preferences::site_prefs方法的具體用法?PHP Preferences::site_prefs怎麽用?PHP Preferences::site_prefs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Preferences
的用法示例。
在下文中一共展示了Preferences::site_prefs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: INT
function do_update()
{
global $DB, $UD, $conf, $REGX;
$Q[] = "ALTER TABLE `exp_search` CHANGE `query` `query` MEDIUMTEXT NULL DEFAULT NULL";
$Q[] = "ALTER TABLE `exp_search` CHANGE `custom_fields` `custom_fields` MEDIUMTEXT NULL DEFAULT NULL";
$Q[] = "ALTER TABLE `exp_templates` ADD `last_author_id` INT(10) UNSIGNED NOT NULL AFTER `edit_date`";
$Q[] = "ALTER TABLE `exp_revision_tracker` ADD `item_author_id` INT(10) UNSIGNED NOT NULL AFTER `item_date`";
$query = $DB->query('SHOW FIELDS FROM exp_weblog_data');
foreach ($query->result as $row) {
if (strncmp($row['Field'], 'field_ft', 8) == 0) {
$Q[] = "ALTER TABLE `exp_weblog_data` CHANGE `{$row['Field']}` `{$row['Field']}` TINYTEXT NULL";
}
}
// run our queries
foreach ($Q as $sql) {
$DB->query($sql);
}
// for the benefit of Mr Kite! Okay, for the benefit of the Prefs class.
if (!defined('REQ')) {
define('REQ', 'UPDATE');
}
require PATH_CORE . 'core.regex' . EXT;
$REGX = new Regex();
require PATH_CORE . 'core.prefs' . EXT;
// We need to add a new template preference, so we'll fetch the existing site template prefs
$query = $DB->query("SELECT site_name, site_id, site_template_preferences FROM exp_sites");
foreach ($query->result as $row) {
$PREFS = new Preferences();
$PREFS->site_prefs($row['site_name'], $row['site_id']);
$prefs = $this->array_stripslashes(unserialize($row['site_template_preferences']));
// Add our new pref to the array
$prefs['strict_urls'] = $PREFS->ini('site_404') == FALSE ? 'n' : 'y';
// Update the DB
$DB->query($DB->update_string('exp_sites', array('site_template_preferences' => addslashes(serialize($prefs))), "site_id = '" . $row['site_id'] . "'"));
}
return TRUE;
}
示例2: DB
$DB = new DB($db_config);
if (!$DB->db_connect(0)) {
exit("Database Error: Unable to connect to your database. Your database appears to be turned off or the database connection settings in your config file are not correct. Please contact your hosting provider if the problem persists.");
}
if (!$DB->select_db()) {
exit("Database Error: Unable to select your database");
}
// ----------------------------------------------
// Instantiate the regular expressions class
// ----------------------------------------------
require PATH_CORE . 'core.regex' . EXT;
$REGX = new Regex();
// ----------------------------------------------
// Set Site Preferences class - Needs DB Connection and Regex
// ----------------------------------------------
$PREFS->site_prefs($site_name);
unset($site_name);
$DB->show_queries = $PREFS->ini('show_queries') == 'y' ? TRUE : FALSE;
$DB->enable_cache = $PREFS->ini('enable_db_caching') == 'y' ? TRUE : FALSE;
$DB->debug = $PREFS->ini('debug') != 0 ? 1 : 0;
// Turn off caching if it's a CP or ACTION request
if (REQ == 'CP' or REQ == 'ACTION') {
$DB->enable_cache = FALSE;
}
// ----------------------------------------------
// Fetch input data: GET, POST, COOKIE, SERVER
// ----------------------------------------------
require PATH_CORE . 'core.input' . EXT;
$IN = new Input();
$IN->trim_input = isset($uri) ? TRUE : FALSE;
if (isset($global_vars) and is_array($global_vars)) {