From b339fd125870bb0b084cf54b03cdacd257cc560b Mon Sep 17 00:00:00 2001
From: Steve Clay
Date: Thu, 17 Jan 2013 10:24:54 -0500
Subject: Corrects encoding and other small tweaks in Twitter widget
---
.../views/default/widgets/twitter/content.php | 41 ++++++++++++++--------
mod/twitter/views/default/widgets/twitter/edit.php | 34 +++++++++++-------
2 files changed, 49 insertions(+), 26 deletions(-)
(limited to 'mod/twitter/views')
diff --git a/mod/twitter/views/default/widgets/twitter/content.php b/mod/twitter/views/default/widgets/twitter/content.php
index c616d944c..dd741745e 100644
--- a/mod/twitter/views/default/widgets/twitter/content.php
+++ b/mod/twitter/views/default/widgets/twitter/content.php
@@ -6,26 +6,39 @@
* @package ElggTwitter
*/
-//some required params
-
$username = $vars['entity']->twitter_username;
+
+if (empty($username)) {
+ echo "" . elgg_echo("twitter:notset") . "
";
+ return;
+}
+
+$username_is_valid = preg_match('~^[a-zA-Z0-9_]{1,20}$~', $username);
+
+if (!$username_is_valid) {
+ echo "" . elgg_echo("twitter:invalid") . "
";
+ return;
+}
+
+
+
$num = $vars['entity']->twitter_num;
+if (empty($num)) {
+ $num = 5;
+}
-// if the twitter username is empty, then do not show
-if ($username) {
+// @todo upgrade to 1.1 API https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline
+$script_url = "https://api.twitter.com/1/statuses/user_timeline/" . urlencode($username) . ".json"
+ . "?callback=twitterCallback2&count=" . (int) $num;
?>
-
-
-" . elgg_echo("twitter:notset") . ".
";
-
-}
diff --git a/mod/twitter/views/default/widgets/twitter/edit.php b/mod/twitter/views/default/widgets/twitter/edit.php
index 5da3a7e55..5dd291257 100644
--- a/mod/twitter/views/default/widgets/twitter/edit.php
+++ b/mod/twitter/views/default/widgets/twitter/edit.php
@@ -1,16 +1,26 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
\ No newline at end of file
--
cgit v1.2.3