* Based on experience with the Comet and Meteor plugins,
* this superclass extracts out some of the common functionality
*
+ * Currently depends on Favorite plugin.
+ *
* @category Plugin
* @package StatusNet
* @author Evan Prodromou <evan@status.net>
/**
* Hook for RouterInitialized event.
*
- * @param Net_URL_Mapper $m path-to-action mapper
+ * @param URLMapper $m path-to-action mapper
* @return boolean hook return
*/
- function onRouterInitialized($m)
+ public function onRouterInitialized(URLMapper $m)
{
$m->connect('main/channel/:channelkey/keepalive',
array('action' => 'keepalivechannel'),
// Add to the public timeline
- if ($notice->is_local == Notice::LOCAL_PUBLIC ||
- ($notice->is_local == Notice::REMOTE && !common_config('public', 'localonly'))) {
+ $is_local = intval($notice->is_local);
+ if ($is_local === Notice::LOCAL_PUBLIC ||
+ ($is_local === Notice::REMOTE && !common_config('public', 'localonly'))) {
$paths[] = array('public', null, null);
}
$act = new ApiAction('/dev/null');
$arr = $act->twitterStatusArray($notice, true);
- $arr['url'] = $notice->getUrl();
+ $arr['url'] = $notice->getUrl(true);
$arr['html'] = htmlspecialchars($notice->rendered);
$arr['source'] = htmlspecialchars($arr['source']);
- $arr['conversation_url'] = $this->getConversationUrl($notice);
+ $arr['conversation_url'] = $notice->getConversationUrl();
$profile = $notice->getProfile();
$arr['user']['profile_url'] = $profile->profileurl;
if (!empty($notice->repeat_of)) {
$original = Notice::getKV('id', $notice->repeat_of);
if ($original instanceof Notice) {
- $arr['retweeted_status']['url'] = $original->getUrl();
+ $arr['retweeted_status']['url'] = $original->getUrl(true);
$arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
$arr['retweeted_status']['source'] = htmlspecialchars($original->source);
$originalProfile = $original->getProfile();
$arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
- $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
+ $arr['retweeted_status']['conversation_url'] = $original->getConversationUrl();
}
unset($original);
}
return $tags;
}
- function getConversationUrl($notice)
- {
- $convurl = null;
-
- if ($notice->hasConversation()) {
- $conv = Conversation::getKV(
- 'id',
- $notice->conversation
- );
- $convurl = $conv->uri;
-
- if(empty($convurl)) {
- $msg = sprintf( "Could not find Conversation ID %d to make 'in context'"
- . "link for Notice ID %d.",
- $notice->conversation,
- $notice->id
- );
-
- common_log(LOG_WARNING, $msg);
- } else {
- $convurl .= '#notice-' . $notice->id;
- }
- }
-
- return $convurl;
- }
-
function _getScripts()
{
$urlpath = self::staticPath(str_replace('Plugin','',__CLASS__),