本文整理匯總了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;
}