本文整理汇总了PHP中mb_eregi_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_eregi_replace函数的具体用法?PHP mb_eregi_replace怎么用?PHP mb_eregi_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mb_eregi_replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: urlnicify
static function urlnicify($url, $id = '')
{
if ('' == $url) {
return $url;
}
$url = trim($url);
$url = strip_tags($url);
$url = filter_text($url);
$temp = explode("/", $url);
$url = $temp[count($temp) - 1];
$url = preg_replace('|[^a-z0-9-~+_. #=&;,/:]|i', '', $url);
$url = str_replace('/', '', $url);
$url = str_replace(' ', '-', $url);
$url = str_replace('&', '', $url);
$url = str_replace("'", "", $url);
$url = str_replace(';//', '://', $url);
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
$url = strtolower($url);
//Últims canvis
$url = trim(mb_eregi_replace("[^ A-Za-z0-9_-]", "", $url));
$url = mb_eregi_replace("[ \t\n\r]+", "-", $url);
$url = mb_eregi_replace("[ -]+", "-", $url);
$url = trim($url, '-');
if ($id == '') {
return $url;
}
return $url . "-" . $id;
}
示例2: display_text
function display_text($string)
{
$string = mb_eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);
$string = mb_eregi_replace("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\\.)+[a-z]{2}([zmuvtg]|fo|me)?\$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);
$string = mb_eregi_replace("\n", "<br>", $string);
return $string;
}
示例3: do_inline
function do_inline($page, $param1, $param2)
{
$id = htmlspecialchars(trim($param1));
$html = convert_inline($param2, $page->getpagename());
$str = mb_eregi_replace('(?:<a\\s.*?>|</a>)', '', $html);
return "<a href=\"#{$id}\">" . $str . '</a>';
}
示例4: checkAccessConstraint
/**
* If access to the WFS conf is restricted, modify the filter.
* TODO: this function is also in mod_wfs_result!! Maybe merge someday.
*/
function checkAccessConstraint($filter, $wfs_conf_id)
{
/* wfs_conf_element */
$sql = "SELECT * FROM wfs_conf_element ";
$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
$sql .= "WHERE wfs_conf_element.fkey_wfs_conf_id = \$1 ";
$sql .= "ORDER BY wfs_conf_element.f_respos";
$v = array($wfs_conf_id);
$t = array('i');
$res = db_prep_query($sql, $v, $t);
while ($row = db_fetch_array($res)) {
if (!empty($row["f_auth_varname"])) {
$auth_varname = $row["f_auth_varname"];
$element_name = $row["element_name"];
}
}
if (!empty($auth_varname)) {
if (isValidVarName($auth_varname)) {
$user = eval("return " . $auth_varname . ";");
if ($user) {
$pattern = "(<ogc:Filter[^>]*>)(.*)(</ogc:Filter>)";
$replacement = "\\1<And>\\2<ogc:PropertyIsEqualTo><ogc:PropertyName>" . $element_name . "</ogc:PropertyName><ogc:Literal>" . $user . "</ogc:Literal></ogc:PropertyIsEqualTo></And>\\3";
$filter = mb_eregi_replace($pattern, $replacement, $filter);
} else {
$e = new mb_exception("mod_wfsGazetteerEditor_server: checkAccessConstraint: invalid value of variable containing user information!");
}
} else {
$e = new mb_exception("mod_wfsGazetteerEditor_server: checkAccessConstraint: var name is not valid! (" . $auth_varname . ")");
}
}
return $filter;
}
示例5: onCompress
public function onCompress(CompressionEvent $event)
{
if (!$event->isSafeToContinue()) {
return;
}
$event->setContent(mb_eregi_replace($this->getPattern(), '\\1\\2', $event->getContent()));
}
示例6: do_translit
function do_translit($st)
{
$replacement = array("й" => "i", "ц" => "c", "у" => "u", "к" => "k", "е" => "e", "н" => "n", "г" => "g", "ш" => "sh", "щ" => "sh", "з" => "z", "х" => "x", "ъ" => "\\'", "ф" => "f", "ы" => "i", "в" => "v", "а" => "a", "п" => "p", "р" => "r", "о" => "o", "л" => "l", "д" => "d", "ж" => "zh", "э" => "ie", "ё" => "e", "я" => "ya", "ч" => "ch", "с" => "c", "м" => "m", "и" => "i", "т" => "t", "ь" => "\\'", "б" => "b", "ю" => "yu", "Й" => "I", "Ц" => "C", "У" => "U", "К" => "K", "Е" => "E", "Н" => "N", "Г" => "G", "Ш" => "SH", "Щ" => "SH", "З" => "Z", "Х" => "X", "Ъ" => "\\'", "Ф" => "F", "Ы" => "I", "В" => "V", "А" => "A", "П" => "P", "Р" => "R", "О" => "O", "Л" => "L", "Д" => "D", "Ж" => "ZH", "Э" => "IE", "Ё" => "E", "Я" => "YA", "Ч" => "CH", "С" => "C", "М" => "M", "И" => "I", "Т" => "T", "Ь" => "\\'", "Б" => "B", "Ю" => "YU");
foreach ($replacement as $i => $u) {
$st = mb_eregi_replace($i, $u, $st);
}
return $st;
}
示例7: FirstLetters
function FirstLetters($string)
{
$n = preg_split('/[ -]/', $string);
foreach ($n as &$v) {
$v = mb_eregi_replace('^(.).+', '\\1', $v);
}
return implode('', $n);
}
示例8: cyrillicToLatin
/**
* Translit text from cyrillic to latin letters.
* @static
* @param string $text the text being translit.
* @return string
*/
protected static function cyrillicToLatin($text)
{
$matrix = array("й" => "i", "ц" => "c", "у" => "u", "к" => "k", "е" => "e", "н" => "n", "г" => "g", "ш" => "sh", "щ" => "sh", "з" => "z", "х" => "h", "ъ" => "\\'", "ф" => "f", "ы" => "i", "в" => "v", "а" => "a", "п" => "p", "р" => "r", "о" => "o", "л" => "l", "д" => "d", "ж" => "zh", "э" => "ie", "ё" => "e", "я" => "ya", "ч" => "ch", "с" => "s", "м" => "m", "и" => "i", "т" => "t", "ь" => "\\'", "б" => "b", "ю" => "yu", "Й" => "I", "Ц" => "C", "У" => "U", "К" => "K", "Е" => "E", "Н" => "N", "Г" => "G", "Ш" => "SH", "Щ" => "SH", "З" => "Z", "Х" => "X", "Ъ" => "\\'", "Ф" => "F", "Ы" => "I", "В" => "V", "А" => "A", "П" => "P", "Р" => "R", "О" => "O", "Л" => "L", "Д" => "D", "Ж" => "ZH", "Э" => "IE", "Ё" => "E", "Я" => "YA", "Ч" => "CH", "С" => "S", "М" => "M", "И" => "I", "Т" => "T", "Ь" => "\\'", "Б" => "B", "Ю" => "YU", "«" => "", "»" => "", " " => "_");
foreach ($matrix as $from => $to) {
$text = mb_eregi_replace($from, $to, $text);
}
return $text;
}
示例9: _strs
function _strs($string) { #Conversion charactere à la con =>pour req sql
$string=str_replace('\\', '\\\\', $string); #caractere protégé \\
#$string=eregi_replace("'", "\\'", $string); #caractere protégé \'
#$string=eregi_replace('"', "\\'", $string); #caractere protégé \"
$string=mb_eregi_replace("'", "\\'", $string); #caractere protégé \'
$string=mb_eregi_replace('"', "\\'", $string); #caractere protégé \"
return $string;
}
示例10: SlugHelperUrl
public function SlugHelperUrl($text)
{
$matrix = array("й" => "i", "ц" => "c", "у" => "u", "к" => "k", "е" => "e", "н" => "n", "г" => "g", "ш" => "sh", "щ" => "sh", "з" => "z", "х" => "h", "ъ" => "\\'", "ф" => "f", "ы" => "i", "в" => "v", "а" => "a", "п" => "p", "р" => "r", "о" => "o", "л" => "l", "д" => "d", "ж" => "zh", "э" => "ie", "ё" => "e", "я" => "ya", "ч" => "ch", "с" => "s", "м" => "m", "и" => "i", "т" => "t", "ь" => "\\'", "б" => "b", "ю" => "yu", "і" => "i", "ї" => "i", "Й" => "I", "Ц" => "C", "У" => "U", "К" => "K", "Е" => "E", "Н" => "N", "Г" => "G", "Ш" => "SH", "Щ" => "SH", "З" => "Z", "Х" => "X", "Ъ" => "\\'", "Ф" => "F", "Ы" => "I", "В" => "V", "А" => "A", "П" => "P", "Р" => "R", "О" => "O", "Л" => "L", "Д" => "D", "Ж" => "ZH", "Э" => "IE", "Ё" => "E", "Я" => "YA", "Ч" => "CH", "С" => "S", "М" => "M", "И" => "I", "Т" => "T", "Ь" => "\\'", "Б" => "B", "Ю" => "YU", "І" => "I", "Ї" => "I", "«" => "", "»" => "", " " => "-");
foreach ($matrix as $from => $to) {
$text = mb_eregi_replace($from, $to, $text);
}
$text = preg_replace('/[^A-Za-z0-9_\\-]/', '', $text);
return trim(strtolower($text));
}
示例11: getSharedModelUploads
public static function getSharedModelUploads($model, $primary, $key)
{
$files = self::getModelUploads($model, $primary, $key);
$len = mb_strlen(DOCROOT);
foreach ($files as $key => $file) {
$files[$key] = DIRECTORY_SEPARATOR . mb_substr($file, $len);
$files[$key] = mb_eregi_replace('\\\\', '/', $files[$key]);
}
return $files;
}
示例12: do_inline
function do_inline($page, $param1, $param2)
{
$url = SCRIPTURL . '?' . htmlspecialchars($param1);
if (trim($param2) == '') {
$alias = htmlspecialchars($url);
} else {
$alias = mb_eregi_replace('(?:<a\\s.*?>|</a>)', '', convert_inline($param2, $page->getpagename()));
}
return "<a href=\"{$url}\">{$alias}</a>";
}
示例13: file_upload
function file_upload($options)
{
if (!isset($_FILES[$options->key])) {
if ($options->is_critical) {
throw new Exception("\$_FILES[{$options->key}] isn't set!");
}
return;
}
$file = $_FILES[$options->key];
if ($file["error"]) {
if ($options->is_critical) {
throw new Exception("<a href=\"http://www.php.net/manual/en/features.file-upload.errors.php\">Error {$file["error"]}!</a>");
}
return;
}
$pathinfo = pathinfo($file["name"]);
$filename = $pathinfo["filename"];
$extension = isset($pathinfo["extension"]) ? $pathinfo["extension"] : "";
$filename = mb_eregi_replace("[^a-z0-9_\\-]", "-", $filename);
$extension = strtolower($extension);
foreach ($options->extensions as &$value) {
$value = strtolower($value);
}
if (!in_array($extension, $options->extensions)) {
if ($options->is_critical) {
throw new Exception("Unexpected file extension {$extension}!");
}
return;
}
if ($options->neoname) {
$pathinfo = pathinfo($options->neoname);
$neoname = $pathinfo["filename"];
} else {
$neoname = $filename;
}
$newname = "{$neoname}.{$extension}";
if (file_exists($options->dir . $newname)) {
$suff = 0;
$newname = "{$neoname}.0.{$extension}";
while (file_exists($options->dir . $newname)) {
$suff++;
$newname = "{$neoname}.{$suff}.{$extension}";
}
}
$uploadfile = $options->dir . $newname;
if (!move_uploaded_file($file['tmp_name'], $uploadfile)) {
if ($options->is_critical) {
throw new Exception("Cannot move uploaded file!");
}
return;
}
chmod($uploadfile, $options->rights);
return $newname;
}
示例14: make
/**
* Generate a URL friendly "slug" from a given Cyrillic string.
*
* @param string $title
* @param string $separator
* @return string
*/
function make($title, $separator = '-')
{
$matrix = array('ü' => 'ue', 'ö' => 'oe', 'ß' => 'ss', 'ä' => 'ae', 'Ü' => 'Ue', 'Ö' => 'Oe', 'Š' => 'Ss', 'Ä' => 'Ae');
foreach ($matrix as $from => $to) {
$title = mb_eregi_replace($from, $to, $title);
}
$title = preg_replace('![^' . preg_quote($separator) . '\\pL\\pN\\s]+!u', '', mb_strtolower($title));
$flip = $separator == '-' ? '_' : '-';
$title = preg_replace('![' . preg_quote($flip) . ']+!u', $separator, $title);
$title = preg_replace('![' . preg_quote($separator) . '\\s]+!u', $separator, $title);
return trim($title, $separator);
}
示例15: make
/**
* Generate a URL friendly "slug" from a given Cyrillic string.
*
* @param string $title
* @param string $separator
* @return string
*/
public function make($title, $separator = '-')
{
$matrix = array('й' => 'i', 'ц' => 'c', 'у' => 'u', 'к' => 'k', 'е' => 'e', 'н' => 'n', 'г' => 'g', 'ш' => 'sh', 'щ' => 'shch', 'з' => 'z', 'х' => 'h', 'ъ' => '', 'ф' => 'f', 'ы' => 'y', 'в' => 'v', 'а' => 'a', 'п' => 'p', 'р' => 'r', 'о' => 'o', 'л' => 'l', 'д' => 'd', 'ж' => 'zh', 'э' => 'e', 'ё' => 'e', 'я' => 'ya', 'ч' => 'ch', 'с' => 's', 'м' => 'm', 'и' => 'i', 'т' => 't', 'ь' => '', 'б' => 'b', 'ю' => 'yu', 'ү' => 'u', 'қ' => 'k', 'ғ' => 'g', 'ә' => 'e', 'ң' => 'n', 'ұ' => 'u', 'ө' => 'o', 'Һ' => 'h', 'һ' => 'h', 'і' => 'i', 'ї' => 'ji', 'є' => 'je', 'ґ' => 'g', 'Й' => 'I', 'Ц' => 'C', 'У' => 'U', 'Ұ' => 'U', 'Ө' => 'O', 'К' => 'K', 'Е' => 'E', 'Н' => 'N', 'Г' => 'G', 'Ш' => 'SH', 'Ә' => 'E', 'Ң ' => 'N', 'З' => 'Z', 'Х' => 'H', 'Ъ' => '', 'Ф' => 'F', 'Ы' => 'Y', 'В' => 'V', 'А' => 'A', 'П' => 'P', 'Р' => 'R', 'О' => 'O', 'Л' => 'L', 'Д' => 'D', 'Ж' => 'ZH', 'Э' => 'E', 'Ё' => 'E', 'Я' => 'YA', 'Ч' => 'CH', 'С' => 'S', 'М' => 'M', 'И' => 'I', 'Т' => 'T', 'Ь' => '', 'Б' => 'B', 'Ю' => 'YU', 'Ү' => 'U', 'Қ' => 'K', 'Ғ' => 'G', 'Щ' => 'SHCH', 'І' => 'I', 'Ї' => 'YI', 'Є' => 'YE', 'Ґ' => 'G');
foreach ($matrix as $from => $to) {
$title = mb_eregi_replace($from, $to, $title);
}
$title = preg_replace('![^' . preg_quote($separator) . '\\pL\\pN\\s]+!u', '', mb_strtolower($title));
$flip = $separator == '-' ? '_' : '-';
$title = preg_replace('![' . preg_quote($flip) . ']+!u', $separator, $title);
$title = preg_replace('![' . preg_quote($separator) . '\\s]+!u', $separator, $title);
return trim($title, $separator);
}