👁 查看:opInstalledPluginManager.class.php
路径:/virtual/bigbrother/sns/lib/plugin/opInstalledPluginManager.class.php
大小:1.57 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/
error_reporting(error_reporting() & ~(E_STRICT | E_DEPRECATED));
/**
* opInstalledPluginManager allows you to manage installed OpenPNE plugins.
*
* @package OpenPNE
* @subpackage plugin
* @author Kousuke Ebihara <ebihara@tejimaya.com>
*/
class opInstalledPluginManager
{
public function getInstalledPlugins()
{
$result = array();
$plugins = sfContext::getInstance()->getConfiguration()->getAllOpenPNEPlugins();
foreach ($plugins as $pluginName)
{
$result[$pluginName] = $this->getPluginInstance($pluginName);
}
return $result;
}
public function getPluginInstance($plugin)
{
return opPlugin::getInstance($plugin);
}
static public function getAdminInviteAuthPlugins()
{
$plugins = sfContext::getInstance()->getConfiguration()->getEnabledAuthPlugin();
$plugins = array_unique($plugins);
$result = array();
foreach ($plugins as $pluginName)
{
$endPoint = strlen($pluginName) - strlen('opAuth') - strlen('Plugin');
$authMode = substr($pluginName, strlen('opAuth'), $endPoint);
$adapterClass = sfOpenPNESecurityUser::getAuthAdapterClassName($authMode);
$adapter = new $adapterClass($authMode);
if (!$adapter->getAuthConfig('admin_invite'))
{
continue;
}
$result[] = $authMode;
}
return $result;
}
}