當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。