summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/common.php2
-rw-r--r--lib/daemon.php11
-rw-r--r--lib/messageform.php6
-rw-r--r--lib/queuehandler.php11
-rw-r--r--lib/router.php9
-rw-r--r--lib/rssaction.php16
-rw-r--r--lib/twitterapi.php62
7 files changed, 101 insertions, 16 deletions
diff --git a/lib/common.php b/lib/common.php
index c47702779..9d7954fa9 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -19,7 +19,7 @@
if (!defined('LACONICA')) { exit(1); }
-define('LACONICA_VERSION', '0.8.0');
+define('LACONICA_VERSION', '0.8.1dev');
define('AVATAR_PROFILE_SIZE', 96);
define('AVATAR_STREAM_SIZE', 48);
diff --git a/lib/daemon.php b/lib/daemon.php
index 9d89c63e7..231f5414e 100644
--- a/lib/daemon.php
+++ b/lib/daemon.php
@@ -24,6 +24,7 @@ if (!defined('LACONICA')) {
class Daemon
{
var $daemonize = true;
+ var $_id = 'generic';
function __construct($daemonize = true)
{
@@ -35,6 +36,16 @@ class Daemon
return null;
}
+ function get_id()
+ {
+ return $this->_id;
+ }
+
+ function set_id($id)
+ {
+ $this->_id = $id;
+ }
+
function background()
{
$pid = pcntl_fork();
diff --git a/lib/messageform.php b/lib/messageform.php
index b8878ec1f..8ea2b36c2 100644
--- a/lib/messageform.php
+++ b/lib/messageform.php
@@ -140,6 +140,12 @@ class MessageForm extends Form
'rows' => 4,
'name' => 'content'),
($this->content) ? $this->content : '');
+ $this->out->elementStart('dl', 'form_note');
+ $this->out->element('dt', null, _('Available characters'));
+ $this->out->element('dd', array('id' => 'notice_text-count'),
+ '140');
+ $this->out->elementEnd('dl');
+
}
/**
diff --git a/lib/queuehandler.php b/lib/queuehandler.php
index c2ff10f32..f11e5bd90 100644
--- a/lib/queuehandler.php
+++ b/lib/queuehandler.php
@@ -29,7 +29,6 @@ define('QUEUE_HANDLER_HIT_IDLE', 0);
class QueueHandler extends Daemon
{
- var $_id = 'generic';
function __construct($id=null, $daemonize=true)
{
@@ -55,16 +54,6 @@ class QueueHandler extends Daemon
return strtolower($this->class_name().'.'.$this->get_id());
}
- function get_id()
- {
- return $this->_id;
- }
-
- function set_id($id)
- {
- $this->_id = $id;
- }
-
function transport()
{
return null;
diff --git a/lib/router.php b/lib/router.php
index e12138637..5e0fcfc94 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -129,6 +129,11 @@ class Router
$m->connect('index.php?action=' . $action, array('action' => $action));
}
+ $m->connect('main/:method',
+ array('action' => 'api',
+ 'method' => 'oembed(.xml|.json)?',
+ 'apiaction' => 'oembed'));
+
// settings
foreach (array('profile', 'avatar', 'password', 'openid', 'im',
@@ -394,6 +399,10 @@ class Router
array('action' => 'api',
'apiaction' => 'laconica'));
+ $m->connect('api/laconica/:method',
+ array('action' => 'api',
+ 'apiaction' => 'laconica'));
+
// Groups
$m->connect('api/laconica/groups/:method/:argument',
array('action' => 'api',
diff --git a/lib/rssaction.php b/lib/rssaction.php
index ffa1f9e99..901558943 100644
--- a/lib/rssaction.php
+++ b/lib/rssaction.php
@@ -39,6 +39,7 @@ class Rss10Action extends Action
var $creators = array();
var $limit = DEFAULT_RSS_LIMIT;
var $notices = null;
+ var $tags_already_output = array();
/**
* Constructor
@@ -234,6 +235,11 @@ class Rss10Action extends Action
$replyurl = common_local_url('shownotice', array('notice' => $notice->reply_to));
$this->element('sioc:reply_of', array('rdf:resource' => $replyurl));
}
+ if (!empty($notice->conversation)) {
+ $conversationurl = common_local_url('conversation',
+ array('id' => $notice->conversation));
+ $this->element('sioc:has_discussion', array('rdf:resource' => $conversationurl));
+ }
$attachments = $notice->attachments();
if($attachments){
foreach($attachments as $attachment){
@@ -268,6 +274,12 @@ class Rss10Action extends Action
foreach ($tags as $tag)
{
$tagpage = common_local_url('tag', array('tag' => $tag));
+
+ if ( in_array($tag, $this->tags_already_output) ) {
+ $this->element('ctag:tagged', array('rdf:resource'=>$tagpage.'#concept'));
+ continue;
+ }
+
$tagrss = common_local_url('tagrss', array('tag' => $tag));
$this->elementStart('ctag:tagged');
$this->elementStart('ctag:Tag', array('rdf:about'=>$tagpage.'#concept', 'ctag:label'=>$tag));
@@ -275,6 +287,8 @@ class Rss10Action extends Action
$this->element('rdfs:seeAlso', array('rdf:resource'=>$tagrss));
$this->elementEnd('ctag:Tag');
$this->elementEnd('ctag:tagged');
+
+ $this->tags_already_output[] = $tag;
}
}
$this->elementEnd('item');
@@ -320,6 +334,8 @@ class Rss10Action extends Action
'http://rdfs.org/sioc/ns#',
'xmlns:sioct' =>
'http://rdfs.org/sioc/types#',
+ 'xmlns:rdfs' =>
+ 'http://www.w3.org/2000/01/rdf-schema#',
'xmlns:laconica' =>
'http://laconi.ca/ont/',
'xmlns' => 'http://purl.org/rss/1.0/'));
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 655b6c777..79da82a19 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -186,6 +186,24 @@ class TwitterapiAction extends Action
$twitter_status['favorited'] = false;
}
+ // Enclosures
+ $attachments = $notice->attachments();
+ $enclosures = array();
+
+ foreach ($attachments as $attachment) {
+ if ($attachment->isEnclosure()) {
+ $enclosure = array();
+ $enclosure['url'] = $attachment->url;
+ $enclosure['mimetype'] = $attachment->mimetype;
+ $enclosure['size'] = $attachment->size;
+ $enclosures[] = $enclosure;
+ }
+ }
+
+ if (!empty($enclosures)) {
+ $twitter_status['attachments'] = $enclosures;
+ }
+
if ($include_user) {
# Don't get notice (recursive!)
$twitter_user = $this->twitter_user_array($profile, false);
@@ -200,7 +218,7 @@ class TwitterapiAction extends Action
$profile = $notice->getProfile();
$entry = array();
- # We trim() to avoid extraneous whitespace in the output
+ // We trim() to avoid extraneous whitespace in the output
$entry['content'] = common_xml_safe_str(trim($notice->rendered));
$entry['title'] = $profile->nickname . ': ' . common_xml_safe_str(trim($notice->content));
@@ -213,7 +231,26 @@ class TwitterapiAction extends Action
$entry['updated'] = $entry['published'];
$entry['author'] = $profile->getBestName();
- # Enclosure
+ // Enclosures
+ $attachments = $notice->attachments();
+ $enclosures = array();
+
+ foreach ($attachments as $attachment) {
+ if ($attachment->isEnclosure()) {
+ $enclosure = array();
+ $enclosure['url'] = $attachment->url;
+ $enclosure['mimetype'] = $attachment->mimetype;
+ $enclosure['size'] = $attachment->size;
+ $enclosures[] = $enclosure;
+ }
+ }
+
+ if (!empty($enclosures)) {
+ $entry['enclosures'] = $enclosures;
+ }
+
+/*
+ // Enclosure
$attachments = $notice->attachments();
if($attachments){
$entry['enclosures']=array();
@@ -227,8 +264,8 @@ class TwitterapiAction extends Action
}
}
}
-
- # RSS Item specific
+*/
+ // RSS Item specific
$entry['description'] = $entry['content'];
$entry['pubDate'] = common_date_rfc2822($notice->created);
$entry['guid'] = $entry['link'];
@@ -354,6 +391,9 @@ class TwitterapiAction extends Action
case 'text':
$this->element($element, null, common_xml_safe_str($value));
break;
+ case 'attachments':
+ $this->show_xml_attachments($twitter_status['attachments']);
+ break;
default:
$this->element($element, null, $value);
}
@@ -374,6 +414,20 @@ class TwitterapiAction extends Action
$this->elementEnd($role);
}
+ function show_xml_attachments($attachments) {
+ if (!empty($attachments)) {
+ $this->elementStart('attachments', array('type' => 'array'));
+ foreach ($attachments as $attachment) {
+ $attrs = array();
+ $attrs['url'] = $attachment['url'];
+ $attrs['mimetype'] = $attachment['mimetype'];
+ $attrs['size'] = $attachment['size'];
+ $this->element('enclosure', $attrs, '');
+ }
+ $this->elementEnd('attachments');
+ }
+ }
+
function show_twitter_rss_item($entry)
{
$this->elementStart('item');