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,
|
||||
),
|
||||
'default' => array(
|
||||
'Activity' => null,
|
||||
'Bookmark' => null,
|
||||
'ClientSideShorten' => null,
|
||||
'Event' => null,
|
||||
'OpenID' => null,
|
||||
'Poll' => null,
|
||||
'QnA' => null,
|
||||
'SearchSub' => null,
|
||||
'TagSub' => null,
|
||||
'Activity' => array(),
|
||||
'Bookmark' => array(),
|
||||
'ClientSideShorten' => array(),
|
||||
'Event' => array(),
|
||||
'OpenID' => array(),
|
||||
'Poll' => array(),
|
||||
'QnA' => array(),
|
||||
'SearchSub' => array(),
|
||||
'TagSub' => array(),
|
||||
),
|
||||
'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
|
||||
'server' => null,
|
||||
|
|
|
@ -95,7 +95,7 @@ require_once(INSTALLDIR.'/lib/language.php');
|
|||
require_once(INSTALLDIR.'/lib/event.php');
|
||||
require_once(INSTALLDIR.'/lib/plugin.php');
|
||||
|
||||
function addPlugin($name, $attrs = null)
|
||||
function addPlugin($name, array $attrs=array())
|
||||
{
|
||||
return StatusNet::addPlugin($name, $attrs);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class StatusNet
|
|||
*
|
||||
* @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);
|
||||
|
||||
|
@ -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();
|
||||
if (!empty($attrs)) {
|
||||
foreach ($attrs as $aname => $avalue) {
|
||||
$inst->$aname = $avalue;
|
||||
}
|
||||
foreach ($attrs as $aname => $avalue) {
|
||||
$inst->$aname = $avalue;
|
||||
}
|
||||
|
||||
// Record activated plugins for later display/config dump
|
||||
|
|
|
@ -24,7 +24,7 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
|
|||
|
||||
foreach (StatusNet::getActivePlugins() as $plugin=>$args) {
|
||||
echo "$plugin: ";
|
||||
if ($args === null) {
|
||||
if (empty($args)) {
|
||||
echo "(no args)\n";
|
||||
} else {
|
||||
foreach ($args as $arg => $val) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user