Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class bd_http_https_auth {
- /**
- * @var bd_http_https_auth - Static property to hold our singleton instance
- */
- static $instance = false;
- private $_second_auth = false;
- private function __construct() {
- add_action( 'set_auth_cookie', array( $this, 'auth_again' ), null, 5 );
- }
- public function auth_again( $auth_cookie, $expire, $expiration, $user_id, $scheme ) {
- if ( !$this->_second_auth ) {
- $this->_second_auth = true;
- wp_set_auth_cookie( $user_id, (bool) $expire, (bool) ( $scheme == 'auth' ) );
- $this->_second_auth = false;
- }
- }
- /**
- * Function to instantiate our class and make it a singleton
- */
- public static function getInstance() {
- if ( !self::$instance ) {
- self::$instance = new self;
- }
- return self::$instance;
- }
- }
- $bd_http_https_auth = bd_http_https_auth::getInstance();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement