Initial commit
This commit is contained in:
		
							
								
								
									
										26
									
								
								OAuth.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								OAuth.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace phpoauthlib2;
 | 
			
		||||
 | 
			
		||||
class OAuth {
 | 
			
		||||
    protected $oauthProvider = null;
 | 
			
		||||
    protected $request = null;
 | 
			
		||||
 | 
			
		||||
    public function __construct($provider, $request) {
 | 
			
		||||
        $this->oauthProvider = $provider;
 | 
			
		||||
        $this->request = $request;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function check() {
 | 
			
		||||
        if (isset($this->request["code"]) && !empty($this->request["code"])) {
 | 
			
		||||
            $this->oauthProvider->getProfile();
 | 
			
		||||
            return true;
 | 
			
		||||
        } else {
 | 
			
		||||
            return $this->oauthProvider->getLoginUrl();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getProfile() {
 | 
			
		||||
        return $this->oauthProvider->getProfile();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user