Пример #1
0
 function __construct()
 {
     parent::__construct();
     if (!defined('HMA_SSO_FACEBOOK_APP_ID') || !defined('HMA_SSO_FACEBOOK_APPLICATION_SECRET')) {
         throw new Exception('constants-not-defined');
         return new WP_Error('constants-not-defined');
     }
     $this->id = 'facebook';
     $this->name = 'Facebook';
     $this->app_id = HMA_SSO_FACEBOOK_APP_ID;
     $this->application_secret = HMA_SSO_FACEBOOK_APPLICATION_SECRET;
     $this->facebook_uid = null;
     $this->supports_publishing = true;
     $this->set_user(wp_get_current_user());
     require_once 'facebook-sdk/src/facebook.php';
     $this->client = new Facebook(array('appId' => $this->app_id, 'secret' => $this->application_secret, 'cookie' => true));
     $this->avatar_option = new HMA_Facebook_Avatar_Option(&$this);
 }
Пример #2
0
 function __construct()
 {
     if (!defined('HMA_SSO_TWITTER_API_KEY') || !defined('HMA_SSO_TWITTER_CONSUMER_SECRET')) {
         return new WP_Error('constants-not-defined');
     }
     require_once 'twitterauth/config.php';
     require_once 'twitterauth/twitteroauth/twitteroauth.php';
     parent::__construct();
     $this->id = 'twitter';
     $this->name = 'Twitter';
     $this->api_key = HMA_SSO_TWITTER_API_KEY;
     $this->consumer_secret = HMA_SSO_TWITTER_CONSUMER_SECRET;
     $this->sign_in_client = null;
     $this->supports_publishing = true;
     $this->set_user(wp_get_current_user());
     $this->usingSession = true;
     if (!isset($_SESSION)) {
         session_start();
     }
     $this->avatar_option = new HMA_Twitter_Avatar_Option(&$this);
 }