本文整理汇总了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 . ';';