本文整理匯總了PHP中CPGPluginAPI::uninstall方法的典型用法代碼示例。如果您正苦於以下問題:PHP CPGPluginAPI::uninstall方法的具體用法?PHP CPGPluginAPI::uninstall怎麽用?PHP CPGPluginAPI::uninstall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CPGPluginAPI
的用法示例。
在下文中一共展示了CPGPluginAPI::uninstall方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: switch
// initialize
$installed = false;
// initialize
$op = @$superCage->get->getAlpha('op');
$p = @$superCage->get->getEscaped('p');
switch ($op) {
case 'uninstall':
if (!checkFormToken()) {
cpg_die(ERROR, $lang_errors['invalid_form_token'], __FILE__, __LINE__);
}
$plugin_id = $p;
if ($CONFIG['enable_plugins'] == 1) {
if (!is_numeric($p)) {
$plugin_id = CPGPluginAPI::installed($plugin_id);
}
$uninstalled = CPGPluginAPI::uninstall($plugin_id);
} else {
$query = 'SELECT * FROM ' . $CONFIG['TABLE_PLUGINS'] . ' WHERE plugin_id=' . $plugin_id . ' LIMIT 1;';
$result = cpg_db_query($query);
$installed_plugin = mysql_fetch_assoc($result);
if ($installed_plugin) {
$priority = $installed_plugin['priority'];
$name = $installed_plugin['name'];
$sql = 'DELETE FROM ' . $CONFIG['TABLE_PLUGINS'] . ' ' . 'WHERE plugin_id=' . $plugin_id . ';';
$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);
}