本文整理汇总了PHP中gpPlugin::SetDataFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP gpPlugin::SetDataFolder方法的具体用法?PHP gpPlugin::SetDataFolder怎么用?PHP gpPlugin::SetDataFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gpPlugin
的用法示例。
在下文中一共展示了gpPlugin::SetDataFolder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateAddon
function UpdateAddon($addon)
{
if (!function_exists('OnTextChange')) {
return;
}
gpPlugin::SetDataFolder($addon);
OnTextChange();
gpPlugin::ClearDataFolder();
}
示例2: Autoload
/**
* Setup SPL Autoloading
*
*/
static function Autoload($class)
{
global $config;
$parts = explode('\\', $class);
$part_0 = array_shift($parts);
if (!$parts) {
return;
}
//look for addon namespace
if ($part_0 === 'Addon') {
$namespace = array_shift($parts);
if (!$parts) {
return;
}
foreach ($config['addons'] as $addon_key => $addon) {
if (isset($addon['Namespace']) && $addon['Namespace'] == $namespace) {
gpPlugin::SetDataFolder($addon_key);
$file = gpPlugin::$current['code_folder_full'] . '/' . implode('/', $parts) . '.php';
if (file_exists($file)) {
include $file;
} else {
trigger_error('Script not found in namespaced autoloader for ' . $class);
}
gpPlugin::ClearDataFolder();
}
}
}
}
示例3: ExecInfo
/**
* Execute a set of directives for theme areas, hooks and special pages
*
*/
static function ExecInfo($info, $args = array())
{
global $dataDir, $addonFolderName, $installed_addon, $config, $page, $gp_overwrite_scripts;
//addonDir is deprecated as of 2.0b3
if (isset($info['addonDir'])) {
if (gp_safe_mode) {
return;
}
gpPlugin::SetDataFolder($info['addonDir']);
} elseif (isset($info['addon'])) {
if (gp_safe_mode) {
return;
}
gpPlugin::SetDataFolder($info['addon']);
}
//if addon was just installed
if ($installed_addon && $installed_addon === $addonFolderName) {
gpPlugin::ClearDataFolder();
return $args;
}
// check for fatal errors
if (self::FatalNotice('exec', $info)) {
return $args;
}
//data
if (!empty($info['data'])) {
IncludeScript($dataDir . $info['data'], 'include_if', array('page', 'dataDir', 'langmessage'));
}
//script
$has_script = false;
if (isset($info['script'])) {
if (is_array($gp_overwrite_scripts) && isset($gp_overwrite_scripts[$info['script']])) {
$full_path = $gp_overwrite_scripts[$info['script']];
} else {
$full_path = $dataDir . $info['script'];
}
if (!file_exists($full_path)) {
$name =& $config['addons'][$addonFolderName]['name'];
trigger_error('gpEasy Error: Addon hook script doesn\'t exist. Script: ' . $info['script'] . ' Addon: ' . $name);
} elseif (IncludeScript($full_path, 'include_once', array('page', 'dataDir', 'langmessage'))) {
$has_script = true;
}
}
//class & method
if (!empty($info['class'])) {
if (class_exists($info['class'])) {
$object = new $info['class']($args);
if (!empty($info['method'])) {
if (method_exists($object, $info['method'])) {
$args[0] = call_user_func_array(array($object, $info['method']), $args);
} elseif ($has_script) {
trigger_error('gpEasy Error: Addon hook method doesn\'t exist. Script: ' . $info['method']);
}
}
} elseif ($has_script) {
$name =& $config['addons'][$addonFolderName]['name'];
trigger_error('gpEasy Error: Addon class doesn\'t exist. Class: ' . $info['class'] . ' Addon: ' . $name);
} else {
trigger_error('gpEasy Error: Addon class doesn\'t exist. Class: ' . $info['class']);
}
} elseif (!empty($info['method'])) {
$callback = $info['method'];
//object callbacks since gpEasy 3.0
if (is_string($callback) && strpos($callback, '->') !== false) {
$has_script = true;
list($object, $method) = explode('->', $callback);
if (isset($GLOBALS[$object]) && is_object($GLOBALS[$object]) && method_exists($GLOBALS[$object], $method)) {
$callback = array($GLOBALS[$object], $method);
}
}
if (is_callable($callback)) {
$args[0] = call_user_func_array($callback, $args);
$method_called = true;
} elseif ($has_script) {
$name =& $config['addons'][$addonFolderName]['name'];
trigger_error('gpEasy Error: Addon hook method doesn\'t exist. Script: ' . $info['method'] . ' Addon: ' . $name);
}
}
gpPlugin::ClearDataFolder();
gpOutput::PopCatchable();
return $args;
}
示例4: RunAdminScript
/**
* Find the requested admin script and execute it if the user has permissions to view it
*
*/
function RunAdminScript()
{
global $dataDir, $langmessage;
//resolve request for /Admin_Theme_Content if the request is for /Admin_Theme_Conent/1234
$parts = explode('/', $this->requested);
do {
$request_string = implode('/', $parts);
$scriptinfo = false;
$scripts = admin_tools::AdminScripts();
if (isset($scripts[$request_string])) {
$scriptinfo = $scripts[$request_string];
if (admin_tools::HasPermission($request_string)) {
if (isset($scriptinfo['addon'])) {
gpPlugin::SetDataFolder($scriptinfo['addon']);
}
admin_display::OrganizeFrequentScripts($request_string);
if (isset($scriptinfo['script'])) {
require $dataDir . $scriptinfo['script'];
}
if (isset($scriptinfo['class'])) {
new $scriptinfo['class']();
}
gpPlugin::ClearDataFolder();
return;
} else {
message($langmessage['not_permitted']);
$parts = array();
}
} elseif (count($scripts) > 0) {
//check case
$case_check = array_keys($scripts);
$case_check = array_combine($case_check, $case_check);
$case_check = array_change_key_case($case_check, CASE_LOWER);
$lower = strtolower($request_string);
if (isset($case_check[$lower])) {
$location = common::GetUrl($case_check[$lower], '', false);
common::Redirect($location);
}
}
//these are here because they should be available to everyone
switch ($request_string) {
case 'Admin_Browser':
includeFile('admin/admin_browser.php');
new admin_browser();
return;
case 'Admin_Preferences':
includeFile('admin/admin_preferences.php');
new admin_preferences();
return;
case 'Admin_About':
includeFile('admin/admin_about.php');
new admin_about();
return;
case 'Admin_Finder':
includeFile('thirdparty/elfinder/connector.php');
return;
}
} while (array_pop($parts));
$this->AdminPanel();
}
示例5: ExecInfo
/**
* Execute a set of directives for theme areas, hooks and special pages
*
*/
static function ExecInfo($info, $args = array())
{
global $addonFolderName, $installed_addon;
//addonDir is deprecated as of 2.0b3
if (isset($info['addonDir'])) {
if (gp_safe_mode) {
return;
}
gpPlugin::SetDataFolder($info['addonDir']);
} elseif (isset($info['addon'])) {
if (gp_safe_mode) {
return;
}
gpPlugin::SetDataFolder($info['addon']);
}
//if addon was just installed
if ($installed_addon && $installed_addon === $addonFolderName) {
gpPlugin::ClearDataFolder();
return $args;
}
// check for fatal errors
if (self::FatalNotice('exec', $info)) {
return $args;
}
$args = self::_ExecInfo($info, $args);
gpPlugin::ClearDataFolder();
gpOutput::PopCatchable();
return $args;
}
示例6: ClearDataFolder
/**
* Reset global path variables
*/
static function ClearDataFolder()
{
global $addonDataFolder, $addonCodeFolder;
//deprecated
global $addonRelativeCode, $addonRelativeData, $addonPathData, $addonPathCode, $addonFolderName, $addon_current_id, $addon_current_version;
self::$current = array();
$addonFolderName = false;
$addonDataFolder = false;
$addonCodeFolder = false;
$addonRelativeCode = $addonRelativeData = $addonPathData = $addonPathCode = $addon_current_id = $addon_current_version = false;
//Make the most recent addon folder or addon id in the stack the current addon
if (count(self::$stack) > 0) {
$info = array_pop(self::$stack);
if ($info['folder']) {
gpPlugin::SetDataFolder($info['folder']);
} elseif ($info['id']) {
$addon_current_id = $info['id'];
}
}
}
示例7: ExecInfo
function ExecInfo($info, $args = array())
{
global $dataDir, $addonFolderName, $installed_addon;
//addonDir is deprecated as of 2.0b3
if (isset($info['addonDir'])) {
gpPlugin::SetDataFolder($info['addonDir']);
} elseif (isset($info['addon'])) {
gpPlugin::SetDataFolder($info['addon']);
}
//if addon was just installed
if ($installed_addon && $installed_addon === $addonFolderName) {
gpPlugin::ClearDataFolder();
return $args;
}
//data
if (!empty($info['data']) && file_exists($dataDir . $info['data'])) {
include $dataDir . $info['data'];
}
//script
$has_script = false;
if (isset($info['script'])) {
if (file_exists($dataDir . $info['script'])) {
include_once $dataDir . $info['script'];
$has_script = true;
} else {
trigger_error('gpEasy Error: Addon hook script doesn\'t exist. Script: ' . $info['script']);
}
}
//class & method
if (!empty($info['class'])) {
if (class_exists($info['class'])) {
$object = new $info['class']($args);
if (!empty($info['method'])) {
if (method_exists($object, $info['method'])) {
$args[0] = call_user_func_array(array($object, $info['method']), $args);
} elseif ($has_script) {
trigger_error('gpEasy Error: Addon hook method doesn\'t exist. Script: ' . $info['method']);
}
}
} elseif ($has_script) {
trigger_error('gpEasy Error: Addon hook class doesn\'t exist. Script: ' . $info['class']);
}
} elseif (!empty($info['method'])) {
$callback = $info['method'];
//object callbacks since gpEasy 3.0
if (is_string($callback) && strpos($callback, '->') !== false) {
$has_script = true;
list($object, $method) = explode('->', $callback);
if (isset($GLOBALS[$object]) && method_exists($GLOBALS[$object], $method)) {
$callback = array($GLOBALS[$object], $method);
}
}
if (is_callable($callback)) {
$args[0] = call_user_func_array($callback, $args);
$method_called = true;
} elseif ($has_script) {
trigger_error('gpEasy Error: Addon hook method doesn\'t exist. Script: ' . $info['method']);
}
}
gpPlugin::ClearDataFolder();
return $args;
}
示例8: ExecInfo
function ExecInfo($scriptinfo)
{
global $dataDir;
ob_start();
if (isset($scriptinfo['addon'])) {
gpPlugin::SetDataFolder($scriptinfo['addon']);
}
if (isset($scriptinfo['script'])) {
require $dataDir . $scriptinfo['script'];
}
if (isset($scriptinfo['class'])) {
new $scriptinfo['class']();
//not passing any args to class, this is being used by special_missing.php
}
gpPlugin::ClearDataFolder();
return ob_get_clean();
}