WC_Session_Handler::is_session_cookie_valid()
Checks if session cookie is expired, or belongs to a logged out user.
Метод класса: WC_Session_Handler{}
Хуков нет.
Возвращает
true|false
. Whether session cookie is valid.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_session_cookie_valid();
Код WC_Session_Handler::is_session_cookie_valid() WC Session Handler::is session cookie valid WC 9.3.3
private function is_session_cookie_valid() { // If session is expired, session cookie is invalid. if ( time() > $this->_session_expiration ) { return false; } // If user has logged out, session cookie is invalid. if ( ! is_user_logged_in() && ! $this->is_customer_guest( $this->_customer_id ) ) { return false; } // Session from a different user is not valid. (Although from a guest user will be valid). if ( is_user_logged_in() && ! $this->is_customer_guest( $this->_customer_id ) && strval( get_current_user_id() ) !== $this->_customer_id ) { return false; } return true; }