当前位置: 首页>>代码示例>>PHP>>正文


PHP Router::pathFor方法代码示例

本文整理汇总了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'));
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:8,代码来源:Index.php

示例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;
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:9,代码来源:Admin.php

示例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;
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:10,代码来源:Logged.php

示例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']);
 }
开发者ID:aimeos,项目名称:ai-slim,代码行数:14,代码来源:RouterTest.php

示例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'));
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:12,代码来源:Censoring.php

示例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();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:12,代码来源:Reports.php

示例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'));
     }
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:16,代码来源:Categories.php

示例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;
 }
开发者ID:featherbb,项目名称:private-messages,代码行数:16,代码来源:PrivateMessages.php

示例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();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:16,代码来源:Register.php

示例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'));
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:19,代码来源:Permissions.php

示例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();
 }
开发者ID:featherbb,项目名称:featherbb,代码行数:24,代码来源:Index.php

示例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 
开发者ID:beaver-dev,项目名称:featherbb-marketplace,代码行数:31,代码来源:create.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 
开发者ID:featherbb,项目名称:featherbb,代码行数:31,代码来源:section_essentials.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>
开发者ID:beaver-dev,项目名称:featherbb-marketplace,代码行数:31,代码来源:login.php

示例15: logout

 function logout($req, $res, $args)
 {
     AuthModel::feather_setcookie('', 1);
     return Router::redirect(Router::pathFor('home'));
 }
开发者ID:adaur,项目名称:featherbb-marketplace,代码行数:5,代码来源:AuthController.php


注:本文中的Router::pathFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。