Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-url-rewrite
Helper
UrlRewrite.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\UrlRewrite\Helper
;
7
8
class
UrlRewrite
extends
\Magento\Framework\App\Helper\AbstractHelper
9
{
13
const
VERR_MANYSLASHES
= 1;
14
15
// Too many slashes in a row of request path, e.g. '///foo//'
16
const
VERR_ANCHOR
= 2;
17
18
// Anchor is not supported in request path, e.g. 'foo#bar'
19
29
protected
function
_validateRequestPath
($requestPath)
30
{
31
if
(strpos($requestPath,
'//'
) !==
false
) {
32
throw
new \Exception(
33
__
(
'Do not use two or more consecutive slashes in the request path.'
),
34
self::VERR_MANYSLASHES
35
);
36
}
37
if
(strpos($requestPath,
'#'
) !==
false
) {
38
throw
new \Exception(
__
(
'Anchor symbol (#) is not supported in request path.'
), self::VERR_ANCHOR);
39
}
40
return
true
;
41
}
42
51
public
function
validateRequestPath
($requestPath)
52
{
53
try
{
54
$this->
_validateRequestPath
($requestPath);
55
}
catch
(\Exception $e) {
56
throw
new \Magento\Framework\Exception\LocalizedException(
__
($e->getMessage()));
57
}
58
return
true
;
59
}
60
69
public
function
validateSuffix
(
$suffix
)
70
{
71
try
{
72
// Suffix itself must be a valid request path
73
$this->
_validateRequestPath
(
$suffix
);
74
}
catch
(\Exception $e) {
75
// Make message saying about suffix, not request path
76
switch
($e->getCode()) {
77
case
self::VERR_MANYSLASHES
:
78
throw
new \Magento\Framework\Exception\LocalizedException(
79
__
(
'Do not use two or more consecutive slashes in the url rewrite suffix.'
)
80
);
81
case
self::VERR_ANCHOR
:
82
throw
new \Magento\Framework\Exception\LocalizedException(
83
__
(
'Anchor symbol (#) is not supported in url rewrite suffix.'
)
84
);
85
}
86
}
87
return
true
;
88
}
89
}
$suffix
$suffix
Definition:
name.phtml:27
__
__()
Definition:
__.php:13
Magento\UrlRewrite\Helper\UrlRewrite
Definition:
UrlRewrite.php:8
Magento\UrlRewrite\Helper\UrlRewrite\_validateRequestPath
_validateRequestPath($requestPath)
Definition:
UrlRewrite.php:29
Magento\UrlRewrite\Helper\UrlRewrite\validateRequestPath
validateRequestPath($requestPath)
Definition:
UrlRewrite.php:51
Magento\UrlRewrite\Helper\UrlRewrite\validateSuffix
validateSuffix($suffix)
Definition:
UrlRewrite.php:69
Magento\UrlRewrite\Helper\UrlRewrite\VERR_ANCHOR
const VERR_ANCHOR
Definition:
UrlRewrite.php:16
Magento\UrlRewrite\Helper\UrlRewrite\VERR_MANYSLASHES
const VERR_MANYSLASHES
Definition:
UrlRewrite.php:13
Magento\Framework\App\Helper\AbstractHelper
Definition:
AbstractHelper.php:13
Magento\UrlRewrite\Helper
Definition:
UrlRewrite.php:6