Namespaces

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

Classes

  • Ftp
  • Html
  • HttpContext
  • HttpRequest
  • HttpResponse
  • HttpUploadedFile
  • Session
  • SessionNamespace
  • Uri
  • UriScript
  • User

Interfaces

  • IHttpRequest
  • IHttpResponse
  • IUser

Exceptions

  • FtpException
  • Overview
  • Namespace
  • 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:  */
 11: 
 12: namespace Nette\Web;
 13: 
 14: use Nette;
 15: 
 16: 
 17: 
 18: /**
 19:  * Extended HTTP URL.
 20:  *
 21:  * <pre>
 22:  *                 basePath   relativeUri
 23:  *                    |           |
 24:  *                 /-----\/------------------\
 25:  * https://nette.org/admin/script.php/pathinfo/?name=param#fragment
 26:  *                 \_______________/\________/
 27:  *                        |              |
 28:  *                   scriptPath       pathInfo
 29:  * </pre>
 30:  *
 31:  * - basePath:    /admin/ (everything before relative URI not including the script name)
 32:  * - baseUri:     https://nette.org/admin/
 33:  * - scriptPath:  /admin/script.php
 34:  * - relativeUri: script.php/pathinfo/
 35:  * - pathInfo:    /pathinfo/ (additional path information)
 36:  *
 37:  * @author     David Grudl
 38:  *
 39:  * @property   string $scriptPath
 40:  * @property-read string $basePath
 41:  * @property-read string $baseUri
 42:  * @property-read string $relativeUri
 43:  * @property-read string $pathInfo
 44:  */
 45: class UriScript extends Uri
 46: {
 47:     /** @var string */
 48:     private $scriptPath = '';
 49: 
 50: 
 51: 
 52:     /**
 53:      * Sets the script-path part of URI.
 54:      * @param  string
 55:      * @return UriScript  provides a fluent interface
 56:      */
 57:     public function setScriptPath($value)
 58:     {
 59:         $this->updating();
 60:         $this->scriptPath = (string) $value;
 61:         return $this;
 62:     }
 63: 
 64: 
 65: 
 66:     /**
 67:      * Returns the script-path part of URI.
 68:      * @return string
 69:      */
 70:     public function getScriptPath()
 71:     {
 72:         return $this->scriptPath;
 73:     }
 74: 
 75: 
 76: 
 77:     /**
 78:      * Returns the base-path.
 79:      * @return string
 80:      */
 81:     public function getBasePath()
 82:     {
 83:         return (string) substr($this->scriptPath, 0, strrpos($this->scriptPath, '/') + 1);
 84:     }
 85: 
 86: 
 87: 
 88:     /**
 89:      * Returns the base-URI.
 90:      * @return string
 91:      */
 92:     public function getBaseUri()
 93:     {
 94:         return $this->scheme . '://' . $this->getAuthority() . $this->getBasePath();
 95:     }
 96: 
 97: 
 98: 
 99:     /**
100:      * Returns the relative-URI.
101:      * @return string
102:      */
103:     public function getRelativeUri()
104:     {
105:         return (string) substr($this->path, strrpos($this->scriptPath, '/') + 1);
106:     }
107: 
108: 
109: 
110:     /**
111:      * Returns the additional path information.
112:      * @return string
113:      */
114:     public function getPathInfo()
115:     {
116:         return (string) substr($this->path, strlen($this->scriptPath));
117:     }
118: 
119: }
120: 
Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0