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


PHP FrontController::getRequest方法代码示例

本文整理汇总了PHP中FrontController::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP FrontController::getRequest方法的具体用法?PHP FrontController::getRequest怎么用?PHP FrontController::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FrontController的用法示例。


在下文中一共展示了FrontController::getRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _subscribe

 protected function _subscribe(Statement $st, stdClass $user)
 {
     $request = FrontController::getRequest();
     if (!$request->getClean('subscribe')) {
         return;
     }
     $st->addSubscriber($user);
 }
开发者ID:dautushenka,项目名称:DLE-Statement,代码行数:8,代码来源:SubscribeEvent.php

示例2: PageNavigation

 public function PageNavigation($route, $count_all, $per_page, array $options = array())
 {
     $default_options = array();
     $options = array_merge($default_options, $options);
     $request = FrontController::getRequest();
     $page = $request->getClean('page');
     if ((int) $page <= 0) {
         $page = 1;
     }
     $i = $per_page * $page > $count_all ? $count_all : $per_page * $page;
     $this->_tpl->load_template('navigation.tpl');
     $vars = array();
     $blocks = array();
     $no_prev = false;
     $no_next = false;
     $cstart = ((int) $page - 1) * $per_page;
     if (isset($cstart) and $cstart != "" and $cstart > 0) {
         $prev = $cstart / $per_page;
         if ($prev > 1) {
             $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $prev));
         } else {
             $page_url = FrontController::getURLByRoute($route);
         }
         $blocks['prev-link'] = "<a href=\"" . $page_url . "\">\\1</a>";
     } else {
         $no_prev = TRUE;
     }
     if ($per_page) {
         if ($count_all > $per_page) {
             $enpages_count = @ceil($count_all / $per_page);
             $pages = "";
             $cstart = $cstart / $per_page + 1;
             if ($enpages_count <= 10) {
                 for ($j = 1; $j <= $enpages_count; $j++) {
                     if ($j > 1) {
                         $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $j));
                     } else {
                         $page_url = FrontController::getURLByRoute($route);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
             } else {
                 $start = 1;
                 $end = 10;
                 $nav_prefix = "... ";
                 if ($cstart > 0) {
                     if ($cstart > 5) {
                         $start = $cstart - 4;
                         $end = $start + 8;
                         if ($end >= $enpages_count) {
                             $start = $enpages_count - 9;
                             $end = $enpages_count - 1;
                             $nav_prefix = "";
                         } else {
                             $nav_prefix = "... ";
                         }
                     }
                 }
                 if ($start >= 2) {
                     $pages .= "<a href=\"" . FrontController::getURLByRoute($route) . "\">1</a> ... ";
                 }
                 for ($j = $start; $j <= $end; $j++) {
                     if ($j > 1) {
                         $page_url = FrontController::getURLByRoute($route . "_pages", array('page' => $j));
                     } else {
                         $page_url = FrontController::getURLByRoute($route);
                     }
                     if ($j != $cstart) {
                         $pages .= "<a href=\"" . $page_url . "\">{$j}</a> ";
                     } else {
                         $pages .= "<span>{$j}</span> ";
                     }
                 }
                 if ($cstart != $enpages_count) {
                     $pages .= $nav_prefix . "<a href=\"" . FrontController::getURLByRoute($route . "_pages", array('page' => $enpages_count)) . "\">{$enpages_count}</a>";
                 } else {
                     $pages .= "<span>{$enpages_count}</span> ";
                 }
             }
         }
         $vars['pages'] = $pages;
     }
     if ($per_page and $per_page < $count_all and $i < $count_all) {
         $next_page = @floor($i / $per_page) + 1;
         $blocks['next-link'] = "<a href=\"" . FrontController::getURLByRoute($route . "_pages", array('page' => $next_page)) . "\">\\1</a>";
     } else {
         $no_next = TRUE;
     }
     if (!$no_prev or !$no_next) {
         $this->_fillTmpl($vars, $blocks);
         return $this->_compile('PageNavigation');
     }
     return '';
 }
开发者ID:dautushenka,项目名称:DLE-Statement,代码行数:98,代码来源:Views.php

示例3: foreach

if (floatval(phpversion()) < 5.4) {
    if (!get_magic_quotes_gpc()) {
        if (isset($_POST)) {
            foreach ($_POST as $key => $value) {
                if (is_array($value)) {
                    $value = implode(',', $value);
                }
                $_POST[$key] = trim(addslashes($value));
            }
        }
        if (isset($_GET)) {
            foreach ($_GET as $key => $value) {
                $_GET[$key] = trim(addslashes($value));
            }
        }
    }
}
//Add the required libraries
require_once APP_PATH . "libraries/Error.class.php";
require_once APP_PATH . "libraries/Router.php";
require_once APP_PATH . "libraries/BaseController.class.php";
require_once APP_PATH . "libraries/FrontController.class.php";
require_once APP_PATH . "libraries/Doctrine.class.php";
// initialize the doctrine
Doctrine::initialize();
// create a new instance of FrontController
$frontController = new FrontController($_GET);
$request = $frontController->getRequest();
// router and execute the action
$router = new Router($request);
$router->dispatchAndExecute();
开发者ID:jackbob2,项目名称:jackbob,代码行数:31,代码来源:bootstrap.php


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