diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Disqus/DisqusPlugin.php | 3 | ||||
-rw-r--r-- | plugins/SubMirror/lib/mirrorqueuehandler.php | 8 | ||||
-rwxr-xr-x | plugins/TwitterBridge/daemons/twitterstatusfetcher.php | 22 |
3 files changed, 30 insertions, 3 deletions
diff --git a/plugins/Disqus/DisqusPlugin.php b/plugins/Disqus/DisqusPlugin.php index 681be19dc..3901562f9 100644 --- a/plugins/Disqus/DisqusPlugin.php +++ b/plugins/Disqus/DisqusPlugin.php @@ -70,6 +70,9 @@ if (!defined('STATUSNET')) { */ class DisqusPlugin extends Plugin { + public $shortname; // Required 'shortname' for actually triggering Disqus. + public $div_style; // Optional CSS chunk for the main <div> + function onEndShowContentBlock($action) { if (get_class($action) == 'ShownoticeAction') { diff --git a/plugins/SubMirror/lib/mirrorqueuehandler.php b/plugins/SubMirror/lib/mirrorqueuehandler.php index dae9c0889..550986b44 100644 --- a/plugins/SubMirror/lib/mirrorqueuehandler.php +++ b/plugins/SubMirror/lib/mirrorqueuehandler.php @@ -36,7 +36,13 @@ class MirrorQueueHandler extends QueueHandler $mirror->subscribed = $notice->profile_id; if ($mirror->find()) { while ($mirror->fetch()) { - $mirror->mirrorNotice($notice); + try { + $mirror->mirrorNotice($notice); + } catch (Exception $e) { + common_log(LOG_ERR, "Exception trying to mirror notice $notice->id " . + "for subscriber $mirror->subscriber ($mirror->style): " . + $e->getMessage()); + } } } return true; 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('/(^|\"\;|\'|\(|\[|\{|\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) |