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


PHP WPSC_Countries::clear_cache方法代码示例

本文整理汇总了PHP中WPSC_Countries::clear_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Countries::clear_cache方法的具体用法?PHP WPSC_Countries::clear_cache怎么用?PHP WPSC_Countries::clear_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSC_Countries的用法示例。


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

示例1: save_options

 /**
  * Save submitted options to the database.
  * @since 3.8.8
  * @uses check_admin_referer() Prevents CSRF.
  * @uses update_option() Saves options to the database.
  * @uses wpdb::query() Queries the database.
  * @uses wpdb::get_col() Queries the database.
  * @access public
  */
 private function save_options($selected = '')
 {
     global $wpdb, $wpsc_gateways;
     $updated = 0;
     //This is to change the Overall target market selection
     check_admin_referer('update-options', 'wpsc-update-options');
     //Should be refactored along with the Marketing tab
     if (isset($_POST['change-settings'])) {
         if (isset($_POST['wpsc_also_bought']) && $_POST['wpsc_also_bought'] == 'on') {
             update_option('wpsc_also_bought', 1);
         } else {
             update_option('wpsc_also_bought', 0);
         }
         if (isset($_POST['display_find_us']) && $_POST['display_find_us'] == 'on') {
             update_option('display_find_us', 1);
         } else {
             update_option('display_find_us', 0);
         }
         if (isset($_POST['wpsc_share_this']) && $_POST['wpsc_share_this'] == 'on') {
             update_option('wpsc_share_this', 1);
         } else {
             update_option('wpsc_share_this', 0);
         }
         if (isset($_POST['wpsc_ga_disable_tracking']) && $_POST['wpsc_ga_disable_tracking'] == '1') {
             update_option('wpsc_ga_disable_tracking', 1);
         } else {
             update_option('wpsc_ga_disable_tracking', 0);
         }
         if (isset($_POST['wpsc_ga_currently_tracking']) && $_POST['wpsc_ga_currently_tracking'] == '1') {
             update_option('wpsc_ga_currently_tracking', 1);
         } else {
             update_option('wpsc_ga_currently_tracking', 0);
         }
         if (isset($_POST['wpsc_ga_advanced']) && $_POST['wpsc_ga_advanced'] == '1') {
             update_option('wpsc_ga_advanced', 1);
             update_option('wpsc_ga_currently_tracking', 1);
         } else {
             update_option('wpsc_ga_advanced', 0);
         }
         if (isset($_POST['wpsc_ga_tracking_id']) && !empty($_POST['wpsc_ga_tracking_id'])) {
             update_option('wpsc_ga_tracking_id', esc_attr($_POST['wpsc_ga_tracking_id']));
         } else {
             update_option('wpsc_ga_tracking_id', '');
         }
     }
     if (empty($_POST['countrylist2']) && !empty($_POST['wpsc_options']['currency_sign_location'])) {
         $selected = 'none';
     }
     if (!isset($_POST['countrylist2'])) {
         $_POST['countrylist2'] = '';
     }
     if (!isset($_POST['country_id'])) {
         $_POST['country_id'] = '';
     }
     if (!isset($_POST['country_tax'])) {
         $_POST['country_tax'] = '';
     }
     if ($_POST['countrylist2'] != null || !empty($selected)) {
         $AllSelected = false;
         if ($selected == 'all') {
             $wpdb->query("UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '1'");
             $AllSelected = true;
         }
         if ($selected == 'none') {
             $wpdb->query("UPDATE `" . WPSC_TABLE_CURRENCY_LIST . "` SET visible = '0'");
             $AllSelected = true;
         }
         if ($AllSelected != true) {
             $countrylist = $wpdb->get_col("SELECT id FROM `" . WPSC_TABLE_CURRENCY_LIST . "` ORDER BY country ASC ");
             //find the countries not selected
             $unselectedCountries = array_diff($countrylist, $_POST['countrylist2']);
             foreach ($unselectedCountries as $unselected) {
                 $wpdb->update(WPSC_TABLE_CURRENCY_LIST, array('visible' => 0), array('id' => $unselected), '%d', '%d');
             }
             //find the countries that are selected
             $selectedCountries = array_intersect($countrylist, $_POST['countrylist2']);
             foreach ($selectedCountries as $selected) {
                 $wpdb->update(WPSC_TABLE_CURRENCY_LIST, array('visible' => 1), array('id' => $selected), '%d', '%d');
             }
         }
         WPSC_Countries::clear_cache();
         wpsc_core_flush_temporary_data();
     }
     $previous_currency = get_option('currency_type');
     //To update options
     if (isset($_POST['wpsc_options'])) {
         $_POST['wpsc_options'] = stripslashes_deep($_POST['wpsc_options']);
         // make sure stock keeping time is a number
         if (isset($_POST['wpsc_options']['wpsc_stock_keeping_time'])) {
             $skt = $_POST['wpsc_options']['wpsc_stock_keeping_time'];
             // I hate repeating myself
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:settings-page.php

示例2: _save_region_data

 /**
  * saves region data to the database
  *
  * @access private
  *
  * @since 3.8.14
  *
  * @param array  key/value pairs that are put into the database columns
  *
  * @return int|boolean country_id on success, false on failure
  */
 private function _save_region_data($region_data)
 {
     global $wpdb;
     /*
      * We need to figure out if we are updating an existing country. There are three
      * possible unique identifiers for a country.  Look for a row that has any of the
      * identifiers.
      */
     $region_id = isset($region_data['id']) ? intval($region_data['id']) : 0;
     $country_id = isset($region_data['country_id']) ? intval($region_data['country_id']) : 0;
     $region_code = isset($region_data['code']) ? $region_data['code'] : '';
     $region_name = isset($region_data['code']) ? $region_data['code'] : '';
     $region_id_from_db = false;
     /*
      *  If at least one of the key feilds ins't present we aren'y going to continue, we can't reliably update
      *  a row in the table, nor could we insrt a row that could reliably be updated.
      */
     if (empty($country_id) || empty($region_code) || empty($region_name)) {
         _wpsc_doing_it_wrong(__FUNCTION__, __('Creating a new region requires country id, region code and region name.', 'wpsc'), '3.8.11');
         return $region_id_from_db;
     }
     if ($region_id) {
         $sql = $wpdb->prepare('SELECT id FROM ' . WPSC_TABLE_REGION_TAX . ' WHERE (`id` = %d )', $region_id);
         $region_id_from_db = $wpdb->get_var($sql);
     }
     if (empty($region_id_from_db)) {
         // we are doing an insert of a new country
         $result = $wpdb->insert(WPSC_TABLE_REGION_TAX, $region_data);
         if ($result) {
             $region_id_from_db = $wpdb->insert_id;
         }
     } else {
         // we are doing an update of an existing country
         if (isset($region_data['id'])) {
             // no need to update the id to itself, don't want to allow changing of region id's either
             unset($region_data['id']);
         }
         $wpdb->update(WPSC_TABLE_REGION_TAX, $region_data, array('id' => $region_id_from_db), '%s', array('%d'));
     }
     // clear the cached data, force a rebuild
     WPSC_Countries::clear_cache();
     return $region_id_from_db;
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:54,代码来源:wpsc-region.class.php


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