summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-03 09:53:16 -0800
committerZach Copley <zach@status.net>2010-03-03 09:53:16 -0800
commit8a58b52a680ffbb162a6f5af9029573f18ba7320 (patch)
treea7d22c9edad378411c5a965135f0dac33d5cfbd1 /lib
parent49a872b56f82a3f1ba59f0751c11dfe7754393dd (diff)
parent4aa516db454f56c5f6307b17503b6c524bd918ae (diff)
Merge branch 'twitter-facebook-mods'
* twitter-facebook-mods: Make Facebook plugin look for API key and secret before doing anything Show global key and secret, if defined, in Twitter bridge admin panel Remove double word from Twitter bridge README - Have Twitter bridge check for a global key and secret if it can't stupid mistake... let's not talk about this. Updated some references to the long gnone "isEnclosure" function to the new "getEnclosure" Update Facebook plugin README with info about new admin panel Initial Facebook admin panel Some wording / spelling fixes - Make 'Sign in with Twitter' optional Remove un-needed config variable for enabling/disabling Twitter integration Initial Twitter bridge admin panel Upgrade XML output scrubbing to better deal with newline and a few other chars
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php2
-rw-r--r--lib/apiaction.php9
-rw-r--r--lib/default.php4
-rw-r--r--lib/util.php41
4 files changed, 34 insertions, 22 deletions
diff --git a/lib/action.php b/lib/action.php
index a7e0eb33b..0918c6858 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -425,8 +425,6 @@ class Action extends HTMLOutputter // lawsuit
$connect = 'imsettings';
} else if (common_config('sms', 'enabled')) {
$connect = 'smssettings';
- } else if (common_config('twitter', 'enabled')) {
- $connect = 'twittersettings';
}
$this->elementStart('dl', array('id' => 'site_nav_global_primary'));
diff --git a/lib/apiaction.php b/lib/apiaction.php
index 8049c0901..eef0ba637 100644
--- a/lib/apiaction.php
+++ b/lib/apiaction.php
@@ -291,11 +291,12 @@ class ApiAction extends Action
$twitter_status['attachments'] = array();
foreach ($attachments as $attachment) {
- if ($attachment->isEnclosure()) {
+ $enclosure_o=$attachment->getEnclosure();
+ if ($enclosure_o) {
$enclosure = array();
- $enclosure['url'] = $attachment->url;
- $enclosure['mimetype'] = $attachment->mimetype;
- $enclosure['size'] = $attachment->size;
+ $enclosure['url'] = $enclosure_o->url;
+ $enclosure['mimetype'] = $enclosure_o->mimetype;
+ $enclosure['size'] = $enclosure_o->size;
$twitter_status['attachments'][] = $enclosure;
}
}
diff --git a/lib/default.php b/lib/default.php
index d849055c2..7b50242ae 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -177,8 +177,8 @@ $default =
array('source' => 'StatusNet', # source attribute for Twitter
'taguri' => null), # base for tag URIs
'twitter' =>
- array('enabled' => true,
- 'consumer_key' => null,
+ array('signin' => true,
+ 'consumer_key' => null,
'consumer_secret' => null),
'cache' =>
array('base' => null),
diff --git a/lib/util.php b/lib/util.php
index 485f6f0d9..add1b0ae6 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -770,20 +770,13 @@ function common_linkify($url) {
}
if (!empty($f)) {
- if ($f->isEnclosure()) {
+ if ($f->getEnclosure()) {
$is_attachment = true;
$attachment_id = $f->id;
- } else {
- $foe = File_oembed::staticGet('file_id', $f->id);
- if (!empty($foe)) {
- // if it has OEmbed info, it's an attachment, too
- $is_attachment = true;
- $attachment_id = $f->id;
-
- $thumb = File_thumbnail::staticGet('file_id', $f->id);
- if (!empty($thumb)) {
- $has_thumb = true;
- }
+
+ $thumb = File_thumbnail::staticGet('file_id', $f->id);
+ if (!empty($thumb)) {
+ $has_thumb = true;
}
}
}
@@ -809,8 +802,28 @@ function common_shorten_links($text)
function common_xml_safe_str($str)
{
- // Neutralize control codes and surrogates
- return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
+ // Replace common eol and extra whitespace input chars
+ $unWelcome = array(
+ "\t", // tab
+ "\n", // newline
+ "\r", // cr
+ "\0", // null byte eos
+ "\x0B" // vertical tab
+ );
+
+ $replacement = array(
+ ' ', // single space
+ ' ',
+ '', // nothing
+ '',
+ ' '
+ );
+
+ $str = str_replace($unWelcome, $replacement, $str);
+
+ // Neutralize any additional control codes and UTF-16 surrogates
+ // (Twitter uses '*')
+ return preg_replace('/[\p{Cc}\p{Cs}]/u', '*', $str);
}
function common_tag_link($tag)