當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Twitter::getUserTimeLine方法代碼示例

本文整理匯總了PHP中Twitter::getUserTimeLine方法的典型用法代碼示例。如果您正苦於以下問題:PHP Twitter::getUserTimeLine方法的具體用法?PHP Twitter::getUserTimeLine怎麽用?PHP Twitter::getUserTimeLine使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Twitter的用法示例。


在下文中一共展示了Twitter::getUserTimeLine方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: twitterUserTimeLine

 public function twitterUserTimeLine()
 {
     $twit = new Twitter();
     $user = $this->params[0];
     $count = (int) $this->params[1];
     return $twit->getUserTimeLine($user, $count);
 }
開發者ID:rezaprima,項目名稱:icms,代碼行數:7,代碼來源:servicecontroller.php

示例2: doExecute

 /**
  * Display the application.
  */
 function doExecute()
 {
     // Get config
     $plugin = JPluginHelper::getPlugin('system', 'plugin_googlemap3');
     $jversion = JVERSION;
     // In Joomla 1.5 get the parameters in Joomla 1.6 and higher the plugin already has them, but need to be rendered with JRegistry
     if (substr($jversion, 0, 3) == "1.5") {
         $params = new JParameter($plugin->params);
     } else {
         $params = new JRegistry();
         $params->loadString($plugin->params);
     }
     // Get params
     $twittername = urldecode(JRequest::getVar('twittername', ''));
     if ($twittername == "") {
         $twittername = $params->get('twittername', '');
     }
     $twittertweets = urldecode(JRequest::getVar('twittertweets', ''));
     if ($twittertweets == "") {
         $twittertweets = $params->get('twittertweets', '15');
     }
     $line = urldecode(JRequest::getVar('twitterline', ''));
     if ($line == "") {
         $line = $params->get('twitterline', '');
     }
     $twitterlinewidth = urldecode(JRequest::getVar('twitterlinewidth', ''));
     if ($twitterlinewidth == "") {
         $twitterlinewidth = $params->get('twitterlinewidth', '5');
     }
     $twitterstartloc = urldecode(JRequest::getVar('twitterstartloc', ''));
     if ($twitterstartloc == "") {
         $twitterstartloc = $params->get('twitterstartloc', '5');
     }
     $twitter = new Twitter(ltrim(rtrim($twittername)));
     $tweets = $twitter->getUserTimeLine(ltrim(rtrim($twittertweets)), 1);
     $profile = $twitter->getProfile();
     // Start KML file, create parent node
     $dom = new DOMDocument('1.0', 'UTF-8');
     //Create the root KML element and append it to the Document
     $node = $dom->createElementNS('http://earth.google.com/kml/2.1', 'kml');
     $parNode = $dom->appendChild($node);
     //Create a Folder element and append it to the KML element
     $docnode = $dom->createElement('Document');
     $parNode = $parNode->appendChild($docnode);
     $twitterStyleNode = $dom->createElement('Style');
     $twitterStyleNode->setAttribute('id', 'tweetStyle');
     $twitterIconstyleNode = $dom->createElement('IconStyle');
     $twitterIconstyleNode->setAttribute('id', 'tweetIcon');
     $twitterIconNode = $dom->createElement('Icon');
     $twitterHref = $dom->createElement('href', $params->get('twittericon', ''));
     $twitterIconNode->appendChild($twitterHref);
     $twitterIconstyleNode->appendChild($twitterIconNode);
     $twitterStyleNode->appendChild($twitterIconstyleNode);
     $docnode->appendChild($twitterStyleNode);
     if ($line != '') {
         // Create a line of travelling
         $twitterStyleNode = $dom->createElement('Style');
         $twitterStyleNode->setAttribute('id', 'lineStyle');
         $twitterLinestyleNode = $dom->createElement('LineStyle');
         $twitterColorNode = $dom->createElement('color', ltrim(rtrim($line)));
         $twitterLinestyleNode->appendChild($twitterColorNode);
         $twitterWidthNode = $dom->createElement('width', ltrim(rtrim($twitterlinewidth)));
         $twitterLinestyleNode->appendChild($twitterWidthNode);
         $twitterStyleNode->appendChild($twitterLinestyleNode);
         $docnode->appendChild($twitterStyleNode);
     }
     //Create a Folder element and append it to the KML element
     $fnode = $dom->createElement('Folder');
     $folderNode = $parNode->appendChild($fnode);
     $nameNode = $dom->createElement('name', 'Tweets ' . $twittername);
     $folderNode->appendChild($nameNode);
     $tweets = array_reverse($tweets);
     $prev_location = explode(',', $twitterstartloc);
     // swap lat and long values. In kml is it different first long then lat
     $lat = $prev_location[0];
     $prev_location[0] = $prev_location[1];
     $prev_location[1] = $lat;
     foreach ($tweets as $tweet) {
         if ($tweet->coordinates == "") {
             $tweet->coordinates->coordinates = $prev_location;
         } else {
             $prev_location = $tweet->coordinates->coordinates;
         }
     }
     $tweets = array_reverse($tweets);
     foreach ($tweets as $tweet) {
         //Create a Placemark and append it to the document
         $node = $dom->createElement('Placemark');
         $placeNode = $folderNode->appendChild($node);
         //Create an id attribute and assign it the value of id column
         $placeNode->setAttribute('id', 'tweet_' . $tweet->id_str);
         //Create name, description, and address elements and assign them the values of
         //the name, type, and address columns from the results
         $nameNode = $dom->createElement('name', date('d m Y g:i:s', strtotime($tweet->created_at)));
         $placeNode->appendChild($nameNode);
         $styleUrl = $dom->createElement('styleUrl', '#tweetStyle');
         $placeNode->appendChild($styleUrl);
//.........這裏部分代碼省略.........
開發者ID:santas156,項目名稱:joomleague-2-komplettpaket,代碼行數:101,代碼來源:plugin_googlemap3_twitter_kml.php


注:本文中的Twitter::getUserTimeLine方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。