Version Description
- Fix: Anonymous customers should not be visible in admin UI.
- Fix: Cronjob to purge anonymous customers doesn't work due to memory issues.
- Fix: Anonymous cart items will be lost after signing in.
Download this release
Release Info
| Developer | garyc40 |
| Plugin | |
| Version | 3.8.13.2 |
| Comparing to | |
| See all releases | |
Code changes from version 3.8.13.1 to 3.8.13.2
- .gitignore +2 -0
- readme.txt +7 -3
- wp-shopping-cart.php +1 -1
- wpsc-core/wpsc-constants.php +4 -9
- wpsc-includes/cron.php +28 -7
- wpsc-includes/customer.php +184 -10
- wpsc-includes/misc.functions.php +0 -20
- wpsc-includes/page-about.php +0 -136
- wpsc-includes/wpsc-meta-init.php +1 -1
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
| 1 |
+
cookbooks
|
| 2 |
+
tmp
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: http://getshopped.org
|
|
| 4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
| 5 |
Requires at least: 3.7
|
| 6 |
Tested up to: 3.8
|
| 7 |
-
Stable tag: 3.8.13.
|
| 8 |
|
| 9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
| 10 |
|
|
@@ -146,9 +146,13 @@ After upgrading from earlier versions look for link "Update Store". This will up
|
|
| 146 |
|
| 147 |
== Changelog ==
|
| 148 |
|
| 149 |
-
= 3.8.13.
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
-
|
|
|
|
| 152 |
|
| 153 |
= 3.8.13 =
|
| 154 |
|
| 4 |
Tags: e-commerce, wp-e-commerce, shop, cart, paypal, authorize, stock control, ecommerce, shipping, tax
|
| 5 |
Requires at least: 3.7
|
| 6 |
Tested up to: 3.8
|
| 7 |
+
Stable tag: 3.8.13.2
|
| 8 |
|
| 9 |
WP e-Commerce is a free WordPress Shopping Cart Plugin that lets customers buy your products, services and digital downloads online.
|
| 10 |
|
| 146 |
|
| 147 |
== Changelog ==
|
| 148 |
|
| 149 |
+
= 3.8.13.2 =
|
| 150 |
+
* Fix: Anonymous customers should not be visible in admin UI.
|
| 151 |
+
* Fix: Cronjob to purge anonymous customers doesn't work due to memory issues.
|
| 152 |
+
* Fix: Anonymous cart items will be lost after signing in.
|
| 153 |
|
| 154 |
+
= 3.8.13.1 =
|
| 155 |
+
* Security and maintenance release
|
| 156 |
|
| 157 |
= 3.8.13 =
|
| 158 |
|
wp-shopping-cart.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
* Plugin Name: WP e-Commerce
|
| 4 |
* Plugin URI: http://getshopped.org/
|
| 5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
| 6 |
-
* Version: 3.8.13.
|
| 7 |
* Author: Instinct Entertainment
|
| 8 |
* Author URI: http://getshopped.org/
|
| 9 |
**/
|
| 3 |
* Plugin Name: WP e-Commerce
|
| 4 |
* Plugin URI: http://getshopped.org/
|
| 5 |
* Description: A plugin that provides a WordPress Shopping Cart. See also: <a href="http://getshopped.org" target="_blank">GetShopped.org</a> | <a href="http://getshopped.org/forums/" target="_blank">Support Forum</a> | <a href="http://docs.getshopped.org/" target="_blank">Documentation</a>
|
| 6 |
+
* Version: 3.8.13.2
|
| 7 |
* Author: Instinct Entertainment
|
| 8 |
* Author URI: http://getshopped.org/
|
| 9 |
**/
|
wpsc-core/wpsc-constants.php
CHANGED
|
@@ -29,9 +29,9 @@ function wpsc_core_constants() {
|
|
| 29 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
| 30 |
|
| 31 |
// Define Plugin version
|
| 32 |
-
define( 'WPSC_VERSION' , '3.8.13.
|
| 33 |
-
define( 'WPSC_MINOR_VERSION' , '
|
| 34 |
-
define( 'WPSC_PRESENTABLE_VERSION', '3.8.13.
|
| 35 |
define( 'WPSC_DB_VERSION' , 8 );
|
| 36 |
|
| 37 |
// Define Debug Variables for developers
|
|
@@ -256,12 +256,7 @@ function wpsc_core_setup_cart() {
|
|
| 256 |
if ( 2 == get_option( 'cart_location' ) )
|
| 257 |
add_filter( 'the_content', 'wpsc_shopping_cart', 14 );
|
| 258 |
|
| 259 |
-
$
|
| 260 |
-
|
| 261 |
-
if ( is_object( $cart ) && ! is_wp_error( $cart ) )
|
| 262 |
-
$GLOBALS['wpsc_cart'] = $cart;
|
| 263 |
-
else
|
| 264 |
-
$GLOBALS['wpsc_cart'] = new wpsc_cart();
|
| 265 |
}
|
| 266 |
|
| 267 |
/**
|
| 29 |
define( 'WPSC_URL', plugins_url( '', __FILE__ ) );
|
| 30 |
|
| 31 |
// Define Plugin version
|
| 32 |
+
define( 'WPSC_VERSION' , '3.8.13.2' );
|
| 33 |
+
define( 'WPSC_MINOR_VERSION' , 'b0ef2e3' );
|
| 34 |
+
define( 'WPSC_PRESENTABLE_VERSION', '3.8.13.2' );
|
| 35 |
define( 'WPSC_DB_VERSION' , 8 );
|
| 36 |
|
| 37 |
// Define Debug Variables for developers
|
| 256 |
if ( 2 == get_option( 'cart_location' ) )
|
| 257 |
add_filter( 'the_content', 'wpsc_shopping_cart', 14 );
|
| 258 |
|
| 259 |
+
$GLOBALS['wpsc_cart'] = wpsc_get_customer_cart();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
}
|
| 261 |
|
| 262 |
/**
|
wpsc-includes/cron.php
CHANGED
|
@@ -3,12 +3,17 @@ add_action( 'wpsc_hourly_cron_task', 'wpsc_clear_stock_claims' );
|
|
| 3 |
add_action( 'wpsc_hourly_cron_task', '_wpsc_clear_customer_meta' );
|
| 4 |
|
| 5 |
/**
|
| 6 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
*/
|
| 8 |
function wpsc_clear_stock_claims() {
|
| 9 |
global $wpdb;
|
| 10 |
|
| 11 |
-
$time
|
| 12 |
$interval = get_option( 'wpsc_stock_keeping_interval', 'day' );
|
| 13 |
|
| 14 |
// we need to convert into seconds because we're allowing decimal intervals like 1.5 days
|
|
@@ -18,27 +23,43 @@ function wpsc_clear_stock_claims() {
|
|
| 18 |
'week' => 604800,
|
| 19 |
);
|
| 20 |
|
| 21 |
-
$seconds = floor( $time * $convert[$interval] );
|
| 22 |
|
| 23 |
$sql = $wpdb->prepare( "DELETE FROM " . WPSC_TABLE_CLAIMED_STOCK . " WHERE last_activity < UTC_TIMESTAMP() - INTERVAL %d SECOND", $seconds );
|
| 24 |
$wpdb->query( $sql );
|
| 25 |
}
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
function _wpsc_clear_customer_meta() {
|
| 28 |
global $wpdb;
|
| 29 |
|
| 30 |
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
| 31 |
|
|
|
|
|
|
|
| 32 |
$sql = "
|
| 33 |
SELECT user_id
|
| 34 |
FROM {$wpdb->usermeta}
|
| 35 |
WHERE
|
| 36 |
meta_key = '_wpsc_last_active'
|
| 37 |
AND meta_value < UNIX_TIMESTAMP() - " . WPSC_CUSTOMER_DATA_EXPIRATION . "
|
|
|
|
| 38 |
";
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
}
|
| 3 |
add_action( 'wpsc_hourly_cron_task', '_wpsc_clear_customer_meta' );
|
| 4 |
|
| 5 |
/**
|
| 6 |
+
* Clears the stock claims, runs on hourly WP_Cron event and when editing purchase log statuses.
|
| 7 |
+
*
|
| 8 |
+
* @since 3.8.9
|
| 9 |
+
* @access public
|
| 10 |
+
*
|
| 11 |
+
* @return void
|
| 12 |
*/
|
| 13 |
function wpsc_clear_stock_claims() {
|
| 14 |
global $wpdb;
|
| 15 |
|
| 16 |
+
$time = (float) get_option( 'wpsc_stock_keeping_time', 1 );
|
| 17 |
$interval = get_option( 'wpsc_stock_keeping_interval', 'day' );
|
| 18 |
|
| 19 |
// we need to convert into seconds because we're allowing decimal intervals like 1.5 days
|
| 23 |
'week' => 604800,
|
| 24 |
);
|
| 25 |
|
| 26 |
+
$seconds = floor( $time * $convert[ $interval ] );
|
| 27 |
|
| 28 |
$sql = $wpdb->prepare( "DELETE FROM " . WPSC_TABLE_CLAIMED_STOCK . " WHERE last_activity < UTC_TIMESTAMP() - INTERVAL %d SECOND", $seconds );
|
| 29 |
$wpdb->query( $sql );
|
| 30 |
}
|
| 31 |
|
| 32 |
+
/**
|
| 33 |
+
* Purges customer meta that is older than WPSC_CUSTOMER_DATA_EXPIRATION on an hourly WP_Cron event.
|
| 34 |
+
*
|
| 35 |
+
* @since 3.8.9.2
|
| 36 |
+
* @access public
|
| 37 |
+
*
|
| 38 |
+
* @return void
|
| 39 |
+
*/
|
| 40 |
function _wpsc_clear_customer_meta() {
|
| 41 |
global $wpdb;
|
| 42 |
|
| 43 |
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
| 44 |
|
| 45 |
+
$purge_count = 200;
|
| 46 |
+
|
| 47 |
$sql = "
|
| 48 |
SELECT user_id
|
| 49 |
FROM {$wpdb->usermeta}
|
| 50 |
WHERE
|
| 51 |
meta_key = '_wpsc_last_active'
|
| 52 |
AND meta_value < UNIX_TIMESTAMP() - " . WPSC_CUSTOMER_DATA_EXPIRATION . "
|
| 53 |
+
LIMIT {$purge_count}
|
| 54 |
";
|
| 55 |
|
| 56 |
+
/* Do this in batches of 200 to avoid memory issues when there are too many anonymous users */
|
| 57 |
+
@set_time_limit( 0 ); // no time limit
|
| 58 |
+
|
| 59 |
+
do {
|
| 60 |
+
$ids = $wpdb->get_col( $sql );
|
| 61 |
+
foreach ( $ids as $id ) {
|
| 62 |
+
wp_delete_user( $id );
|
| 63 |
+
}
|
| 64 |
+
} while ( count( $ids ) == $purge_count );
|
| 65 |
}
|
wpsc-includes/customer.php
CHANGED
|
@@ -4,6 +4,9 @@ add_action( 'wpsc_set_cart_item' , '_wpsc_action_update_customer_last_ac
|
|
| 4 |
add_action( 'wpsc_add_item' , '_wpsc_action_update_customer_last_active' );
|
| 5 |
add_action( 'wpsc_before_submit_checkout', '_wpsc_action_update_customer_last_active' );
|
| 6 |
add_action( 'wp_login' , '_wpsc_action_setup_customer' );
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
/**
|
| 9 |
* Helper function for setting the customer cookie content and expiration
|
|
@@ -123,8 +126,10 @@ function _wpsc_create_customer_id_cookie( $id, $fake_it = false ) {
|
|
| 123 |
* @return mixed Return the customer ID if the cookie is valid, false if otherwise.
|
| 124 |
*/
|
| 125 |
function _wpsc_validate_customer_cookie() {
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
| 128 |
|
| 129 |
$cookie = $_COOKIE[ WPSC_CUSTOMER_COOKIE ];
|
| 130 |
list( $id, $expire, $hash ) = $x = explode( '|', $cookie );
|
|
@@ -133,22 +138,25 @@ function _wpsc_validate_customer_cookie() {
|
|
| 133 |
$id = intval( $id );
|
| 134 |
|
| 135 |
// invalid ID
|
| 136 |
-
if ( ! $id )
|
| 137 |
return false;
|
|
|
|
| 138 |
|
| 139 |
$user = get_user_by( 'id', $id );
|
| 140 |
|
| 141 |
// no user found
|
| 142 |
-
if ( $user === false )
|
| 143 |
return false;
|
|
|
|
| 144 |
|
| 145 |
$pass_frag = substr( $user->user_pass, 8, 4 );
|
| 146 |
$key = wp_hash( $user->user_login . $pass_frag . '|' . $expire );
|
| 147 |
$hmac = hash_hmac( 'md5', $data, $key );
|
| 148 |
|
| 149 |
// integrity check
|
| 150 |
-
if ( $hmac == $hash )
|
| 151 |
return $id;
|
|
|
|
| 152 |
|
| 153 |
_wpsc_set_customer_cookie( '', time() - 3600 );
|
| 154 |
return false;
|
|
@@ -192,12 +200,20 @@ function wpsc_get_current_customer_id() {
|
|
| 192 |
* @since 3.8.13
|
| 193 |
*/
|
| 194 |
function _wpsc_action_setup_customer() {
|
| 195 |
-
// if the user is logged in and the cookie is still there, delete the cookie
|
| 196 |
-
if ( is_user_logged_in() && isset( $_COOKIE[WPSC_CUSTOMER_COOKIE] ) )
|
| 197 |
-
_wpsc_set_customer_cookie( '', time() - 3600 );
|
| 198 |
-
|
| 199 |
// if the customer cookie is invalid, unset it
|
| 200 |
-
_wpsc_validate_customer_cookie();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
// if this request is by a bot, prevent multiple account creation
|
| 203 |
_wpsc_maybe_setup_bot_user();
|
|
@@ -211,6 +227,64 @@ function _wpsc_action_setup_customer() {
|
|
| 211 |
do_action( 'wpsc_setup_customer' );
|
| 212 |
}
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
/**
|
| 215 |
* Return the internal customer meta key, which depends on the blog prefix
|
| 216 |
* if this is a multi-site installation.
|
|
@@ -474,4 +548,104 @@ function _wpsc_is_bot_user() {
|
|
| 474 |
|
| 475 |
// at this point we have eliminated all but the most obvious choice, a human (or cylon?)
|
| 476 |
return false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 477 |
}
|
| 4 |
add_action( 'wpsc_add_item' , '_wpsc_action_update_customer_last_active' );
|
| 5 |
add_action( 'wpsc_before_submit_checkout', '_wpsc_action_update_customer_last_active' );
|
| 6 |
add_action( 'wp_login' , '_wpsc_action_setup_customer' );
|
| 7 |
+
add_action( 'load-users.php' , '_wpsc_action_load_users' );
|
| 8 |
+
add_filter( 'views_users' , '_wpsc_filter_views_users' );
|
| 9 |
+
add_filter( 'editable_roles' , '_wpsc_filter_editable_roles' );
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Helper function for setting the customer cookie content and expiration
|
| 126 |
* @return mixed Return the customer ID if the cookie is valid, false if otherwise.
|
| 127 |
*/
|
| 128 |
function _wpsc_validate_customer_cookie() {
|
| 129 |
+
|
| 130 |
+
if ( is_admin() || ! isset( $_COOKIE[ WPSC_CUSTOMER_COOKIE ] ) ) {
|
| 131 |
+
return false;
|
| 132 |
+
}
|
| 133 |
|
| 134 |
$cookie = $_COOKIE[ WPSC_CUSTOMER_COOKIE ];
|
| 135 |
list( $id, $expire, $hash ) = $x = explode( '|', $cookie );
|
| 138 |
$id = intval( $id );
|
| 139 |
|
| 140 |
// invalid ID
|
| 141 |
+
if ( ! $id ) {
|
| 142 |
return false;
|
| 143 |
+
}
|
| 144 |
|
| 145 |
$user = get_user_by( 'id', $id );
|
| 146 |
|
| 147 |
// no user found
|
| 148 |
+
if ( $user === false ) {
|
| 149 |
return false;
|
| 150 |
+
}
|
| 151 |
|
| 152 |
$pass_frag = substr( $user->user_pass, 8, 4 );
|
| 153 |
$key = wp_hash( $user->user_login . $pass_frag . '|' . $expire );
|
| 154 |
$hmac = hash_hmac( 'md5', $data, $key );
|
| 155 |
|
| 156 |
// integrity check
|
| 157 |
+
if ( $hmac == $hash ) {
|
| 158 |
return $id;
|
| 159 |
+
}
|
| 160 |
|
| 161 |
_wpsc_set_customer_cookie( '', time() - 3600 );
|
| 162 |
return false;
|
| 200 |
* @since 3.8.13
|
| 201 |
*/
|
| 202 |
function _wpsc_action_setup_customer() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
// if the customer cookie is invalid, unset it
|
| 204 |
+
$id = _wpsc_validate_customer_cookie();
|
| 205 |
+
|
| 206 |
+
// if a valid ID is present in the cookie, and the user is logged in,
|
| 207 |
+
// it's time to merge the carts
|
| 208 |
+
if ( isset( $_COOKIE[WPSC_CUSTOMER_COOKIE] ) && is_user_logged_in() ) {
|
| 209 |
+
// merging cart requires the taxonomies to have been initialized
|
| 210 |
+
if ( did_action( 'wpsc_register_taxonomies_after' ) ) {
|
| 211 |
+
_wpsc_merge_cart();
|
| 212 |
+
}
|
| 213 |
+
else {
|
| 214 |
+
add_action( 'wpsc_register_taxonomies_after', '_wpsc_merge_cart', 1 );
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
|
| 218 |
// if this request is by a bot, prevent multiple account creation
|
| 219 |
_wpsc_maybe_setup_bot_user();
|
| 227 |
do_action( 'wpsc_setup_customer' );
|
| 228 |
}
|
| 229 |
|
| 230 |
+
function _wpsc_merge_cart() {
|
| 231 |
+
$old_id = _wpsc_validate_customer_cookie();
|
| 232 |
+
|
| 233 |
+
if ( ! $old_id ) {
|
| 234 |
+
return;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
$new_id = get_current_user_id();
|
| 238 |
+
|
| 239 |
+
$old_cart = wpsc_get_customer_cart( $old_id );
|
| 240 |
+
$items = $old_cart->get_items();
|
| 241 |
+
|
| 242 |
+
$new_cart = wpsc_get_customer_cart( $new_id );
|
| 243 |
+
|
| 244 |
+
// first of all empty the old cart so that the claimed stock and related
|
| 245 |
+
// hooks are released
|
| 246 |
+
$old_cart->empty_cart();
|
| 247 |
+
|
| 248 |
+
// add each item to the new cart
|
| 249 |
+
foreach ( $items as $item ) {
|
| 250 |
+
$new_cart->set_item( $item->product_id, array(
|
| 251 |
+
'quantity' => $item->quantity,
|
| 252 |
+
'variation_values' => $item->variation_values,
|
| 253 |
+
'custom_message' => $item->custom_message,
|
| 254 |
+
'provided_price' => $item->provided_price,
|
| 255 |
+
'time_requested' => $item->time_requested,
|
| 256 |
+
'custom_file' => $item->custom_file,
|
| 257 |
+
'is_customisable' => $item->is_customisable,
|
| 258 |
+
'meta' => $item->meta
|
| 259 |
+
) );
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
require_once( ABSPATH . 'wp-admin/includes/user.php' );
|
| 263 |
+
wp_delete_user( $old_id );
|
| 264 |
+
|
| 265 |
+
_wpsc_set_customer_cookie( '', time() - 3600 );
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
function wpsc_get_customer_cart( $id = false ) {
|
| 269 |
+
global $wpsc_cart;
|
| 270 |
+
|
| 271 |
+
if ( ! empty( $wpsc_cart ) && ( ! $id || $id == wpsc_get_current_customer_id() ) )
|
| 272 |
+
return $wpsc_cart;
|
| 273 |
+
|
| 274 |
+
$cart = maybe_unserialize( base64_decode( wpsc_get_customer_meta( 'cart', $id ) ) );
|
| 275 |
+
if ( empty( $cart ) || ! $cart instanceof wpsc_cart )
|
| 276 |
+
$cart = new wpsc_cart();
|
| 277 |
+
|
| 278 |
+
return $cart;
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
function wpsc_update_customer_cart( $cart, $id = false ) {
|
| 282 |
+
if ( ! $id || $id == wpsc_get_current_customer_id() )
|
| 283 |
+
return wpsc_serialize_shopping_cart();
|
| 284 |
+
|
| 285 |
+
return wpsc_update_customer_meta( 'cart', base64_encode( serialize( $wpsc_cart ) ), $id );
|
| 286 |
+
}
|
| 287 |
+
|
| 288 |
/**
|
| 289 |
* Return the internal customer meta key, which depends on the blog prefix
|
| 290 |
* if this is a multi-site installation.
|
| 548 |
|
| 549 |
// at this point we have eliminated all but the most obvious choice, a human (or cylon?)
|
| 550 |
return false;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
/**
|
| 554 |
+
* Given a users.php view's HTML code, this function returns the user count displayed
|
| 555 |
+
* in the view.
|
| 556 |
+
*
|
| 557 |
+
* If `count_users()` had implented caching, we could have just called that function again
|
| 558 |
+
* instead of using this hack.
|
| 559 |
+
*
|
| 560 |
+
* @access private
|
| 561 |
+
* @since 3.8.13.2
|
| 562 |
+
* @param string $view
|
| 563 |
+
* @return int
|
| 564 |
+
*/
|
| 565 |
+
function _wpsc_extract_user_count( $view ) {
|
| 566 |
+
if ( preg_match( '/class="count">\((\d+)\)/', $view, $matches ) ) {
|
| 567 |
+
return absint( $matches[1] );
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
return 0;
|
| 571 |
+
}
|
| 572 |
+
|
| 573 |
+
/**
|
| 574 |
+
* Filter the user views so that Anonymous role is not displayed
|
| 575 |
+
*
|
| 576 |
+
* @since 3.8.13.2
|
| 577 |
+
* @access private
|
| 578 |
+
* @param array $views
|
| 579 |
+
* @return array
|
| 580 |
+
*/
|
| 581 |
+
function _wpsc_filter_views_users( $views ) {
|
| 582 |
+
if ( isset( $views['wpsc_anonymous'] ) ) {
|
| 583 |
+
// ugly hack to make the anonymous users not count towards "All"
|
| 584 |
+
// really wish WordPress had a filter in count_users(), but in the mean time
|
| 585 |
+
// this will do
|
| 586 |
+
$anon_count = _wpsc_extract_user_count( $views['wpsc_anonymous'] );
|
| 587 |
+
$all_count = _wpsc_extract_user_count( $views['all'] );
|
| 588 |
+
$new_count = $all_count - $anon_count;
|
| 589 |
+
$views['all'] = str_replace( "(${all_count})", "(${new_count})", $views['all'] );
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
unset( $views['wpsc_anonymous'] );
|
| 593 |
+
return $views;
|
| 594 |
+
}
|
| 595 |
+
|
| 596 |
+
/**
|
| 597 |
+
* Add the action necessary to filter out anonymous users
|
| 598 |
+
*
|
| 599 |
+
* @since 3.8.13.2
|
| 600 |
+
* @access private
|
| 601 |
+
*/
|
| 602 |
+
function _wpsc_action_load_users() {
|
| 603 |
+
add_action( 'pre_user_query', '_wpsc_action_pre_user_query', 10, 1 );
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
/**
|
| 607 |
+
* Filter out anonymous users in "All" view
|
| 608 |
+
*
|
| 609 |
+
* @since 3.8.13.2
|
| 610 |
+
* @access private
|
| 611 |
+
* @param WP_User_Query $query
|
| 612 |
+
*/
|
| 613 |
+
function _wpsc_action_pre_user_query( $query ) {
|
| 614 |
+
global $wpdb;
|
| 615 |
+
|
| 616 |
+
// only do this when we're viewing all users
|
| 617 |
+
if ( ! empty( $query->query_vars['role'] ) )
|
| 618 |
+
return;
|
| 619 |
+
|
| 620 |
+
// if the site is multisite, a JOIN is already done
|
| 621 |
+
if ( is_multisite() ) {
|
| 622 |
+
$query->query_where .= " AND CAST($wpdb->usermeta.meta_value AS CHAR) NOT LIKE '%" . like_escape( '"wpsc_anonymous"' ) . "%'";
|
| 623 |
+
return;
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
$cap_meta_query = array(
|
| 627 |
+
array(
|
| 628 |
+
'key' => $wpdb->get_blog_prefix( $query->query_vars['blog_id'] ) . 'capabilities',
|
| 629 |
+
'value' => '"wpsc_anonymous"',
|
| 630 |
+
'compare' => 'not like',
|
| 631 |
+
)
|
| 632 |
+
);
|
| 633 |
+
|
| 634 |
+
$meta_query = new WP_Meta_Query( $cap_meta_query );
|
| 635 |
+
$clauses = $meta_query->get_sql( 'user', $wpdb->users, 'ID', $query );
|
| 636 |
+
|
| 637 |
+
$query->query_from .= $clauses['join'];
|
| 638 |
+
$query->query_where .= $clauses['where'];
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
/**
|
| 642 |
+
* Make sure Anonymous role not editable
|
| 643 |
+
*
|
| 644 |
+
* @since 3.8.13.2
|
| 645 |
+
* @param array $editable_roles
|
| 646 |
+
* @return array
|
| 647 |
+
*/
|
| 648 |
+
function _wpsc_filter_editable_roles( $editable_roles ) {
|
| 649 |
+
unset( $editable_roles['wpsc_anonymous'] );
|
| 650 |
+
return $editable_roles;
|
| 651 |
}
|
wpsc-includes/misc.functions.php
CHANGED
|
@@ -909,24 +909,4 @@ function wpsc_get_ajax_spinner() {
|
|
| 909 |
}
|
| 910 |
|
| 911 |
return apply_filters( 'wpsc_get_ajax_spinner', $url );
|
| 912 |
-
}
|
| 913 |
-
|
| 914 |
-
function _wpsc_remove_erroneous_files() {
|
| 915 |
-
$files = array(
|
| 916 |
-
WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/.htaccess',
|
| 917 |
-
WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/error_log',
|
| 918 |
-
WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/functions.php',
|
| 919 |
-
WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/admin-functions.php',
|
| 920 |
-
WPSC_FILE_PATH . '/wpsc-components/marketplace-core-v1/library/Sputnik/advanced-cache.php'
|
| 921 |
-
);
|
| 922 |
-
|
| 923 |
-
foreach ( $files as $file ) {
|
| 924 |
-
@unlink( $file );
|
| 925 |
-
}
|
| 926 |
-
|
| 927 |
-
update_option( 'wpsc_38131_file_check', false );
|
| 928 |
-
}
|
| 929 |
-
|
| 930 |
-
if ( get_option( 'wpsc_38131_file_check', true ) ) {
|
| 931 |
-
add_action( 'admin_init', '_wpsc_remove_erroneous_files' );
|
| 932 |
}
|
| 909 |
}
|
| 910 |
|
| 911 |
return apply_filters( 'wpsc_get_ajax_spinner', $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 912 |
}
|
wpsc-includes/page-about.php
DELETED
|
@@ -1,136 +0,0 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/**
|
| 3 |
-
* The template for displaying the About page.
|
| 4 |
-
*
|
| 5 |
-
* @package WordPress
|
| 6 |
-
* @subpackage Twenty_Eleven
|
| 7 |
-
* @since Twenty Eleven 1.0
|
| 8 |
-
*/
|
| 9 |
-
|
| 10 |
-
get_header(); ?>
|
| 11 |
-
|
| 12 |
-
<div class="row-fluid aboutBG our-goal"></div>
|
| 13 |
-
<div class="container">
|
| 14 |
-
<div class="row-fluid" id="aboutUs">
|
| 15 |
-
<div class="header span12">
|
| 16 |
-
<h4><span class="show">Licensing. Production & Development. Distribution. Marketing & Publicity. Digital & Social Media. Creative Services.</span><span class="hide">Saban Brands</span></h4>
|
| 17 |
-
</div>
|
| 18 |
-
<div class="row-fluid">
|
| 19 |
-
<div class="span2">
|
| 20 |
-
<ul class="nav nav-pills nav-stacked ">
|
| 21 |
-
<li class="active"><a href="#">Saban Brands</a></li>
|
| 22 |
-
<li><a href="#">Power Rangers emPOWER</a></li>
|
| 23 |
-
<li><a href="#">Paul Frank Arts</a></li>
|
| 24 |
-
</ul>
|
| 25 |
-
</div>
|
| 26 |
-
<script>
|
| 27 |
-
jQuery( document ).ready(function( $ ) {
|
| 28 |
-
|
| 29 |
-
$( 'div.about-section' ).not( ':first' ).hide();
|
| 30 |
-
|
| 31 |
-
var show_about_tabs = function( e ) {
|
| 32 |
-
var $this, $parent, $index, $_index, $_hash;
|
| 33 |
-
|
| 34 |
-
if ( e && $( this ).parents( 'ul' ).hasClass( 'nav-stacked' ) ) {
|
| 35 |
-
|
| 36 |
-
e.preventDefault();
|
| 37 |
-
$this = $( this );
|
| 38 |
-
|
| 39 |
-
} else if ( window.location.hash ) {
|
| 40 |
-
|
| 41 |
-
if ( e ) {
|
| 42 |
-
$_hash = $( this ).prop( 'hash' );
|
| 43 |
-
} else {
|
| 44 |
-
$_hash = window.location.hash;
|
| 45 |
-
}
|
| 46 |
-
|
| 47 |
-
$_index = $( '.about-section.' + $_hash.substring(1) ).index();
|
| 48 |
-
$this = $( '.nav-stacked li' ).eq( $_index ).find( 'a' );
|
| 49 |
-
}
|
| 50 |
-
|
| 51 |
-
$parent = $this.parent(), $index = $parent.index();
|
| 52 |
-
|
| 53 |
-
$( '.nav-stacked li' ).removeClass( 'active' );
|
| 54 |
-
|
| 55 |
-
$parent.addClass( 'active' );
|
| 56 |
-
|
| 57 |
-
$( '.about-section' ).hide();
|
| 58 |
-
$( '.about-section' ).eq( $index ).show();
|
| 59 |
-
|
| 60 |
-
$( '.aboutBG' ).removeClass().addClass( 'row-fluid aboutBG ' + $( '.about-section' ).eq( $index ).attr( 'class' ).split(' ')[1] );
|
| 61 |
-
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
if ( $( 'body' ).hasClass( 'page-id-2' ) ) {
|
| 65 |
-
$( 'li.first-menu-item ul.dropdown-menu a' ).click( show_about_tabs );
|
| 66 |
-
}
|
| 67 |
-
|
| 68 |
-
if ( window.location.hash ) {
|
| 69 |
-
show_about_tabs();
|
| 70 |
-
}
|
| 71 |
-
|
| 72 |
-
$( '.nav-stacked li a' ).click( show_about_tabs );
|
| 73 |
-
|
| 74 |
-
});
|
| 75 |
-
</script>
|
| 76 |
-
<?php while ( have_posts() ) : the_post(); ?>
|
| 77 |
-
<div class="span10" id="description">
|
| 78 |
-
<?php
|
| 79 |
-
the_content();
|
| 80 |
-
?>
|
| 81 |
-
</div>
|
| 82 |
-
<?php endwhile; // end of the loop. ?>
|
| 83 |
-
<div class="clearfix"></div>
|
| 84 |
-
</div>
|
| 85 |
-
</div>
|
| 86 |
-
<ul class="thumbnails">
|
| 87 |
-
<?php
|
| 88 |
-
$logo_src = isset( $brand_meta['brand-logo_url'] ) ? $brand_meta['brand-logo_url'] : '';
|
| 89 |
-
|
| 90 |
-
$latest_posts = get_posts( array( 'numberposts' => 3, 'brands' => 'saban-brands', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'value' => '', 'compare' => '!=' ) ) ) );
|
| 91 |
-
foreach ( $latest_posts as $latest_post ) :
|
| 92 |
-
?>
|
| 93 |
-
<li class="span4">
|
| 94 |
-
<div class="thumbnail">
|
| 95 |
-
<?php
|
| 96 |
-
if ( has_post_thumbnail( $latest_post->ID ) )
|
| 97 |
-
echo get_the_post_thumbnail( $latest_post->ID, 'home-page-news' );
|
| 98 |
-
|
| 99 |
-
$link = get_permalink( $latest_post->ID );
|
| 100 |
-
|
| 101 |
-
if ( in_category( 'press', $latest_post->ID ) ) {
|
| 102 |
-
$pdfs = get_posts( array( 'post_parent' => $latest_post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'application/pdf', 'numberposts' => 1 ) );
|
| 103 |
-
$pdf = wp_get_attachment_url( $pdfs[0]->ID );
|
| 104 |
-
|
| 105 |
-
$link = $pdf ? $pdf : $link;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
?>
|
| 109 |
-
<div class="copy">
|
| 110 |
-
<h3><?php echo get_the_title( $latest_post->ID ); ?></h3>
|
| 111 |
-
<p><?php echo wp_trim_words( $latest_post->post_content, 16 ); ?></p>
|
| 112 |
-
<a class="btn" href="<?php echo esc_url( $link ); ?>">read Article</a></div>
|
| 113 |
-
</div>
|
| 114 |
-
</li>
|
| 115 |
-
<?php endforeach; ?>
|
| 116 |
-
|
| 117 |
-
</ul><p></p>
|
| 118 |
-
|
| 119 |
-
<!--We Love it Here Row-->
|
| 120 |
-
|
| 121 |
-
<div class="row-fluid" id="weLoveItHere">
|
| 122 |
-
<div class="header span12">
|
| 123 |
-
<h4>We Love it Here</h4>
|
| 124 |
-
</div>
|
| 125 |
-
|
| 126 |
-
<?php
|
| 127 |
-
if ( is_active_sidebar( 'footer-content' ) ) :
|
| 128 |
-
dynamic_sidebar( 'footer-content' );
|
| 129 |
-
endif;
|
| 130 |
-
?>
|
| 131 |
-
</div>
|
| 132 |
-
|
| 133 |
-
<!--End We Love it Here Row-->
|
| 134 |
-
</div>
|
| 135 |
-
|
| 136 |
-
<?php get_footer(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wpsc-includes/wpsc-meta-init.php
CHANGED
|
@@ -122,7 +122,7 @@ function wpsc_meta_migrate( $meta_object_type ) {
|
|
| 122 |
|
| 123 |
foreach ( $old_meta_rows as $old_meta_row ) {
|
| 124 |
$meta_data = maybe_unserialize( $old_meta_row->meta_value );
|
| 125 |
-
add_metadata( $meta_object_type, $old_meta_row->object_id, $old_meta_row->meta_key, $meta_data, false );
|
| 126 |
}
|
| 127 |
}
|
| 128 |
|
| 122 |
|
| 123 |
foreach ( $old_meta_rows as $old_meta_row ) {
|
| 124 |
$meta_data = maybe_unserialize( $old_meta_row->meta_value );
|
| 125 |
+
add_metadata( 'wpsc_' . $meta_object_type, $old_meta_row->object_id, $old_meta_row->meta_key, $meta_data, false );
|
| 126 |
}
|
| 127 |
}
|
| 128 |
|
