本文整理汇总了PHP中plugin::load_tool方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::load_tool方法的具体用法?PHP plugin::load_tool怎么用?PHP plugin::load_tool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::load_tool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
// From this point we'll be able to use the full STK layout
$template->assign_var('S_STK_FULL_BODY', true);
// Perform some quick tasks here that require the user to be authenticated
perform_authed_quick_tasks($action);
// If they canceled redirect them to the STK index.
if (isset($_POST['cancel'])) {
redirect(append_sid(STK_INDEX, false, true, $user->session_id));
}
// Setup the plugin manager
$plugin = new plugin();
// Output common stuff
$template->assign_vars(array('U_ACTION' => append_sid(STK_INDEX, $plugin->url_arg(), true, $user->session_id), 'U_ADM_INDEX' => append_sid(PHPBB_ROOT_PATH . 'adm/index.' . PHP_EXT, false, true, $user->session_id), 'U_STK_INDEX' => append_sid(STK_INDEX, false, true, $user->session_id), 'U_STK_LOGOUT' => append_sid(STK_INDEX, 'action=stklogout', true, $user->session_id), 'U_BACK_TOOL' => $plugin->get_part('t') ? append_sid(STK_INDEX, $plugin->url_arg(), true, $user->session_id) : false, 'U_INDEX' => append_sid(PHPBB_ROOT_PATH . 'index.' . PHP_EXT), 'U_LOGOUT' => append_sid(PHPBB_ROOT_PATH . 'ucp.' . PHP_EXT, 'mode=logout', true, $user->session_id), 'USERNAME' => $user->data['username']));
// Does the user want to run a tool?
if ($plugin->get_part('t')) {
// Load the tool
$tool = $plugin->load_tool($plugin->get_part('c'), $plugin->get_part('t'));
// Can we use this tool?
if (method_exists($tool, 'tool_active')) {
if (($msg = $tool->tool_active()) !== true) {
if ($msg === false) {
$msg = $user->lang['TOOL_NOT_AVAILABLE'];
} else {
$msg = isset($user->lang[$msg]) ? $user->lang[$msg] : $msg;
}
trigger_error($msg);
}
}
$error = array();
if ($submit) {
// In run_tool do whatever is required. If there is an error, put it into the array and the display options will be ran again
$tool->run_tool($error);