本文整理汇总了PHP中add_site_option函数的典型用法代码示例。如果您正苦于以下问题:PHP add_site_option函数的具体用法?PHP add_site_option怎么用?PHP add_site_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_site_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert_install_date
/**
* Insert the install date
*
* @since 1.3.0
* @access public
*
* @return string
*/
private function insert_install_date()
{
$datetime_now = new DateTime();
$date_string = $datetime_now->format('Y-m-d');
add_site_option(RP4WP_Constants::OPTION_INSTALL_DATE, $date_string, '', 'no');
return $date_string;
}
示例2: cntctfrm_settings
function cntctfrm_settings()
{
global $wpmu, $cntctfrm_options, $cntctfrm_option_defaults, $wpdb;
$cntctfrm_option_defaults = array('cntctfrm_user_email' => 'admin', 'cntctfrm_custom_email' => '', 'cntctfrm_select_email' => 'user', 'cntctfrm_from_email' => 'user', 'cntctfrm_custom_from_email' => '', 'cntctfrm_additions_options' => 0, 'cntctfrm_attachment' => 0, 'cntctfrm_attachment_explanations' => 1, 'cntctfrm_send_copy' => 0, 'cntctfrm_from_field' => get_bloginfo('name'), 'cntctfrm_select_from_field' => 'custom', 'cntctfrm_display_phone_field' => 0, 'cntctfrm_display_address_field' => 0, 'cntctfrm_required_name_field' => 1, 'cntctfrm_required_address_field' => 0, 'cntctfrm_required_email_field' => 1, 'cntctfrm_required_phone_field' => 0, 'cntctfrm_required_subject_field' => 1, 'cntctfrm_required_message_field' => 1, 'cntctfrm_required_symbol' => 1, 'cntctfrm_display_add_info' => 1, 'cntctfrm_display_sent_from' => 1, 'cntctfrm_display_date_time' => 1, 'cntctfrm_mail_method' => 'wp-mail', 'cntctfrm_display_coming_from' => 1, 'cntctfrm_display_user_agent' => 1, 'cntctfrm_language' => array(), 'cntctfrm_change_label' => 0, 'cntctfrm_name_label' => array('en' => __("Name:", 'contact_form')), 'cntctfrm_address_label' => array('en' => __("Address:", 'contact_form')), 'cntctfrm_email_label' => array('en' => __("Email Address:", 'contact_form')), 'cntctfrm_phone_label' => array('en' => __("Phone number:", 'contact_form')), 'cntctfrm_subject_label' => array('en' => __("Subject:", 'contact_form')), 'cntctfrm_message_label' => array('en' => __("Message:", 'contact_form')), 'cntctfrm_attachment_label' => array('en' => __("Attachment:", 'contact_form')), 'cntctfrm_send_copy_label' => array('en' => __("Send me a copy", 'contact_form')), 'cntctfrm_submit_label' => array('en' => __("Submit", 'contact_form')), 'cntctfrm_name_error' => array('en' => __("Your name is required.", 'contact_form')), 'cntctfrm_address_error' => array('en' => __("Address is required.", 'contact_form')), 'cntctfrm_email_error' => array('en' => __("A valid email address is required.", 'contact_form')), 'cntctfrm_phone_error' => array('en' => __("Phone number is required.", 'contact_form')), 'cntctfrm_subject_error' => array('en' => __("Subject is required.", 'contact_form')), 'cntctfrm_message_error' => array('en' => __("Message text is required.", 'contact_form')), 'cntctfrm_attachment_error' => array('en' => __("File format is not valid.", 'contact_form')), 'cntctfrm_attachment_upload_error' => array('en' => __("File upload error.", 'contact_form')), 'cntctfrm_attachment_move_error' => array('en' => __("The file could not be uploaded.", 'contact_form')), 'cntctfrm_attachment_size_error' => array('en' => __("This file is too large.", 'contact_form')), 'cntctfrm_captcha_error' => array('en' => __("Please fill out the CAPTCHA.", 'contact_form')), 'cntctfrm_form_error' => array('en' => __("Please make corrections below and try again.", 'contact_form')), 'cntctfrm_action_after_send' => 1, 'cntctfrm_thank_text' => array('en' => __("Thank you for contacting us.", 'contact_form')), 'cntctfrm_redirect_url' => '', 'cntctfrm_delete_attached_file' => '0');
// install the option defaults
if (1 == $wpmu) {
if (!get_site_option('cntctfrm_options')) {
add_site_option('cntctfrm_options', $cntctfrm_option_defaults, '', 'yes');
}
} else {
if (!get_option('cntctfrm_options')) {
add_option('cntctfrm_options', $cntctfrm_option_defaults, '', 'yes');
}
}
// get options from the database
if (1 == $wpmu) {
$cntctfrm_options = get_site_option('cntctfrm_options');
} else {
$cntctfrm_options = get_option('cntctfrm_options');
}
// get options from the database
if (empty($cntctfrm_options['cntctfrm_language']) && !is_array($cntctfrm_options['cntctfrm_name_label'])) {
$cntctfrm_options['cntctfrm_name_label'] = array('en' => $cntctfrm_options['cntctfrm_name_label']);
$cntctfrm_options['cntctfrm_address_label'] = array('en' => $cntctfrm_options['cntctfrm_address_label']);
$cntctfrm_options['cntctfrm_email_label'] = array('en' => $cntctfrm_options['cntctfrm_email_label']);
$cntctfrm_options['cntctfrm_phone_label'] = array('en' => $cntctfrm_options['cntctfrm_phone_label']);
$cntctfrm_options['cntctfrm_subject_label'] = array('en' => $cntctfrm_options['cntctfrm_subject_label']);
$cntctfrm_options['cntctfrm_message_label'] = array('en' => $cntctfrm_options['cntctfrm_message_label']);
$cntctfrm_options['cntctfrm_attachment_label'] = array('en' => $cntctfrm_options['cntctfrm_attachment_label']);
$cntctfrm_options['cntctfrm_send_copy_label'] = array('en' => $cntctfrm_options['cntctfrm_send_copy_label']);
$cntctfrm_options['cntctfrm_thank_text'] = array('en' => $cntctfrm_options['cntctfrm_thank_text']);
$cntctfrm_options['cntctfrm_submit_label'] = array('en' => $cntctfrm_option_defaults['cntctfrm_submit_label']['en']);
$cntctfrm_options['cntctfrm_name_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_name_error']['en']);
$cntctfrm_options['cntctfrm_address_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_address_error']['en']);
$cntctfrm_options['cntctfrm_email_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_email_error']['en']);
$cntctfrm_options['cntctfrm_phone_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_phone_error']['en']);
$cntctfrm_options['cntctfrm_subject_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_subject_error']['en']);
$cntctfrm_options['cntctfrm_message_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_message_error']['en']);
$cntctfrm_options['cntctfrm_attachment_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_attachment_error']['en']);
$cntctfrm_options['cntctfrm_attachment_upload_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_attachment_upload_error']['en']);
$cntctfrm_options['cntctfrm_attachment_move_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_attachment_move_error']['en']);
$cntctfrm_options['cntctfrm_attachment_size_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_attachment_size_error']['en']);
$cntctfrm_options['cntctfrm_captcha_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_captcha_error']['en']);
$cntctfrm_options['cntctfrm_form_error'] = array('en' => $cntctfrm_option_defaults['cntctfrm_form_error']['en']);
}
$cntctfrm_options = array_merge($cntctfrm_option_defaults, $cntctfrm_options);
update_option('cntctfrm_options', $cntctfrm_options);
// create db table of fields list
$wpdb->query("DROP TABLE IF EXISTS " . $wpdb->prefix . "cntctfrm_field");
$sql = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "cntctfrm_field` (\n\t\t\tid int NOT NULL AUTO_INCREMENT,\t\t\t\t\t\t\t\n\t\t\tname CHAR(100) NOT NULL,\n\t\t\tUNIQUE KEY id (id)\n\t\t);";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
$fields = array('name', 'email', 'subject', 'message', 'address', 'phone', 'attachment', 'attachment_explanations', 'send_copy', 'sent_from', 'date_time', 'coming_from', 'user_agent');
foreach ($fields as $key => $value) {
$db_row = $wpdb->get_row("SELECT * FROM " . $wpdb->prefix . "cntctfrm_field WHERE `name` = '" . $value . "'", ARRAY_A);
if (!isset($db_row) || empty($db_row)) {
$wpdb->insert($wpdb->prefix . "cntctfrm_field", array('name' => $value), array('%s'));
}
}
}
示例3: onp_updates_324_set_site_transient
function onp_updates_324_set_site_transient($transient, $value, $expiration = 0, $actions = false)
{
global $_wp_using_ext_object_cache;
if ($actions) {
$value = apply_filters('pre_set_site_transient_' . $transient, $value);
}
if ($_wp_using_ext_object_cache) {
$result = wp_cache_set($transient, $value, 'site-transient', $expiration);
} else {
$transient_timeout = '_site_transient_timeout_' . $transient;
$transient = '_site_transient_' . $transient;
if (false === get_site_option($transient)) {
if ($expiration) {
add_site_option($transient_timeout, time() + $expiration);
}
$result = add_site_option($transient, $value);
} else {
if ($expiration) {
update_site_option($transient_timeout, time() + $expiration);
}
delete_site_option($transient);
$result = update_site_option($transient, $value);
}
}
if ($result && $actions) {
do_action('set_site_transient_' . $transient);
do_action('setted_site_transient', $transient);
}
return $result;
}
示例4: install
public static function install()
{
// set up options array
$new_stored_options = array('zws_contacts_database_plugin_table_name' => self::TABLE_NAME_NO_PREFIX, 'zws_contacts_database_memcached_active' => self::USE_MEMCACHED, 'zws_contacts_database_memcached_period' => self::MEMCACHED_PERIOD, 'zws_contacts_database_memcached_ip' => self::DEFAULT_MEMCACHED_IP, 'zws_contacts_database_memcached_port' => self::DEFAULT_MEMCACHED_PORT, 'zws_contacts_database_plugin_db_version' => self::DB_VERSION, 'zws_contacts_database_plugin_privacy_policy_url' => self::DEFAULT_PRIVACY_POLICY_URL, 'zws_contacts_database_google_server_api_key' => self::DEFAULT_GOOGLE_SERVER_API_KEY, 'zws_contacts_database_plugin_map_contact_icon_url' => self::DEFAULT_MAP_CONTACT_ICON, 'zws_contacts_database_plugin_map_target_icon_url' => self::DEFAULT_MAP_TARGET_ICON, 'zws_contacts_database_plugin_map_base_icon_url' => self::DEFAULT_MAP_BASE_ICON, 'zws_contacts_database_plugin_memcached_keybase' => self::MEMCACHED_KEY_BASE . '_' . rand(), 'zws_contacts_database_plugin_google_map_zoom' => self::GOOGLE_MAP_ZOOM, 'zws_contacts_database_plugin_base_name' => '', 'zws_contacts_database_plugin_base_postcode' => '', 'zws_contacts_database_plugin_base_coordinates' => array(), 'zws_contacts_database_plugin_admin_email_active' => self::ADMIN_EMAIL_ACTIVE, 'zws_contacts_database_plugin_admin_email' => array(), 'zws_contacts_database_plugin_reg_email_active' => self::REG_EMAIL_ACTIVE, 'zws_contacts_database_plugin_reg_email_from' => array(get_site_option('blogname'), get_site_option('admin_email')), 'zws_contacts_database_plugin_reg_email_subject' => self::REG_EMAIL_SUBJECT, 'zws_contacts_database_plugin_country_of_use' => self::COUNTRY_CODE);
// set options array if does not exist
if (!get_site_option(self::OPTIONS_LABEL)) {
add_site_option(self::OPTIONS_LABEL, $new_stored_options);
} else {
// update array with new key/values if do not exist
self::$existing_stored_options = get_site_option(self::OPTIONS_LABEL);
foreach ($new_stored_options as $new_key => $new_value) {
// if option and/or option value does not exist ...
if (!self::check_exists($new_key)) {
// update existing options with the non-existent new key/value
self::$existing_stored_options[$new_key] = $new_value;
}
}
// update the options with the newly updated existing_stored_options array
update_site_option(self::OPTIONS_LABEL, self::$existing_stored_options);
}
// the special option for removal of data on uninstall
if (!get_site_option('zws_contact_database_remove_data')) {
add_site_option('zws_contacts_database_remove_data', self::DEFAULT_FULL_REMOVAL);
}
// create or update the database
require_once __DIR__ . '/Database.php';
\ZwsContactsDatabase\Database::update_database();
// return true when successful
return True;
}
示例5: execute_activate
/**
* Execute module activation.
*
* @since 4.0
*
* @return void
*/
public function execute_activate()
{
$options = get_site_option('itsec_strong_passwords');
if ($options === false) {
add_site_option('itsec_strong_passwords', $this->defaults);
}
}
示例6: execute_upgrade
/**
* Execute module upgrade
*
* @return void
*/
public function execute_upgrade($itsec_old_version)
{
if ($itsec_old_version < 4000) {
global $itsec_bwps_options;
$current_options = get_site_option('itsec_ban_users');
if ($current_options === false) {
$current_options = $this->defaults;
}
$current_options['enabled'] = isset($itsec_bwps_options['bu_enabled']) && $itsec_bwps_options['bu_enabled'] == 1 ? true : false;
$current_options['default'] = isset($itsec_bwps_options['bu_blacklist']) && $itsec_bwps_options['bu_blacklist'] == 1 ? true : false;
if (isset($itsec_bwps_options['bu_banlist']) && !is_array($itsec_bwps_options['bu_banlist']) && strlen($itsec_bwps_options['bu_banlist']) > 1) {
$raw_hosts = explode(PHP_EOL, $itsec_bwps_options['bu_banlist']);
foreach ($raw_hosts as $host) {
if (strlen($host) > 1) {
$current_options['host_list'][] = $host;
}
}
}
if (isset($itsec_bwps_options['bu_banagent']) && !is_array($itsec_bwps_options['bu_banagent']) && strlen($itsec_bwps_options['bu_banagent']) > 1) {
$current_options['agent_list'] = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']);
$raw_agents = explode(PHP_EOL, $itsec_bwps_options['bu_banagent']);
foreach ($raw_agents as $agent) {
if (strlen($agent) > 1) {
$current_options['agent_list'][] = $agent;
}
}
}
update_site_option('itsec_ban_users', $current_options);
add_site_option('itsec_rewrites_changed', true);
}
if ($itsec_old_version < 4027) {
add_site_option('itsec_rewrites_changed', true);
}
}
示例7: bp_blogs_install
function bp_blogs_install()
{
global $wpdb, $bp;
if (!empty($wpdb->charset)) {
$charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
}
$sql[] = "CREATE TABLE {$bp->blogs->table_name} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\tblog_id bigint(20) NOT NULL,\n\t\t\t\tKEY user_id (user_id),\n\t\t\t\tKEY blog_id (blog_id)\n\t\t\t ) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_posts} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\tblog_id bigint(20) NOT NULL,\n\t\t\t\tpost_id bigint(20) NOT NULL,\n\t\t\t\tdate_created datetime NOT NULL,\n\t\t\t\tKEY user_id (user_id),\n\t\t\t\tKEY blog_id (blog_id),\n\t\t\t\tKEY post_id (post_id)\n\t\t\t ) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->blogs->table_name_blog_comments} (\n\t\t \t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t\tuser_id bigint(20) NOT NULL,\n\t\t\t\tblog_id bigint(20) NOT NULL,\n\t\t\t\tcomment_id bigint(20) NOT NULL,\n\t\t\t\tcomment_post_id bigint(20) NOT NULL,\n\t\t\t\tdate_created datetime NOT NULL,\n\t\t\t\tKEY user_id (user_id),\n\t\t\t\tKEY blog_id (blog_id),\n\t\t\t\tKEY comment_id (comment_id),\n\t\t\t\tKEY comment_post_id (comment_post_id)\n\t\t\t ) {$charset_collate};";
$sql[] = "CREATE TABLE {$bp->blogs->table_name_blogmeta} (\n\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\tblog_id bigint(20) NOT NULL,\n\t\t\tmeta_key varchar(255) DEFAULT NULL,\n\t\t\tmeta_value longtext DEFAULT NULL,\n\t\t\tKEY blog_id (blog_id),\n\t\t\tKEY meta_key (meta_key)\n\t\t ) {$charset_collate};";
require_once ABSPATH . 'wp-admin/upgrade-functions.php';
dbDelta($sql);
// On first installation - record all existing blogs in the system.
if (!(int) get_site_option('bp-blogs-first-install')) {
bp_blogs_record_existing_blogs();
add_site_option('bp-blogs-first-install', 1);
} else {
// Import blog titles and descriptions into the blogmeta table
if (get_site_option('bp-blogs-version') <= '0.1.5') {
$blog_ids = $wpdb->get_col($wpdb->prepare("SELECT blog_id FROM " . $bp->blogs->table_name));
for ($i = 0; $i < count($blog_ids); $i++) {
$name = get_blog_option($blog_ids[$i], 'blogname');
$desc = get_blog_option($blog_ids[$i], 'blogdescription');
bp_blogs_update_blogmeta($blog_ids[$i], 'name', $name);
bp_blogs_update_blogmeta($blog_ids[$i], 'description', $desc);
bp_blogs_update_blogmeta($blog_ids[$i], 'last_activity', time());
}
}
}
update_site_option('bp-blogs-db-version', BP_BLOGS_DB_VERSION);
}
示例8: the_data
private function the_data()
{
$usage = get_site_option('wpe_upload_space_usage');
$ttl = get_site_option('wpe_upload_space_usage_ttl');
// If TTL is more then interval from now, it's bogus, so kill it.
if ($ttl > time() + self::CACHE_TTL) {
$ttl = false;
}
// If have from cache and it's within TTL, then do nothing else.
// If TTL has not expired, leave
if ($ttl && $ttl >= time()) {
return $usage;
}
// Get the value and save it in the cache
$usage_remote = $this->from_remote();
$expire = time() + self::CACHE_TTL;
// If did not have an initial value
if (false === $usage) {
add_site_option('wpe_upload_space_usage', $usage_remote);
add_site_option('wpe_upload_space_usage_ttl', $expire);
} else {
update_site_option('wpe_upload_space_usage', $usage_remote);
update_site_option('wpe_upload_space_usage_ttl', $expire);
}
return $usage_remote;
}
示例9: register_httpsrdrctn_settings
function register_httpsrdrctn_settings()
{
global $wpmu, $httpsrdrctn_options, $httpsrdrctn_plugin_info;
$httpsrdrctn_option_defaults = array('https' => 0, 'https_domain' => 0, 'https_pages_array' => array(), 'force_resources' => 0, 'plugin_option_version' => $httpsrdrctn_plugin_info["Version"]);
/* Install the option defaults */
if (1 == $wpmu) {
if (!get_site_option('httpsrdrctn_options')) {
add_site_option('httpsrdrctn_options', $httpsrdrctn_option_defaults, '', 'yes');
}
} else {
if (!get_option('httpsrdrctn_options')) {
add_option('httpsrdrctn_options', $httpsrdrctn_option_defaults, '', 'yes');
}
}
/* Get options from the database */
if (1 == $wpmu) {
$httpsrdrctn_options = get_site_option('httpsrdrctn_options');
} else {
$httpsrdrctn_options = get_option('httpsrdrctn_options');
}
/* Array merge incase this version has added new options */
if (!isset($httpsrdrctn_options['plugin_option_version']) || $httpsrdrctn_options['plugin_option_version'] != $httpsrdrctn_plugin_info["Version"]) {
$httpsrdrctn_options = array_merge($httpsrdrctn_option_defaults, $httpsrdrctn_options);
$httpsrdrctn_options['plugin_option_version'] = $httpsrdrctn_plugin_info["Version"];
update_option('httpsrdrctn_options', $httpsrdrctn_options);
}
}
示例10: scoper_establish_group_scope
function scoper_establish_group_scope()
{
// TODO : possibly change this back to scoper_get_option call
$sitewide_groups = get_site_option('scoper_mu_sitewide_groups');
$last_sitewide_groups = get_option('scoper_mu_last_sitewide_groups');
// sitewide groups is a sitewide option, but schema update must be run for each blog if that sitewide option changes
global $scoper_site_options, $scoper_blog_options;
if (false === $sitewide_groups) {
$no_setting = true;
$last_version = isset($scoper_blog_options['scoper_version']) ? unserialize($scoper_blog_options['scoper_version']) : array();
if (!empty($last_version['version'])) {
// MU installations that ran previous RS version might have existing blog-specific groups; must default to not using site-wide
add_site_option('scoper_mu_sitewide_groups', 0);
$sitewide_groups = 0;
} else {
// if this is the first RS run (or the installation has been fully wiped), explicitly default to sitewide groups by storing option
add_site_option('scoper_mu_sitewide_groups', 1);
$sitewide_groups = 1;
}
} else {
$no_setting = false;
}
$scoper_site_options['mu_sitewide_groups'] = $sitewide_groups;
if ($sitewide_groups != $last_sitewide_groups || $no_setting) {
update_option('scoper_mu_last_sitewide_groups', intval($sitewide_groups));
delete_option('scoper_version');
// force db schema update on sitewide groups change
}
return $sitewide_groups;
}
示例11: zws_filter_install
public static function zws_filter_install()
{
// set or update table name option if necessary
if (!get_site_option('zws_filter_table_name')) {
add_site_option('zws_filter_table_name', self::$table_name_no_prefix);
} else {
if (get_site_option('zws_filter_table_name') != self::$table_name_no_prefix) {
update_site_option('zws_filter_table_name', self::$table_name_no_prefix);
}
}
// set reject text if does not exist
if (!get_site_option('zws_filter_reject_text')) {
add_site_option('zws_filter_reject_text', self::$reject_text);
}
// set reject text color if does not exist
if (!get_site_option('zws_filter_reject_text_color')) {
add_site_option('zws_filter_reject_text_color', self::$reject_text_color);
}
// initiate db
require_once __DIR__ . '/db.php';
ZwsDatabaseAdmin::create_database();
// set the initial blacklist if emtpy
$resultset = ZwsDatabaseAdmin::get_blacklist();
if (empty($resultset)) {
ZwsDatabaseAdmin::set_blacklist(self::get_default_blacklist());
}
}
示例12: buddyblog_install
/**
* BuddyBlog Installation Routine
* Does Nothing at the moment
* @global type $wpdb
* @global type $bp
*/
function buddyblog_install()
{
$default = array('post_type' => 'post', 'post_status' => 'publish', 'comment_status' => 'open', 'show_comment_option' => 1, 'custom_field_title' => '', 'enable_taxonomy' => 1, 'allowed_taxonomies' => 1, 'enable_category' => 1, 'enable_tags' => 1, 'show_posts_on_profile' => false, 'limit_no_of_posts' => false, 'max_allowed_posts' => 20, 'publish_cap' => 'read', 'allow_unpublishing' => 1, 'post_cap' => 'read', 'allow_edit' => 1, 'allow_delete' => 1, 'allow_upload' => false, 'max_upload_count' => 2);
if (!get_site_option('buddyblog-settings')) {
add_site_option('buddyblog-settings', $default);
}
}
示例13: default_site_options
/**
*
* add filter for Site option defaults
*
*/
public static function default_site_options()
{
//global
add_site_option('backwpup_version', '0.0.0');
//job default
add_site_option('backwpup_jobs', array());
//general
add_site_option('backwpup_cfg_showadminbar', 1);
add_site_option('backwpup_cfg_showfoldersize', 0);
add_site_option('backwpup_cfg_protectfolders', 1);
//job
$max_execution_time = 0;
if (strstr(PHP_SAPI, 'cgi')) {
$max_execution_time = (int) ini_get('max_execution_time');
}
add_site_option('backwpup_cfg_jobmaxexecutiontime', $max_execution_time);
add_site_option('backwpup_cfg_jobziparchivemethod', '');
add_site_option('backwpup_cfg_jobstepretry', 3);
add_site_option('backwpup_cfg_jobrunauthkey', substr(md5(BackWPup::get_plugin_data('hash')), 11, 8));
add_site_option('backwpup_cfg_loglevel', 'normal_translated');
add_site_option('backwpup_cfg_jobwaittimems', 0);
add_site_option('backwpup_cfg_jobdooutput', 0);
//Logs
add_site_option('backwpup_cfg_maxlogs', 30);
add_site_option('backwpup_cfg_gzlogs', 0);
$upload_dir = wp_upload_dir();
$logs_dir = trailingslashit(str_replace('\\', '/', $upload_dir['basedir'])) . 'backwpup-' . BackWPup::get_plugin_data('hash') . '-logs/';
$content_path = trailingslashit(str_replace('\\', '/', WP_CONTENT_DIR));
$logs_dir = str_replace($content_path, '', $logs_dir);
add_site_option('backwpup_cfg_logfolder', $logs_dir);
//Network Auth
add_site_option('backwpup_cfg_httpauthuser', '');
add_site_option('backwpup_cfg_httpauthpassword', '');
}
示例14: zws_filter_install
public static function zws_filter_install()
{
// set up options array
self::$new_stored_options = array('zws_api_consumer_plugin_table_name' => self::$table_name_no_prefix, 'zws_api_consumer_memcached_active' => self::$use_memcached, 'zws_api_consumer_memcached_period' => self::$memcached_period, 'zws_api_consumer_memcached_ip' => self::$default_memcached_IP, 'zws_api_consumer_memcached_port' => self::$default_memcached_port, 'zws_api_consumer_api_base_url' => self::$default_api_base_url, 'zws_api_consumer_api_path' => self::$default_api_url_path, 'zws_api_consumer_proto' => self::$default_proto, 'zws_api_consumer_plugin_db_version' => self::$db_version, 'zws_api_consumer_use_oauth' => self::$default_use_oath, 'zws_api_consumer_oauth_consumer_key' => '', 'zws_api_consumer_oauth_consumer_secret' => '', 'zws_api_consumer_oauth_token' => '', 'zws_api_consumer_oauth_token_secret' => '', 'zws_api_consumer_content_display_module' => self::$default_display_module);
// set options array if does not exist
if (!get_site_option(self::$plugin_options_name)) {
add_site_option(self::$plugin_options_name, self::$new_stored_options);
} else {
// update array with new key/values if do not exist
self::$existing_stored_options = get_site_option(self::$plugin_options_name);
foreach (self::$new_stored_options as $new_key => $new_value) {
// if option and/or option value does not exist ...
if (!self::check_exists($new_key)) {
// update existing options with the non-existent new key/value
self::$existing_stored_options[$new_key] = $new_value;
}
}
// update the options with the newly updated existing_stored_options array
update_site_option(self::$plugin_options_name, self::$existing_stored_options);
}
/* Uncomment below to initiate a database upon first install. Configure table in db.php.
*
* require_once(__DIR__ . '/db.php');
* ZwsApiConsumerDatabaseAdmin::update_database();
*
*/
}
示例15: execute_activate
/**
* Execute module activation.
*
* @since 4.0
*
* @return void
*/
public function execute_activate() {
$options = get_site_option( 'itsec_malware_scheduling' );
if ( $options === false ) {
add_site_option( 'itsec_malware_scheduling', $this->defaults );
}
}