Packages

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • NFtp
  • NHtml
  • NHttpContext
  • NHttpRequest
  • NHttpResponse
  • NHttpUploadedFile
  • NSession
  • NSessionNamespace
  • NUri
  • NUriScript
  • NUser

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • NFtpException
  • Overview
  • Package
  • Class
  • Tree
  • Other releases
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (https://nette.org)
  5:  *
  6:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
  7:  *
  8:  * For the full copyright and license information, please view
  9:  * the file license.txt that was distributed with this source code.
 10:  * @package Nette\Web
 11:  */
 12: 
 13: 
 14: 
 15: /**
 16:  * Extended HTTP URL.
 17:  *
 18:  * <pre>
 19:  *                 basePath   relativeUri
 20:  *                    |           |
 21:  *                 /-----\/------------------\
 22:  * https://nette.org/admin/script.php/pathinfo/?name=param#fragment
 23:  *                 \_______________/\________/
 24:  *                        |              |
 25:  *                   scriptPath       pathInfo
 26:  * </pre>
 27:  *
 28:  * - basePath:    /admin/ (everything before relative URI not including the script name)
 29:  * - baseUri:     https://nette.org/admin/
 30:  * - scriptPath:  /admin/script.php
 31:  * - relativeUri: script.php/pathinfo/
 32:  * - pathInfo:    /pathinfo/ (additional path information)
 33:  *
 34:  * @author     David Grudl
 35:  *
 36:  * @property   string $scriptPath
 37:  * @property-read string $basePath
 38:  * @property-read string $baseUri
 39:  * @property-read string $relativeUri
 40:  * @property-read string $pathInfo
 41:  * @package Nette\Web
 42:  */
 43: class NUriScript extends NUri
 44: {
 45:     /** @var string */
 46:     private $scriptPath = '';
 47: 
 48: 
 49: 
 50:     /**
 51:      * Sets the script-path part of URI.
 52:      * @param  string
 53:      * @return NUriScript  provides a fluent interface
 54:      */
 55:     public function setScriptPath($value)
 56:     {
 57:         $this->updating();
 58:         $this->scriptPath = (string) $value;
 59:         return $this;
 60:     }
 61: 
 62: 
 63: 
 64:     /**
 65:      * Returns the script-path part of URI.
 66:      * @return string
 67:      */
 68:     public function getScriptPath()
 69:     {
 70:         return $this->scriptPath;
 71:     }
 72: 
 73: 
 74: 
 75:     /**
 76:      * Returns the base-path.
 77:      * @return string
 78:      */
 79:     public function getBasePath()
 80:     {
 81:         return (string) substr($this->scriptPath, 0, strrpos($this->scriptPath, '/') + 1);
 82:     }
 83: 
 84: 
 85: 
 86:     /**
 87:      * Returns the base-URI.
 88:      * @return string
 89:      */
 90:     public function getBaseUri()
 91:     {
 92:         return $this->scheme . '://' . $this->getAuthority() . $this->getBasePath();
 93:     }
 94: 
 95: 
 96: 
 97:     /**
 98:      * Returns the relative-URI.
 99:      * @return string
100:      */
101:     public function getRelativeUri()
102:     {
103:         return (string) substr($this->path, strrpos($this->scriptPath, '/') + 1);
104:     }
105: 
106: 
107: 
108:     /**
109:      * Returns the additional path information.
110:      * @return string
111:      */
112:     public function getPathInfo()
113:     {
114:         return (string) substr($this->path, strlen($this->scriptPath));
115:     }
116: 
117: }
118: 
Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0