Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Zend_Uri Class Reference

Public Member Functions

 __toString ()
 
 getScheme ()
 
 getUri ()
 
 valid ()
 

Static Public Member Functions

static check ($uri)
 
static factory ($uri='http', $className=null)
 
static setConfig ($config)
 

Protected Member Functions

 __construct ($scheme, $schemeSpecific='')
 

Protected Attributes

 $_scheme = ''
 

Static Protected Attributes

static $_config
 

Detailed Description

Definition at line 30 of file Uri.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $scheme,
  $schemeSpecific = '' 
)
abstractprotected

Zend_Uri and its subclasses cannot be instantiated directly. Use Zend_Uri::factory() to return a new Zend_Uri object.

Parameters
string$schemeThe scheme of the URI
string$schemeSpecificThe scheme-specific part of the URI

Member Function Documentation

◆ __toString()

__toString ( )

Return a string representation of this URI.

See also
getUri()
Returns
string

Definition at line 54 of file Uri.php.

55  {
56  try {
57  return $this->getUri();
58  } catch (Exception $e) {
59  trigger_error($e->getMessage(), E_USER_WARNING);
60  return '';
61  }
62  }

◆ check()

static check (   $uri)
static

Convenience function, checks that a $uri string is well-formed by validating it but not returning an object. Returns TRUE if $uri is a well-formed URI, or FALSE otherwise.

Parameters
string$uriThe URI to check
Returns
boolean

Definition at line 72 of file Uri.php.

73  {
74  try {
75  $uri = self::factory($uri);
76  } catch (Exception $e) {
77  return false;
78  }
79 
80  return $uri->valid();
81  }
static factory($uri='http', $className=null)
Definition: Uri.php:96

◆ factory()

static factory (   $uri = 'http',
  $className = null 
)
static

Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.

Parameters
string$uriThe URI form which a Zend_Uri instance is created
string$classNameThe name of the class to use in order to manipulate URI
Exceptions
Zend_Uri_ExceptionWhen an empty string was supplied for the scheme
Zend_Uri_ExceptionWhen an illegal scheme is supplied
Zend_Uri_ExceptionWhen the scheme is not supported
Zend_Uri_ExceptionWhen $className doesn't exist or doesn't implements Zend_Uri
Returns
Zend_Uri http://www.faqs.org/rfcs/rfc2396.html

Create a new Zend_Uri object for the $uri. If a subclass of Zend_Uri exists for the scheme, return an instance of that class. Otherwise, a Zend_Uri_Exception is thrown.

Definition at line 96 of file Uri.php.

97  {
98  // Separate the scheme from the scheme-specific parts
99  $uri = explode(':', $uri, 2);
100  $scheme = strtolower($uri[0]);
101  $schemeSpecific = isset($uri[1]) === true ? $uri[1] : '';
102 
103  if (strlen($scheme) === 0) {
104  #require_once 'Zend/Uri/Exception.php';
105  throw new Zend_Uri_Exception('An empty string was supplied for the scheme');
106  }
107 
108  // Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
109  if (ctype_alnum($scheme) === false) {
110  #require_once 'Zend/Uri/Exception.php';
111  throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
112  }
113 
114  if ($className === null) {
119  switch ($scheme) {
120  case 'http':
121  // Break intentionally omitted
122  case 'https':
123  $className = 'Zend_Uri_Http';
124  break;
125 
126  case 'mailto':
127  // TODO
128  default:
129  #require_once 'Zend/Uri/Exception.php';
130  throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
131  break;
132  }
133  }
134 
135  #require_once 'Zend/Loader.php';
136  try {
138  } catch (Exception $e) {
139  #require_once 'Zend/Uri/Exception.php';
140  throw new Zend_Uri_Exception("\"$className\" not found");
141  }
142 
143  $schemeHandler = new $className($scheme, $schemeSpecific);
144 
145  if (! $schemeHandler instanceof Zend_Uri) {
146  #require_once 'Zend/Uri/Exception.php';
147  throw new Zend_Uri_Exception("\"$className\" is not an instance of Zend_Uri");
148  }
149 
150  return $schemeHandler;
151  }
static loadClass($class, $dirs=null)
Definition: Loader.php:52
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31

◆ getScheme()

getScheme ( )

Get the URI's scheme

Returns
string|false Scheme or false if no scheme is set.

Definition at line 158 of file Uri.php.

159  {
160  if (empty($this->_scheme) === false) {
161  return $this->_scheme;
162  } else {
163  return false;
164  }
165  }
$_scheme
Definition: Uri.php:37

◆ getUri()

getUri ( )
abstract

Return a string representation of this URI.

Returns
string

◆ setConfig()

static setConfig (   $config)
static

Set global configuration options

Parameters
Zend_Config | array$config

Definition at line 172 of file Uri.php.

173  {
174  if ($config instanceof Zend_Config) {
175  $config = $config->toArray();
176  } elseif (!is_array($config)) {
177  throw new Zend_Uri_Exception("Config must be an array or an instance of Zend_Config.");
178  }
179 
180  foreach ($config as $k => $v) {
181  self::$_config[$k] = $v;
182  }
183  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$config
Definition: fraud_order.php:17

◆ valid()

valid ( )
abstract

Returns TRUE if this URI is valid, or FALSE otherwise.

Returns
boolean

Field Documentation

◆ $_config

$_config
staticprotected
Initial value:
= array(
'allow_unwise' => false
)

Definition at line 44 of file Uri.php.

◆ $_scheme

$_scheme = ''
protected

Definition at line 37 of file Uri.php.


The documentation for this class was generated from the following file: