diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-18 15:26:20 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-18 15:26:20 -0700 |
commit | f1bfbece06d7db20fa144fe5ac8a2f6c589eff45 (patch) | |
tree | 9804f314e8cd260819c9af059d9f50a47d7ee5b0 /plugins | |
parent | eb93bdbb038e8e22ee2bbcb84dbe3967672c48cf (diff) | |
parent | 140308bb03ecf99ac5738d6adbef066bf4e60461 (diff) |
Merge branch '1.0.x' into schema-x
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/DirectionDetector/DirectionDetectorPlugin.php | 3 | ||||
-rw-r--r-- | plugins/OStatus/tests/FeedDiscoveryTest.php | 9 | ||||
-rw-r--r-- | plugins/OStatus/tests/remote-tests.php | 44 | ||||
-rw-r--r-- | plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php | 3 | ||||
-rw-r--r-- | plugins/OpenID/openidadminpanel.php | 2 |
5 files changed, 45 insertions, 16 deletions
diff --git a/plugins/DirectionDetector/DirectionDetectorPlugin.php b/plugins/DirectionDetector/DirectionDetectorPlugin.php index 1473c386f..4a38f390f 100644 --- a/plugins/DirectionDetector/DirectionDetectorPlugin.php +++ b/plugins/DirectionDetector/DirectionDetectorPlugin.php @@ -81,6 +81,9 @@ class DirectionDetectorPlugin extends Plugin { * @return boolean */ public static function startsWithRTLCharacter($str){ + if (strlen($str) < 1) { + return false; + } if( is_array($cc = self::utf8ToUnicode(mb_substr($str, 0, 1, 'utf-8'))) ) $cc = $cc[0]; else diff --git a/plugins/OStatus/tests/FeedDiscoveryTest.php b/plugins/OStatus/tests/FeedDiscoveryTest.php index 3be4bf736..ef17efe7c 100644 --- a/plugins/OStatus/tests/FeedDiscoveryTest.php +++ b/plugins/OStatus/tests/FeedDiscoveryTest.php @@ -75,9 +75,10 @@ END; '<body><pre><LINK rel=alternate hRef=http://example.com/feed/rss type=application/rss+xml><fnork', 'http://example.com/feed/rss'), // 'rel' attribute must be lowercase, alone per http://www.rssboard.org/rss-autodiscovery + // but we're going to be liberal in what we receive. array('http://example.com/tagsoup2', '<body><pre><LINK rel=" feeders alternate 467" hRef=http://example.com/feed/rss type=application/rss+xml><fnork', - false), + 'http://example.com/feed/rss'), array('http://example.com/tagsoup3', '<body><pre><LINK rel=ALTERNATE hRef=http://example.com/feed/rss type=application/rss+xml><fnork', false), @@ -87,18 +88,20 @@ END; array('http://example.com/relative/link2', '<html><link rel="alternate" href="../feed/rss" type="application/rss+xml">', 'http://example.com/feed/rss'), + // This one can't resolve correctly; relative link is bogus. array('http://example.com/relative/link3', '<html><link rel="alternate" href="http:/feed/rss" type="application/rss+xml">', - 'http://example.com/feed/rss'), + 'http:/feed/rss'), array('http://example.com/base/link1', '<html><link rel="alternate" href="/feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', 'http://target.example.com/feed/rss'), array('http://example.com/base/link2', '<html><link rel="alternate" href="feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', 'http://target.example.com/feed/rss'), + // This one can't resolve; relative link is bogus. array('http://example.com/base/link3', '<html><link rel="alternate" href="http:/feed/rss" type="application/rss+xml"><base href="http://target.example.com/">', - 'http://target.example.com/feed/rss'), + 'http:/feed/rss'), // Trick question! There's a <base> but no href on it array('http://example.com/relative/fauxbase', '<html><link rel="alternate" href="../feed/rss" type="application/rss+xml"><base target="top">', diff --git a/plugins/OStatus/tests/remote-tests.php b/plugins/OStatus/tests/remote-tests.php index 64c60a8a4..7888ec7c5 100644 --- a/plugins/OStatus/tests/remote-tests.php +++ b/plugins/OStatus/tests/remote-tests.php @@ -4,7 +4,7 @@ if (php_sapi_name() != 'cli') { die('not for web'); } -define('TIMEOUT', 60); // ssslllloowwwww salmon if queues are off +define('HTTP_TIMEOUT', 60); // ssslllloowwwww salmon if queues are off define('INSTALLDIR', dirname(dirname(dirname(dirname(__FILE__))))); set_include_path(INSTALLDIR . '/extlib' . PATH_SEPARATOR . get_include_path()); @@ -63,14 +63,15 @@ class OStatusTester extends TestBase /** * @param string $a base URL of test site A (eg http://localhost/mublog) * @param string $b base URL of test site B (eg http://localhost/mublog2) + * @param int $timeout HTTP timeout value (needs to be long if Salmon is slow) */ - function __construct($a, $b) { + function __construct($a, $b, $timeout=60) { $this->a = $a; $this->b = $b; $base = 'test' . mt_rand(1, 1000000); - $this->pub = new SNTestClient($this->a, 'pub' . $base, 'pw-' . mt_rand(1, 1000000)); - $this->sub = new SNTestClient($this->b, 'sub' . $base, 'pw-' . mt_rand(1, 1000000)); + $this->pub = new SNTestClient($this->a, 'pub' . $base, 'pw-' . mt_rand(1, 1000000), $timeout); + $this->sub = new SNTestClient($this->b, 'sub' . $base, 'pw-' . mt_rand(1, 1000000), $timeout); } function run() @@ -166,11 +167,12 @@ class OStatusTester extends TestBase class SNTestClient extends TestBase { - function __construct($base, $username, $password) + function __construct($base, $username, $password, $timeout=60) { $this->basepath = $base; $this->username = $username; $this->password = $password; + $this->timeout = $timeout; $this->fullname = ucfirst($username) . ' Smith'; $this->homepage = 'http://example.org/' . $username; @@ -190,7 +192,7 @@ class SNTestClient extends TestBase { $url = $this->basepath . '/' . $path; - $http = new HTTP_Request2($url, 'POST', array('timeout' => TIMEOUT)); + $http = new HTTP_Request2($url, 'POST', array('timeout' => $this->timeout)); if ($auth) { $http->setAuth($this->username, $this->password, HTTP_Request2::AUTH_BASIC); } @@ -217,7 +219,7 @@ class SNTestClient extends TestBase protected function web($path, $form, $params=array()) { $url = $this->basepath . '/' . $path; - $http = new HTTP_Request2($url, 'GET', array('timeout' => TIMEOUT)); + $http = new HTTP_Request2($url, 'GET', array('timeout' => $this->timeout)); $response = $http->send(); $dom = $this->checkWeb($url, 'GET', $response); @@ -534,10 +536,29 @@ class SNTestClient extends TestBase } -$args = array_slice($_SERVER['argv'], 1); +// @fixme switch to commandline.inc? +$timeout = HTTP_TIMEOUT; + +$args = array(); +$options = array(); +foreach (array_slice($_SERVER['argv'], 1) as $arg) { + if (substr($arg, 0, 2) == '--') { + $bits = explode('=', substr($arg, 2), 2); + if (count($bits == 2)) { + list($key, $val) = $bits; + $options[$key] = $val; + } else { + list($key) = $bits; + $options[$key] = true; + } + } else { + $args[] = $arg; + } +} if (count($args) < 2) { print <<<END_HELP -remote-tests.php <url1> <url2> +remote-tests.php [options] <url1> <url2> + --timeout=## change HTTP timeout from default {$timeout}s url1: base URL of a StatusNet instance url2: base URL of another StatusNet instance @@ -551,6 +572,9 @@ exit(1); $a = $args[0]; $b = $args[1]; +if (isset($options['timeout'])) { + $timeout = intval($options['timeout']); +} -$tester = new OStatusTester($a, $b); +$tester = new OStatusTester($a, $b, $timeout); $tester->run(); diff --git a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php index 611f5e5c7..f0f6144e0 100644 --- a/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php +++ b/plugins/OpenExternalLinkTarget/OpenExternalLinkTargetPlugin.php @@ -40,7 +40,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class OpenExternalLinkTargetPlugin extends Plugin { function onEndShowScripts($action) @@ -57,7 +56,7 @@ class OpenExternalLinkTargetPlugin extends Plugin 'author' => 'Sarven Capadisli', 'homepage' => 'http://status.net/wiki/Plugin:OpenExternalLinkTarget', 'rawdescription' => - _m('Opens external links (e.g., with rel=external) on a new window or tab.')); + _m('Opens external links (i.e. with rel=external) on a new window or tab.')); return true; } } diff --git a/plugins/OpenID/openidadminpanel.php b/plugins/OpenID/openidadminpanel.php index ce4806cc8..38df183fe 100644 --- a/plugins/OpenID/openidadminpanel.php +++ b/plugins/OpenID/openidadminpanel.php @@ -257,7 +257,7 @@ class OpenIDAdminPanelForm extends AdminForm $this->out->checkbox( 'openidonly', _m('Enable OpenID-only mode'), (bool) $this->value('openidonly', 'site'), - _m('Require all users to login via OpenID. WARNING: disables password authentication for all users!'), + _m('Require all users to login via OpenID. Warning: disables password authentication for all users!'), 'true' ); $this->unli(); |