Mercurial > hg > cmmr2012-drupal-site
annotate vendor/masterminds/html5/bin/entities.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
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@4 | 14 $sname = substr($name, 1, -1); |
Chris@4 | 15 $table[$sname] = $obj->characters; |
Chris@0 | 16 } |
Chris@0 | 17 |
Chris@4 | 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@4 | 24 echo '; |
Chris@0 | 25 }' . PHP_EOL; |
Chris@0 | 26 //print serialize($table); |