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


PHP Zend_Controller_Request_Http::setBaseUrl方法代码示例

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


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

示例1: _addHomepageRoute

 /**
  * Adds the homepage route to the router (as specified by the navigation settings page)
  * The route will not be added if the user is currently on the admin theme.
  *
  * @param Zend_Controller_Router_Rewrite $router The router
  */
 private function _addHomepageRoute($router)
 {
     // Don't add the route if the user is on the admin theme
     if (!is_admin_theme()) {
         $homepageUri = get_option(Omeka_Form_Navigation::HOMEPAGE_URI_OPTION_NAME);
         $homepageUri = trim($homepageUri);
         $withoutAdminUri = $this->_leftTrim($this->_leftTrim($homepageUri, ADMIN_BASE_URL), '/' . ADMIN_WEB_DIR);
         if ($withoutAdminUri != $homepageUri) {
             // homepage uri is an admin link
             $homepageUri = WEB_ROOT . '/' . ADMIN_WEB_DIR . $withoutAdminUri;
             $this->addRedirectRouteForDefaultRoute(self::HOMEPAGE_ROUTE_NAME, $homepageUri, array(), $router);
         } else {
             // homepage uri is not an admin link
             // left trim root directory off of the homepage uri
             $homepageUri = $this->_leftTrim($homepageUri, PUBLIC_BASE_URL);
             // make sure the new homepage is not the default homepage
             if ($homepageUri == '' || $homepageUri == self::DEFAULT_ROUTE_NAME || $homepageUri == PUBLIC_BASE_URL) {
                 return;
             }
             $homepageRequest = new Zend_Controller_Request_Http();
             $homepageRequest->setBaseUrl(WEB_ROOT);
             // web root includes server and root directory
             $homepageRequest->setRequestUri($homepageUri);
             $router->route($homepageRequest);
             $dispatcher = Zend_Controller_Front::getInstance()->getDispatcher();
             if ($dispatcher->isDispatchable($homepageRequest)) {
                 // homepage is an internal link
                 $router->addRoute(self::HOMEPAGE_ROUTE_NAME, new Zend_Controller_Router_Route(self::DEFAULT_ROUTE_NAME, $homepageRequest->getParams()));
             } else {
                 // homepage is some external link or a broken internal link
                 $this->addRedirectRouteForDefaultRoute(self::HOMEPAGE_ROUTE_NAME, $homepageUri, array(), $router);
             }
         }
     }
 }
开发者ID:kwiliarty,项目名称:Omeka,代码行数:41,代码来源:Router.php

示例2: _initRequest

 protected function _initRequest(array $options = array())
 {
     // Ensure front controller instance is present, and fetch it
     $this->bootstrap('FrontController');
     $front = $this->getResource('FrontController');
     // Initialize the request object
     $request = new Zend_Controller_Request_Http();
     $request->setBaseUrl(dirname($_SERVER['SCRIPT_NAME']));
     // Add it to the front controller
     $front->setRequest($request);
     //$front->addControllerDirectory(APPLICATION_PATH . '/modules/forum/controllers', 'forum');
     // Bootstrap will store this value in the 'request' key of its container
     return $request;
 }
开发者ID:neogriffon,项目名称:queroeventos,代码行数:14,代码来源:Bootstrap.php

示例3: urlFor

 /**
  * Return the URL
  *
  * @param string|array $urlOptions
  * @param string       $name
  * @param bool         $reset
  * @param bool         $encode
  * @return string
  */
 public function urlFor($urlOptions, $name = null, $reset = false, $encode = true)
 {
     $front = Zend_Controller_Front::getInstance();
     $router = $front->getRouter();
     if (is_string($urlOptions)) {
         $urlOptions = '/' . ltrim($urlOptions, '/');
         // Case the first character is a '?
         $request = new Zend_Controller_Request_Http();
         // Creates a cleaned instance of request http
         $request->setBaseUrl($front->getBaseUrl());
         $request->setRequestUri($urlOptions);
         $route = $router->route($request);
         // Return the request route with params modifieds
         $urlOptions = $route->getParams();
         /*var_dump($route->getParams());
           die();*/
     }
     return $router->assemble((array) $urlOptions, $name, $reset, $encode);
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:28,代码来源:UrlFor.php

示例4: testSetBaseUrl

 public function testSetBaseUrl()
 {
     $this->_request->setBaseUrl('/news');
     $this->assertEquals('/news', $this->_request->getBaseUrl());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:5,代码来源:HttpTest.php

示例5: testSetGotoUrlWithBaseUrlUsingPrependBaseOption

 public function testSetGotoUrlWithBaseUrlUsingPrependBaseOption()
 {
     $this->request->setBaseUrl('/my');
     $this->redirector->setGotoUrl('/foo/bar', array('prependBase' => true));
     $this->assertEquals('/my/foo/bar', $this->redirector->getRedirectUrl());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:RedirectorTest.php

示例6: testPathInfoShouldRespectNonEncodedRequestUri

 /**
  * @group ZF-3527
  */
 public function testPathInfoShouldRespectNonEncodedRequestUri()
 {
     $request = new Zend_Controller_Request_Http();
     $request->setBaseUrl('~user');
     $_SERVER['REQUEST_URI'] = '~user/module/controller/action';
     $pathInfo = $request->getPathInfo();
     $this->assertEquals('/module/controller/action', $pathInfo, $pathInfo);
 }
开发者ID:nbcutech,项目名称:o3drupal,代码行数:11,代码来源:HttpTest.php

示例7: dirname

/**
 * @package     Engine_Core
 * @version     $Id: mobile.php 7539 2010-10-04 04:41:38Z john $
 * @copyright   Copyright (c) 2008 Webligo Developments
 * @license     http://www.socialengine.net/license/
 */
$_GET['m'] = 'mobile';
// Trick main loader
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'index.php';
$application->bootstrap();
// Return site info
if (empty($_REQUEST['action'])) {
    $site = Engine_Api::_()->getApi('settings', 'core')->getSetting('core.general.site');
    $info = array('site' => $site);
    echo Zend_Json::encode($info);
    exit;
}
// Parse action param
$action = preg_replace('/[^a-zA-Z0-9\\/_-]/', '', $_GET['action']);
$action = explode('/', $action);
if (count($action) != 2 && count($action) != 3) {
    echo Zend_Json::encode(array('error' => true, 'core' => 404));
    exit;
}
$action = join('/', $action);
// Dispatch
$front = Zend_Controller_Front::getInstance();
//$front->setBaseUrl($front->getBaseUrl().'/index.php');
$request = new Zend_Controller_Request_Http('http://' . $_SERVER['HTTP_HOST'] . $front->getBaseUrl() . '/' . $action);
$request->setBaseUrl($front->getBaseUrl());
$front->dispatch($request);
开发者ID:robeendey,项目名称:ce,代码行数:31,代码来源:mobile.php

示例8: _initRequest

	/**
	 *
	 */
    protected function _initRequest()
    {
        // Ensure the front controller is initialized
        $this->bootstrap('FrontController');
 
        // Retrieve the front controller from the bootstrap registry
        $front = $this->getResource('FrontController');

        $request = new Zend_Controller_Request_Http();
        $request->setBaseUrl('/');
        $front->setRequest($request);
 
        // Ensure the request is stored in the bootstrap registry
        return $request;
    }
开发者ID:roxtaz,项目名称:EvidPac,代码行数:18,代码来源:Bootstrap.php

示例9: testSetPathInfoShouldNotStripBaseUrlIfBaseUrlNotInRequestUri

 /**
  * @group ZF-9091
  */
 public function testSetPathInfoShouldNotStripBaseUrlIfBaseUrlNotInRequestUri()
 {
     $request = new Zend_Controller_Request_Http();
     $request->setBaseUrl('/app');
     $_SERVER['REQUEST_URI'] = '/index/index';
     $pathInfo = $request->getPathInfo();
     $this->assertEquals('/index/index', $pathInfo);
 }
开发者ID:travisj,项目名称:zf,代码行数:11,代码来源:HttpTest.php

示例10: myUrl

    /**

     * Return the URL

     *

     * @param string|array $urlOptions

     * @param string       $name

     * @param bool         $reset

     * @param bool         $encode

     * @return string

     */
    public function myUrl($urlOptions = array(), $name = null, $reset = false, $encode = true)
    {
        $front = Zend_Controller_Front::getInstance();
        $router = $front->getRouter();
        $extraUrlOptions = array();
        $extraOptions = Zend_Controller_Front::getInstance()->getRequest()->getParams();
        if (count($extraOptions)) {
            foreach ($extraOptions as $key => $value) {
                if ($key != 'module' && $key != 'controller' && $key != 'action') {
                    $extraUrlOptions[] = $key . '=' . ($encode ? urlencode($value) : $value);
                }
            }
        }
        if (is_string($urlOptions)) {
            $urlOptions = '/' . ltrim($urlOptions, '/');
            // Case the first character is ?
            $request = new Zend_Controller_Request_Http();
            // Creates a cleaned instance of request http
开发者ID:agenciaaeh,项目名称:kahina,代码行数:35,代码来源:MyUrl.php


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