Additionnal corrections for extended mode V06.007
authorymh <ymh.work@gmail.com>
Sun, 23 Sep 2018 15:20:25 +0200
changeset 1476 b5098fdacc60
parent 1475 a8f1006005c7
child 1477 bdf75c8cff6b
Additionnal corrections for extended mode
web/res/js/live-polemic.js
web/search_tweets.php
--- a/web/res/js/live-polemic.js	Sun Sep 23 14:13:29 2018 +0200
+++ b/web/res/js/live-polemic.js	Sun Sep 23 15:20:25 2018 +0200
@@ -139,11 +139,20 @@
     options.pages || (options.pages = 1);
     options.rpp || (options.rpp = 100);
     options.currentPage = 0;
-    var baseurl = "search_tweets.php",
-        firstparams = "?q=" + encodeURIComponent(options.keyword)+ "&count=" + options.rpp
-            + (options.lang ? "&lang=" + options.lang : '' ),
-        lastparams = (options.since_id ? "&since_id=" + options.since_id : '' ),
-        jsonurl = baseurl + firstparams + lastparams;
+
+    var urlParams = {
+        tweet_mode: 'extended',
+        q: options.keyword,
+        count: options.rpp
+    };
+    if ( options.lang ) {
+        urlParams.lang = options.lang;
+    }
+    if ( options.since_id ) {
+        urlParams.since_id = options.since_id;
+    }
+
+    var jsonurl = "search_tweets.php?"+$.param(urlParams);
     getTweetUrl(jsonurl);
 }
 
--- a/web/search_tweets.php	Sun Sep 23 14:13:29 2018 +0200
+++ b/web/search_tweets.php	Sun Sep 23 15:20:25 2018 +0200
@@ -31,11 +31,9 @@
     $token = unserialize($_SESSION['TWITTER_ACCESS_TOKEN']);
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $token['oauth_token'], $token['oauth_token_secret']);
 
-    $parameters = array_merge([
-        'tweet_mode' => 'extended'
-    ], $_GET ? $_GET : []);
 
-    $statuses = $connection->get("search/tweets", $parameters);
+    // $statuses = $connection->get("search/tweets", $parameters);
+    $statuses = $connection->get("search/tweets", $_GET);
     // $client = $token->getHttpClient($configuration);
     // $client->setUri("https://api.twitter.com/1.1/$endpoint.json");
     // $client->setMethod(Zend_Http_Client::GET);