当前位置: 首页>>代码示例>>PHP>>正文


PHP update_site_option函数代码示例

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


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


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