mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Merge pull request #306 from kijin/pr/plugin-blacklist
호환되지 않거나 불필요한 애드온과 모듈의 실행을 방지
This commit is contained in:
commit
4a79b5ce25
8 changed files with 79 additions and 21 deletions
|
|
@ -157,6 +157,11 @@ class Context
|
|||
*/
|
||||
public $isSuccessInit = TRUE;
|
||||
|
||||
/**
|
||||
* Plugin blacklist cache
|
||||
*/
|
||||
private static $_blacklist = null;
|
||||
|
||||
/**
|
||||
* Singleton instance
|
||||
* @var object
|
||||
|
|
@ -2566,6 +2571,26 @@ class Context
|
|||
return self::$_instance->allow_rewrite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an addon, module, or widget is blacklisted
|
||||
*
|
||||
* @param string $plugin_name
|
||||
* @return bool
|
||||
*/
|
||||
public static function isBlacklistedPlugin($plugin_name)
|
||||
{
|
||||
if (self::$_blacklist === null)
|
||||
{
|
||||
self::$_blacklist = (include RX_BASEDIR . 'common/defaults/blacklist.php');
|
||||
if (!is_array(self::$_blacklist))
|
||||
{
|
||||
self::$_blacklist = array();
|
||||
}
|
||||
}
|
||||
|
||||
return isset(self::$_blacklist[$plugin_name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a local path into an URL
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1191,6 +1191,12 @@ class ModuleHandler extends Handler
|
|||
$type = $item->type;
|
||||
$called_method = $item->called_method;
|
||||
|
||||
// do not call if module is blacklisted
|
||||
if (Context::isBlacklistedPlugin($module))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// todo why don't we call a normal class object ?
|
||||
$oModule = getModule($module, $type);
|
||||
if(!$oModule || !method_exists($oModule, $called_method))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue