Example #1
0
 /**
  * take the recorded twitter screen name and parse it through the template
  * @param string $screenName
  * @return string|unknown
  */
 protected function format($screenName)
 {
     if (trim($screenName) == '') {
         return '';
     }
     require_once COM_FABRIK_FRONTEND . DS . 'libs' . DS . 'twitter' . DS . 'class.twitter.php';
     $twitter = new twitter();
     $params =& $this->getParams();
     static $error;
     $tmpl = $params->get('twitter_profile_template');
     $tmpl = str_replace('{screen_name}', $screenName, $tmpl);
     if (!$twitter->twitterAvailable()) {
         if (!isset($error)) {
             $error = true;
             JError::raiseNotice(500, 'Looks like twitters down');
         }
         $tmpl = preg_replace("/{[^}\\s]+}/i", '', $tmpl);
         return $tmpl;
     }
     $user = $twitter->showUser($screenName);
     foreach ($user as $k => $v) {
         if (is_object($v)) {
             foreach ($v as $k2 => $v2) {
                 $tmpl = str_replace('{' . $k . '.' . $k2 . '}', $v2, $tmpl);
             }
         } else {
             $tmpl = str_replace('{' . $k . '}', $v, $tmpl);
         }
     }
     $tmpl = preg_replace("/{[^}\\s]+}/i", '', $tmpl);
     return $tmpl;
 }
Example #2
0
 function __construct2($userscreen_name, $userpassword)
 {
     $t = new twitter();
     $t->username = '******';
     $t->password = '******';
     //$t->verifyCredentials();
     //print_r($t->responseInfo);
     $res = $t->showUser($userscreen_name);
     if ($res === false) {
         echo "ERROR logging in<hr/>";
         echo "<pre>";
         print_r($t->responseInfo);
         echo "</pre>";
     } else {
         $this->userid = $res->id;
         $this->username = $res->name;
         $this->userscreen_name = $userscreen_name;
         $this->userpassword = $userpassword;
         $this->userdefaultzoom = 2;
         $this->userlastlogon = date(DATE_RFC822);
         $this->userlocation = $res->location;
         $this->userdescription = $res->description;
         $this->userprofile_image_url = $res->profile_image_url;
         $this->userurl = $res->url;
         $this->userprotected = $res->user_protected;
     }
 }