summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Comet/README5
-rwxr-xr-xplugins/TwitterBridge/daemons/twitterstatusfetcher.php22
-rw-r--r--scripts/commandline.inc24
-rw-r--r--scripts/importtwitteratom.php24
4 files changed, 48 insertions, 27 deletions
diff --git a/plugins/Comet/README b/plugins/Comet/README
index 4abd40af7..f6e840b6a 100644
--- a/plugins/Comet/README
+++ b/plugins/Comet/README
@@ -6,7 +6,10 @@ NOTE: this is an insecure version; don't roll it out on a production
server.
It requires a cometd server. I've only had the cometd-java server work
-correctly; something's wiggy with the Twisted-based server.
+correctly; something's wiggy with the Twisted-based server. See here
+for help setting up a comet server:
+
+ http://cometd.org/
After you have a cometd server installed, just add this code to your
config.php:
diff --git a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
index 31129b96d..590fa2954 100755
--- a/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
+++ b/plugins/TwitterBridge/daemons/twitterstatusfetcher.php
@@ -692,6 +692,10 @@ class TwitterStatusFetcher extends ParallelizingDaemon
$text = $status->text;
if (empty($status->entities)) {
+ common_log(LOG_WARNING, "No entities data for {$status->id}; trying to fake up links ourselves.");
+ $text = common_replace_urls_callback($text, 'common_linkify');
+ $text = preg_replace('/(^|\&quot\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.TwitterStatusFetcher::tagLink('\\2')", $text);
+ $text = preg_replace('/(^|\s+)@([a-z0-9A-Z_]{1,64})/e', "'\\1@'.TwitterStatusFetcher::atLink('\\2')", $text);
return $text;
}
@@ -750,12 +754,26 @@ class TwitterStatusFetcher extends ParallelizingDaemon
function makeHashtagLink($object)
{
- return "#<a href='https://twitter.com/search?q=%23{$object->text}' class='hashtag'>{$object->text}</a>";
+ return "#" . self::tagLink($object->text);
}
function makeMentionLink($object)
{
- return "@<a href='http://twitter.com/{$object->screen_name}' title='{$object->name}'>{$object->screen_name}</a>";
+ return "@".self::atLink($object->screen_name, $object->name);
+ }
+
+ static function tagLink($tag)
+ {
+ return "<a href='https://twitter.com/search?q=%23{$tag}' class='hashtag'>{$tag}</a>";
+ }
+
+ static function atLink($screenName, $fullName=null)
+ {
+ if (!empty($fullName)) {
+ return "<a href='http://twitter.com/{$screenName}' title='{$fullName}'>{$screenName}</a>";
+ } else {
+ return "<a href='http://twitter.com/{$screenName}'>{$screenName}</a>";
+ }
}
function saveStatusMentions($notice, $status)
diff --git a/scripts/commandline.inc b/scripts/commandline.inc
index a475e11d0..a29f58844 100644
--- a/scripts/commandline.inc
+++ b/scripts/commandline.inc
@@ -177,3 +177,27 @@ function get_option_value($opt, $alt=null)
return null;
}
+
+function getUser()
+{
+ $user = null;
+
+ if (have_option('i', 'id')) {
+ $id = get_option_value('i', 'id');
+ $user = User::staticGet('id', $id);
+ if (empty($user)) {
+ throw new Exception("Can't find user with id '$id'.");
+ }
+ } else if (have_option('n', 'nickname')) {
+ $nickname = get_option_value('n', 'nickname');
+ $user = User::staticGet('nickname', $nickname);
+ if (empty($user)) {
+ throw new Exception("Can't find user with nickname '$nickname'");
+ }
+ } else {
+ show_help();
+ exit(1);
+ }
+
+ return $user;
+}
diff --git a/scripts/importtwitteratom.php b/scripts/importtwitteratom.php
index c12e3b91a..261dfb1d0 100644
--- a/scripts/importtwitteratom.php
+++ b/scripts/importtwitteratom.php
@@ -36,30 +36,6 @@ END_OF_IMPORTTWITTERATOM_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
-function getUser()
-{
- $user = null;
-
- if (have_option('i', 'id')) {
- $id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
- if (empty($user)) {
- throw new Exception("Can't find user with id '$id'.");
- }
- } else if (have_option('n', 'nickname')) {
- $nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
- if (empty($user)) {
- throw new Exception("Can't find user with nickname '$nickname'");
- }
- } else {
- show_help();
- exit(1);
- }
-
- return $user;
-}
-
function getAtomFeedDocument()
{
$filename = get_option_value('f', 'file');