| 1 |
<?php |
| 2 |
|
| 3 |
namespace WindPressDeps; |
| 4 |
|
| 5 |
/** |
| 6 |
* Fetch the entities.json file and convert to PHP datastructure. |
| 7 |
*/ |
| 8 |
// The URL to the official entities JSON file. |
| 9 |
$ENTITIES_URL = 'http://www.w3.org/TR/2012/CR-html5-20121217/entities.json'; |
| 10 |
$payload = \file_get_contents($ENTITIES_URL); |
| 11 |
$json = \json_decode($payload); |
| 12 |
$table = array(); |
| 13 |
foreach ($json as $name => $obj) { |
| 14 |
$sname = \substr($name, 1, -1); |
| 15 |
$table[$sname] = $obj->characters; |
| 16 |
} |
| 17 |
echo '<?php |
| 18 |
namespace Masterminds\\HTML5; |
| 19 |
/** Entity lookup tables. This class is automatically generated. */ |
| 20 |
class Entities { |
| 21 |
public static $byName = '; |
| 22 |
\var_export($table); |
| 23 |
echo '; |
| 24 |
}' . \PHP_EOL; |
| 25 |
//print serialize($table); |
| 26 |
|