本文整理汇总了PHP中plugin::dir方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::dir方法的具体用法?PHP plugin::dir怎么用?PHP plugin::dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::dir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPluginInstance
public static function getPluginInstance($plugin = null, $params = array(), $instance_id = null, $load_controller = false)
{
if (isset(self::$_instances[$plugin]) && is_object(self::$_instances[$plugin])) {
return self::$_instances[$plugin];
}
if (!isset(self::$_instances_exist[$plugin])) {
$plugin_class = 'plugin_' . $plugin;
eval('class ' . $plugin_class . ' extends plugin {}');
self::$_instances_exist[$plugin] = $plugin_class;
} else {
$plugin_class = self::$_instances_exist[$plugin];
}
if (!isset(self::$_instances[$plugin]) || !is_object(self::$_instances[$plugin])) {
$ajax = ajax();
if (!isset($params[1])) {
self::$_loading_prefix = $plugin;
$_plugin = self::$_instances[$plugin] = new $plugin_class();
$_plugin->params = array();
if (!is_null($instance_id)) {
$_plugin->_id = $instance_id;
$_plugin->id = $instance_id;
self::$_instances_ids[$plugin][$instance_id] = $instance_id;
}
$_plugin->dir = self::dir($plugin);
$_plugin->loading = $plugin;
self::$_loading_prefix = null;
} else {
$args = array();
$params = $params[1];
$_params = range('a', 'f');
foreach ($_params as $k => $v) {
$args[$v] = current($params);
if ($k >= count($params)) {
$args[$v] = null;
} else {
next($params);
}
}
extract($args);
self::$_loading_prefix = $plugin;
$_plugin = self::$_instances[$plugin] = new $plugin_class($a, $b, $c, $d, $e, $f);
$_plugin->params = $params;
if (!is_null($instance_id)) {
$_plugin->_id = $instance_id;
$_plugin->id = $instance_id;
self::$_instances_ids[$plugin][$instance_id] = $instance_id;
}
$_plugin->dir = plugin::dir($plugin);
$_plugin->loading = $plugin;
self::$_loading_prefix = null;
}
} else {
$_plugin = self::$_instances[$plugin];
}
$dir = plugin::dir($plugin) . $_plugin->controllers_dir;
$_plugin->xml = $ajax->xmlObject($instance_id);
$_plugin->controllers_dir = $dir;
$_plugin->controller_file = $dir . "/{$plugin}.php";
$_plugin->loading = $plugin;
return $_plugin;
}