private function _getScreenName($aCredentials)
 {
     /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
     $_oConnect = new FetchTweets_TwitterAPI_Verification($aCredentials['consumer_key'], $aCredentials['consumer_secret'], $aCredentials['access_token'], $aCredentials['access_secret']);
     /* Request access tokens from twitter */
     $_aResponse = $_oConnect->getStatus();
     return isset($_aResponse['screen_name']) ? $_aResponse['screen_name'] : null;
 }
 /**
  * Triggered when the manual keys are set and submitted.
  * 
  * @since       2
  * @since       2.4.5       Moved from the admin page class.
  * @remark      valiudation_{class name}_{section id}
  */
 public function replyToValidate($aInput, $aOldInput, $oFactory, $aSubmitInfo)
 {
     // Sanitize
     $aInput['consumer_key'] = trim($aInput['consumer_key']);
     $aInput['consumer_secret'] = trim($aInput['consumer_secret']);
     $aInput['access_token'] = trim($aInput['access_token']);
     $aInput['access_secret'] = trim($aInput['access_secret']);
     // Check the connection
     $_oConnect = new FetchTweets_TwitterAPI_Verification($aInput['consumer_key'], $aInput['consumer_secret'], $aInput['access_token'], $aInput['access_secret']);
     $_aStatus = $_oConnect->getStatus();
     // If it's connected, add the connection status
     if (isset($_aStatus['id_str'])) {
         $aInput['user_id'] = $_aStatus['id_str'];
         $aInput['screen_name'] = $_aStatus['screen_name'];
         $aInput['is_connected'] = true;
         $aInput['connect_method'] = 'manual';
     } else {
         $aInput['is_connected'] = false;
         $aInput['connect_method'] = 'manual';
     }
     do_action('fetch_tweets_action_updated_credentials', $aInput);
     return $aInput;
 }
 /**
  * Checks if the plugin is connected to Twitter.
  * 
  * @since            2
  */
 public function isConnected()
 {
     // The keys are manually set
     if ($this->isAuthKeysManuallySet()) {
         if (isset($this->aOptions['authentication_keys']['is_connected'])) {
             return $this->aOptions['authentication_keys']['is_connected'];
         }
         $_oConnect = new FetchTweets_TwitterAPI_Verification($this->aOptions['authentication_keys']['consumer_key'], $this->aOptions['authentication_keys']['consumer_secret'], $this->aOptions['authentication_keys']['access_token'], $this->aOptions['authentication_keys']['access_secret']);
         $_aStatus = $_oConnect->getStatus();
         return isset($_aStatus['screen_name']);
     }
     // The keys are automatically retrieved
     if (isset($this->aOptions['twitter_connect']['is_connected'])) {
         return $this->aOptions['twitter_connect']['is_connected'];
     }
     $_oConnect = new FetchTweets_TwitterAPI_Verification(FetchTweets_Commons::ConsumerKey, FetchTweets_Commons::ConsumerSecret, $this->aOptions['twitter_connect']['access_token'], $this->aOptions['twitter_connect']['access_secret']);
     $_aStatus = $_oConnect->getStatus();
     return isset($_aStatus['screen_name']);
 }
 /**
  * Checks the API credential is valid or not.
  *      
  * @since           1.3.0
  * @since           2.4.5       Moved from the admin page class.
  * @return          array       the retrieved data.
  * @remark          The returned data is a merged result of 'account/verify_credientials' and 'rate_limit_status'.
  */
 private function _getAuthenticationStatus($sConsumerKey, $sConsumerSecret, $sAccessToken, $sAccessSecret)
 {
     $_oTwitterOAuth_Verification = new FetchTweets_TwitterAPI_Verification($sConsumerKey, $sConsumerSecret, $sAccessToken, $sAccessSecret);
     return $_oTwitterOAuth_Verification->getStatus();
 }