| @@ 1453-1460 (lines=8) @@ | ||
| 1450 | * @param int $codepoint |
|
| 1451 | * @return null|string |
|
| 1452 | */ |
|
| 1453 | static function decCharReference( $codepoint ) { |
|
| 1454 | $point = intval( $codepoint ); |
|
| 1455 | if ( Sanitizer::validateCodepoint( $point ) ) { |
|
| 1456 | return sprintf( '&#%d;', $point ); |
|
| 1457 | } else { |
|
| 1458 | return null; |
|
| 1459 | } |
|
| 1460 | } |
|
| 1461 | ||
| 1462 | /** |
|
| 1463 | * @param int $codepoint |
|
| @@ 1466-1473 (lines=8) @@ | ||
| 1463 | * @param int $codepoint |
|
| 1464 | * @return null|string |
|
| 1465 | */ |
|
| 1466 | static function hexCharReference( $codepoint ) { |
|
| 1467 | $point = hexdec( $codepoint ); |
|
| 1468 | if ( Sanitizer::validateCodepoint( $point ) ) { |
|
| 1469 | return sprintf( '&#x%x;', $point ); |
|
| 1470 | } else { |
|
| 1471 | return null; |
|
| 1472 | } |
|
| 1473 | } |
|
| 1474 | ||
| 1475 | /** |
|
| 1476 | * Returns true if a given Unicode codepoint is a valid character in |
|