diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Blacklist/BlacklistPlugin.php | 34 | ||||
-rw-r--r-- | plugins/OStatus/OStatusPlugin.php | 3 | ||||
-rw-r--r-- | plugins/OStatus/classes/Ostatus_profile.php | 28 | ||||
-rw-r--r-- | plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php | 2 | ||||
-rw-r--r-- | plugins/Realtime/realtimeupdate.js | 2 |
5 files changed, 42 insertions, 27 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index c2b60b7d2..adc4d9d7e 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -49,32 +49,26 @@ class BlacklistPlugin extends Plugin public $urls = array(); public $canAdmin = true; - private $_nicknamePatterns = array(); - private $_urlPatterns = array(); - - /** - * Initialize the plugin - * - * @return void - */ - - function initialize() + function _getNicknamePatterns() { $confNicknames = $this->_configArray('blacklist', 'nicknames'); $dbNicknames = Nickname_blacklist::getPatterns(); - $this->_nicknamePatterns = array_merge($this->nicknames, - $confNicknames, - $dbNicknames); + return array_merge($this->nicknames, + $confNicknames, + $dbNicknames); + } + function _getUrlPatterns() + { $confURLs = $this->_configArray('blacklist', 'urls'); $dbURLs = Homepage_blacklist::getPatterns(); - $this->_urlPatterns = array_merge($this->urls, - $confURLs, - $dbURLs); + return array_merge($this->urls, + $confURLs, + $dbURLs); } /** @@ -265,7 +259,9 @@ class BlacklistPlugin extends Plugin private function _checkUrl($url) { - foreach ($this->_urlPatterns as $pattern) { + $patterns = $this->_getUrlPatterns(); + + foreach ($patterns as $pattern) { if (preg_match("/$pattern/", $url)) { return false; } @@ -286,7 +282,9 @@ class BlacklistPlugin extends Plugin private function _checkNickname($nickname) { - foreach ($this->_nicknamePatterns as $pattern) { + $patterns = $this->_getNicknamePatterns(); + + foreach ($patterns as $pattern) { if (preg_match("/$pattern/", $nickname)) { return false; } diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index c985fb4bc..f183bc7ae 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -102,7 +102,8 @@ class OStatusPlugin extends Plugin */ function onStartEnqueueNotice($notice, &$transports) { - $transports[] = 'ostatus'; + // put our transport first, in case there's any conflict (like OMB) + array_unshift($transports, 'ostatus'); return true; } diff --git a/plugins/OStatus/classes/Ostatus_profile.php b/plugins/OStatus/classes/Ostatus_profile.php index c7e3b0509..34bff548d 100644 --- a/plugins/OStatus/classes/Ostatus_profile.php +++ b/plugins/OStatus/classes/Ostatus_profile.php @@ -550,14 +550,22 @@ class Ostatus_profile extends Memcached_DataObject } $shortSummary = common_shorten_links($summary); if (Notice::contentTooLong($shortSummary)) { - $url = common_shorten_url(common_local_url('attachment', - array('attachment' => $attachment->id))); + $url = common_shorten_url($sourceUrl); $shortSummary = substr($shortSummary, 0, Notice::maxContent() - (mb_strlen($url) + 2)); - $shortSummary .= '… ' . $url; - $content = $shortSummary; - $rendered = common_render_text($content); + $content = $shortSummary . ' ' . $url; + + // We mark up the attachment link specially for the HTML output + // so we can fold-out the full version inline. + $attachUrl = common_local_url('attachment', + array('attachment' => $attachment->id)); + $rendered = common_render_text($shortSummary) . + '<a href="' . htmlspecialchars($attachUrl) .'"'. + ' class="attachment more"' . + ' title="'. htmlspecialchars(_m('Show more')) . '">' . + '…' . + '</a>'; } } @@ -1667,10 +1675,18 @@ class Ostatus_profile extends Memcached_DataObject throw new Exception("Couldn't find a valid profile for '$addr'"); } + /** + * Store the full-length scrubbed HTML of a remote notice to an attachment + * file on our server. We'll link to this at the end of the cropped version. + * + * @param string $title plaintext for HTML page's title + * @param string $rendered HTML fragment for HTML page's body + * @return File + */ function saveHTMLFile($title, $rendered) { $final = sprintf("<!DOCTYPE html>\n<html><head><title>%s</title></head>". - '<body><div>%s</div></body></html>', + '<body>%s</body></html>', htmlspecialchars($title), $rendered); diff --git a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php index ebb0189e0..6756f1993 100644 --- a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php +++ b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php @@ -45,7 +45,7 @@ class OpenExternalLinkTargetPlugin extends Plugin { function onEndShowScripts($action) { - $action->inlineScript('$("a[rel~=external]").click(function(){ window.open(this.href); return false; });'); + $action->inlineScript('$("a[rel~=external]:not([class~=attachment])").live("click", function(){ window.open(this.href); return false; });'); return true; } diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 0f7a680d7..2e5851ae5 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -130,7 +130,7 @@ RealtimeUpdate = { user = data['user']; html = data['html'].replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/&/g,'&'); source = data['source'].replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/&/g,'&'); -console.log(data); + ni = "<li class=\"hentry notice\" id=\"notice-"+unique+"\">"+ "<div class=\"entry-title\">"+ "<span class=\"vcard author\">"+ |