本文整理汇总了PHP中plugins::perform_action方法的典型用法代码示例。如果您正苦于以下问题:PHP plugins::perform_action方法的具体用法?PHP plugins::perform_action怎么用?PHP plugins::perform_action使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugins
的用法示例。
在下文中一共展示了plugins::perform_action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ws_plugins_performAction
/**
* API method
* Performs an action on a plugin
* @param mixed[] $params
* @option string action
* @option string plugin
* @option string pwg_token
*/
function ws_plugins_performAction($params, $service)
{
global $template;
if (get_pwg_token() != $params['pwg_token']) {
return new PwgError(403, 'Invalid security token');
}
define('IN_ADMIN', true);
include_once PHPWG_ROOT_PATH . 'admin/include/plugins.class.php';
$plugins = new plugins();
$errors = $plugins->perform_action($params['action'], $params['plugin']);
if (!empty($errors)) {
return new PwgError(500, $errors);
} else {
if (in_array($params['action'], array('activate', 'deactivate'))) {
$template->delete_compiled_templates();
}
return true;
}
}
示例2: elseif
} elseif (null != pwg_get_session_var('plugins_show_details')) {
$show_details = pwg_get_session_var('plugins_show_details');
} else {
$show_details = false;
}
$base_url = get_root_url() . 'admin.php?page=' . $page['page'];
$pwg_token = get_pwg_token();
$action_url = $base_url . '&plugin=' . '%s' . '&pwg_token=' . $pwg_token;
$plugins = new plugins();
//--------------------------------------------------perform requested actions
if (isset($_GET['action']) and isset($_GET['plugin'])) {
if (!is_webmaster()) {
$page['errors'][] = l10n('Webmaster status is required.');
} else {
check_pwg_token();
$page['errors'] = $plugins->perform_action($_GET['action'], $_GET['plugin']);
if (empty($page['errors'])) {
if ($_GET['action'] == 'activate' or $_GET['action'] == 'deactivate') {
$template->delete_compiled_templates();
$persistent_cache->purge(true);
}
redirect($base_url);
}
}
}
//--------------------------------------------------------Incompatible Plugins
if (isset($_GET['incompatible_plugins'])) {
$incompatible_plugins = array();
foreach ($plugins->get_incompatible_plugins() as $plugin => $version) {
if ($plugin == '~~expire~~') {
continue;
示例3: activate_core_plugins
/**
* Automatically activate some core plugins
*/
function activate_core_plugins()
{
include_once PHPWG_ROOT_PATH . 'admin/include/plugins.class.php';
$plugins = new plugins();
foreach ($plugins->fs_plugins as $plugin_id => $fs_plugin) {
if (in_array($plugin_id, array('TakeATour'))) {
$plugins->perform_action('activate', $plugin_id);
}
}
}