本文整理汇总了PHP中Router::pathFor方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::pathFor方法的具体用法?PHP Router::pathFor怎么用?PHP Router::pathFor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Router
的用法示例。
在下文中一共展示了Router::pathFor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: markread
public function markread()
{
Container::get('hooks')->fire('controller.index.markread');
Auth::set_last_visit(User::get()->id, User::get()->logged);
// Reset tracked topics
Track::set_tracked_topics(null);
return Router::redirect(Router::pathFor('home'), __('Mark read redirect'));
}
示例2: __invoke
public function __invoke($request, $response, $next)
{
// Redirect user to home page if not admin
if (User::get()->g_id != ForumEnv::get('FEATHER_ADMIN')) {
return Router::redirect(Router::pathFor('home'), __('No permission'));
}
$response = $next($request, $response);
return $response;
}
示例3: __invoke
public function __invoke($request, $response, $next)
{
// Redirect user to login page if not logged
if (User::get()->is_guest) {
// throw new Error(__('No permission'), 403);
return Router::redirect(Router::pathFor('login'));
}
$response = $next($request, $response);
return $response;
}
示例4: testPathForRouteNotExists
/**
* @expectedException \RuntimeException
*/
public function testPathForRouteNotExists()
{
$methods = ['GET'];
$pattern = '/hello/{first}/{last}';
$callable = function ($request, $response, $args) {
echo sprintf('Hello %s %s', $args['first'], $args['last']);
};
$route = $this->router->map($methods, $pattern, $callable);
$route->setName('foo');
$this->router->pathFor('bar', ['first' => 'josh', 'last' => 'lockhart']);
}
示例5: remove_word
public function remove_word()
{
$id = intval(key(Input::post('remove')));
$id = Container::get('hooks')->fire('model.admin.censoring.remove_censoring_word_start', $id);
$result = DB::for_table('censoring')->find_one($id);
$result = Container::get('hooks')->fireDB('model.admin.censoring.remove_censoring_word', $result);
$result = $result->delete();
// Regenerate the censoring cache
Container::get('cache')->store('search_for', Cache::get_censoring('search_for'));
Container::get('cache')->store('replace_with', Cache::get_censoring('replace_with'));
return Router::redirect(Router::pathFor('adminCensoring'), __('Word removed redirect'));
}
示例6: display
public function display($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.reports.display');
// Zap a report
if (Request::isPost()) {
$zap_id = intval(key(Input::post('zap_id')));
$this->model->zap_report($zap_id);
return Router::redirect(Router::pathFor('adminReports'), __('Report zapped redirect'));
}
AdminUtils::generateAdminMenu('reports');
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Reports')), 'active_page' => 'admin', 'admin_console' => true, 'report_data' => $this->model->get_reports(), 'report_zapped_data' => $this->model->get_zapped_reports()))->addTemplate('admin/reports.php')->display();
}
示例7: delete
public function delete($req, $res, $args)
{
Container::get('hooks')->fire('controller.admin.categories.delete');
$cat_to_delete = (int) Input::post('cat_to_delete');
if ($cat_to_delete < 1) {
throw new Error(__('Bad request'), '400');
}
if (intval(Input::post('disclaimer')) != 1) {
return Router::redirect(Router::pathFor('adminCategories'), __('Delete category not validated'));
}
if ($this->model->delete_category($cat_to_delete)) {
return Router::redirect(Router::pathFor('adminCategories'), __('Category deleted redirect'));
} else {
return Router::redirect(Router::pathFor('adminCategories'), __('Unable to delete category'));
}
}
示例8: addNavlink
public function addNavlink($navlinks)
{
translate('private_messages', 'private-messages');
if (!User::get()->is_guest) {
$nbUnread = Model\PrivateMessages::countUnread(User::get()->id);
$count = $nbUnread > 0 ? ' (' . $nbUnread . ')' : '';
$navlinks[] = '4 = <a href="' . Router::pathFor('Conversations.home') . '">PMS' . $count . '</a>';
if ($nbUnread > 0) {
Container::get('hooks')->bind('header.toplist', function ($toplists) {
$toplists[] = '<li class="reportlink"><span><strong><a href="' . Router::pathFor('Conversations.home', ['inbox_id' => 1]) . '">' . __('Unread messages', 'private_messages') . '</a></strong></span></li>';
return $toplists;
});
}
}
return $navlinks;
}
示例9: rules
public function rules($req, $res, $args)
{
Container::get('hooks')->fire('controller.register.rules');
// If we are logged in, we shouldn't be here
if (!User::get()->is_guest) {
return Router::redirect(Router::pathFor('home'));
}
// Display an error message if new registrations are disabled
if (ForumSettings::get('o_regs_allow') == '0') {
throw new Error(__('No new regs'), 403);
}
if (ForumSettings::get('o_rules') != '1') {
return Router::redirect(Router::pathFor('register'));
}
View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Register'), __('Forum rules')), 'active_page' => 'register'))->addTemplate('register/rules.php')->display();
}
示例10: update_permissions
public function update_permissions()
{
$form = array_map('intval', Input::post('form'));
$form = Container::get('hooks')->fire('model.admin.permissions.update_permissions.form', $form);
foreach ($form as $key => $input) {
// Make sure the input is never a negative value
if ($input < 0) {
$input = 0;
}
// Only update values that have changed
if (array_key_exists('p_' . $key, Container::get('forum_settings')) && ForumSettings::get('p_' . $key) != $input) {
DB::for_table('config')->where('conf_name', 'p_' . $key)->update_many('conf_value', $input);
}
}
// Regenerate the config cache
Container::get('cache')->store('config', Cache::get_config());
// $this->clear_feed_cache();
return Router::redirect(Router::pathFor('adminPermissions'), __('Perms updated redirect'));
}
示例11: display
public function display($req, $res, $args)
{
if (!isset($args['action'])) {
$args['action'] = null;
}
Container::get('hooks')->fire('controller.admin.index.display');
// Check for upgrade
if ($args['action'] == 'check_upgrade') {
if (!ini_get('allow_url_fopen')) {
throw new Error(__('fopen disabled message'), 500);
}
$latest_version = trim(@file_get_contents('http://featherbb.org/latest_version.html'));
if (empty($latest_version)) {
throw new Error(__('Upgrade check failed message'), 500);
}
if (version_compare(ForumSettings::get('o_cur_version'), $latest_version, '>=')) {
return Router::redirect(Router::pathFor('adminIndex'), __('Running latest version message'));
} else {
return Router::redirect(Router::pathFor('adminIndex'), sprintf(__('New version available message'), '<a href="http://featherbb.org/">FeatherBB.org</a>'));
}
}
AdminUtils::generateAdminMenu('index');
return View::setPageInfo(array('title' => array(Utils::escape(ForumSettings::get('o_board_title')), __('Admin'), __('Index')), 'active_page' => 'admin', 'admin_console' => true))->addTemplate('admin/index.php')->display();
}
示例12:
<?php
}
?>
</ul>
</div>
</div>
</div>
<?php
}
?>
<div id="postform" class="blockform">
<h2><span>Submit new theme</span></h2>
<div class="box">
<form id="form" action="<?php
echo Router::pathFor('themes.create');
?>
" method="post">
<input type="hidden" name="csrf_name" value="<?php
echo $csrf_name;
?>
">
<input type="hidden" name="csrf_value" value="<?php
echo $csrf_value;
?>
">
<?php
include '_form.php';
?>
</form>
<strong><?php
示例13: _e
<br /></label>
<?php
}
?>
</div>
</fieldset>
</div>
<div class="inform">
<fieldset>
<legend><?php
_e('User activity');
?>
</legend>
<div class="infldset">
<p><?php
printf(__('Registered info'), Utils::format_time($user['registered'], true) . (User::get()->is_admmod ? ' (<a href="' . Router::pathFor('usersIpShow', ['ip' => $user['registration_ip']]) . '">' . Utils::escape($user['registration_ip']) . '</a>)' : ''));
?>
</p>
<p><?php
printf(__('Last post info'), Utils::format_time($user['last_post']));
?>
</p>
<p><?php
printf(__('Last visit info'), Utils::format_time($user['last_visit']));
?>
</p>
<?php
echo $user_disp['posts_field'];
if (User::get()->is_admmod) {
?>
<label><?php
示例14:
<div class="blockform">
<h2><span>Login</span></h2>
<div class="box">
<form id="login" method="post" action="<?php
echo Router::pathFor('login');
?>
">
<input type="hidden" name="csrf_name" value="<?php
echo $csrf_name;
?>
">
<input type="hidden" name="csrf_value" value="<?php
echo $csrf_value;
?>
">
<div class="inform">
<fieldset>
<legend>Enter your username and password below</legend>
<div class="infldset">
<input type="hidden" name="form_sent" value="1" />
<label class="conl required"><strong>Username <span>(Required)</span></strong><br /><input type="text" name="req_username" size="25" maxlength="25" tabindex="1" /><br /></label>
<label class="conl required"><strong>Password <span>(Required)</span></strong><br /><input type="password" name="req_password" size="25" tabindex="2" /><br /></label>
<div class="rbox clearb">
<label><input type="checkbox" name="save_pass" value="1" tabindex="3" />Log me in automatically each time I visit.<br /></label>
</div>
<p class="clearb">Please provide the credentials used when registering to FeatherBB forum.</p>
<p class="actions"><span><a href="http://forums.featherbb.org/register/agree/" tabindex="5" target="_blank">Not registered yet?</a></span></p>
</div>
</fieldset>
示例15: logout
function logout($req, $res, $args)
{
AuthModel::feather_setcookie('', 1);
return Router::redirect(Router::pathFor('home'));
}