本文整理匯總了PHP中CPGPluginAPI::install方法的典型用法代碼示例。如果您正苦於以下問題:PHP CPGPluginAPI::install方法的具體用法?PHP CPGPluginAPI::install怎麽用?PHP CPGPluginAPI::install使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CPGPluginAPI
的用法示例。
在下文中一共展示了CPGPluginAPI::install方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cpg_db_query
$result = cpg_db_query($sql);
// Shift the plugins up
$sql = 'UPDATE ' . $CONFIG['TABLE_PLUGINS'] . ' SET priority=priority-1 WHERE priority>' . $priority . ';';
$result = cpg_db_query($sql);
if ($CONFIG['log_mode']) {
log_write("Plugin '" . $name . "' uninstalled", CPG_GLOBAL_LOG);
}
}
}
break;
case 'install':
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
if ($CONFIG['enable_plugins']) {
$installed = CPGPluginAPI::install($p);
} else {
cpgRedirectPage('pluginmgr.php', $lang_pluginmgr_php['pmgr'], $lang_pluginmgr_php['plugin_disabled_note']);
}
break;
case 'delete':
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
$path = $p;
if (is_bool(strpos('/', $path))) {
cpg_folder_file_delete('./plugins/' . $path);
if ($CONFIG['log_mode']) {
log_write("Plugin '" . $path . "' deleted", CPG_GLOBAL_LOG);
}
}
示例2: switch
/**
* Plugin manager events
*
* Executes manager events
*/
$op = @$_GET['op'];
switch ($op) {
case 'uninstall':
$plugin_id = $_GET['p'];
if (!is_numeric($_GET['p'])) {
$plugin_id = CPGPluginAPI::installed($plugin_id);
}
$uninstalled = CPGPluginAPI::uninstall($plugin_id);
break;
case 'install':
$installed = CPGPluginAPI::install($_GET['p']);
break;
case 'delete':
$path = $_GET['p'];
if (is_bool(strpos('/', $path))) {
deldir('./plugins/' . $path);
}
break;
case 'moveu':
$thisplugin = @$CPG_PLUGINS[$_GET['p']];
if (isset($thisplugin) && ($priority = $thisplugin->priority) > 0) {
// Move the plugin above down
$sql = 'update ' . $CONFIG['TABLE_PLUGINS'] . ' set priority=' . $priority . ' where priority=' . ($priority - 1) . ';';
cpg_db_query($sql);
// Move this plugin up
$sql = 'update ' . $CONFIG['TABLE_PLUGINS'] . ' ' . 'set priority=' . ($priority - 1) . ' where plugin_id=' . $thisplugin->plugin_id . ';';