Пример #1
0
 private function getProfileInformation()
 {
     if (!$this->takeDataFromServer && ($oCurUser = SJB_UserManager::getCurrentUser())) {
         $curUserSID = $oCurUser->getSID();
         $profileSocialID = self::getProfileSocialID($curUserSID);
         if ($profileSocialID) {
             $aProfExpl = explode($this->getNetwork() . '_', $profileSocialID);
             $linkedinID = $aProfExpl[1];
             $profileSocialInfo = $this->getProfileSocialSavedInfoBySocialID($linkedinID);
             if ($profileSocialInfo) {
                 self::$oProfile = $profileSocialInfo['profile_info'];
                 self::$oSocialPlugin = $this;
                 if (SJB_HelperFunctions::debugModeIsTurnedOn()) {
                     SJB_HelperFunctions::debugInfoPush(self::$oProfile, 'SOCIAL_PLUGIN');
                 }
                 return true;
             }
         }
     }
     if (self::$object) {
         try {
             $response = self::$object->getProfileInfo($this->requestedProfileFields);
             if ($response) {
                 self::$oProfile = new SimpleXMLElement($response);
                 self::$oSocialPlugin = $this;
                 if (SJB_HelperFunctions::debugModeIsTurnedOn()) {
                     SJB_HelperFunctions::debugInfoPush(self::$oProfile, 'SOCIAL_PLUGIN');
                 }
                 return true;
             }
         } catch (Exception $ex) {
             // revocation successful, clear session
             unset($_SESSION['oauth'][self::NETWORK_ID]);
             $this->cleanSessionData(self::NETWORK_ID);
             if (SJB_HelperFunctions::debugModeIsTurnedOn()) {
                 $debug = "Error retrieving profile information:\n\nRESPONSE:\n\n<pre>" . print_r($ex->getMessage()) . "</pre>";
                 SJB_HelperFunctions::debugInfoPush($debug, 'SOCIAL_PLUGINS');
             }
         }
     }
     return null;
 }