public/wordpress/wp-content/plugins/wp-courseware/includes/core/session.php
/**
	 * Register Sessions.
	 *
	 * Only registers on the frontend of the site.
	 *
	 * @since 4.3.0
	 */
Register Sessions.
Only registers on the frontend of the site.


Register Sessions . Only registers on the frontend of the site .
public function register_sessions() {
		if ( ! wpcw_is_request( 'frontend' ) && ! wpcw_is_request( 'ajax' ) ) {
			return;
		}
		$cookie = $this->get_session_cookie();
		if ( $cookie ) {
			$this->_student_id         = $cookie[0];
			$this->_session_expiration = $cookie[1];
			$this->_session_expiring   = $cookie[2];
			$this->_has_cookie         = true;
			if ( time() > $this->_session_expiring ) {
				$this->set_session_expiration();
				$this->update_session_timestamp( $this->_student_id, $this->_session_expiration );
			}
		} else {
			$this->set_session_expiration();
			$this->_student_id = $this->generate_student_id();
		}
		$this->_data = $this->get_session_data();
		add_action( 'wpcw_set_cart_cookies', array( $this, 'set_student_session_cookie' ), 10 );
		add_action( 'shutdown', array( $this, 'save_data' ), 20 );
		add_action( 'wp_logout', array( $this, 'destroy_session' ) );
		if ( ! is_user_logged_in() ) {
			add_filter( 'nonce_user_logged_out', array( $this, 'nonce_user_logged_out' ) );
		}
	}
public function register_sessions ( ) { if ( ! wpcw_is_request ( 'frontend' ) && ! wpcw_is_request ( 'ajax' ) ) { return ; } $ cookie = $ this -> get_session_cookie ( ) ; if ( $ cookie ) { $ this -> _student_id = $ cookie [ 0 ] ; $ this -> _session_expiration = $ cookie [ 1 ] ; $ this -> _session_expiring = $ cookie [ 2 ] ; $ this -> _has_cookie = true ; if ( time ( ) > $ this -> _session_expiring ) { $ this -> set_session_expiration ( ) ; $ this -> update_session_timestamp ( $ this -> _student_id , $ this -> _session_expiration ) ; } } else { $ this -> set_session_expiration ( ) ; $ this -> _student_id = $ this -> generate_student_id ( ) ; } $ this -> _data = $ this -> get_session_data ( ) ; add_action ( 'wpcw_set_cart_cookies' , array ( $ this , 'set_student_session_cookie' ) , 10 ) ; add_action ( 'shutdown' , array ( $ this , 'save_data' ) , 20 ) ; add_action ( 'wp_logout' , array ( $ this , 'destroy_session' ) ) ; if ( ! is_user_logged_in ( ) ) { add_filter ( 'nonce_user_logged_out' , array ( $ this , 'nonce_user_logged_out' ) ) ; } }
Register Sessions.
Register Sessions .