Comment and typing improvements
To make the StatusNet::addPlugin() accept only arrays, the lib/default.php had to be changed because all plugins had 'null' as default value instead of an array.
This commit is contained in:
parent
06b068d43b
commit
c942bdcb43
@ -298,15 +298,15 @@ $default =
|
|||||||
'StrictTransportSecurity' => null,
|
'StrictTransportSecurity' => null,
|
||||||
),
|
),
|
||||||
'default' => array(
|
'default' => array(
|
||||||
'Activity' => null,
|
'Activity' => array(),
|
||||||
'Bookmark' => null,
|
'Bookmark' => array(),
|
||||||
'ClientSideShorten' => null,
|
'ClientSideShorten' => array(),
|
||||||
'Event' => null,
|
'Event' => array(),
|
||||||
'OpenID' => null,
|
'OpenID' => array(),
|
||||||
'Poll' => null,
|
'Poll' => array(),
|
||||||
'QnA' => null,
|
'QnA' => array(),
|
||||||
'SearchSub' => null,
|
'SearchSub' => array(),
|
||||||
'TagSub' => null,
|
'TagSub' => array(),
|
||||||
),
|
),
|
||||||
'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
|
'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
|
||||||
'server' => null,
|
'server' => null,
|
||||||
|
@ -95,7 +95,7 @@ require_once(INSTALLDIR.'/lib/language.php');
|
|||||||
require_once(INSTALLDIR.'/lib/event.php');
|
require_once(INSTALLDIR.'/lib/event.php');
|
||||||
require_once(INSTALLDIR.'/lib/plugin.php');
|
require_once(INSTALLDIR.'/lib/plugin.php');
|
||||||
|
|
||||||
function addPlugin($name, $attrs = null)
|
function addPlugin($name, array $attrs=array())
|
||||||
{
|
{
|
||||||
return StatusNet::addPlugin($name, $attrs);
|
return StatusNet::addPlugin($name, $attrs);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ class StatusNet
|
|||||||
*
|
*
|
||||||
* @throws ServerException if plugin can't be found
|
* @throws ServerException if plugin can't be found
|
||||||
*/
|
*/
|
||||||
public static function addPlugin($name, $attrs = null)
|
public static function addPlugin($name, array $attrs=array())
|
||||||
{
|
{
|
||||||
$name = ucfirst($name);
|
$name = ucfirst($name);
|
||||||
|
|
||||||
@ -78,11 +78,11 @@ class StatusNet
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Doesn't this $inst risk being garbage collected or something?
|
||||||
|
// TODO: put into a static array that makes sure $inst isn't lost.
|
||||||
$inst = new $pluginclass();
|
$inst = new $pluginclass();
|
||||||
if (!empty($attrs)) {
|
foreach ($attrs as $aname => $avalue) {
|
||||||
foreach ($attrs as $aname => $avalue) {
|
$inst->$aname = $avalue;
|
||||||
$inst->$aname = $avalue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Record activated plugins for later display/config dump
|
// Record activated plugins for later display/config dump
|
||||||
|
@ -24,7 +24,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
|
|||||||
|
|
||||||
foreach (StatusNet::getActivePlugins() as $plugin=>$args) {
|
foreach (StatusNet::getActivePlugins() as $plugin=>$args) {
|
||||||
echo "$plugin: ";
|
echo "$plugin: ";
|
||||||
if ($args === null) {
|
if (empty($args)) {
|
||||||
echo "(no args)\n";
|
echo "(no args)\n";
|
||||||
} else {
|
} else {
|
||||||
foreach ($args as $arg => $val) {
|
foreach ($args as $arg => $val) {
|
||||||
|
Loading…
Reference in New Issue
Block a user