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


PHP mb_decode_numericentity函数代码示例

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


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

示例1: lookupDecimal

 /**
  * Given a decimal number, return the UTF-8 character.
  */
 public static function lookupDecimal($int)
 {
     $entity = '&#' . $int . ';';
     // UNTESTED: This may fail on some planes. Couldn't find full documentation
     // on the value of the mask array.
     return mb_decode_numericentity($entity, static::$numeric_mask, 'utf-8');
 }
开发者ID:layershifter,项目名称:html5-php,代码行数:10,代码来源:CharacterReference.php

示例2: setup

 /**
  * Setup: Decode our test strings aheads of time and disable the MultiByte library.
  */
 protected function setup()
 {
     $convmap = array(0x80, 0xffff, 0, 0xffff);
     foreach ($this->test_strings as $key => $value) {
         $this->test_strings[$key] = mb_decode_numericentity($value, $convmap, 'utf-8');
     }
 }
开发者ID:habari,项目名称:tests,代码行数:10,代码来源:test_multibyte.php

示例3: motopressCEJsonEncode

function motopressCEJsonEncode($array)
{
    //convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding
    $options = array('convmap' => array(0x80, 0xffff, 0, 0xffff), 'encoding' => 'UTF-8');
    array_walk_recursive($array, 'motopressCEMbEncodeNumericentity', $options);
    return mb_decode_numericentity(json_encode($array), $options['convmap'], $options['encoding']);
}
开发者ID:umang11,项目名称:glotech,代码行数:7,代码来源:functions.php

示例4: stripForForm

/**
 * For nicer placement in our textareas - but are we using this really?
 * @param string $text 
 * @param string $process 
 * @return string
 */
function stripForForm($text = '', $process = '')
{
    if (empty($process)) {
        // have we checked this yet
        if (function_exists('mb_decode_numericentity')) {
            return mb_decode_numericentity($text, UTF8EntConvert('1'), 'utf-8');
        } else {
            $text = htmlspecialchars($text);
            return str_replace(array("&gt;", "&lt;"), array(">", "<"), $text);
        }
    }
    if ($text) {
        $out = str_replace("<p>", "", $text);
        $out = str_replace(array("<br />", "<br>"), array("", ""), $out);
        $out = str_replace("</p>", "", $out);
        if (function_exists('mb_decode_numericentity')) {
            $out = mb_decode_numericentity($out, UTF8EntConvert('1'), 'utf-8');
        } else {
            $out = htmlspecialchars($out);
            $out = str_replace(array("&gt;", "&lt;"), array(">", "<"), $out);
        }
        return $out;
    } else {
        return '';
    }
}
开发者ID:WurdahMekanik,项目名称:hlf-ndxz,代码行数:32,代码来源:output.php

示例5: kfJsonEncode

/**
 * Polyfill for json_encode JSON_UNESCAPED_UNICODE (new in PHP 5.4.0) for PHP 5.3
 */
function kfJsonEncode($arr)
{
    array_walk_recursive($arr, function (&$item, $key) {
        if (is_string($item)) {
            $item = mb_encode_numericentity($item, array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
        }
    });
    return mb_decode_numericentity(json_encode($arr), array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
}
开发者ID:JeanFred,项目名称:intuition,代码行数:12,代码来源:wpAvailableLanguages.js.php

示例6: _convertSjisToUtf8

 /**
  * Convert character encoding from Shift_JIS to UTF-8.
  *
  * @param  string  $text
  * @return string
  */
 function _convertSjisToUtf8($text)
 {
     $pattern = '/\\x1B\\x24([\\x45-\\x47\\x4F-\\x51][\\x21-\\x7A]+)\\x0F?/';
     $callback = array($this, '_convertWebcodeToEntity');
     $text = preg_replace_callback($pattern, $callback, $text);
     $text = mb_convert_encoding($text, 'UTF-8', 'SJIS-win');
     $text = mb_decode_numericentity($text, $this->_utf8map, 'UTF-8');
     return $text;
 }
开发者ID:noriotakei,项目名称:suraimu,代码行数:15,代码来源:Jphone.php

示例7: setup

 /**
  * Setup: Decode our test strings aheads of time and disable the MultiByte library.
  */
 protected function setup()
 {
     $convmap = array(0x80, 0xffff, 0, 0xffff);
     foreach ($this->test_strings as $key => $value) {
         $this->test_strings[$key] = mb_decode_numericentity($value, $convmap, 'utf-8');
     }
     // disable using a multibyte library
     $this->old_library = MultiByte::library(false);
 }
开发者ID:habari,项目名称:tests,代码行数:12,代码来源:test_multibyte_native.php

示例8: decodeNumericEntity

 public function decodeNumericEntity($text)
 {
     if (function_exists('mb_decode_numericentity')) {
         $convmap = array(0x0, 0x2ffff, 0, 0xffff);
         return mb_decode_numericentity($text, $convmap, 'UTF-8');
     } else {
         return $text;
     }
 }
开发者ID:raykai,项目名称:porter,代码行数:9,代码来源:smf2.php

示例9: sphinx_keyword

 function sphinx_keyword($keyword, $index_data = '')
 {
     $this->index_data = $index_data ? $index_data : $this->index_data;
     //Cắt ngắn
     if (mb_strlen($keyword, "UTF-8") > $this->max_keyword_length) {
         $keyword = mb_substr($keyword, 0, $this->max_keyword_length, "UTF-8");
     }
     $this->keyword = mb_strtolower($keyword, "UTF-8");
     //echo "2";
     //Remove "
     $this->keyword = str_replace("&quot;", "", $this->keyword);
     //Replace các bad character
     $array_bad_word = array("?", "^", ",", ";", "*", "/", "~", "@", "-", "!", "[", "]", "(", ")", "=", "|");
     $this->keyword = str_replace($array_bad_word, "", $this->keyword);
     //Chống các ký tự ô vuông, convert lại đúng kiểu UTF-8
     $this->keyword = mb_convert_encoding($this->keyword, "UTF-8", "UTF-8");
     //Xóa bỏ ký tự NCR
     $convmap = array(0x0, 0x2ffff, 0, 0xffff);
     $this->keyword = @mb_decode_numericentity($this->keyword, $convmap, "UTF-8");
     //echo "3";
     $j = -1;
     //Lấy keyword còn lại sau, bẻ dấu cách
     $array_temp = explode(" ", $this->keyword);
     for ($i = 0; $i < count($array_temp); $i++) {
         if (trim($array_temp[$i]) != "") {
             //Những keyword có độ dài > 1 mới cho vào array
             if (mb_strlen(trim($array_temp[$i]), "UTF-8") > 1) {
                 $j++;
                 $this->array_keyword[$j][0] = str_replace("'", "''", trim($array_temp[$i]));
             }
         }
     }
     $quorum = count($array_temp) * 3 / 5;
     $quorum = intval($quorum);
     if ($quorum < 2) {
         $quorum = 2;
     }
     $this->keyword = trim($this->keyword);
     $this->original_keyword = $this->keyword;
     //echo $this->keyword;
     //Cấu hình sphinx tại localhost
     if (@$_SERVER['SERVER_NAME'] == "localhost") {
         $this->sphinx_host = "127.0.0.1";
         $this->sphinx_port = 9312;
     }
     //echo "3";
     //Khởi tạo class và mở kết nối đến server
     $this->sphinx = new SphinxClient();
     $this->sphinx->SetServer($this->sphinx_host, $this->sphinx_port);
     $this->sphinx->SetConnectTimeout(1.5);
     $this->sphinx->SetMatchMode(SPH_MATCH_ANY);
     //Lấy max 5030 kết quả trả về
     $this->sphinx->_maxmatches = 330;
     $this->sphinx->Open();
     //echo "4";
 }
开发者ID:virutmath,项目名称:suckhoe,代码行数:56,代码来源:sphinx_keyword.php

示例10: json_encode_readable

function json_encode_readable($arr)
{
    //convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding
    array_walk_recursive($arr, function (&$item, $key) {
        if (is_string($item)) {
            $item = mb_encode_numericentity($item, array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
        }
    });
    return mb_decode_numericentity(json_encode($arr), array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
}
开发者ID:ayunah,项目名称:opencorpora,代码行数:10,代码来源:api.php

示例11: json

function json($data)
{
    $CI =& get_instance();
    if ($CI->input->is_ajax_request()) {
        return json_encode($data);
    }
    $data = str_replace('<br />', '', $data);
    return preg_replace_callback('/\\\\u([0-9a-f]{4})/i', function ($val) {
        return mb_decode_numericentity('&#' . intval($val[1], 16) . ';', array(0, 0xffff, 0, 0xffff), 'utf-8');
    }, json_encode($data));
}
开发者ID:reg2005,项目名称:CI_HMVC_SECURITY,代码行数:11,代码来源:system_helper.php

示例12: _convertEntityToUtf8

 /**
  * Callback function called by the filter() method.
  *
  * This function converts Unicode hexadecimal number to UTF-8 emoji.
  *
  * @param  array   $matches
  * @return string
  */
 function _convertEntityToUtf8($matches)
 {
     $unicode = hexdec($matches[1]);
     $entity = '&#' . $unicode . ';';
     $utf8 = mb_decode_numericentity($entity, $this->_convmap, 'UTF-8');
     if ($entity !== $utf8) {
         return $utf8;
     } else {
         return $matches[0];
     }
 }
开发者ID:k1LoW,项目名称:yak,代码行数:19,代码来源:HexToUtf8.php

示例13: htmldecode

 /**
  * HTMLデコードした文字列を返す
  * @param string $value 対象の文字列
  * @return string
  */
 public static function htmldecode($value)
 {
     if (!empty($value) && is_string($value)) {
         $value = mb_convert_encoding($value, 'UTF-8', mb_detect_encoding($value));
         $value = preg_replace_callback("/&#[xX]([0-9a-fA-F]+);/u", function ($m) {
             return '&#' . hexdec($m[1]) . ';';
         }, $value);
         $value = mb_decode_numericentity($value, array(0x0, 0x10000, 0, 0xfffff), "UTF-8");
         $value = html_entity_decode($value, ENT_QUOTES, "UTF-8");
         $value = str_replace(array("\\\"", "\\'", "\\\\"), array("\"", "\\'", "\\"), $value);
     }
     return $value;
 }
开发者ID:tokushima,项目名称:rhaco3,代码行数:18,代码来源:Text.php

示例14: fromDecimal

 /**
  * @param mixed $number
  *
  * @return string
  */
 public static function fromDecimal($number)
 {
     // Only convert code points within planes 0-2, excluding NULL
     if (empty($number) || $number > 0x2ffff) {
         return self::fromHex('fffd');
     }
     $entity = '&#' . $number . ';';
     $converted = mb_decode_numericentity($entity, [0x0, 0x2ffff, 0, 0xffff], 'UTF-8');
     if ($converted === $entity) {
         return self::fromHex('fffd');
     }
     return $converted;
 }
开发者ID:colinodell,项目名称:commonmark-php,代码行数:18,代码来源:Html5Entities.php

示例15: associativeArrayToJsonStr

 /**
  * @author devilan (REMOVEIT) (at) o2 (dot) pl
  * For PHP5.3 users who want to emulate JSON_UNESCAPED_UNICODE
  * @see https://php.net/manual/en/function.json-encode.php#105789
  */
 public static function associativeArrayToJsonStr($arr, $optionsBitMask = 0)
 {
     if (defined('JSON_UNESCAPED_UNICODE')) {
         return json_encode($arr, JSON_UNESCAPED_UNICODE | $optionsBitMask);
     }
     $convmap = array(0x80, 0xffff, 0, 0xffff);
     //convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding
     array_walk_recursive($arr, function (&$item, $key) use(&$convmap) {
         if (is_string($item)) {
             $item = mb_encode_numericentity($item, $convmap, 'UTF-8');
         }
     });
     return mb_decode_numericentity(json_encode($arr, $optionsBitMask), $convmap, 'UTF-8');
 }
开发者ID:billforward,项目名称:bf-php,代码行数:19,代码来源:Utility.php


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