本文整理匯總了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);