当前位置: 首页>>代码示例>>PHP>>正文


PHP mb_eregi函数代码示例

本文整理汇总了PHP中mb_eregi函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_eregi函数的具体用法?PHP mb_eregi怎么用?PHP mb_eregi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了mb_eregi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isValidEmail

 /**
  * checks whether the passed email-address is valid / following a pattern
  * @todo is this an exact representation of the RFC 2822?
  * @todo this should be checked: what about umlaut-domains and tld like '.museum'?
  * @see http://tools.ietf.org/html/rfc2822
  *
  * @param <string> a all lowercase email adress to test
  * @return <boolean> answer to "is the passed over email valid?""
  */
 function isValidEmail($email)
 {
     if (mb_eregi("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})\$", $email)) {
         return true;
     }
     return false;
 }
开发者ID:bfpi,项目名称:klarschiff-frontend-mit-mapbender,代码行数:16,代码来源:class_administration.php

示例2: cs2cs_core2

function cs2cs_core2($lat, $lon, $to)
{
    $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
    if (mb_eregi('^[a-z0-9_ ,.\\+\\-=]*$', $to) == 0) {
        die("invalid arguments in command: " . $to . "\n");
    }
    $command = CS2CS . " +proj=latlong +ellps=WGS84 +to " . $to;
    $process = proc_open($command, $descriptorspec, $pipes);
    if (is_resource($process)) {
        fwrite($pipes[0], $lon . " " . $lat);
        fclose($pipes[0]);
        $stdout = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        $stderr = stream_get_contents($pipes[2]);
        fclose($pipes[2]);
        //
        // $procstat = proc_get_status($process);
        //
        // neither proc_close nor proc_get_status return reasonable results with PHP5 and linux 2.6.11,
        // see http://bugs.php.net/bug.php?id=32533
        //
        // as temporary (?) workaround, check stderr output.
        // (Vinnie, 2006-02-09)
        if ($stderr) {
            die("proc_open() failed:<br />command='{$command}'<br />stderr='" . $stderr . "'");
        }
        proc_close($process);
        return mb_split("\t|\n| ", mb_trim($stdout));
    } else {
        die("proc_open() failed, command={$command}\n");
    }
}
开发者ID:kojoty,项目名称:opencaching-pl,代码行数:32,代码来源:cs2cs.inc.php

示例3: filterMatch

 /**
  * マルチバイト対応で正規表現マッチする
  *
  * @param string $pattern マッチ文字列。SJISで入ってくる。
  * @param string $target  検索対象文字列。SJISで入ってくる。
  * @param string $zenhan  全角/半角の区別を完全になくす
  * (これをオンにすると、メモリの使用量が倍くらいになる。速度負担はそれほどでもない)
  */
 public static function filterMatch($pattern, $target, $zenhan = true)
 {
     // 全角/半角を(ある程度)区別なくマッチ
     if ($zenhan) {
         // 全角/半角を 完全に 区別なくマッチ
         $pattern = self::getPatternToHan($pattern);
         $target = self::getPatternToHan($target, true);
     } else {
         // 全角/半角を ある程度 区別なくマッチ
         $pattern = self::getPatternZenHan($pattern);
     }
     // HTML要素にマッチさせないための否定先読みパターンを付加
     $pattern = '(' . $pattern . ')(?![^<]*>)';
     if (P2_MBREGEX_AVAILABLE == 1) {
         $result = @mb_eregi($pattern, $target);
         // None|Error:false
     } else {
         // UTF-8に変換してから処理する
         $pattern_utf8 = '/' . mb_convert_encoding($pattern, 'UTF-8', 'CP932') . '/iu';
         $target_utf8 = mb_convert_encoding($target, 'UTF-8', 'CP932');
         $result = @preg_match($pattern_utf8, $target_utf8);
         // None:0, Error:false
         //$result = mb_convert_encoding($result, 'CP932', 'UTF-8');
     }
     if (!$result) {
         return false;
     } else {
         return true;
     }
 }
开发者ID:xingskycn,项目名称:p2-php,代码行数:38,代码来源:StrCtl.php

示例4: path2array_paquet

 public static function path2array_paquet($_path, $lg1, $lg2, $mesure)
 {
     $array_lg = array($lg1, $lg2);
     sort($array_lg);
     $data = Tool_files::file_load($_path);
     $f = Tool_files::csv2array_line($data, "\n");
     $array_paquet = array();
     $tmp = array();
     $flag_vu = false;
     foreach ($f as $line) {
         if (mb_eregi("[:alnum:]", $line)) {
             $tmp[] = trim($line);
         } elseif (len($tmp) > 0) {
             list($dist, $rep) = mb_split(" : ", $tmp[0]);
             list($score, $l1, $l2) = mb_split(" ", $rep);
             $score = trim($score);
             $dist = trim($dist);
             $l1 = trim($l1);
             $l2 = trim($l2);
             if ($dist == $mesure) {
                 if ($l1 == $lg2 and $l2 == $lg1 or $lg1 == $l1 and $lg2 == $l2) {
                     $flag_vu = true;
                     list($str1, $rep1) = self::line2str_rep($tmp[1]);
                     list($str2, $rep2) = self::line2str_rep($tmp[2]);
                     $array_paquet[] = array('score' => $score, $l1 => $rep1, $l2 => $rep2, "str_{$l1}" => $str1, "str_{$l2}" => $str2);
                 }
             } elseif ($flag_vu) {
                 break;
             }
             $tmp = array();
         }
     }
     return $array_paquet;
 }
开发者ID:BGCX261,项目名称:zone-align-svn-to-git,代码行数:34,代码来源:tool_read_log.php

示例5: is_seo_visit

 public function is_seo_visit()
 {
     if (isset($_SERVER['HTTP_REFERER'])) {
         $referer = $_SERVER['HTTP_REFERER'];
         return mb_eregi('www.google.', $referer);
     }
 }
开发者ID:Antoinebr,项目名称:wp-seo-log,代码行数:7,代码来源:wpseolog.class.php

示例6: peg_regex_test

 function peg_regex_test($pattern, $string)
 {
     if (substr($pattern, -1) == 'i') {
         return mb_eregi(substr($pattern, 1, -2), $string);
     } else {
         return mb_ereg(substr($pattern, 1, -1), $string);
     }
 }
开发者ID:fr-esco,项目名称:php-dice,代码行数:8,代码来源:BaseParser.php

示例7: isAlphanumeric

 /**
  * Alphanumeric characters (including full stop [.] minus [-], underscore [_] and space [ ])
  * 
  * @param mixed $varValue The value to be validated
  * 
  * @return boolean True if the value is alphanumeric
  */
 public static function isAlphanumeric($varValue)
 {
     if (function_exists('mb_eregi')) {
         return mb_eregi('^[[:alnum:] \\._-]*$', $varValue);
     } else {
         return preg_match('/^[\\pN\\pL \\._-]*$/u', $varValue);
     }
 }
开发者ID:rikaix,项目名称:core,代码行数:15,代码来源:Validator.php

示例8: match

/**
 * @param $pattern
 * @param $substring
 * @param string $options
 * @return array
 */
function match($pattern, $substring, $options = 'ms')
{
    $result = [];
    if (function_exists('mb_ereg_search')) {
        mb_eregi($pattern, $substring, $result);
        return $result;
    }
    preg_match($pattern, $substring, $result);
    return $result;
}
开发者ID:Max201,项目名称:nanocore,代码行数:16,代码来源:functions.php

示例9: uppsite_match

function uppsite_match($pattern, $subject)
{
    $ret = array();
    if (function_exists('mb_eregi')) {
        mb_eregi($pattern, $subject, $ret);
    } else {
        preg_match("/" . $pattern . "/", $subject, $ret);
    }
    return $ret;
}
开发者ID:alpual,项目名称:Caitlin-Sabo,代码行数:10,代码来源:functions.php

示例10: email

 function email($string)
 {
     if (mb_strlen($string) > 200) {
         return false;
     }
     if (mb_eregi("^[a-z0-9\\._-]+@[a-z0-9\\._-]+\\.[a-z]{2,4}\$", $string)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:startusin,项目名称:akaweb,代码行数:11,代码来源:SUM_DataChecking.php

示例11: open

 function open($command)
 {
     $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
     if (mb_eregi('^[a-z0-9_ ,\\+\\-=\\.]*$', $command) == 0) {
         die("invalid arguments in command: " . $command . "\n");
     }
     $command = BIN_CS2CS . " " . $command;
     $this->process = proc_open($command, $descriptorspec, $this->pipes);
     if (!is_resource($this->process)) {
         die("proc_open() failed, command={$command}\n");
     }
 }
开发者ID:pawelzielak,项目名称:opencaching-pl,代码行数:12,代码来源:coordinate_batch.class.php

示例12: strscore

/**
 * A PHP implementation of the Quicksilver string score algorithm. Requires “MBString” extension (for unicode support).
 * 
 * Quicksilver URL: http://docs.blacktree.com/quicksilver/development/string_ranking
 * 
 * @param       string      Text to match against.
 * @param       search      Text to try to match with.
 * @param       offset      Offset to start matching from.
 * @return      float       Score (between 0.0 and 1.0).
 * @category    Strings
 */
function strscore($string, $search, $offset = 0)
{
    // Save some time from calling functions
    $stringlen = mb_strlen($string);
    $searchlen = mb_strlen($search);
    if ($searchlen == 0) {
        return 0.9;
    }
    if ($searchlen > $stringlen) {
        return 0;
    }
    // Search for smaller and smaller portions
    for ($i = $searchlen; $i > 0; --$i) {
        $part = mb_substr($search, 0, $i);
        $index = mb_stripos($string, $part);
        if ($index === FALSE) {
            continue;
        }
        if ($index + $searchlen > $stringlen + $offset) {
            continue;
        }
        $next = mb_substr($string, $index + mb_strlen($part));
        $nextlen = mb_strlen($next);
        $abbr = '';
        if ($i < $searchlen) {
            $abbr = mb_substr($search, $i);
        }
        // Search for the rest of the abbreviation (that didn't match)
        $rem = strscore($next, $abbr, $offset + $index);
        if ($rem > 0) {
            $score = $stringlen - $nextlen;
            if ($index != 0) {
                if (mb_eregi('\\s', mb_substr($string, $index - 1, 1))) {
                    for ($j = $index - 2; $j > -1; --$j) {
                        if (mb_eregi('\\s', mb_substr($string, $j, 1))) {
                            $score -= 1.0;
                        } else {
                            $score -= 0.15;
                        }
                    }
                } else {
                    $score -= $index;
                }
            }
            $score += $rem * $nextlen;
            $score /= $stringlen;
            return (double) $score;
        }
    }
    return 0;
}
开发者ID:Burgestrand,项目名称:phplibs,代码行数:62,代码来源:strscore.php

示例13: getFullRuDateFromMysqlDate

 public static function getFullRuDateFromMysqlDate($mysqlDate)
 {
     $date = null;
     if (mb_eregi('^\\d{4,}-\\d{2}-\\d{2}$', $mysqlDate)) {
         $date = DateTime::createFromFormat('Y-m-d', $mysqlDate);
     } elseif (mb_eregi('^\\d{4,}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$', $mysqlDate)) {
         $date = DateTime::createFromFormat('Y-m-d H:i:s', $mysqlDate);
     }
     if (is_null($date)) {
         return false;
     } else {
         return $date->format('j') . ' ' . self::translateMonthRuEn($date->format('F')) . ' ' . $date->format('Y');
     }
 }
开发者ID:s4urp8n,项目名称:kohana-admin,代码行数:14,代码来源:FieldString.php

示例14: getLink

 public function getLink($link)
 {
     if (mb_eregi("^https\\:\\/\\/docs.google.com\\/", $link)) {
         return '/doc?src=' . $link . '';
     }
     if (mb_eregi("^(https?|ftp)\\:\\/\\/", $link)) {
         return $link;
     }
     if (is_numeric($link)) {
         return "/view/" . $link;
     }
     if ($link == "") {
         return "http://" . $_SERVER['HTTP_HOST'];
     }
     return "/" . $link;
 }
开发者ID:winorun,项目名称:zdvlib.srv-dev,代码行数:16,代码来源:Menu.php

示例15: smarty_outputfilter_highlight

function smarty_outputfilter_highlight($source, &$smarty)
{
    global $prefs;
    $highlight = $_REQUEST['highlight'];
    if (isset($prefs['feature_referer_highlight']) && $prefs['feature_referer_highlight'] == 'y') {
        $refererhi = _refererhi();
        if (isset($refererhi) && !empty($refererhi)) {
            if (isset($highlight) && !empty($highlight)) {
                $highlight = $highlight . " " . $refererhi;
            } else {
                $highlight = $refererhi;
            }
        }
    }
    if (!isset($highlight) || empty($highlight)) {
        return $source;
    }
    $matches = array();
    if (strstr($source, 'id="rightcolumn"')) {
        if (function_exists('mb_eregi')) {
            // UTF8 support enabled
            mb_eregi('^(.*\\s+id="centercolumn"[^>]*>)(.*)(<td[^>]*\\s+id="rightcolumn".*)$', $source, $matches);
        } else {
            // This may not work at all with UTF8 chars
            preg_match('~(.* id="centercolumn"[^>]*>)(.*)(<td[^>]* id="rightcolumn".*)~xsi', $source, $matches);
        }
    } elseif (function_exists('mb_eregi')) {
        if (!mb_eregi('^(.*\\s+id="centercolumn"[^>]*>)(.*)$', $source, $matches)) {
            return $source;
        }
    } elseif (!preg_match('~(.* id="centercolumn"[^>]*>)(.*)~xsi', $source, $matches)) {
        return $source;
    } else {
        $matches[3] = '';
    }
    // Avoid highlight parsing in unknown cases where $matches[2] is empty, which will result in an empty page.
    if ($matches[2] != '') {
        $source = preg_replace_callback('~(?:<head>.*</head>                          # head blocks
	      |<div[^>]*nohighlight.*</div><!--nohighlight--> # div with nohightlight
	      |<script[^>]+>.*</script>                     # script blocks
	      |<a[^>]*onmouseover.*onmouseout[^>]*>            # onmouseover (user popup)
	      |<[^>]*>                                      # all html tags
	      |(' . _enlightColor($highlight) . '))~xsiU', '_enlightColor', $matches[2]);
    }
    return $matches[1] . $source . $matches[3];
}
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:46,代码来源:outputfilter.highlight.php


注:本文中的mb_eregi函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。