PHP 클래스 URLify
Handles symbols from Latin languages, Greek, Turkish, Bulgarian, Russian,
Ukrainian, Czech, Polish, Romanian, Latvian, Lithuanian, Vietnamese, Arabic,
Serbian, and Azerbaijani. Symbols it cannot transliterate
it will simply omit.
Usage:
echo URLify::filter (' J\'étudie le français ');
"jetudie-le-francais"
echo URLify::filter ('Lo siento, no hablo español.');
"lo-siento-no-hablo-espanol"
파일 보기
프로젝트 열기: jbroadway/urlify
1 사용 예제들
공개 프로퍼티들
공개 메소드들
메소드 |
설명 |
|
add_chars ( $map ) |
Add new characters to the list. $map should be a hash. |
|
downcode ( $text, $language = "" ) |
Transliterates characters to their ASCII equivalents. |
|
filter ( string $text, integer $length = 60, string $language = "", boolean $file_name = false, boolean $use_remove_list = true, boolean $lower_case = true, boolean $treat_underscore_as_space = true ) |
Filters a string, e.g., "Petty theft" to "petty-theft" |
|
remove_words ( $words ) |
Append words to the remove list. Accepts either single words
or an array of words. |
|
transliterate ( $text ) |
Alias of URLify::downcode(). |
|
비공개 메소드들
메소드 |
설명 |
|
init ( $language = "" ) |
Initializes the character map. |
|
메소드 상세
Add new characters to the list. $map should be a hash.
$language specifies a priority for a specific language.
The latter is useful if languages have different rules for the same character.
public static downcode ( $text, $language = "" ) |
Filters a string, e.g., "Petty theft" to "petty-theft"
public static filter ( string $text, integer $length = 60, string $language = "", boolean $file_name = false, boolean $use_remove_list = true, boolean $lower_case = true, boolean $treat_underscore_as_space = true ) |
$text |
string |
The text to return filtered |
$length |
integer |
The length (after filtering) of the string to be returned |
$language |
string |
The transliteration language, passed down to downcode() |
$file_name |
boolean |
Whether there should be and additional filter considering this is a filename |
$use_remove_list |
boolean |
Whether you want to remove specific elements previously set in self::$remove_list |
$lower_case |
boolean |
Whether you want the filter to maintain casing or lowercase everything (default) |
$treat_underscore_as_space |
boolean |
Treat underscore as space, so it will replaced with "-" |
remove_words()
공개 정적인 메소드
Append words to the remove list. Accepts either single words
or an array of words.
transliterate()
공개 정적인 메소드
Alias of URLify::downcode().
프로퍼티 상세
$remove_list 공개적으로 정적으로 프로퍼티
List of words to remove from URLs.
public static $remove_list |