PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.9.14
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.9.14
1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / masterminds / html5 / src / HTML5 / Parser / CharacterReference.php

CharacterReference.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.9.14, at vendor_prefixed/masterminds/html5/src/HTML5/Parser/CharacterReference.php

52 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WCPOS\Vendor\Masterminds\HTML5\Parser;
4
5 use WCPOS\Vendor\Masterminds\HTML5\Entities;
6 /**
7 * Manage entity references.
8 *
9 * This is a simple resolver for HTML5 character reference entitites. See Entities for the list of supported entities.
10 */
11 class CharacterReference
12 {
13 protected static $numeric_mask = array(0x0, 0x2ffff, 0, 0xffff);
14 /**
15 * Given a name (e.g. 'amp'), lookup the UTF-8 character ('&').
16 *
17 * @param string $name The name to look up.
18 *
19 * @return string The character sequence. In UTF-8 this may be more than one byte.
20 */
21 public static function lookupName($name)
22 {
23 // Do we really want to return NULL here? or FFFD
24 return isset(Entities::$byName[$name]) ? Entities::$byName[$name] : null;
25 }
26 /**
27 * Given a decimal number, return the UTF-8 character.
28 *
29 * @param $int
30 *
31 * @return false|string|string[]|null
32 */
33 public static function lookupDecimal($int)
34 {
35 $entity = '&#' . $int . ';';
36 // UNTESTED: This may fail on some planes. Couldn't find full documentation
37 // on the value of the mask array.
38 return \mb_decode_numericentity($entity, static::$numeric_mask, 'utf-8');
39 }
40 /**
41 * Given a hexadecimal number, return the UTF-8 character.
42 *
43 * @param $hexdec
44 *
45 * @return false|string|string[]|null
46 */
47 public static function lookupHex($hexdec)
48 {
49 return static::lookupDecimal(\hexdec($hexdec));
50 }
51 }
52