Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
26330b93
Commit
26330b93
authored
Dec 26, 2013
by
Antonio Ramirez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed ascii method and use the new TransliteratorHelper::process at its place
parent
fc9fb80c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
59 deletions
+4
-59
BaseInflector.php
framework/yii/helpers/BaseInflector.php
+4
-59
No files found.
framework/yii/helpers/BaseInflector.php
View file @
26330b93
...
@@ -215,61 +215,6 @@ class BaseInflector
...
@@ -215,61 +215,6 @@ class BaseInflector
'wildebeest'
=>
'wildebeest'
,
'wildebeest'
=>
'wildebeest'
,
'Yengeese'
=>
'Yengeese'
,
'Yengeese'
=>
'Yengeese'
,
];
];
/**
* @var array map of special chars and its translation. This is used by [[slug()]].
*/
public
static
$transliteration
=
[
'/ä|æ|ǽ/'
=>
'ae'
,
'/ö|œ/'
=>
'oe'
,
'/ü/'
=>
'ue'
,
'/Ä/'
=>
'Ae'
,
'/Ü/'
=>
'Ue'
,
'/Ö/'
=>
'Oe'
,
'/À|Á|Â|Ã|Å|Ǻ|Ā|Ă|Ą|Ǎ/'
=>
'A'
,
'/à|á|â|ã|å|ǻ|ā|ă|ą|ǎ|ª/'
=>
'a'
,
'/Ç|Ć|Ĉ|Ċ|Č/'
=>
'C'
,
'/ç|ć|ĉ|ċ|č/'
=>
'c'
,
'/Ð|Ď|Đ/'
=>
'D'
,
'/ð|ď|đ/'
=>
'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ŵ/'
=>
'W'
,
'/ŵ/'
=>
'w'
,
'/Ź|Ż|Ž/'
=>
'Z'
,
'/ź|ż|ž/'
=>
'z'
,
'/Æ|Ǽ/'
=>
'AE'
,
'/ß/'
=>
'ss'
,
'/IJ/'
=>
'IJ'
,
'/ij/'
=>
'ij'
,
'/Œ/'
=>
'OE'
,
'/ƒ/'
=>
'f'
];
/**
/**
* Converts a word to its plural form.
* Converts a word to its plural form.
...
@@ -434,20 +379,20 @@ class BaseInflector
...
@@ -434,20 +379,20 @@ class BaseInflector
/**
/**
* Returns a string with all spaces converted to given replacement and
* Returns a string with all spaces converted to given replacement and
* non word characters removed. Maps special characters to ASCII using
* non word characters removed. Maps special characters to ASCII using
*
`Inflector::$transliteration`
*
[[TransliteratorHelper::process()]]
* @param string $string An arbitrary string to convert
* @param string $string An arbitrary string to convert
* @param string $replacement The replacement to use for spaces
* @param string $replacement The replacement to use for spaces
* @return string The converted string.
* @return string The converted string.
*/
*/
public
static
function
slug
(
$string
,
$replacement
=
'-'
)
public
static
function
slug
(
$string
,
$replacement
=
'-'
)
{
{
$map
=
static
::
$transliteration
+
[
$map
=
array
(
'/[^\w\s]/'
=>
' '
,
'/[^\w\s]/'
=>
' '
,
'/\\s+/'
=>
$replacement
,
'/\\s+/'
=>
$replacement
,
'/(?<=[a-z])([A-Z])/'
=>
$replacement
.
'\\1'
,
'/(?<=[a-z])([A-Z])/'
=>
$replacement
.
'\\1'
,
str_replace
(
':rep'
,
preg_quote
(
$replacement
,
'/'
),
'/^[:rep]+|[:rep]+$/'
)
=>
''
str_replace
(
':rep'
,
preg_quote
(
$replacement
,
'/'
),
'/^[:rep]+|[:rep]+$/'
)
=>
''
]
;
)
;
return
preg_replace
(
array_keys
(
$map
),
array_values
(
$map
),
$string
);
return
preg_replace
(
array_keys
(
$map
),
array_values
(
$map
),
TransliteratorHelper
::
process
(
$string
,
''
,
'en'
)
);
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment