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


PHP _wpsc_doing_it_wrong函数代码示例

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


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

示例1: _wpsc_action_setup_customer

/**
 * Setup current user object and customer ID as well as cart.
 *
 * @uses  do_action() Calls 'wpsc_setup_customer' after customer data is ready
 * @access private
 * @since  3.8.13
 * @return int visitor id
 *
 */
function _wpsc_action_setup_customer()
{
    /////////////////////////////////////////////////////////////////////////
    // Setting up the customer happens after WPEC is initialized AND after
    // WordPress has loaded.  The reason for this is that the conditional
    // query tags are checked to see if the request is a 404 or a feed or
    // some other request that should not create a visitor profile.  The
    // conditional query tags are not available until after the
    // posts_selection hook is processed.  The 'wp' action is fired after
    // the 'posts_selection' hook.
    /////////////////////////////////////////////////////////////////////////
    if (!did_action('init')) {
        _wpsc_doing_it_wrong(__FUNCTION__, __('Customer cannot be reliably setup until at least the "init" hook as been fired during AJAX processing.', 'wpsc'), '3.8.14');
    }
    // if the customer cookie is invalid, unset it
    $visitor_id_from_cookie = _wpsc_validate_customer_cookie();
    if ($visitor_id_from_cookie && is_user_logged_in()) {
        $id_from_wp_user = get_user_meta(get_current_user_id(), _wpsc_get_visitor_meta_key('visitor_id'), true);
        if (empty($id_from_wp_user)) {
            _wpsc_update_wp_user_visitor_id(get_current_user_id(), $visitor_id_from_cookie);
        } elseif ($visitor_id_from_cookie != $id_from_wp_user) {
            // save the old visitor id so the merge cart function can do its work
            wpsc_update_customer_meta('merge_cart_vistor_id', $visitor_id_from_cookie);
            // make the current customer cookie match the cookie that is in the WordPress user meta
            _wpsc_create_customer_id_cookie($id_from_wp_user);
            // merging cart requires the taxonomies to have been initialized
            if (did_action('wpsc_register_taxonomies_after')) {
                _wpsc_merge_cart();
            } else {
                add_action('wpsc_register_taxonomies_after', '_wpsc_merge_cart', 1);
            }
        }
    }
    // initialize customer ID if it's not already there
    $visitor_id = wpsc_get_current_customer_id();
    // if there wasn't a visitor id in the cookies we set it now
    if ($visitor_id && empty($visitor_id_from_cookie) && is_user_logged_in()) {
        _wpsc_create_customer_id_cookie($visitor_id);
    }
    // setup the cart and restore its items
    wpsc_core_setup_cart();
    do_action('wpsc_setup_customer', $visitor_id);
}
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:52,代码来源:customer-private.php

示例2: save

 public function save()
 {
     if (defined('WPSC_LOAD_DEPRECATED') && WPSC_LOAD_DEPRECATED) {
         _wpsc_doing_it_wrong(__FUNCTION__, __('As of version 3.8.14 calling WPSC_Country class method "save" is not required. Changes to WPSC_Country properties are saved automatically.', 'wpsc'), '3.8.14');
     }
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:6,代码来源:wpsc-country.class.php

示例3: init_controller

 private function init_controller($controller)
 {
     global $wp_query;
     if (empty($controller)) {
         return;
     }
     $controller_args = trim(get_query_var('wpsc_controller_args'), '/');
     $controller_args = explode('/', $controller_args);
     if (!is_array($controller_args)) {
         $controller_args = array();
     }
     $slug = array_shift($controller_args);
     $method = str_replace(array(' ', '-'), '_', $slug);
     if (!$method) {
         $slug = $method = 'index';
     }
     $this->controller_slug = $slug;
     $this->controller_method = $method;
     $this->controller_name = $controller;
     $this->controller = _wpsc_load_controller($controller);
     // If method/path not found, show the 404 page
     if (!is_callable(array($this->controller, $method))) {
         _wpsc_doing_it_wrong(__FUNCTION__, __('Invalid controller method: ' . get_class($this->controller) . '::' . $method . '()', 'wpsc'), '4.0');
         return $this->not_found();
     }
     do_action('wpsc_router_init');
     $this->controller_args = $controller_args;
     if (is_callable(array($this->controller, '_pre_action'))) {
         call_user_func(array($this->controller, '_pre_action'), $this->controller_method, $this->controller_args);
     }
     call_user_func_array(array($this->controller, $this->controller_method), $this->controller_args);
     if (is_callable(array($this->controller, '_post_action'))) {
         call_user_func(array($this->controller, '_post_action'), $this->controller_method, $this->controller_args);
     }
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:35,代码来源:router.php

示例4: wpsc_customer_updated_data_ajax

/**
 * Update customer information using information supplied by shopper on WPeC pages
 *
 * @since 3.8.14
 *
 * @global  $_REQUEST['meta_data']  array of key value pairs that the user has changed, key is meta item name, value is new value
 *
 * @return JSON encoded response array with results
 *
 * 			$RESPONSE['request']		: 	array containing the original AJAX $_REQUEST that was sent to
 * 											the server, use to match up asynchronous AJAX transactions, or
 * 											to see original rquiest paramters
 *
 * 			$RESPONSE['customer_meta']	: 	array of key value pairs containing updated meta values. The
 * 											specific value changed is not included. If there isn't any updated
 * 											customer meta, other than the original meta changed, this array element
 * 											may not be present, or may be present and empty
 *
 * 			$response['checkout_info']  :	array of updated checkout information, array key is the HTML element ID
 * 											where the information is presented on the checkout form. If there isn't
 * 											any updated	checkout information this array element	may not be present,
 * 											or may be present and empty
 *
 *
 */
function wpsc_customer_updated_data_ajax()
{
    $success = true;
    // we will echo back the request in the (likely async) response so that the client knows
    // which transaction the response matches
    $response = array('request' => $_REQUEST);
    // update can be a single key/value pair or an array of key value pairs
    if (!empty($_REQUEST['meta_data'])) {
        $customer_meta = isset($_REQUEST['meta_data']) ? $_REQUEST['meta_data'] : array();
    } elseif (!empty($_REQUEST['meta_key']) && isset($_REQUEST['meta_value'])) {
        $customer_meta = array($_REQUEST['meta_key'] => $_REQUEST['meta_value']);
    } else {
        _wpsc_doing_it_wrong(__FUNCTION__, __('missing meta key or meta array', 'wpsc'), '3.8.14');
        $customer_meta = array();
    }
    // We will want to know which interface elements have changed as a result of this meta update,
    // capture the current state of the elements
    $checkout_info_before_updates = _wpsc_get_checkout_info();
    // We will want to know which, if any, checkout meta changes as a result of hooks and filters
    // that may fire as we update each meta item
    $all_checkout_meta_before_updates = _wpsc_get_checkout_meta();
    if (!empty($customer_meta)) {
        foreach ($customer_meta as $meta_key => $meta_value) {
            // this will echo back any fields to the requester. It's a
            // means for the requester to maintain some state during
            // asynchronous requests
            if (!empty($meta_key)) {
                $updated = wpsc_update_customer_meta($meta_key, $meta_value);
                $success = $success & $updated;
            }
        }
        // loop through a second time so that all of the meta has been set, tht way if there are
        // dependencies in response calculation
        foreach ($customer_meta as $meta_key => $meta_value) {
            $response = apply_filters('wpsc_customer_meta_response_' . $meta_key, $response, $meta_key, $meta_value);
        }
        if ($success) {
            $response['type'] = 'success';
            $response['error'] = '';
        } else {
            $response['type'] = 'error';
            $response['error'] = __('meta values may not have been updated', 'wpsc');
        }
    } else {
        $response['type'] = 'error';
        $response['error'] = __('invalid parameters, meta array or meta key value pair required', 'wpsc');
    }
    // Let's see what the current state of the customer meta set is after we applied the requested updates
    $all_checkout_meta_after_updates = _wpsc_get_checkout_meta();
    foreach ($all_checkout_meta_after_updates as $current_meta_key => $current_meta_value) {
        // if the meta key and value are the same as what was sent in the request we don't need to
        // send them back because the client already knows about this.
        //
        // But we have to check just in case a data rule or a plugin that used our hooks made some adjustments
        if (isset($all_checkout_meta_before_updates[$current_meta_key]) && $all_checkout_meta_before_updates[$current_meta_key] == $current_meta_value) {
            // new value s the same as the old value, why send it?
            unset($all_checkout_meta_after_updates[$current_meta_key]);
            unset($all_checkout_meta_before_updates[$current_meta_key]);
            continue;
        }
        // if the meta value we are considering sending back is one of the values the client gave, we don't send it
        // because the client already knows the meta value and it is probably already visible in the user interface
        if (isset($customer_meta[$current_meta_key]) && $customer_meta[$current_meta_key] == $current_meta_value) {
            // new value s the same as the old value, why send it?
            unset($all_checkout_meta_after_updates[$current_meta_key]);
            continue;
        }
    }
    // Any checkout meta that has changed as a result of the requeeted updates remains
    // in our array, add it to the response
    $response['customer_meta'] = $all_checkout_meta_after_updates;
    // Get the changed checkout information and if something has changed add it to the repsonse
    $new_checkout_info = _wpsc_remove_unchanged_checkout_info($checkout_info_before_updates, _wpsc_get_checkout_info());
    if (!empty($new_checkout_info)) {
        $response['checkout_info'] = $new_checkout_info;
//.........这里部分代码省略.........
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:101,代码来源:wpsc-checkout-ajax.php

示例5: wpsc_delete_customer_meta_ajax

 /**
  * Delete a customer meta
  * @param string
  * @return JSON encoded array with results, results include original request parameters
  * @since 3.8.14
  */
 function wpsc_delete_customer_meta_ajax()
 {
     $meta_key = isset($_POST['meta_key']) ? $_REQUEST['meta_key'] : '';
     $response = array('request' => $_REQUEST);
     if (!empty($meta_key)) {
         $response['old_value'] = wpsc_get_customer_meta($meta_key);
         $response['type'] = __('success', 'wpsc');
         $response['error'] = '';
         wpsc_delete_customer_meta($meta_key);
     } else {
         $response['old_value'] = '';
         $response['type'] = __('error', 'wpsc');
         $response['error'] = __('no meta key', 'wpsc');
         _wpsc_doing_it_wrong(__FUNCTION__, __('missing meta key', 'wpsc'), '3.8.14');
     }
     $response = _wpsc_add_customer_meta_to_response($response);
     wp_send_json_success($response);
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:24,代码来源:customer-ajax.php

示例6: _confirm_data_ready

 /**
  * Make sure the data is available
  *
  * @access public
  *
  * @since 3.8.14
  *
  * @return string  a map name to uniquely identify this map so it can be saved and restored
  */
 private function _confirm_data_ready()
 {
     if (!is_array($this->_map_data)) {
         // if this is a named map we can try to restore it from the transient store
         if (!empty($this->_map_name)) {
             $this->_map_data = get_transient($this->_map_name);
         }
         // if we still don't have a valid map and there is a constructor callback use it
         if (!is_array($this->_map_data) && !empty($this->_map_callback) && is_callable($this->_map_callback)) {
             static $already_invoking_callback = array();
             // the callback could be a string or an array, we can keep track of
             // who's call we are processing tp avoid a recursion problem, just in case!
             $callback_unique_key = md5(json_encode($this->_map_callback));
             if (!array_key_exists($callback_unique_key, $already_invoking_callback)) {
                 $already_invoking_callback[$callback_unique_key] = true;
                 $this->_map_data = array();
                 // callback has a single parameter, the data map
                 call_user_func($this->_map_callback, $this);
                 if (!is_array($this->_map_data)) {
                     $this->_map_data = array();
                 }
                 if (!empty($this->_map_name)) {
                     set_transient($this->_map_name, $this->_map_data);
                 }
                 // we just loaded and saved the data, that makes it not dirty
                 $this->_dirty = false;
             } else {
                 if (is_array($this->_map_callback)) {
                     $function = $this->_map_callback[0] . '::' . $this->_map_callback[1];
                 } else {
                     $function = $this->_map_callback;
                 }
                 _wpsc_doing_it_wrong($function, __('WPSC_Data_Map map creation callback is recursively calling itself.', 'wpsc'), '3.8.14');
             }
             unset($already_invoking_callback[$callback_unique_key]);
         }
         // if we still don't have valid map data create an empty array
         if (!is_array($this->_map_data)) {
             $this->_map_data = array();
         }
     }
     return is_array($this->_map_data);
 }
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:52,代码来源:wpsc-data-map.class.php

示例7: wpsc_delete_purchlog

/**
 * Delete a purchase log
 *
 * @deprecated  Use WPSC_Purchase_Log->delete() instead.
 *
 * @param   int|string  $purchlog_id  Required. Purchase log ID (empty string is deprecated).
 * @return  boolean                   Deleted successfully.
 */
function wpsc_delete_purchlog($purchlog_id = '')
{
    global $wpdb;
    // Deprecate empty purchase log ID parameter.
    if ($purchlog_id == '') {
        _wpsc_doing_it_wrong('wpsc_delete_purchlog', __('$purchlog_id parameter requires a numeric purchase log ID.', 'wp-e-commerce'), '3.9.0');
        return false;
    }
    $log = new WPSC_Purchase_Log($purchlog_id);
    return $log->delete();
}
开发者ID:ashik968,项目名称:digiplot,代码行数:19,代码来源:init.php

示例8: wpec_taxes_get_region_information

 /**
  * @description: wpec_taxes_get_region_information - given a region code and column
  *                   this function will return the resulting value.
  * @param: region_code - code for this region
  * @param: attribute (optional) - specify a column to retrieve
  *                            Default action is to retrieve the id column.
  * @return: int, string, or false
  * */
 function wpec_taxes_get_region_information($region, $attribute = 'id', $country = null)
 {
     $returnable = false;
     if ('all-markets' == $region || 'all-markets' == $country) {
         $returnable = __('All Markets', 'wpsc');
     } else {
         // prior to version 3.8.14 this function was made available without the country parameter, because
         // there is no assurance that region code ar unique across the globe we need to specify a country
         // at the time of this change this function was not called with WPeC, but just in case we have a
         // little logic here to try to catch an improper call, but it isn't perfect.
         if ($country == null) {
             _wpsc_doing_it_wrong(__FUNCTION__, __('Prior to version 3.8.14 this function was made available without the country parameter. Because there is no assurance that region codes are unique across the globe, we need to specify a country.', 'wpsc'), '3.8.14');
         }
         //check for all markets ifset return the string 'All Markets'
         if (!$returnable) {
             $wpsc_country = new WPSC_Country($country);
             if ($wpsc_country) {
                 $wpsc_region = $wpsc_country->get_region($region);
                 if ($wpsc_region) {
                     $returnable = $wpsc_region->get($attribute);
                 }
             }
         }
     }
     return $returnable;
 }
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:34,代码来源:taxes.class.php

示例9: _wpsc_ajax_get_cart

/**
 * Returns the Cart Widget
 *
 * @param  boolean $die          Whether or not to return the output (for new JSON requests) or to die() on the old $output / action.
 * @param  array   $cart_message An array of cart messages to be optionally passed.  Primarily passed via wpsc_add_to_cart().
 *
 * @since 3.8.11
 * @return mixed                 Returns an array of output data, alternatively
 */
function _wpsc_ajax_get_cart($die = true, $cart_messages = array())
{
    $return = array();
    if (defined('DOING_AJAX') && DOING_AJAX) {
        ob_start();
        include_once wpsc_get_template_file_path('wpsc-cart_widget.php');
        $output = ob_get_contents();
        ob_end_clean();
        $output = str_replace(array('\\n', '\\r'), '', $output);
        $return['widget_output'] = $output;
        $return['core_images_url'] = WPSC_CORE_IMAGES_URL;
        if (1 == get_option('show_sliding_cart') || empty($cart_messages)) {
            if (wpsc_cart_item_count()) {
                $_SESSION['slider_state'] = 1;
                $return['sliding_cart_state'] = 'show';
            } else {
                $_SESSION['slider_state'] = 0;
                $return['sliding_cart_state'] = 'hide';
            }
        }
        $action_output = '';
        if (has_action('wpsc_alternate_cart_html') && empty($_REQUEST['_wpsc_compat_ajax'])) {
            //Deprecated action. Do not use.  We now have a custom JS event called 'wpsc_fancy_notification'. There is access to the complete $json_response object.
            ob_start();
            echo _wpsc_get_alternate_html($cart_messages);
            $action_output = ob_get_contents();
            $output = '';
            ob_end_clean();
        }
        if (!empty($action_output)) {
            _wpsc_doing_it_wrong('wpsc_alternate_cart_html', __('As of WPeC 3.8.11, it is improper to hook into "wpsc_alternate_cart_html" to output javascript.  We now have a custom javascript event called "wpsc_fancy_notification" you can hook into.', 'wpsc'), '3.8.11');
            $return['wpsc_alternate_cart_html'] = $action_output;
        }
    }
    if ($die) {
        echo $output . $action_output;
        die;
    } else {
        return $return;
    }
}
开发者ID:dreamteam111,项目名称:dreamteam,代码行数:50,代码来源:ajax.php

示例10: _wpsc_doing_it_wrong

 /**
  * Doing it Wrong
  *
  * @since   4.0
  * @access  private
  */
 function _wpsc_doing_it_wrong($method)
 {
     _wpsc_doing_it_wrong('wpsc_products_by_category->' . $method . '()', __('This class is deprecated. There is no direct replacement. Hiding subcategory products in parent categories is now handled by the private wpsc_hide_subcatsprods_in_cat_query() function.', 'wp-e-commerce'), '4.0');
 }
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:10,代码来源:wpsc-products-by-category.php

示例11: _wpsc_verify_global_cart_has_been_initialized

/**
 * Prior to using the global cart variable cart template API functions should check
 * to be sure the global cart variable has been initialized.
 *
 * @access private
 * @static
 * @since 3.8.14
 *
 * @uses wpsc_cart
 * @return boolean true if we have a valid cart, false otherwise
 *
 */
function _wpsc_verify_global_cart_has_been_initialized($function = __FUNCTION__)
{
    global $wpsc_cart;
    $we_have_a_valid_cart = !empty($wpsc_cart) && is_a($wpsc_cart, 'wpsc_cart');
    if (!$we_have_a_valid_cart) {
        $wpsc_cart = wpsc_get_customer_cart();
        $we_have_a_valid_cart = !empty($wpsc_cart) && is_a($wpsc_cart, 'wpsc_cart');
    }
    // We will try to give a helpful message to the developer so that they can adjust their code
    static $already_gave_no_valid_cart_message = false;
    if (!$we_have_a_valid_cart && !$already_gave_no_valid_cart_message) {
        _wpsc_doing_it_wrong($function, __('The WPeC global cart is not yet initialized. Accessing global cart properties and methods will not work.', 'wpsc'), '3.8.14');
        $already_gave_no_valid_cart_message = true;
    }
    return $we_have_a_valid_cart;
}
开发者ID:parkesma,项目名称:WP-e-Commerce,代码行数:28,代码来源:cart-template-api.php

示例12: _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

示例13: delete

 /**
  * Deletes a log from the database.
  *
  * @access  public
  * @since   3.8.9
  *
  * @uses  $wpdb                              Global database instance.
  * @uses  wpsc_is_store_admin()              Check user has admin capabilities.
  * @uses  WPSC_Purchase_Log::delete_cache()  Delete purchaselog cache.
  * @uses  WPSC_Claimed_Stock                 Claimed Stock class.
  *
  * @param   string   $log_id   ID of the log.
  * @return  boolean            Deleted successfully.
  */
 public function delete($log_id = false)
 {
     global $wpdb;
     if (!(isset($this) && get_class($this) == __CLASS__)) {
         _wpsc_doing_it_wrong('WPSC_Purchase_Log::delete', __('WPSC_Purchase_Log::delete() is no longer a static method and should not be called statically.', 'wpsc'), '3.9.0');
     }
     if (false !== $log_id) {
         _wpsc_deprecated_argument(__FUNCTION__, '3.9.0', 'The $log_id param is not used. You must first create an instance of WPSC_Purchase_Log before calling this method.');
     }
     if (!wpsc_is_store_admin()) {
         return false;
     }
     $log_id = $this->get('id');
     if ($log_id > 0) {
         do_action('wpsc_purchase_log_before_delete', $log_id);
         self::delete_cache($log_id);
         // Delete claimed stock
         $purchlog_status = $wpdb->get_var($wpdb->prepare("SELECT `processed` FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id`= %d", $log_id));
         if ($purchlog_status == WPSC_Purchase_Log::CLOSED_ORDER || $purchlog_status == WPSC_Purchase_Log::INCOMPLETE_SALE) {
             $claimed_query = new WPSC_Claimed_Stock(array('cart_id' => $log_id, 'cart_submitted' => 1));
             $claimed_query->clear_claimed_stock(0);
         }
         // Delete cart content, submitted data, then purchase log
         $wpdb->query($wpdb->prepare("DELETE FROM `" . WPSC_TABLE_CART_CONTENTS . "` WHERE `purchaseid` = %d", $log_id));
         $wpdb->query($wpdb->prepare("DELETE FROM `" . WPSC_TABLE_SUBMITTED_FORM_DATA . "` WHERE `log_id` IN (%d)", $log_id));
         $wpdb->query($wpdb->prepare("DELETE FROM `" . WPSC_TABLE_PURCHASE_LOGS . "` WHERE `id` = %d LIMIT 1", $log_id));
         do_action('wpsc_purchase_log_delete', $log_id);
         return true;
     }
     return false;
 }
开发者ID:VanessaGarcia-Freelance,项目名称:ButtonHut,代码行数:45,代码来源:purchase-log.class.php

示例14: _save_country_data

 /**
  * saves country data to the database
  *
  * @access WPeC 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
  */
 public static function _save_country_data($country_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.
      */
     $country_id = isset($country_data['id']) ? intval($country_data['id']) : 0;
     $country_iso_code = isset($country_data['isocode']) ? $country_data['isocode'] : '';
     /*
      *  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($country_iso_code)) {
         _wpsc_doing_it_wrong(__FUNCTION__, __('To insert a country either country id or country ISO code must be specified.', 'wpsc'), '3.8.11');
         return false;
     }
     // check the database to find the country id
     $sql = $wpdb->prepare('SELECT id FROM ' . WPSC_TABLE_CURRENCY_LIST . ' WHERE (`id` = %d ) OR ( `isocode` = %s ) ', $country_id, $country_iso_code);
     $country_id_from_db = $wpdb->get_var($sql);
     // do a little data clean up prior to inserting into the database
     if (isset($country_data['has_regions'])) {
         $country_data['has_regions'] = $country_data['has_regions'] ? 1 : 0;
     }
     if (isset($country_data['visible'])) {
         $country_data['visible'] = $country_data['visible'] ? 1 : 0;
     }
     // insert or update the information
     if (empty($country_id_from_db)) {
         // we are doing an insert of a new country
         $result = $wpdb->insert(WPSC_TABLE_CURRENCY_LIST, $country_data);
         if ($result) {
             $country_id_from_db = $wpdb->insert_id;
         }
     } else {
         // we are doing an update of an existing country
         if (isset($country_data['id'])) {
             // no nead to update the id to itself
             unset($country_data['id']);
         }
         $wpdb->update(WPSC_TABLE_CURRENCY_LIST, $country_data, array('id' => $country_id_from_db), '%s', array('%d'));
     }
     // clear the cached data, force a rebuild by getting a country
     self::clear_cache();
     return $country_id_from_db;
 }
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:58,代码来源:wpsc-countries.class.php

示例15: wpsc_deprecated_filter_user_log_get

/**
 * deprecating user log filter for getting all customer meta as an array.
 *
 *@deprecated 3.8.14
 *
 * @return none
 */
function wpsc_deprecated_filter_user_log_get()
{
    if (has_filter('wpsc_user_log_get')) {
        $meta_data = wpsc_get_customer_meta('checkout_details');
        $meta_data = apply_filters('wpsc_user_log_get', $meta_data, wpsc_get_current_customer_id());
        wpsc_update_customer_meta('checkout_details', $meta_data);
        _wpsc_doing_it_wrong('wpsc_user_log_get', __('The filter being used has been deprecated. Use wpsc_get_visitor_meta or wpsc_get_visitor_meta_$meta_name instead.', 'wp-e-commerce'), '3.8.14');
    }
}
开发者ID:AngryBird3,项目名称:WP-e-Commerce,代码行数:16,代码来源:wpsc-deprecated.php


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