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


PHP utf8_check函数代码示例

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


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

示例1: entities_to_7bit

function entities_to_7bit($str)
{
    require_once LEPTON_PATH . '/framework/summary.utf8.php';
    // convert to UTF-8
    $str = charset_to_utf8($str);
    if (!utf8_check($str)) {
        return $str;
    }
    // replace some specials
    $str = utf8_stripspecials($str, '_');
    // translate non-ASCII characters to ASCII
    $str = utf8_romanize($str);
    // missed some? - Many UTF-8-chars can't be romanized
    // convert to HTML-entities, and replace entites by hex-numbers
    $str = utf8_fast_umlauts_to_entities($str, false);
    $str = str_replace(''', ''', $str);
    //    $str = preg_replace_callback('/&#([0-9]+);/', function($matches) {return "dechex($matches[1])";}, $str);
    //    $str = preg_replace_callback('/&#([0-9]+);/', function($matches) {return dechex($matches[1]);}, $str);
    if (version_compare(PHP_VERSION, '5.3', '<')) {
        $str = preg_replace('/&#([0-9]+);/e', "dechex('\$1')", $str);
    } else {
        $str = preg_replace_callback('/&#([0-9]+);/', create_function('$aMatches', 'return dechex($aMatches[1]);'), $str);
    }
    // maybe there are some &gt; &lt; &apos; &quot; &amp; &nbsp; left, replace them too
    $str = str_replace(array('&gt;', '&lt;', '&apos;', '\'', '&quot;', '&amp;'), '', $str);
    $str = str_replace('&amp;', '', $str);
    return $str;
}
开发者ID:pixelhulk,项目名称:LEPTON,代码行数:28,代码来源:function.entities_to_7bit.php

示例2: __construct

 /**
  * Constructor
  */
 public function __construct()
 {
     global $INPUT;
     parent::__construct();
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         $this->_debug("LDAP err: PHP LDAP extension not found.", -1, __LINE__, __FILE__);
         $this->success = false;
         return;
     }
     // Prepare SSO
     if (!empty($_SERVER['REMOTE_USER'])) {
         // make sure the right encoding is used
         if ($this->getConf('sso_charset')) {
             $_SERVER['REMOTE_USER'] = iconv($this->getConf('sso_charset'), 'UTF-8', $_SERVER['REMOTE_USER']);
         } elseif (!utf8_check($_SERVER['REMOTE_USER'])) {
             $_SERVER['REMOTE_USER'] = utf8_encode($_SERVER['REMOTE_USER']);
         }
         // trust the incoming user
         if ($this->conf['sso']) {
             $_SERVER['REMOTE_USER'] = $this->cleanUser($_SERVER['REMOTE_USER']);
             // we need to simulate a login
             if (empty($_COOKIE[DOKU_COOKIE])) {
                 $INPUT->set('u', $_SERVER['REMOTE_USER']);
                 $INPUT->set('p', 'sso_only');
             }
         }
     }
     // Add the capabilities to change the password
     $this->cando['modPass'] = $this->getConf('modPass');
 }
开发者ID:numas,项目名称:dokuwiki,代码行数:34,代码来源:auth.php

示例3: __construct

 /**
  * Constructor
  */
 function __construct()
 {
     global $conf;
     $this->cnf = $conf['auth']['ad'];
     // additional information fields
     if (isset($this->cnf['additional'])) {
         $this->cnf['additional'] = str_replace(' ', '', $this->cnf['additional']);
         $this->cnf['additional'] = explode(',', $this->cnf['additional']);
     } else {
         $this->cnf['additional'] = array();
     }
     // ldap extension is needed
     if (!function_exists('ldap_connect')) {
         if ($this->cnf['debug']) {
             msg("AD Auth: PHP LDAP extension not found.", -1);
         }
         $this->success = false;
         return;
     }
     // Prepare SSO
     if (!utf8_check($_SERVER['REMOTE_USER'])) {
         $_SERVER['REMOTE_USER'] = utf8_encode($_SERVER['REMOTE_USER']);
     }
     if ($_SERVER['REMOTE_USER'] && $this->cnf['sso']) {
         // remove possible NTLM domain
         list($dom, $usr) = explode('\\', $_SERVER['REMOTE_USER'], 2);
         if (!$usr) {
             $usr = $dom;
         }
         // remove possible Kerberos domain
         list($usr, $dom) = explode('@', $usr);
         $dom = strtolower($dom);
         $_SERVER['REMOTE_USER'] = $usr;
         // we need to simulate a login
         if (empty($_COOKIE[DOKU_COOKIE])) {
             $_REQUEST['u'] = $_SERVER['REMOTE_USER'];
             $_REQUEST['p'] = 'sso_only';
         }
     }
     // prepare adLDAP standard configuration
     $this->opts = $this->cnf;
     // add possible domain specific configuration
     if ($dom && is_array($this->cnf[$dom])) {
         foreach ($this->cnf[$dom] as $key => $val) {
             $this->opts[$key] = $val;
         }
     }
     // handle multiple AD servers
     $this->opts['domain_controllers'] = explode(',', $this->opts['domain_controllers']);
     $this->opts['domain_controllers'] = array_map('trim', $this->opts['domain_controllers']);
     $this->opts['domain_controllers'] = array_filter($this->opts['domain_controllers']);
     // we can change the password if SSL is set
     if ($this->opts['use_ssl'] || $this->opts['use_tls']) {
         $this->cando['modPass'] = true;
     }
     $this->cando['modName'] = true;
     $this->cando['modMail'] = true;
 }
开发者ID:AlexanderS,项目名称:Part-DB,代码行数:61,代码来源:ad.class.php

示例4: dol_print_file

/**
 *  Output content of a file $filename in version of current language (otherwise may use an alternate language)
 *  @param      langs           Object language to use for output
 *  @param      filename        Relative filename to output
 *  @param      searchalt       1=Search also in alternative languages
 *	@return		boolean
 */
function dol_print_file($langs,$filename,$searchalt=0)
{
    global $conf;

    // Test if file is in lang directory
    foreach($langs->dir as $searchdir)
    {
        $htmlfile=($searchdir."/langs/".$langs->defaultlang."/".$filename);
        dol_syslog('functions2::dol_print_file search file '.$htmlfile, LOG_DEBUG);
        if (is_readable($htmlfile))
        {
            $content=file_get_contents($htmlfile);
            $isutf8=utf8_check($content);
            if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') print utf8_encode($content);
            elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') print utf8_decode($content);
            else print $content;
            return true;
        }
        else dol_syslog('functions2::dol_print_file not found', LOG_DEBUG);

        if ($searchalt) {
            // Test si fichier dans repertoire de la langue alternative
            if ($langs->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename;
            else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
            dol_syslog('functions2::dol_print_file search alt file '.$htmlfilealt, LOG_DEBUG);
            //print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt);
            if (is_readable($htmlfilealt))
            {
                $content=file_get_contents($htmlfilealt);
                $isutf8=utf8_check($content);
                if (! $isutf8 && $conf->file->character_set_client == 'UTF-8') print utf8_encode($content);
                elseif ($isutf8 && $conf->file->character_set_client == 'ISO-8859-1') print utf8_decode($content);
                else print $content;
                return true;
            }
            else dol_syslog('functions2::dol_print_file not found', LOG_DEBUG);
        }
    }

    return false;
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:48,代码来源:functions2.lib.php

示例5: processTagUrl

 public function processTagUrl(array $tag, array $rendererStates)
 {
     if (!empty($tag['option'])) {
         $url = $tag['option'];
         $text = $this->renderSubTree($tag['children'], $rendererStates);
     } else {
         $url = $this->stringifyTree($tag['children']);
         $text = urldecode($url);
         if (!utf8_check($text)) {
             $text = $url;
         }
     }
     $validUrl = $this->_getValidUrl($url);
     if (!empty($validUrl)) {
         $this->_urls[$url] = $validUrl;
     }
     if (!empty($tag['option'])) {
         return "[URL={$this->_urlPrefix}{$url}{$this->_urlSuffix}]{$text}[/URL]";
     } else {
         return "[URL]{$this->_urlPrefix}{$url}{$this->_urlSuffix}[/URL]";
     }
 }
开发者ID:ThemeHouse-XF,项目名称:ImageRestrict,代码行数:22,代码来源:Reverse.php

示例6: sanitize

 /**
  * Sanitize a variable.
  * 
  * @param string $input
  * @param string $type
  * @return string|false
  */
 public static function sanitize($input, $type)
 {
     switch ($type) {
         // Escape HTML special characters.
         case 'escape':
             if (!utf8_check($input)) {
                 return false;
             }
             return escape($input);
             // Strip all HTML tags.
         // Strip all HTML tags.
         case 'strip':
             if (!utf8_check($input)) {
                 return false;
             }
             return escape(strip_tags($input));
             // Clean up HTML content to prevent XSS attacks.
         // Clean up HTML content to prevent XSS attacks.
         case 'html':
             if (!utf8_check($input)) {
                 return false;
             }
             return Filters\HTMLFilter::clean($input);
             // Clean up the input to be used as a safe filename.
         // Clean up the input to be used as a safe filename.
         case 'filename':
             if (!utf8_check($input)) {
                 return false;
             }
             return Filters\FilenameFilter::clean($input);
             // Unknown filters return false.
         // Unknown filters return false.
         default:
             return false;
     }
 }
开发者ID:rhymix,项目名称:rhymix,代码行数:43,代码来源:security.php

示例7: show_elem

/**
 * Function to put the movable box of a source field
 *
 * @param	array	$fieldssource	List of source fields
 * @param	int		$pos			Pos
 * @param	string	$key			Key
 * @param	boolean	$var			Line style (odd or not)
 * @param	int		$nostyle		Hide style
 * @return	void
 */
function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
{
    global $langs, $bc;
    print "\n\n<!-- Box " . $pos . " start -->\n";
    print '<div class="box" style="padding: 0px 0px 0px 0px;" id="boxto_' . $pos . '">' . "\n";
    print '<table summary="boxtable' . $pos . '" width="100%" class="nobordernopadding">' . "\n";
    if ($pos && $pos > count($fieldssource)) {
        print '<tr ' . ($nostyle ? '' : $bc[$var]) . ' height="20">';
        print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
        print img_picto($pos > 0 ? $langs->trans("MoveField", $pos) : '', 'uparrow', 'class="boxhandle" style="cursor:move;"');
        print '</td>';
        print '<td style="font-weight: normal">';
        print $langs->trans("NoFields");
        print '</td>';
        print '</tr>';
    } elseif ($key == 'none') {
        print '<tr ' . ($nostyle ? '' : $bc[$var]) . ' height="20">';
        print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
        print '&nbsp;';
        print '</td>';
        print '<td style="font-weight: normal">';
        print '&nbsp;';
        print '</td>';
        print '</tr>';
    } else {
        print '<tr ' . ($nostyle ? '' : $bc[$var]) . ' height="20">';
        print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
        // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
        print img_picto($langs->trans("MoveField", $pos), 'uparrow', 'class="boxhandle" style="cursor:move;"');
        print '</td>';
        print '<td style="font-weight: normal">';
        print $langs->trans("Field") . ' ' . $pos;
        $example = $fieldssource[$pos]['example1'];
        if ($example) {
            if (!utf8_check($example)) {
                $example = utf8_encode($example);
            }
            print ' (<i>' . $example . '</i>)';
        }
        print '</td>';
        print '</tr>';
    }
    print "</table>\n";
    print "</div>\n";
    print "<!-- Box end -->\n\n";
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:56,代码来源:import.php

示例8: is_photo_available

 function is_photo_available($sdir)
 {
     include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
     $pdir = get_exdir($this->id, 2) . $this->id . "/photos/";
     $dir = $sdir . '/' . $pdir;
     $nbphoto = 0;
     $dir_osencoded = dol_osencode($dir);
     if (file_exists($dir_osencoded)) {
         $handle = opendir($dir_osencoded);
         if (is_resource($handle)) {
             while (($file = readdir($handle)) != false) {
                 if (!utf8_check($file)) {
                     $file = utf8_encode($file);
                 }
                 // To be sure data is stored in UTF8 in memory
                 if (dol_is_file($dir . $file)) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:abbenbouchta,项目名称:immobilier,代码行数:23,代码来源:local.class.php

示例9: dol_string_unaccent

/**
 *	Clean a string from all accent characters to be used as ref, login or by dol_sanitizeFileName
 *
 *	@param	string	$str			String to clean
 *	@return string   	       		Cleaned string
 *
 * 	@see    		dol_sanitizeFilename, dol_string_nospecial
 */
function dol_string_unaccent($str)
{
    if (utf8_check($str)) {
        // See http://www.utf8-chartable.de/
        $string = rawurlencode($str);
        $replacements = array('%C3%80' => 'A', '%C3%81' => 'A', '%C3%82' => 'A', '%C3%83' => 'A', '%C3%84' => 'A', '%C3%85' => 'A', '%C3%88' => 'E', '%C3%89' => 'E', '%C3%8A' => 'E', '%C3%8B' => 'E', '%C3%8C' => 'I', '%C3%8D' => 'I', '%C3%8E' => 'I', '%C3%8F' => 'I', '%C3%92' => 'O', '%C3%93' => 'O', '%C3%94' => 'O', '%C3%95' => 'O', '%C3%96' => 'O', '%C3%99' => 'U', '%C3%9A' => 'U', '%C3%9B' => 'U', '%C3%9C' => 'U', '%C3%A0' => 'a', '%C3%A1' => 'a', '%C3%A2' => 'a', '%C3%A3' => 'a', '%C3%A4' => 'a', '%C3%A5' => 'a', '%C3%A7' => 'c', '%C3%A8' => 'e', '%C3%A9' => 'e', '%C3%AA' => 'e', '%C3%AB' => 'e', '%C3%AC' => 'i', '%C3%AD' => 'i', '%C3%AE' => 'i', '%C3%AF' => 'i', '%C3%B1' => 'n', '%C3%B2' => 'o', '%C3%B3' => 'o', '%C3%B4' => 'o', '%C3%B5' => 'o', '%C3%B6' => 'o', '%C3%B9' => 'u', '%C3%BA' => 'u', '%C3%BB' => 'u', '%C3%BC' => 'u', '%C3%BF' => 'y');
        $string = strtr($string, $replacements);
        return rawurldecode($string);
    } else {
        // See http://www.ascii-code.com/
        $string = strtr($str, "ÀÁÂÃÄÅÇ\n\t\t\tÈÉÊËÌÍÎÏÐÑ\n\t\t\tÒÓÔÕØÙÚÛÝ\n\t\t\tàáâãäåçèéêë\n\t\t\tìíîïðñòóôõø\n\t\t\tùúûüýÿ", "AAAAAAC\n\t\t\tEEEEIIIIDN\n\t\t\tOOOOOUUUY\n\t\t\taaaaaaceeee\n\t\t\tiiiidnooooo\n\t\t\tuuuuyy");
        $string = strtr($string, array("Ä" => "Ae", "Æ" => "AE", "Ö" => "Oe", "Ü" => "Ue", "Þ" => "TH", "ß" => "ss", "ä" => "ae", "æ" => "ae", "ö" => "oe", "ü" => "ue", "þ" => "th"));
        return $string;
    }
}
开发者ID:ADDAdev,项目名称:Dolibarr,代码行数:23,代码来源:functions.lib.php

示例10: _getCookie

 /**
  * Returns one random cookie
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function _getCookie($cookie)
 {
     $file = mediaFN($cookie);
     if (!@file_exists($file)) {
         return 'ERROR: cookie file not found';
     }
     $dim = filesize($file);
     if ($dim < 2) {
         return "ERROR: invalid cookie file {$file}";
     }
     mt_srand((double) microtime() * 1000000);
     $rnd = mt_rand(0, $dim);
     $fd = fopen($file, 'r');
     if (!$fd) {
         return "ERROR: reading cookie file {$file} failed";
     }
     // jump to random place in file
     fseek($fd, $rnd);
     $text = '';
     $line = '';
     $cookie = false;
     $test = 0;
     while (true) {
         $seek = ftell($fd);
         $line = fgets($fd, 1024);
         if ($seek == 0) {
             // start of file always starts a cookie
             $cookie = true;
             if ($line == "%\n") {
                 // ignore delimiter if exists
                 continue;
             } else {
                 // part of the cookie
                 $text .= htmlspecialchars($line) . '<br />';
                 continue;
             }
         }
         if (feof($fd)) {
             if ($cookie) {
                 // we had a cookie already, stop here
                 break;
             } else {
                 // no cookie yet, wrap around
                 fseek($fd, 0);
                 continue;
             }
         }
         if ($line == "%\n") {
             if ($cookie) {
                 // we had a cookie already, stop here
                 break;
             } elseif ($seek == $dim - 2) {
                 // it's the end of file delimiter, wrap around
                 fseek($fd, 0);
                 continue;
             } else {
                 // start of the cookie
                 $cookie = true;
                 continue;
             }
         }
         // part of the cookie?
         if ($cookie) {
             $text .= htmlspecialchars($line) . '<br />';
         }
     }
     fclose($fd);
     // if it is not valid UTF-8 assume it's latin1
     if (!utf8_check($text)) {
         return utf8_encode($text);
     }
     return $text;
 }
开发者ID:splitbrain,项目名称:dokuwiki-plugin-xfortune,代码行数:78,代码来源:syntax.php

示例11: convert

 /**
  * 进行转换
  *
  * 说明:
  *   - iconv 下会忽略在目标字符集中不存在的字符
  *   - 查表方法使用 UTF-16BE 作为中间编码进行转换
  *   - 非 mbstring 方式由 HTML-ENTITIES(NCR) 转换到非 UTF-8 编码使用 UTF-8 作中间编码
  *   - 转换到 pinyin 使用 GBK 作中间编码
  *
  *
  * @param string $str 要转换的字符串
  * @param string $from 不填写将直接使用属性 from_encoding
  * @param string $to 不填写将直接使用属性 to_encoding
  * @return string 转换后的字符串
  */
 function convert($str, $from = '', $to = '')
 {
     if ($this->set($from, $to) && !empty($str) && $this->from_encoding != $this->to_encoding) {
         if (in_array($this->from_encoding, array('traditional', 'simplified')) || in_array($this->to_encoding, array('traditional', 'simplified'))) {
             if (utf8_check($str)) {
                 if ($this->from_encoding == 'simplified' && $this->to_encoding == 'traditional') {
                     return utf8_traditional_zh($str);
                 } else {
                     if ($this->from_encoding == 'traditional' && $this->to_encoding == 'simplified') {
                         return utf8_simplified_zh($str);
                     }
                 }
             }
             return $str;
         }
         if ($this->to_encoding == 'pinyin') {
             if ($this->from_encoding != 'gbk') {
                 $from_encoding = $this->from_encoding;
                 $str = $this->convert($str, $this->from_encoding, 'gbk');
                 $this->from_encoding = $from_encoding;
                 $this->to_encoding = 'pinyin';
             }
             return $this->gbk2pin($str);
         }
         switch ($this->type) {
             case 'mbstring':
                 return mb_convert_encoding($str, $this->to_encoding, $this->from_encoding);
             case 'iconv':
                 if ($this->to_encoding == 'html-entities') {
                     $str = iconv($this->from_encoding, 'utf-16be', $str);
                     return $this->unicode2htm($str);
                 } else {
                     if ($this->from_encoding != 'html-entities') {
                         return iconv($this->from_encoding, $this->to_encoding . '//IGNORE', $str);
                     }
                 }
             default:
                 if ($this->from_encoding == 'utf-8' && $this->to_encoding == 'html-entities') {
                     return utf8_to_ncr($str);
                 } else {
                     if ($this->from_encoding == 'html-entities') {
                         $str = utf8_from_ncr($str);
                         if ($this->to_encoding != 'utf-8') {
                             $str = $this->convert($str, 'utf-8', $this->to_encoding);
                             $this->from_encoding = 'html-entities';
                         }
                         return $str;
                     } else {
                         $space = array("\n", "\r", "\t");
                         $tag = array('<|n|>', '<|r|>', '<|t|>');
                         $str = str_replace($space, $tag, $str);
                         $method_name = substr($this->from_encoding, 0, 3);
                         $to_unicode = $method_name . '2unicode';
                         if ($this->from_encoding == 'utf-16le') {
                             $str = $this->change_byte($str);
                         } else {
                             if ($this->from_encoding != 'utf-16be' && method_exists($this, $to_unicode)) {
                                 $str = $this->{$to_unicode}($str);
                             }
                         }
                         $from_unicode = 'unicode2' . $method_name;
                         if ($this->to_encoding == 'utf-16le') {
                             $str = $this->change_byte($str);
                         } else {
                             if ($this->to_encoding != 'utf-16be' && method_exists($this, $from_unicode)) {
                                 $str = $this->{$from_unicode}($str);
                             }
                         }
                         return str_replace($tag, $space, $str);
                     }
                 }
         }
     } else {
         return $str;
     }
 }
开发者ID:h3len,项目名称:Project,代码行数:91,代码来源:encoding.class.php

示例12: cleanText

/**
 * convert line ending to unix format
 *
 * also makes sure the given text is valid UTF-8
 *
 * @see    formText() for 2crlf conversion
 * @author Andreas Gohr <andi@splitbrain.org>
 *
 * @param string $text
 * @return string
 */
function cleanText($text)
{
    $text = preg_replace("/(\r\n)|(\r)/", "\n", $text);
    // if the text is not valid UTF-8 we simply assume latin1
    // this won't break any worse than it breaks with the wrong encoding
    // but might actually fix the problem in many cases
    if (!utf8_check($text)) {
        $text = utf8_encode($text);
    }
    return $text;
}
开发者ID:splitbrain,项目名称:dokuwiki,代码行数:22,代码来源:common.php

示例13: utf8_clean

/**
 * Remove BOM and invalid UTF-8 sequences from file content.
 * 
 * @param string $str
 * @return string
 */
function utf8_clean($str)
{
    if (strlen($str) >= 3 && substr($str, 0, 3) === "") {
        $str = substr($str, 3);
    }
    if (!utf8_check($str)) {
        $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
    }
    return $str;
}
开发者ID:rhymix,项目名称:rhymix,代码行数:16,代码来源:functions.php

示例14: check_server_port

 /**
  * Try to create a socket connection
  *
  * @param 	string		$host		Add ssl:// for SSL/TLS.
  * @param 	int			$port		Example: 25, 465
  * @return	int						Socket id if ok, 0 if KO
  */
 function check_server_port($host, $port)
 {
     $_retVal = 0;
     $timeout = 5;
     // Timeout in seconds
     if (function_exists('fsockopen')) {
         dol_syslog("Try socket connection to host=" . $host . " port=" . $port);
         //See if we can connect to the SMTP server
         if ($socket = @fsockopen($host, $port, $errno, $errstr, $timeout)) {
             // Windows still does not have support for this timeout function
             if (function_exists('stream_set_timeout')) {
                 stream_set_timeout($socket, $timeout, 0);
             }
             dol_syslog("Now we wait for answer 220");
             // Check response from Server
             if ($_retVal = $this->server_parse($socket, "220")) {
                 $_retVal = $socket;
             }
         } else {
             $this->error = utf8_check('Error ' . $errno . ' - ' . $errstr) ? 'Error ' . $errno . ' - ' . $errstr : utf8_encode('Error ' . $errno . ' - ' . $errstr);
         }
     }
     return $_retVal;
 }
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:31,代码来源:CMailFile.class.php

示例15: html_hilight

/**
 * Highlights searchqueries in HTML code
 *
 * @author Andreas Gohr <andi@splitbrain.org>
 * @author Harry Fuecks <hfuecks@gmail.com>
 */
function html_hilight($html, $phrases)
{
    $phrases = array_filter((array) $phrases);
    $regex = join('|', array_map('ft_snippet_re_preprocess', array_map('preg_quote_cb', $phrases)));
    if ($regex === '') {
        return $html;
    }
    if (!utf8_check($regex)) {
        return $html;
    }
    $html = @preg_replace_callback("/((<[^>]*)|{$regex})/ui", 'html_hilight_callback', $html);
    return $html;
}
开发者ID:nefercheprure,项目名称:dokuwiki,代码行数:19,代码来源:html.php


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