add default plugins and load them

This commit is contained in:
Evan Prodromou 2010-01-07 16:13:36 -08:00
parent 6ae6fb7a35
commit 2c33e61b94
2 changed files with 38 additions and 0 deletions

View File

@ -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.

View File

@ -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),
)
);