PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.0.11
WindPress – Tailwind CSS integration for WordPress v3.0.11
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
windpress / vendor / masterminds / html5 / src / HTML5 / Parser / CharacterReference.php

CharacterReference.php in WindPress – Tailwind CSS integration for WordPress 3.0.11, at vendor/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 WindPressDeps\Masterminds\HTML5\Parser;
4
5 use WindPressDeps\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 hexidecimal 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