Cloud computing platform
Révision | 5f8cf3b0fe42591296867e04e340d33ef8c3bf8d (tree) |
---|---|
l'heure | 2017-11-10 14:11:04 |
Auteur | naoki hirata <naoki@magi...> |
Commiter | naoki hirata |
Eコマース機能更新。
@@ -18,19 +18,19 @@ if ( ! defined( 'ABSPATH' ) ) { | ||
18 | 18 | class WC_Session_Handler extends WC_Session { |
19 | 19 | |
20 | 20 | /** @var string cookie name */ |
21 | - private $_cookie; | |
21 | +// private $_cookie; | |
22 | 22 | |
23 | 23 | /** @var string session due to expire timestamp */ |
24 | - private $_session_expiring; | |
24 | +// private $_session_expiring; | |
25 | 25 | |
26 | 26 | /** @var string session expiration timestamp */ |
27 | - private $_session_expiration; | |
27 | +// private $_session_expiration; | |
28 | 28 | |
29 | 29 | /** $var bool Bool based on whether a cookie exists **/ |
30 | - private $_has_cookie = false; | |
30 | +// private $_has_cookie = false; | |
31 | 31 | |
32 | 32 | /** @var string Custom session table name */ |
33 | - private $_table; | |
33 | +// private $_table; | |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Constructor for the session class. |
@@ -38,10 +38,10 @@ class WC_Session_Handler extends WC_Session { | ||
38 | 38 | public function __construct() { |
39 | 39 | // global $wpdb; |
40 | 40 | |
41 | - $this->_cookie = apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ); | |
41 | +// $this->_cookie = apply_filters( 'woocommerce_cookie', 'wp_woocommerce_session_' . COOKIEHASH ); | |
42 | 42 | // $this->_table = $wpdb->prefix . 'woocommerce_sessions'; |
43 | 43 | |
44 | - if ( $cookie = $this->get_session_cookie() ) { | |
44 | +/* if ( $cookie = $this->get_session_cookie() ) { | |
45 | 45 | $this->_customer_id = $cookie[0]; |
46 | 46 | $this->_session_expiration = $cookie[1]; |
47 | 47 | $this->_session_expiring = $cookie[2]; |
@@ -55,7 +55,7 @@ class WC_Session_Handler extends WC_Session { | ||
55 | 55 | } else { |
56 | 56 | $this->set_session_expiration(); |
57 | 57 | $this->_customer_id = $this->generate_customer_id(); |
58 | - } | |
58 | + }*/ | |
59 | 59 | |
60 | 60 | // セッションからデータ読み込み |
61 | 61 | //$this->_data = $this->get_session_data(); |
@@ -64,13 +64,13 @@ class WC_Session_Handler extends WC_Session { | ||
64 | 64 | $this->_data = isset($sessionObj) ? $sessionObj : array(); |
65 | 65 | |
66 | 66 | // Actions |
67 | - add_action( 'woocommerce_set_cart_cookies', array( $this, 'set_customer_session_cookie' ), 10 ); | |
68 | - add_action( 'woocommerce_cleanup_sessions', array( $this, 'cleanup_sessions' ), 10 ); | |
67 | +// add_action( 'woocommerce_set_cart_cookies', array( $this, 'set_customer_session_cookie' ), 10 ); | |
68 | +// add_action( 'woocommerce_cleanup_sessions', array( $this, 'cleanup_sessions' ), 10 ); | |
69 | 69 | // add_action( 'shutdown', array( $this, 'save_data' ), 20 ); |
70 | - add_action( 'wp_logout', array( $this, 'destroy_session' ) ); | |
70 | +/* add_action( 'wp_logout', array( $this, 'destroy_session' ) ); | |
71 | 71 | if ( ! is_user_logged_in() ) { |
72 | 72 | add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ) ); |
73 | - } | |
73 | + }*/ | |
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -82,7 +82,7 @@ class WC_Session_Handler extends WC_Session { | ||
82 | 82 | * |
83 | 83 | * @param bool $set |
84 | 84 | */ |
85 | - public function set_customer_session_cookie( $set ) { | |
85 | +/* public function set_customer_session_cookie( $set ) { | |
86 | 86 | if ( $set ) { |
87 | 87 | // Set/renew our cookie |
88 | 88 | $to_hash = $this->_customer_id . '|' . $this->_session_expiration; |
@@ -93,24 +93,24 @@ class WC_Session_Handler extends WC_Session { | ||
93 | 93 | // Set the cookie |
94 | 94 | wc_setcookie( $this->_cookie, $cookie_value, $this->_session_expiration, apply_filters( 'wc_session_use_secure_cookie', false ) ); |
95 | 95 | } |
96 | - } | |
96 | + }*/ | |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Return true if the current user has an active session, i.e. a cookie to retrieve values. |
100 | 100 | * |
101 | 101 | * @return bool |
102 | 102 | */ |
103 | - public function has_session() { | |
103 | +/* public function has_session() { | |
104 | 104 | return isset( $_COOKIE[ $this->_cookie ] ) || $this->_has_cookie || is_user_logged_in(); |
105 | - } | |
105 | + }*/ | |
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Set session expiration. |
109 | 109 | */ |
110 | - public function set_session_expiration() { | |
110 | +/* public function set_session_expiration() { | |
111 | 111 | $this->_session_expiring = time() + intval( apply_filters( 'wc_session_expiring', 60 * 60 * 47 ) ); // 47 Hours. |
112 | 112 | $this->_session_expiration = time() + intval( apply_filters( 'wc_session_expiration', 60 * 60 * 48 ) ); // 48 Hours. |
113 | - } | |
113 | + }*/ | |
114 | 114 | |
115 | 115 | /** |
116 | 116 | * Generate a unique customer ID for guests, or return user ID if logged in. |
@@ -119,7 +119,7 @@ class WC_Session_Handler extends WC_Session { | ||
119 | 119 | * |
120 | 120 | * @return int|string |
121 | 121 | */ |
122 | - public function generate_customer_id() { | |
122 | +/* public function generate_customer_id() { | |
123 | 123 | if ( is_user_logged_in() ) { |
124 | 124 | return get_current_user_id(); |
125 | 125 | } else { |
@@ -127,14 +127,14 @@ class WC_Session_Handler extends WC_Session { | ||
127 | 127 | $hasher = new PasswordHash( 8, false ); |
128 | 128 | return md5( $hasher->get_random_bytes( 32 ) ); |
129 | 129 | } |
130 | - } | |
130 | + }*/ | |
131 | 131 | |
132 | 132 | /** |
133 | 133 | * Get session cookie. |
134 | 134 | * |
135 | 135 | * @return bool|array |
136 | 136 | */ |
137 | - public function get_session_cookie() { | |
137 | +/* public function get_session_cookie() { | |
138 | 138 | if ( empty( $_COOKIE[ $this->_cookie ] ) || ! is_string( $_COOKIE[ $this->_cookie ] ) ) { |
139 | 139 | return false; |
140 | 140 | } |
@@ -150,7 +150,7 @@ class WC_Session_Handler extends WC_Session { | ||
150 | 150 | } |
151 | 151 | |
152 | 152 | return array( $customer_id, $session_expiration, $session_expiring, $cookie_hash ); |
153 | - } | |
153 | + }*/ | |
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Get session data. |
@@ -203,7 +203,7 @@ class WC_Session_Handler extends WC_Session { | ||
203 | 203 | /** |
204 | 204 | * Destroy all session data. |
205 | 205 | */ |
206 | - public function destroy_session() { | |
206 | +/* public function destroy_session() { | |
207 | 207 | // Clear cookie |
208 | 208 | wc_setcookie( $this->_cookie, '', time() - YEAR_IN_SECONDS, apply_filters( 'wc_session_use_secure_cookie', false ) ); |
209 | 209 |
@@ -216,7 +216,7 @@ class WC_Session_Handler extends WC_Session { | ||
216 | 216 | $this->_data = array(); |
217 | 217 | $this->_dirty = false; |
218 | 218 | $this->_customer_id = $this->generate_customer_id(); |
219 | - } | |
219 | + }*/ | |
220 | 220 | |
221 | 221 | /** |
222 | 222 | * When a user is logged out, ensure they have a unique nonce by using the customer/session ID. |
@@ -225,14 +225,14 @@ class WC_Session_Handler extends WC_Session { | ||
225 | 225 | * |
226 | 226 | * @return string |
227 | 227 | */ |
228 | - public function nonce_user_logged_out( $uid ) { | |
228 | +/* public function nonce_user_logged_out( $uid ) { | |
229 | 229 | return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid; |
230 | - } | |
230 | + }*/ | |
231 | 231 | |
232 | 232 | /** |
233 | 233 | * Cleanup sessions. |
234 | 234 | */ |
235 | - public function cleanup_sessions() { | |
235 | +/* public function cleanup_sessions() { | |
236 | 236 | global $wpdb; |
237 | 237 | |
238 | 238 | if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) { |
@@ -243,7 +243,7 @@ class WC_Session_Handler extends WC_Session { | ||
243 | 243 | // Invalidate cache |
244 | 244 | WC_Cache_Helper::incr_cache_prefix( WC_SESSION_CACHE_GROUP ); |
245 | 245 | } |
246 | - } | |
246 | + }*/ | |
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Returns the session. |
@@ -252,7 +252,7 @@ class WC_Session_Handler extends WC_Session { | ||
252 | 252 | * @param mixed $default |
253 | 253 | * @return string|array |
254 | 254 | */ |
255 | - public function get_session( $customer_id, $default = false ) { | |
255 | +/* public function get_session( $customer_id, $default = false ) { | |
256 | 256 | global $wpdb; |
257 | 257 | |
258 | 258 | if ( defined( 'WP_SETUP_CONFIG' ) ) { |
@@ -273,14 +273,14 @@ class WC_Session_Handler extends WC_Session { | ||
273 | 273 | } |
274 | 274 | |
275 | 275 | return maybe_unserialize( $value ); |
276 | - } | |
276 | + }*/ | |
277 | 277 | |
278 | 278 | /** |
279 | 279 | * Delete the session from the cache and database. |
280 | 280 | * |
281 | 281 | * @param int $customer_id |
282 | 282 | */ |
283 | - public function delete_session( $customer_id ) { | |
283 | +/* public function delete_session( $customer_id ) { | |
284 | 284 | global $wpdb; |
285 | 285 | |
286 | 286 | // wp_cache_delete( $this->get_cache_prefix() . $customer_id, WC_SESSION_CACHE_GROUP ); |
@@ -292,14 +292,14 @@ class WC_Session_Handler extends WC_Session { | ||
292 | 292 | ) |
293 | 293 | ); |
294 | 294 | } |
295 | - | |
295 | +*/ | |
296 | 296 | /** |
297 | 297 | * Update the session expiry timestamp. |
298 | 298 | * |
299 | 299 | * @param string $customer_id |
300 | 300 | * @param int $timestamp |
301 | 301 | */ |
302 | - public function update_session_timestamp( $customer_id, $timestamp ) { | |
302 | +/* public function update_session_timestamp( $customer_id, $timestamp ) { | |
303 | 303 | global $wpdb; |
304 | 304 | |
305 | 305 | $wpdb->update( |
@@ -314,7 +314,7 @@ class WC_Session_Handler extends WC_Session { | ||
314 | 314 | '%d' |
315 | 315 | ) |
316 | 316 | ); |
317 | - } | |
317 | + }*/ | |
318 | 318 | /** |
319 | 319 | * セッションオブジェクト取得(Magic3追加) |
320 | 320 | * |