/** * 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; }
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')); } } }
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; }
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; }
/** * 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); } }
/** * 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); } }
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); }
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; }
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); } }
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; }
/** * Execute module activation. * * @since 4.0 * * @return void */ public function execute_activate() { $options = get_site_option('itsec_backup'); if ($options === false) { add_site_option('itsec_backup', $this->defaults); } }
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()); } }
/** * Execute module activation. * * @since 4.0 * * @return void */ public function execute_activate() { $options = get_site_option('itsec_user_logging'); if ($options === false) { add_site_option('itsec_user_logging', $this->defaults); } }
/** * 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); } }
/** * * 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', ''); }
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(); * */ }
/** * 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 ); } }
function __construct($file, $sku, $prefix, $plugin_name, $text_domain, $documentation_link) { $this->check_update_timeout = 24 * 60 * 60; // 24 hours $this->plugin_file = $file; $this->name = $plugin_name; $this->sku = $sku; $this->documentation_link = $documentation_link; $this->prefix = $prefix; $this->text_domain = $text_domain; add_site_option($this->prefix . '_last_checked', ''); add_site_option($this->prefix . '_license_key', ''); add_site_option($this->prefix . '_download_url', ''); add_site_option($this->prefix . '_installed_version', ''); add_site_option($this->prefix . '_live_version', ''); add_site_option($this->prefix . '_changelog', ''); add_site_option($this->prefix . '_login_link', ''); add_site_option($this->prefix . '_due_date', ''); add_action('admin_init', array($this, 'initialize_plugin_data')); add_action('admin_footer', array($this, 'add_plugin_style_script')); add_action('admin_footer', array($this, 'add_support_ticket_content')); add_action('wp_ajax_' . $this->prefix . '_validate_license_key', array($this, 'validate_license_key')); add_action('wp_ajax_' . $this->prefix . '_force_check_for_updates', array($this, 'force_check_for_updates')); add_action('wp_ajax_' . $this->prefix . '_reset_license_details', array($this, 'reset_license_details')); add_filter('all_plugins', array($this, 'overwrite_wp_plugin_data_for_plugin')); add_filter('plugins_api', array($this, 'overwrite_wp_plugin_api_for_plugin'), 10, 3); add_filter('site_transient_update_plugins', array($this, 'overwrite_site_transient'), 10, 2); add_filter('plugin_row_meta', array($this, 'add_support_link'), 10, 4); add_filter('storeapps_upgrade_create_link', array($this, 'storeapps_upgrade_create_link'), 10, 4); }
/** * * 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 add_site_option('backwpup_cfg_jobmaxexecutiontime', 0); add_site_option('backwpup_cfg_jobziparchivemethod', ''); add_site_option('backwpup_cfg_jobstepretry', 3); add_site_option('backwpup_cfg_jobsteprestart', 0); add_site_option('backwpup_cfg_jobrunauthkey', substr(md5(BackWPup::get_plugin_data('hash')), 11, 8)); add_site_option('backwpup_cfg_jobnotranslate', 0); add_site_option('backwpup_cfg_jobwaittimems', 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/'; add_site_option('backwpup_cfg_logfolder', $logs_dir); //Network Auth add_site_option('backwpup_cfg_httpauthuser', ''); add_site_option('backwpup_cfg_httpauthpassword', ''); }
function twttr_add_pages() { global $bstwbsftwppdtplgns_options, $bstwbsftwppdtplgns_added_menu; $bws_menu_version = get_plugin_data(plugin_dir_path(__FILE__) . "bws_menu/bws_menu.php"); $bws_menu_version = $bws_menu_version["Version"]; $base = plugin_basename(__FILE__); if (!isset($bstwbsftwppdtplgns_options)) { if (is_multisite()) { if (!get_site_option('bstwbsftwppdtplgns_options')) { add_site_option('bstwbsftwppdtplgns_options', array(), '', 'yes'); } $bstwbsftwppdtplgns_options = get_site_option('bstwbsftwppdtplgns_options'); } else { if (!get_option('bstwbsftwppdtplgns_options')) { add_option('bstwbsftwppdtplgns_options', array(), '', 'yes'); } $bstwbsftwppdtplgns_options = get_option('bstwbsftwppdtplgns_options'); } } if (isset($bstwbsftwppdtplgns_options['bws_menu_version'])) { $bstwbsftwppdtplgns_options['bws_menu']['version'][$base] = $bws_menu_version; unset($bstwbsftwppdtplgns_options['bws_menu_version']); if (is_multisite()) { update_site_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes'); } else { update_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes'); } require_once dirname(__FILE__) . '/bws_menu/bws_menu.php'; } else { if (!isset($bstwbsftwppdtplgns_options['bws_menu']['version'][$base]) || $bstwbsftwppdtplgns_options['bws_menu']['version'][$base] < $bws_menu_version) { $bstwbsftwppdtplgns_options['bws_menu']['version'][$base] = $bws_menu_version; if (is_multisite()) { update_site_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes'); } else { update_option('bstwbsftwppdtplgns_options', $bstwbsftwppdtplgns_options, '', 'yes'); } require_once dirname(__FILE__) . '/bws_menu/bws_menu.php'; } else { if (!isset($bstwbsftwppdtplgns_added_menu)) { $plugin_with_newer_menu = $base; foreach ($bstwbsftwppdtplgns_options['bws_menu']['version'] as $key => $value) { if ($bws_menu_version < $value && is_plugin_active($base)) { $plugin_with_newer_menu = $key; } } $plugin_with_newer_menu = explode('/', $plugin_with_newer_menu); $wp_content_dir = defined('WP_CONTENT_DIR') ? basename(WP_CONTENT_DIR) : 'wp-content'; if (file_exists(ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php')) { require_once ABSPATH . $wp_content_dir . '/plugins/' . $plugin_with_newer_menu[0] . '/bws_menu/bws_menu.php'; } else { require_once dirname(__FILE__) . '/bws_menu/bws_menu.php'; } $bstwbsftwppdtplgns_added_menu = true; } } } add_menu_page('BWS Plugins', 'BWS Plugins', 'manage_options', 'bws_plugins', 'bws_add_menu_render', plugins_url('images/px.png', __FILE__), 1001); add_submenu_page('bws_plugins', __('Twitter Settings', 'twitter'), __('Twitter', 'twitter'), 'manage_options', 'twitter.php', 'twttr_settings_page'); }
/** * Set the plugin to no longer bug users if user asks not to be. */ public function set_no_bug() { // Bail out if not on correct page if (!isset($_GET['_wpnonce']) || (!wp_verify_nonce($_GET['_wpnonce'], 'user-photo-nonce') || !is_admin() || !isset($_GET[self::NO_BUG_OPTION]) || !current_user_can('manage_options'))) { return; } add_site_option(self::NO_BUG_OPTION, true); }
/** * Add plugin default options * @since 1.3.0 */ public static function init_options() { add_site_option('mucd_copy_files', 'yes'); add_site_option('mucd_keep_users', 'yes'); add_site_option('mucd_log', 'no'); add_site_option('mucd_log_dir', MUCD_COMPLETE_PATH . '/logs/'); MUCD_Option::init_duplicable_option(); }
public static function activate_plugin($network) { if (is_network_admin()) { add_site_option("Clef_Activated", true); } else { add_option("Clef_Activated", true); } }
function rp4wp_activate_plugin() { global $wpdb; $sql = "CREATE TABLE IF NOT EXISTS `" . $wpdb->prefix . "rp4wp_cache` (\n `post_id` bigint(20) unsigned NOT NULL,\n `word` varchar(255) CHARACTER SET utf8 NOT NULL,\n `weight` float unsigned NOT NULL,\n `post_type` varchar(20) CHARACTER SET utf8 NOT NULL,\n PRIMARY KEY (`post_id`,`word`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"; $wpdb->query($sql); // Redirect to installation wizard add_site_option('rp4wp_do_install', true); }
public static function plugin_activation() { add_site_option('tt_version', '1.0.0'); $upg_file = TAUCHTERMINAL__PLUGIN_DIR . 'upgrade/install-1.0.0.php'; if (file_exists($upg_file) && is_readable($upg_file)) { include_once $upg_file; } }
/** * Hooks to 'register_activation_hook' * * @since 1.0.0 */ function register_activation() { /* Check if multisite, if so then save as site option */ if (is_multisite()) { add_site_option('author_notifier_version', AUTHOR_NOTIFIER_VERSION_NUM); } else { add_option('author_notifier_version', AUTHOR_NOTIFIER_VERSION_NUM); } }
public function activate() { if (is_multisite()) { add_site_option('mtpc_deeplink_auto_default', true); add_site_option('mtpc_registration_auto', false); } else { add_option('mtpc_deeplink_auto_default', true); } }
function bp_groupblog_setup() { global $wpdb; // Set up the array of potential defaults $groupblog_blogdefaults = array('theme' => 'bp-default|bp-groupblog', 'page_template_layout' => 'magazine', 'delete_blogroll_links' => '1', 'default_cat_name' => 'Uncategorized', 'default_link_cat' => 'Links', 'delete_first_post' => 0, 'delete_first_comment' => 0, 'allowdashes' => 0, 'allowunderscores' => 0, 'allownumeric' => 0, 'minlength' => 4, 'redirectblog' => 0, 'deep_group_integration' => 0, 'pagetitle' => 'Blog'); // Add a site option so that we'll know set up ran add_site_option('bp_groupblog_blog_defaults_setup', 1); add_site_option('bp_groupblog_blog_defaults_options', $groupblog_blogdefaults); }
/** * Hooks to 'register_activation_hook' * * @since 1.0.0 */ static function register_activation() { /* Check if multisite, if so then save as site option */ if (is_multisite()) { add_site_option(self::$version_setting_name, WPSITE_POST_STATUS_NOTIFICATION_VERSION_NUM); } else { add_option(self::$version_setting_name, WPSITE_POST_STATUS_NOTIFICATION_VERSION_NUM); } }
/** * Add an option from a given network * * Switches to the specified network internally to operate on it. * * @param int $network_id ID of network. * @param string $key Option key. * @param mixed $value Option value, can be anything. * @return boolean|WP_Error True if the option is added, false if not addedd. `WP_Error` instance if invalid network ID is passed. */ function add_network_option($network_id, $key, $value) { if (!switch_to_network($network_id, true)) { return new WP_Error('wpmn.network_missing', __('Network does not exist', 'wp-multi-network'), array('status' => 400)); } $result = add_site_option($key, $value); restore_current_network(); return $result; }