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


PHP modX::sendForward方法代码示例

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


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

示例1: route

 /**
  * Route the URL request based on the container IDs
  *
  * @return boolean
  */
 public function route()
 {
     $serverUri = $this->modx->request->parameters['REQUEST'];
     $qmt = $serverUri[$this->modx->getOption('request_param_alias')];
     // check to see there is a link rss comments
     if (preg_match("@comments-(.*?).rss@si", $qmt, $data)) {
         if (in_array($data[1], $this->aliasMap) && $data[0] == $qmt && $this->_hasConversations($data[1])) {
             $_REQUEST['comment'] = $data[1];
             $_REQUEST['rss'] = 'true';
             $this->modx->sendForward($data[1]);
         }
     }
     // check to see there is a link to a comment
     if (!preg_match("@/?comment-(.*?)-mt@si", $qmt, $data)) {
         return true;
     }
     $alias = str_replace($data[0], '', $qmt);
     $id = $alias === '/' ? $this->modx->getOption('site_start', 1) : $this->aliasMap[$alias];
     if ($id) {
         if (isset($data[1]) && $this->_hasConversations($id)) {
             if ($data[1] == 'last' || intval($data[1]) || date('Y-m', strtotime($data[1]))) {
                 $_REQUEST['comment'] = $data[1];
                 $this->modx->sendForward($id);
             }
         }
     }
     return true;
 }
开发者ID:jolichter,项目名称:modxTalks,代码行数:33,代码来源:modxtalksrouter.class.php

示例2: setRequest

 /**
  * Prepare the request parameters.
  *
  * @access public
  * @return void
  */
 public function setRequest()
 {
     $params = str_replace('.html', '', $this->urlParams);
     if ($this->regEx) {
         $params = preg_match($this->regEx, $params);
     } else {
         $params = explode('/', $params);
     }
     if (count($params) >= 1) {
         $setting = $this->requests[$this->alias];
         // set the request parameters
         foreach ($params as $key => $value) {
             if (isset($setting['urlParams'][$key])) {
                 $_REQUEST[$setting['urlParams'][$key]] = $value;
             } else {
                 $_REQUEST['p' . ($key + 1)] = $value;
             }
         }
     }
     $this->modx->sendForward($this->resourceId);
     return;
 }
开发者ID:vgrish,项目名称:CustomRequest,代码行数:28,代码来源:customrequest.class.php

示例3: sendForward

 /**
  * @param $id
  * @param null $options
  */
 public function sendForward($id, $options = null)
 {
     $this->modx->sendForward($id, $options);
 }
开发者ID:suasti,项目名称:pdoTools,代码行数:8,代码来源:_micromodx.php

示例4: route

 /**
  * Route the URL request based on the container IDs
  * @return boolean
  */
 public function route()
 {
     $containerIds = $this->modx->getOption('articles.container_ids', null, '');
     if (empty($containerIds)) {
         return false;
     }
     $containerIds = explode(',', $containerIds);
     /* handle redirects */
     $search = $_SERVER['REQUEST_URI'];
     $base_url = $this->modx->getOption('base_url');
     if ($base_url != '/') {
         $search = str_replace($base_url, '', $search);
     }
     $search = trim($search, '/');
     /* get resource to redirect to */
     $resourceId = false;
     $prefix = 'arc_';
     foreach ($containerIds as $archive) {
         $archive = explode(':', $archive);
         $archiveId = $archive[0];
         $alias = array_search($archiveId, $this->modx->aliasMap);
         if ($alias && strpos($search, $alias) !== false) {
             $search = str_replace($alias, '', $search);
             $resourceId = $archiveId;
             if (isset($archive[1])) {
                 $prefix = $archive[1];
             }
         }
     }
     if (!$resourceId) {
         return false;
     }
     /* figure out archiving */
     $params = explode('/', $search);
     if (count($params) < 1) {
         return false;
     }
     /* tag handling! */
     if ($params[0] == 'tags') {
         $_GET['tag'] = $params[1];
         /* author based */
     } else {
         if ($params[0] == 'user' || $params[0] == 'author') {
             $_GET[$prefix . 'author'] = $params[1];
             /* numeric "archives/1234" */
         } else {
             if ($params[0] == 'archives' && !empty($params[1])) {
                 $resourceId = intval(trim(trim($params[1]), '/'));
                 if (!empty($resourceId)) {
                     $this->modx->sendForward($resourceId);
                 }
                 /* normal yyyy/mm/dd or yyyy/mm */
             } else {
                 /* set Archivist parameters for date-based archives */
                 $_GET[$prefix . 'year'] = $params[0];
                 if (isset($params[1])) {
                     $_GET[$prefix . 'month'] = $params[1];
                 }
                 if (isset($params[2])) {
                     $_GET[$prefix . 'day'] = $params[2];
                 }
             }
         }
     }
     /* forward */
     $this->modx->sendForward($resourceId);
     return true;
 }
开发者ID:raadhuis,项目名称:modx-basic,代码行数:72,代码来源:articlesrouter.class.php

示例5: route

 /**
  * Route the URL request based on the container IDs
  * @return boolean
  */
 public function route()
 {
     $containerIds = $this->modx->getOption('articles.container_ids', null, '');
     if (empty($containerIds)) {
         return false;
     }
     $containerIds = explode(',', $containerIds);
     /* handle redirects */
     $search = $_SERVER['REQUEST_URI'];
     $base_url = $this->modx->getOption('base_url');
     if ($base_url != '/') {
         $search = str_replace($base_url, '', $search);
     }
     $search = trim($search, '/');
     /* get resource to redirect to */
     $resourceId = false;
     $prefix = 'arc_';
     foreach ($containerIds as $archive) {
         if (empty($archive)) {
             continue;
         }
         $archive = explode(':', $archive);
         $archiveId = $archive[0];
         if (method_exists($this->modx->context, 'getResourceURI')) {
             $alias = $this->modx->context->getResourceURI($archiveId);
         } else {
             $alias = is_array($this->modx->aliasMap) ? array_search($archiveId, $this->modx->aliasMap) : '';
         }
         if ($alias && $startPageId == $archiveId) {
             $startPageResId = $archiveId;
             if (isset($archive[1])) {
                 $startPagePrefix = $archive[1];
             }
         }
         if ($alias && strpos($search, $alias) === 0) {
             $search = substr($search, strlen($alias));
             $resourceId = $archiveId;
             if (isset($archive[1])) {
                 $prefix = $archive[1];
             }
         }
     }
     if (!$resourceId) {
         return false;
     }
     /* figure out archiving */
     $params = explode('/', $search);
     if (count($params) < 1) {
         return false;
     }
     /* tag handling! */
     if ($params[0] == 'tags') {
         $_REQUEST[$prefix . 'author'] = $_GET['tag'] = urldecode($params[1]);
         /* author based */
     } else {
         if ($params[0] == 'user' || $params[0] == 'author') {
             $_REQUEST[$prefix . 'author'] = $_GET[$prefix . 'author'] = urldecode($params[1]);
             /* numeric "archives/1234" */
         } else {
             if ($params[0] == 'archives' && !empty($params[1])) {
                 $resourceId = intval(trim(trim($params[1]), '/'));
                 if (!empty($resourceId)) {
                     $this->modx->sendForward($resourceId);
                 }
                 /* normal yyyy/mm/dd or yyyy/mm */
             } else {
                 /* set Archivist parameters for date-based archives */
                 if (is_numeric($params[0])) {
                     $_REQUEST[$prefix . 'year'] = $_GET[$prefix . 'year'] = $params[0];
                     if (isset($params[1]) && is_numeric($params[1])) {
                         $_REQUEST[$prefix . 'month'] = $_GET[$prefix . 'month'] = $params[1];
                     } else {
                         if (isset($params[1])) {
                             // Display the default 404 page if "month" is not a number
                             $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found');
                         }
                     }
                     if (isset($params[2]) && is_numeric($params[2])) {
                         $_REQUEST[$prefix . 'day'] = $_GET[$prefix . 'day'] = $params[2];
                     } else {
                         if (isset($params[2])) {
                             // Display the default 404 page if "day" is not a number
                             $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found');
                         }
                     }
                 } else {
                     // Display the default 404 page if nothing found
                     $this->modx->sendForward($this->modx->getOption('error_page'), 'HTTP/1.1 404 Not Found');
                 }
             }
         }
     }
     /* forward */
     $this->modx->sendForward($resourceId);
     return true;
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:100,代码来源:articlesrouter.class.php


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