Mercurial > hg > isophonics-drupal-site
annotate vendor/masterminds/html5/bin/entities.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 129ea1e6d783 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 /** |
Chris@0 | 3 * Fetch the entities.json file and convert to PHP datastructure. |
Chris@0 | 4 */ |
Chris@0 | 5 |
Chris@0 | 6 // The URL to the official entities JSON file. |
Chris@0 | 7 $ENTITIES_URL = 'http://www.w3.org/TR/2012/CR-html5-20121217/entities.json'; |
Chris@0 | 8 |
Chris@0 | 9 $payload = file_get_contents($ENTITIES_URL); |
Chris@0 | 10 $json = json_decode($payload); |
Chris@0 | 11 |
Chris@0 | 12 $table = array(); |
Chris@0 | 13 foreach ($json as $name => $obj) { |
Chris@17 | 14 $sname = substr($name, 1, -1); |
Chris@17 | 15 $table[$sname] = $obj->characters; |
Chris@0 | 16 } |
Chris@0 | 17 |
Chris@17 | 18 echo '<?php |
Chris@0 | 19 namespace Masterminds\\HTML5; |
Chris@0 | 20 /** Entity lookup tables. This class is automatically generated. */ |
Chris@0 | 21 class Entities { |
Chris@0 | 22 public static $byName = '; |
Chris@0 | 23 var_export($table); |
Chris@17 | 24 echo '; |
Chris@0 | 25 }' . PHP_EOL; |
Chris@0 | 26 //print serialize($table); |