WP_Session::get_instance PHP Method

get_instance() public static method

Retrieve the current session instance.
public static get_instance ( ) : boolean | WP_Session
return boolean | WP_Session
    public static function get_instance()
    {
        if (!self::$instance) {
            self::$instance = new self();
        }
        return self::$instance;
    }

Usage Example

コード例 #1
1
 /**
  * Setup the WP_Session instance
  *
  * @access public
  * @since 1.5
  * @return void
  */
 public function init()
 {
     if ($this->use_php_sessions) {
         $this->session = isset($_SESSION['clef']) && is_array($_SESSION['clef']) ? $_SESSION['clef'] : array();
     } else {
         $this->session = WP_Session::get_instance();
     }
     return $this->session;
 }
All Usage Examples Of WP_Session::get_instance