summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-07 16:13:36 -0800
committerEvan Prodromou <evan@status.net>2010-01-07 16:13:36 -0800
commit2c33e61b94fca8654c0d543fb0baa164ee86d2c3 (patch)
treed6935d5965b6412de3f6b23814c6617d80c14c79
parent6ae6fb7a35cb666fbb59218fa57717522af96f60 (diff)
add default plugins and load them
-rw-r--r--lib/common.php21
-rw-r--r--lib/default.php17
2 files changed, 38 insertions, 0 deletions
diff --git a/lib/common.php b/lib/common.php
index b0e5c4390..fb5e5919e 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -238,6 +238,27 @@ function __autoload($cls)
}
}
+// Load default plugins
+
+foreach ($config['plugins']['default'] as $name => $params) {
+ if (is_null($params)) {
+ addPlugin($name);
+ } else if (is_array($params)) {
+ if (count($params) == 0) {
+ addPlugin($name);
+ } else {
+ $keys = array_keys($params);
+ if (is_string($keys[0])) {
+ addPlugin($name, $params);
+ } else {
+ foreach ($params as $paramset) {
+ addPlugin($name, $paramset);
+ }
+ }
+ }
+ }
+}
+
// XXX: how many of these could be auto-loaded on use?
// XXX: note that these files should not use config options
// at compile time since DB config options are not yet loaded.
diff --git a/lib/default.php b/lib/default.php
index f2e577149..5acd2fb87 100644
--- a/lib/default.php
+++ b/lib/default.php
@@ -230,4 +230,21 @@ $default =
array('timeout' => 5), // HTTP request timeout in seconds when contacting remote hosts for OMB updates
'logincommand' =>
array('disabled' => true),
+ 'plugins' =>
+ array('default' => array('LilUrl' => array('shortenerName'=>'ur1.ca',
+ 'freeService' => true,
+ 'serviceUrl'=>'http://ur1.ca/'),
+ 'PtitUrl' => array('shortenerName' => 'ptiturl1.com',
+ 'serviceUrl' => 'http://ptiturl.com/?creer=oui&action=Reduire&url=%1$s'),
+ 'SimpleUrl' => array(array('shortenerName' => 'is.gd', 'serviceUrl' => 'http://is.gd/api.php?longurl=%1$s'),
+ array('shortenerName' => 'snipr.com', 'serviceUrl' => 'http://snipr.com/site/snip?r=simple&link=%1$s'),
+ array('shortenerName' => 'metamark.net', 'serviceUrl' => 'http://metamark.net/api/rest/simple?long_url=%1$s'),
+ array('shortenerName' => 'tinyurl.com', 'serviceUrl' => 'http://tinyurl.com/api-create.php?url=%1$s')),
+ 'TightUrl' => array('shortenerName' => '2tu.us', 'freeService' => true,'serviceUrl'=>'http://2tu.us/?save=y&url=%1$s'),
+ 'Geonames' => null,
+ 'Mapstraction' => null,
+ 'Linkback' => null,
+ 'WikiHashtags' => null,
+ 'OpenID' => null),
+ )
);