summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2009-04-20 13:09:05 +0200
committerAdrian Lang <mail@adrianlang.de>2009-04-20 13:09:05 +0200
commit0dd90461cdc7aad26b6f855ca7f63988a4a74d74 (patch)
treea7b295ac9307484f6f4dec3f3b1697d177127b90 /lib
parent558fa2743e182e50efb8aa1ad3fbc756ca1665e7 (diff)
parent48846c38057b20bb51814c22456d6907cc2a99e8 (diff)
Merge branch '0.7.x' of git://gitorious.org/laconica/mgrdcm-twitapibools into review/master
Diffstat (limited to 'lib')
-rw-r--r--lib/twitterapi.php29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/twitterapi.php b/lib/twitterapi.php
index 6a90b4e28..caf8c0716 100644
--- a/lib/twitterapi.php
+++ b/lib/twitterapi.php
@@ -51,6 +51,26 @@ class TwitterapiAction extends Action
parent::handle($args);
}
+ /**
+ * Overrides XMLOutputter::element to write booleans as strings (true|false).
+ * See that method's documentation for more info.
+ *
+ * @param string $tag Element type or tagname
+ * @param array $attrs Array of element attributes, as
+ * key-value pairs
+ * @param string $content string content of the element
+ *
+ * @return void
+ */
+ function element($tag, $attrs=null, $content=null)
+ {
+ if (is_bool($content)) {
+ $content = ($content ? 'true' : 'false');
+ }
+
+ return parent::element($tag, $attrs, $content);
+ }
+
function twitter_user_array($profile, $get_notice=false)
{
@@ -66,7 +86,7 @@ class TwitterapiAction extends Action
$avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
$twitter_user['profile_image_url'] = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE);
- $twitter_user['protected'] = 'false'; # not supported by Laconica yet
+ $twitter_user['protected'] = false; # not supported by Laconica yet
$twitter_user['url'] = ($profile->homepage) ? $profile->homepage : null;
if ($get_notice) {
@@ -86,7 +106,7 @@ class TwitterapiAction extends Action
$twitter_status = array();
$twitter_status['text'] = $notice->content;
- $twitter_status['truncated'] = 'false'; # Not possible on Laconica
+ $twitter_status['truncated'] = false; # Not possible on Laconica
$twitter_status['created_at'] = $this->date_twitter($notice->created);
$twitter_status['in_reply_to_status_id'] = ($notice->reply_to) ?
intval($notice->reply_to) : null;
@@ -108,10 +128,9 @@ class TwitterapiAction extends Action
($replier_profile) ? $replier_profile->nickname : null;
if (isset($this->auth_user)) {
- $twitter_status['favorited'] =
- ($this->auth_user->hasFave($notice)) ? 'true' : 'false';
+ $twitter_status['favorited'] = $this->auth_user->hasFave($notice);
} else {
- $twitter_status['favorited'] = 'false';
+ $twitter_status['favorited'] = false;
}
if ($include_user) {