• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update_site_option函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中update_site_option函数的典型用法代码示例。如果您正苦于以下问题:PHP update_site_option函数的具体用法?PHP update_site_option怎么用?PHP update_site_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了update_site_option函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

	function __construct() {

		global $itsec_globals;

		//make sure the log file info is there or generate it. This should only affect beta users.
		if ( ! isset( $itsec_globals['settings']['log_info'] ) ) {

			$itsec_globals['settings']['log_info'] = substr( sanitize_title( get_bloginfo( 'name' ) ), 0, 20 ) . '-' . ITSEC_Lib::get_random( mt_rand( 0, 10 ) );

			update_site_option( 'itsec_global', $itsec_globals['settings'] );

		}

		//Make sure the logs directory was created
		if ( ! is_dir( $itsec_globals['ithemes_log_dir'] ) ) {
			@mkdir( trailingslashit( $itsec_globals['ithemes_dir'] ) . 'logs' );
		}

		//don't create a log file if we don't need it.
		if ( isset( $itsec_globals['settings']['log_type'] ) && $itsec_globals['settings']['log_type'] !== 0 ) {

			$this->log_file = $itsec_globals['ithemes_log_dir'] . '/event-log-' . $itsec_globals['settings']['log_info'] . '.log';
			$this->start_log(); //create a log file if we don't have one

		}

		$this->logger_modules  = array(); //array to hold information on modules using this feature
		$this->logger_displays = array(); //array to hold metabox information
		$this->module_path     = ITSEC_Lib::get_module_path( __FILE__ );

		add_action( 'plugins_loaded', array( $this, 'register_modules' ) );

		add_action( 'admin_enqueue_scripts', array( $this, 'admin_script' ) ); //enqueue scripts for admin page

		//Run database cleanup daily with cron
		if ( ! wp_next_scheduled( 'itsec_purge_logs' ) ) {
			wp_schedule_event( time(), 'daily', 'itsec_purge_logs' );
		}

		add_action( 'itsec_purge_logs', array( $this, 'purge_logs' ) );

		if ( is_admin() ) {

			require( trailingslashit( $itsec_globals['plugin_dir'] ) . 'core/lib/class-itsec-wp-list-table.php' ); //used for generating log tables

			add_action( 'itsec_add_admin_meta_boxes', array( $this, 'add_admin_meta_boxes' ) ); //add log meta boxes

		}

		if ( isset( $_POST['itsec_clear_logs'] ) && $_POST['itsec_clear_logs'] === 'clear_logs' ) {

			global $itsec_clear_all_logs;

			$itsec_clear_all_logs = true;

			add_action( 'plugins_loaded', array( $this, 'purge_logs' ) );

		}

	}
开发者ID:helloworld-digital,项目名称:insightvision,代码行数:60,代码来源:class-itsec-logger.php


示例2: 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_ssl');
         // Don't do anything if settings haven't already been set, defaults exist in the module system and we prefer to use those
         if (false !== $current_options) {
             $current_options['frontend'] = isset($itsec_bwps_options['ssl_frontend']) ? intval($itsec_bwps_options['ssl_frontend']) : 0;
             update_site_option('itsec_ssl', $current_options);
             ITSEC_Response::regenerate_wp_config();
         }
     }
     if ($itsec_old_version < 4041) {
         $current_options = get_site_option('itsec_ssl');
         // If there are no current options, go with the new defaults by not saving anything
         if (is_array($current_options)) {
             // If anything in this module is being used activate it, otherwise deactivate it
             $activate = false;
             foreach ($current_options as $on) {
                 if ($on) {
                     $activate = true;
                     break;
                 }
             }
             if ($activate) {
                 ITSEC_Modules::activate('ssl');
             } else {
                 ITSEC_Modules::deactivate('ssl');
             }
             // remove 'enabled' which isn't used in the new module
             unset($current_options['enabled']);
             ITSEC_Modules::set_settings('ssl', $current_options);
         }
     }
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:40,代码来源:setup.php


示例3: update_network_option

 function update_network_option($optionName, $defaultValue = '')
 {
     if ($this->use_site_option()) {
         return update_site_option($optionName, $defaultValue);
     }
     return update_option($optionName, $defaultValue);
 }
开发者ID:dparks-seattletimes,项目名称:openworldstudios,代码行数:7,代码来源:Livefyre_Application.php


示例4: process_network_settings

 /**
  *	Process network options
  */
 function process_network_settings()
 {
     if (current_user_can('manage_network')) {
         $opts = array('recaptcha_publickey' => 'trim', 'recaptcha_privatekey' => 'trim', 'recaptcha_enable_comments' => 'intval', 'recaptcha_enable_signup' => 'intval', 'recaptcha_enable_login' => 'intval', 'recaptcha_enable_lostpw' => 'intval', 'recaptcha_enable_wc_order' => 'intval', 'recaptcha_disable_for_known_users' => 'intval', 'recaptcha_noscript' => 'intval', 'recaptcha_comment_use_42_filter' => 'intval');
         if (array_intersect(array_keys($_POST), array_keys($opts))) {
             check_admin_referer('recaptcha-network-settings');
         }
         $updated = false;
         foreach ($opts as $option_name => $sanitize_cb) {
             if (isset($_POST[$option_name])) {
                 $option_value = sanitize_text_field($_POST[$option_name]);
                 if (is_callable($sanitize_cb)) {
                     $option_value = call_user_func($sanitize_cb, $_POST[$option_name]);
                 }
                 update_site_option($option_name, $option_value);
                 $updated = true;
             }
         }
         if ($updated) {
             $redirect = $this->remove_new_apikey_url(add_query_arg(array('updated' => 'true')));
             wp_redirect($redirect);
         }
     } else {
         wp_die('Cheating, uh?');
     }
     // expecting api keys,
 }
开发者ID:salaros,项目名称:wp-recaptcha-integration,代码行数:30,代码来源:class-wp_recaptcha_options.php


示例5: update_admin_status

function update_admin_status()
{
    global $wpdb;
    if (check_ajax_referer('pb-network-managers')) {
        $restricted = $wpdb->get_results('SELECT * FROM wp_sitemeta WHERE meta_key = "pressbooks_network_managers"');
        if ($restricted) {
            $restricted = maybe_unserialize($restricted[0]->meta_value);
        } else {
            $restricted = array();
        }
        $id = absint($_POST['admin_id']);
        if (1 === absint($_POST['status'])) {
            if (!in_array($id, $restricted)) {
                $restricted[] = $id;
            }
        } elseif (0 === absint($_POST['status'])) {
            if (($key = array_search($id, $restricted)) !== false) {
                unset($restricted[$key]);
            }
        }
        if (is_array($restricted) && !empty($restricted)) {
            update_site_option('pressbooks_network_managers', $restricted);
        } else {
            delete_site_option('pressbooks_network_managers');
        }
    }
}
开发者ID:samsruti,项目名称:pressbooks,代码行数:27,代码来源:pb-network-managers.php


示例6: undismiss_core_update

function undismiss_core_update( $version, $locale ) {
	$dismissed = get_site_option( 'dismissed_update_core' );
	$key = $version.'|'.$locale;
	if ( !isset( $dismissed[$key] ) ) return false;
	unset( $dismissed[$key] );
	return update_site_option( 'dismissed_update_core', $dismissed );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:7,代码来源:update.php


示例7: Add_Post_To_H1_Recent_Posts_From_Network

 /**
  * This function actually adds the post to the list of network recent posts when it is published for the first time.
  *
  * If the content on the post is empty then the title will be 'Auto Draft' and so it is not added to the list
  * until it is published with content.  Once a post has made it to the list it is never added back to the beginning.
  * That is, if you update the post it will not come back on to the list, nor would it move to the front if it was
  * already on the list.
  */
 function Add_Post_To_H1_Recent_Posts_From_Network()
 {
     global $post;
     if ($post->post_title == __('Auto Draft')) {
         return;
     }
     if (!get_post_meta($post->ID, 'published_once', true) && ($post->ID != 1 || strpos($post->content, $this->first_post) === false)) {
         global $wpdb;
         $domains = array();
         $blog_id = get_current_blog_id();
         // Ignore main site posts
         if ($blog_id == BLOG_ID_CURRENT_SITE) {
             return;
         }
         $rows = $wpdb->get_results("SELECT * FROM {$wpdb->dmtable} WHERE `blog_id`={$blog_id} ORDER BY id DESC LIMIT 0,1");
         foreach ($rows as $key => $val) {
             $domains[] = 'http://' . $val->domain;
         }
         $orig_blogurl = get_option('home') ? get_option('home') : get_option('siteurl');
         $mapped_blogurl = count($domains) > 0 ? $domains[0] : $orig_blogurl;
         $thumbnail = get_the_post_thumbnail($post->ID, 'medium', array('class' => 'hrpn-alignleft hrpn-thumb'));
         $essential_post_data = array('title' => $post->post_title, 'permalink' => str_replace($orig_blogurl, $mapped_blogurl, get_the_permalink($post->ID)), 'thumbnail' => $thumbnail, 'date' => $post->post_date);
         $current_recent_posts = get_site_option('network_latest_posts');
         if (empty($current_recent_posts)) {
             $current_recent_posts = array();
         }
         array_unshift($current_recent_posts, $essential_post_data);
         $new_recent_posts = array_slice($current_recent_posts, 0, 50);
         update_site_option('network_latest_posts', $new_recent_posts);
         update_post_meta($post->ID, 'published_once', 'true');
     }
 }
开发者ID:ZeelandFamily,项目名称:h1-recent-posts-from-network,代码行数:40,代码来源:HerculesRecentPostsfromNetwork.php


示例8: tearDown

 function tearDown()
 {
     global $wpdb;
     update_site_option('ms_files_rewriting', 0);
     $wpdb->suppress_errors($this->suppress);
     parent::tearDown();
 }
开发者ID:Benrajalu,项目名称:philRaj,代码行数:7,代码来源:ms-files-rewriting.php


示例9: bp_links_upgrade

/**
 * Perform database upgrades, create missing tables if necessary
 */
function bp_links_upgrade()
{
    global $wpdb, $bp;
    // make sure globals are set up
    $bp->links->setup_globals();
    // get db version
    $db_version = get_site_option('bp-links-db-version');
    // the sql to exec
    $sql = array();
    if (!empty($wpdb->charset)) {
        $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    }
    $sql[] = "CREATE TABLE `{$bp->links->table_name}` (\n\t\t\t\t`id` bigint unsigned NOT NULL auto_increment,\n\t\t\t\t`cloud_id` char(32) NOT NULL,\n\t\t\t\t`user_id` bigint unsigned NOT NULL,\n\t\t\t\t`category_id` tinyint NOT NULL,\n\t\t\t\t`url` varchar(255) NOT NULL default '',\n\t\t\t\t`url_hash` char(32) NOT NULL,\n\t\t\t\t`target` varchar(25) default NULL,\n\t\t\t\t`rel` varchar(25) default NULL,\n\t\t\t\t`slug` varchar(255) NOT NULL,\n\t\t\t\t`name` varchar(255) NOT NULL,\n\t\t\t\t`description` text,\n\t\t\t\t`status` tinyint(1) NOT NULL default '1',\n\t\t\t\t`vote_count` smallint NOT NULL default '0',\n\t\t\t\t`vote_total` smallint NOT NULL default '0',\n\t\t\t\t`popularity` mediumint UNSIGNED NOT NULL default '0',\n\t\t\t\t`embed_service` char(32) default null,\n\t\t\t\t`embed_status` tinyint(1) default '0',\n\t\t\t\t`embed_data` text,\n\t\t\t\t`date_created` datetime NOT NULL,\n\t\t\t\t`date_updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t\t\tPRIMARY KEY  (`id`),\n\t\t\tUNIQUE `cloud_id` (`cloud_id`),\n\t\t\tKEY `user_id` (`user_id`),\n\t\t\tKEY `category_id` (`category_id`),\n\t\t\tKEY `url_hash` (`url_hash`),\n\t\t\tKEY `slug` (`slug`),\n\t\t\tKEY `name` (`name`(20)),\n\t\t\tKEY `status` (`status`),\n\t\t\tKEY `vote_count` (`vote_count`),\n\t\t\tKEY `vote_total` (`vote_total`),\n\t\t\tKEY `popularity` (`popularity`),\n\t\t\tKEY `date_created` (`date_created`),\n\t\t\tKEY `date_updated` (`date_updated`)\n\t\t\t) {$charset_collate};";
    $sql[] = "CREATE TABLE `{$bp->links->table_name_categories}` (\n\t\t\t\t`id` tinyint(4) NOT NULL auto_increment,\n\t\t\t\t`slug` varchar(50) NOT NULL,\n\t\t\t\t`name` varchar(50) NOT NULL,\n\t\t\t\t`description` varchar(255) default NULL,\n\t\t\t\t`priority` smallint NOT NULL,\n\t\t\t\t`date_created` datetime NOT NULL,\n\t\t\t\t`date_updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t\t\tPRIMARY KEY  (`id`),\n\t\t\tKEY `slug` (`slug`),\n\t\t\tKEY `priority` (`priority`)\n\t\t\t) {$charset_collate};";
    // if initial install, add default categories
    if (empty($db_version)) {
        $sql[] = "INSERT INTO `{$bp->links->table_name_categories}`\n\t\t\t\t\t( slug, name, description, priority, date_created )\n\t\t\t\t\tVALUES  ( 'news', 'News', NULL, 10, NOW() ),\n\t\t\t\t\t\t\t( 'humor', 'Humor', NULL, 20, NOW() ),\n\t\t\t\t\t\t\t( 'other', 'Other', NULL, 30, NOW() );";
    }
    $sql[] = "CREATE TABLE `{$bp->links->table_name_votes}` (\n\t\t\t\t`link_id` bigint unsigned NOT NULL,\n\t\t\t\t`user_id` bigint unsigned NOT NULL,\n\t\t\t\t`vote` tinyint(1) NOT NULL,\n\t\t\t\t`date_created` datetime NOT NULL,\n\t\t\t\t`date_updated` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t\t\tPRIMARY KEY  (`user_id`,`link_id`),\n\t\t\tKEY `link_id` (`link_id`),\n\t\t\tKEY `date_created` (`date_created`)\n\t\t\t) {$charset_collate};";
    $sql[] = "CREATE TABLE `{$bp->links->table_name_linkmeta}` (\n\t\t\t\t`id` bigint NOT NULL auto_increment,\n\t\t\t\t`link_id` bigint unsigned NOT NULL,\n\t\t\t\t`meta_key` varchar(255) default NULL,\n\t\t\t\t`meta_value` longtext,\n\t\t\tPRIMARY KEY  (`id`),\n\t\t\tKEY `meta_key` (`meta_key`),\n\t\t\tKEY `link_id` (`link_id`)\n\t\t\t) {$charset_collate};";
    require_once ABSPATH . 'wp-admin/upgrade-functions.php';
    dbDelta($sql);
    // get a db version?
    if ($db_version) {
        // upgrades!
        bp_links_upgrade_04($db_version);
        bp_links_upgrade_08($db_version);
        bp_links_upgrade_082($db_version);
    }
    // update db version to current
    update_site_option('bp-links-db-version', BP_LINKS_DB_VERSION);
}
开发者ID:OxBEEF,项目名称:merge-server,代码行数:35,代码来源:bp-links-upgrade.php


示例10: save

 function save()
 {
     global $wpdb;
     $defaults = array('ID' => null, 'blog_id' => is_network_admin() ? 0 : get_current_blog_id(), 'author' => wp_get_current_user()->ID, 'summary' => null, 'visibility' => 'inactive', 'type' => 'notfication_rule', 'created' => current_time('mysql', 1));
     $data = $this->to_array();
     $record = array_intersect_key($data, $defaults);
     if ($this->exists()) {
         $before = new WP_Stream_Notification_Rule($this->ID);
         // update `created` to current date if needed
         if ($before->visibility === 'inactive' || $this->visibility === 'inactive') {
             $record['created'] = $defaults['created'];
         }
         $result = $wpdb->update($wpdb->stream, $record, array('ID' => $this->ID));
         // cache ok, db call ok
         $success = false !== $result;
     } else {
         if (!$record['created']) {
             unset($record['created']);
         }
         $record = wp_parse_args($record, $defaults);
         $result = $wpdb->insert($wpdb->stream, $record);
         // cache ok, db call ok
         $success = is_int($result);
         if ($success) {
             $this->ID = $wpdb->insert_id;
             // cache ok, db call ok
         }
     }
     if ($this->ID) {
         $meta_keys = array('triggers', 'groups', 'alerts');
         $meta = array_intersect_key($data, array_flip($meta_keys));
         update_site_option('stream_notifications_' . $this->ID, $meta);
     }
     return $success;
 }
开发者ID:xwp,项目名称:stream-legacy,代码行数:35,代码来源:wp-stream-notification-rule.php


示例11: activate_leadin

/**
 * Activate the plugin
 */
function activate_leadin($network_wide)
{
    // Check activation on entire network or one blog
    if (is_multisite() && $network_wide) {
        global $wpdb;
        // Get this so we can switch back to it later
        $current_blog = $wpdb->blogid;
        // For storing the list of activated blogs
        $activated = array();
        // Get all blogs in the network and activate plugin on each one
        $q = "SELECT blog_id FROM {$wpdb->blogs}";
        $blog_ids = $wpdb->get_col($q);
        foreach ($blog_ids as $blog_id) {
            switch_to_blog($blog_id);
            add_leadin_defaults();
            $activated[] = $blog_id;
        }
        // Switch back to the current blog
        switch_to_blog($current_blog);
        // Store the array for a later function
        update_site_option('leadin_activated', $activated);
    } else {
        add_leadin_defaults();
    }
}
开发者ID:TakenCdosG,项目名称:admissionsrevolution_new,代码行数:28,代码来源:leadin.php


示例12: licence_deactivation_check

 function licence_deactivation_check()
 {
     if (!$this->licence_key_verify() || $this->is_local_instance() === TRUE) {
         return;
     }
     $license_data = get_site_option('apto_license');
     if (isset($license_data['last_check'])) {
         if (time() < $license_data['last_check'] + 86400) {
             return;
         }
     }
     $license_key = $license_data['kye'];
     $args = array('sl_action' => 'status-check', 'licence_key' => $license_key, 'product_id' => APTO_PRODUCT_ID, 'secret_key' => APTO_SECRET_KEY, 'sl_instance' => APTO_INSTANCE);
     $request_uri = APTO_APP_API_URL . '?' . http_build_query($args, '', '&');
     $data = wp_remote_get($request_uri);
     if (is_wp_error($data) || $data['response']['code'] != 200) {
         return;
     }
     $data_body = json_decode($data['body']);
     if (isset($data_body->status)) {
         if ($data_body->status == 'success') {
             if ($data_body->status_code == 's203' || $data_body->status_code == 's204') {
                 $license_data['kye'] = '';
             }
         }
         if ($data_body->status == 'error') {
             $license_data['kye'] = '';
         }
     }
     $license_data['last_check'] = time();
     update_site_option('apto_license', $license_data);
 }
开发者ID:b0123498765,项目名称:template-wordpress,代码行数:32,代码来源:apto-licence-class.php


示例13: 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();
      * 
      */
 }
开发者ID:ZWS2014,项目名称:WordPress-API-Consumer,代码行数:27,代码来源:installer.php


示例14: on_activate

 /**
  * Check some thinks on plugin activation
  *
  * @since   0.0.1
  * @access  public
  * @static
  * @return  void
  */
 public static function on_activate()
 {
     // check WordPress version
     if (!version_compare($GLOBALS['wp_version'], '4.0', '>=')) {
         deactivate_plugins(RW_Distributed_Profile_Server::$plugin_filename);
         die(wp_sprintf('<strong>%s:</strong> ' . __('This plugin requires WordPress 4.0 or newer to work', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name')));
     }
     // check php version
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         deactivate_plugins(RW_Site_Config::$plugin_filename);
         die(wp_sprintf('<strong>%1s:</strong> ' . __('This plugin requires PHP 5.3 or newer to work. Your current PHP version is %1s, please update.', RW_Site_Config::get_textdomain()), RW_Site_Config::get_plugin_data('Name'), PHP_VERSION));
     }
     if (defined('RW_SITE_CONFIG_PLUGINS_CONFIG')) {
         if (false === get_site_option('rw_site_config_plugins')) {
             $plugins = unserialize(RW_SITE_CONFIG_PLUGINS_CONFIG);
             update_site_option('rw_site_config_plugins', $plugins);
         }
     }
     if (defined('RW_SITE_CONFIG_OPTIONS_CONFIG')) {
         if (false === get_site_option('rw_site_config_options')) {
             $options = unserialize(RW_SITE_CONFIG_OPTIONS_CONFIG);
             update_site_option('rw_site_config_options', $options);
         }
     }
 }
开发者ID:rpi-virtuell,项目名称:rw-site-config,代码行数:33,代码来源:RW_Site_Config_Installation.php


示例15: sr_activate

/**
 * Registers a plugin function to be run when the plugin is activated.
 */
function sr_activate()
{
    global $wpdb, $blog_id;
    if (false === get_site_option('sr_is_auto_refresh')) {
        update_site_option('sr_is_auto_refresh', 'no');
        update_site_option('sr_what_to_refresh', 'all');
        update_site_option('sr_refresh_duration', '5');
    }
    if (is_multisite()) {
        $blog_ids = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}", 0);
    } else {
        $blog_ids = array($blog_id);
    }
    foreach ($blog_ids as $blog_id) {
        if (file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php') && is_plugin_active('woocommerce/woocommerce.php')) {
            $wpdb_obj = clone $wpdb;
            $wpdb->blogid = $blog_id;
            $wpdb->set_prefix($wpdb->base_prefix);
            $create_table_order_items_query = "\n\t\t\t\tCREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sr_woo_order_items` (\n\t\t\t\t  `product_id` bigint(20) unsigned NOT NULL default '0',\n\t\t\t\t  `order_id` bigint(20) unsigned NOT NULL default '0',\n\t\t\t\t  `order_date` datetime NOT NULL default '0000-00-00 00:00:00',\n\t\t\t\t  `order_status` text NOT NULL,\n\t\t\t\t  `product_name` text NOT NULL,\n\t\t\t\t  `sku` text NOT NULL,\n\t\t\t\t  `category` text NOT NULL,\n\t\t\t\t  `quantity` int(10) unsigned NOT NULL default '0',\n\t\t\t\t  `sales` decimal(11,2) NOT NULL default '0.00',\n\t\t\t\t  `discount` decimal(11,2) NOT NULL default '0.00',\n\t\t\t\t  KEY `product_id` (`product_id`),\n\t\t\t\t  KEY `order_id` (`order_id`)\n\t\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8;\n\t\t\t";
            $create_table_abandoned_items_query = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}sr_woo_abandoned_items` (\n\t\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t  `user_id` bigint(20) unsigned NOT NULL default '0',\n\t\t\t\t  `product_id` bigint(20) unsigned NOT NULL default '0',\n\t\t\t\t  `quantity` int(10) unsigned NOT NULL default '0',\n\t\t\t\t  `cart_id` bigint(20),\n\t\t\t\t  `abandoned_cart_time` int(11) unsigned NOT NULL,\n\t\t\t\t  `product_abandoned` int(1) unsigned NOT NULL default '0',\n\t\t\t\t  `order_id` bigint(20),\n\t\t\t\t  PRIMARY KEY (`id`),\n\t\t\t\t  KEY `product_id` (`product_id`),\n\t\t\t\t  KEY `user_id` (`user_id`)\n\t\t\t\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8;";
            require_once ABSPATH . 'wp-admin/includes/upgrade.php';
            dbDelta($create_table_order_items_query);
            dbDelta($create_table_abandoned_items_query);
            add_action('load_sr_woo_order_items', 'load_sr_woo_order_items');
            do_action('load_sr_woo_order_items', $wpdb);
            $wpdb = clone $wpdb_obj;
        }
    }
}
开发者ID:adams0917,项目名称:woocommerce_eht,代码行数:32,代码来源:smart-reporter.php


示例16: activate_wpts

 function activate_wpts()
 {
     global $default_tab_settings, $wpts_db_version;
     $installed_ver = get_site_option('wpts_db_version');
     if ($installed_ver != $wpts_db_version) {
         $wpts_opts1 = get_option('wpts_options');
         $speed = isset($wpts_opts1['speed']) ? $wpts_opts1['speed'] : '';
         if (isset($wpts_opts1) and $speed == '1') {
             $pages = $wpts_opts1['pages'];
             $posts = $wpts_opts1['posts'];
             if (empty($pages) or !isset($pages)) {
                 $wpts_opts1['pages'] = '0';
             }
             if (empty($posts) or !isset($posts)) {
                 $wpts_opts1['posts'] = '0';
             }
         }
         $wpts_opts2 = $default_tab_settings;
         if ($wpts_opts1) {
             $wpts = $wpts_opts1 + $wpts_opts2;
             update_option('wpts_options', $wpts);
         } else {
             $wpts_opts1 = array();
             $wpts = $wpts_opts1 + $wpts_opts2;
             add_option('wpts_options', $wpts);
         }
         update_site_option('wpts_db_version', $wpts_db_version);
     }
 }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:29,代码来源:wordpress-post-tabs.php


示例17: install

 private function install()
 {
     global $wpdb;
     $sql = array();
     $charset_collate = '';
     //check if tables exist,
     //just update one table in that case
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     /* BuddyPress component DB schema */
     if (!empty($wpdb->charset)) {
         $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
     }
     $bp_prefix = bp_core_get_table_prefix();
     $bp_chat = bp_chat();
     //install
     $sql_table_exists_check = "SHOW TABLES LIKE '" . $bp_prefix . "_bp_chat_%'";
     if ($wpdb->get_col($sql_table_exists_check)) {
         ////just update the user table
         $sql[] = "ALTER TABLE {$bp_chat->table_name_users} MODIFY last_active_time DATETIME ";
     } else {
         //if tables do not exist
         $sql[] = "CREATE TABLE {$bp_chat->table_name_users} (\r\n\t\t\t\t\t\tuser_id bigint(20) NOT NULL,\r\n\t\t\t\t\t\tis_online tinyint(4) NOT NULL,\r\n\t\t\t\t\t\tlast_active_time datetime NOT NULL,\r\n\t\t\t\t\t\tstatus_message varchar(255) NOT NULL,\r\n\t\t\t\t\t\tlast_fetch_time datetime NOT NULL ,\r\n\t\t\t\t\t\tfriends_only tinyint(1) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\tPRIMARY KEY (user_id)\r\n\t\t\t\t\t  ) {$charset_collate};";
         $sql[] = "CREATE TABLE {$bp_chat->table_name_channels} (\r\n\t\t\t\t\t\tid bigint(20) unsigned NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\tlast_message_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\r\n\t\t\t\t\t\ttime_created datetime NOT NULL,\r\n\t\t\t\t\t\tstatus tinyint(3) unsigned NOT NULL,\r\n\t\t\t\t\t\tis_multichat tinyint(3) NOT NULL,\r\n\t\t\t\t\t\tis_open tinyint(4) NOT NULL,\r\n\t\t\t\t\t\tPRIMARY KEY (id)\r\n\t\t\t\t\t ) {$charset_collate};";
         $sql[] = "CREATE TABLE {$bp_chat->table_name_channel_users} (\r\n\t\t\t\t\t\tchannel_id bigint(20) NOT NULL,\r\n\t\t\t\t\t\tuser_id bigint(20) NOT NULL,\r\n\t\t\t\t\t\tstatus varchar(32) NOT NULL,\r\n\t\t\t\t\t\thas_initiated tinyint(4) NOT NULL,\r\n\t\t\t\t\t\tKEY channel_id (channel_id,user_id)\r\n\t\t\t\t   ) {$charset_collate};";
         //meta data
         $sql[] = "CREATE TABLE {$bp_chat->table_name_messages} (\r\n\t\t\t\t\t\t\tid bigint(20) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\tsender_id bigint(20) NOT NULL,\r\n\t\t\t\t\t\t\tchannel_id bigint(20) NOT NULL,\r\n\t\t\t\t\t\t\tmessage text NOT NULL,\r\n\t\t\t\t\t\t\tsent_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\r\n\t\t\t\t\t\t\tPRIMARY KEY (id),\r\n\t\t\t\t\t\t\tKEY channel_id (channel_id)\r\n\t\t\t\t\t ) {$charset_collate};";
     }
     //execute sql
     dbDelta($sql);
     update_site_option('bp-chat-db-version', BP_CHAT_DB_VERSION);
 }
开发者ID:Lady1178,项目名称:bp-chat,代码行数:31,代码来源:install.php


示例18: _mw_adminimize_get_admin_bar_frontend_nodes

/**
 * Get admin bar items from frontend view.
 *
 * @since 2015-07-03
 * @return null
 */
function _mw_adminimize_get_admin_bar_frontend_nodes()
{
    if (is_admin()) {
        return NULL;
    }
    global $wp_admin_bar;
    // @see: http://codex.wordpress.org/Function_Reference/get_nodes
    $all_toolbar_nodes = $wp_admin_bar->get_nodes();
    if ($all_toolbar_nodes) {
        // get all options
        if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
            $adminimizeoptions = get_site_option('mw_adminimize');
        } else {
            $adminimizeoptions = get_option('mw_adminimize');
        }
        // add admin bar array
        $adminimizeoptions['mw_adminimize_admin_bar_frontend_nodes'] = $all_toolbar_nodes;
        // update options
        if (is_multisite() && is_plugin_active_for_network(MW_ADMIN_FILE)) {
            update_site_option('mw_adminimize', $adminimizeoptions);
        } else {
            update_option('mw_adminimize', $adminimizeoptions);
        }
    }
}
开发者ID:Alinea-Interactive,项目名称:Adminimize,代码行数:31,代码来源:admin-bar-items.php


示例19: 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;
 }
开发者ID:ZWS2014,项目名称:zws-wordpress-contacts-database,代码行数:30,代码来源:Installer.php


示例20: xprofile_install

/**
 * xprofile_install()
 *
 * Set up the database tables needed for the xprofile component.
 * 
 * @package BuddyPress XProfile
 * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
 * @uses dbDelta() Takes SQL statements and compares them to any existing tables and creates/updates them.
 * @uses add_site_option() adds a value for a meta_key into the wp_sitemeta table
 */
function xprofile_install()
{
    global $bp, $wpdb;
    if (!empty($wpdb->charset)) {
        $charset_collate = "DEFAULT CHARACTER SET {$wpdb->charset}";
    }
    if ('' == get_site_option('bp-xprofile-base-group-name')) {
        update_site_option('bp-xprofile-base-group-name', 'Base');
    }
    if ('' == get_site_option('bp-xprofile-fullname-field-name')) {
        update_site_option('bp-xprofile-fullname-field-name', 'Name');
    }
    $sql[] = "CREATE TABLE {$bp->profile->table_name_groups} (\n\t\t\t  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t  name varchar(150) NOT NULL,\n\t\t\t  description mediumtext NOT NULL,\n\t\t\t  can_delete tinyint(1) NOT NULL,\n\t\t\t  KEY can_delete (can_delete)\n\t) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp->profile->table_name_fields} (\n\t\t\t  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t  group_id bigint(20) unsigned NOT NULL,\n\t\t\t  parent_id bigint(20) unsigned NOT NULL,\n\t\t\t  type varchar(150) NOT NULL,\n\t\t\t  name varchar(150) NOT NULL,\n\t\t\t  description longtext NOT NULL,\n\t\t\t  is_required tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t  is_default_option tinyint(1) NOT NULL DEFAULT '0',\n\t\t\t  field_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t  option_order bigint(20) NOT NULL DEFAULT '0',\n\t\t\t  order_by varchar(15) NOT NULL,\n\t\t\t  is_public int(2) NOT NULL DEFAULT '1',\n\t\t\t  can_delete tinyint(1) NOT NULL DEFAULT '1',\n\t\t\t  KEY group_id (group_id),\n\t\t\t  KEY parent_id (parent_id),\n\t\t\t  KEY is_public (is_public),\n\t\t\t  KEY can_delete (can_delete),\n\t\t\t  KEY is_required (is_required)\n\t) {$charset_collate};";
    $sql[] = "CREATE TABLE {$bp->profile->table_name_data} (\n\t\t\t  id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t  field_id bigint(20) unsigned NOT NULL,\n\t\t\t  user_id bigint(20) unsigned NOT NULL,\n\t\t\t  value longtext NOT NULL,\n\t\t\t  last_updated datetime NOT NULL,\n\t\t\t  KEY field_id (field_id),\n\t\t\t  KEY user_id (user_id)\n\t) {$charset_collate};";
    if ('' == get_site_option('bp-xprofile-db-version')) {
        $sql[] = "INSERT INTO {$bp->profile->table_name_groups} VALUES ( 1, '" . get_site_option('bp-xprofile-base-group-name') . "', '', 0 );";
        $sql[] = "INSERT INTO {$bp->profile->table_name_fields} ( \n\t\t\t\t\tid, group_id, parent_id, type, name, description, is_required, field_order, option_order, order_by, is_public, can_delete\n\t\t\t\t  ) VALUES (\n\t\t\t\t\t1, 1, 0, 'textbox', '" . get_site_option('bp-xprofile-fullname-field-name') . "', '', 1, 1, 0, '', 1, 0\n\t\t\t\t  );";
    }
    require_once ABSPATH . 'wp-admin/upgrade-functions.php';
    dbDelta($sql);
    if (function_exists('bp_wire_install')) {
        xprofile_wire_install();
    }
    update_site_option('bp-xprofile-db-version', BP_XPROFILE_DB_VERSION);
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:36,代码来源:bp-xprofile.php



注:本文中的update_site_option函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP update_sql函数代码示例发布时间:2022-05-23
下一篇:
PHP update_setting函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap