You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

62 lines
1.3 KiB

  1. <?php
  2. define('FCK_ACTION_SUBDIR', realpath(dirname(__FILE__)) . '/');
  3. $entities = array();
  4. serialize_ents('ents.data');
  5. serialize_ents('fcked-ents.data');
  6. serialize_ents('ents.merge.data');
  7. $file = "";
  8. if(isset($argv[1])) {
  9. $f = $argv[1];
  10. if ($f && file_exists($f)) $file = $f;
  11. }
  12. elseif(file_exists('add.ent')) {
  13. $file = 'add.ent';
  14. }
  15. if($file && file_exists($file)) {
  16. echo "adding entities from $file\n";
  17. serialize_ents($file);
  18. }
  19. $serialized = FCK_ACTION_SUBDIR . 'ent.ser';
  20. file_put_contents($serialized,serialize($entities));
  21. //$ents = unserialize(file_get_contents($serialized));
  22. //print_r($ents);
  23. exit;
  24. function serialize_ents($file) {
  25. global $entities;
  26. $entities_file = FCK_ACTION_SUBDIR . $file;
  27. if(!file_exists($entities_file)) return;
  28. $lines = file_get_contents($entities_file);
  29. $lines_array=preg_split('/^\n/ms',$lines);
  30. foreach ($lines_array as $line) {
  31. if(isset($line) && strlen($line)) {
  32. list($icon, $numeric,$character) = @preg_split('/\s+/',$line);
  33. if(!$icon || !$numeric || !$character) continue;
  34. $numeric = trim($numeric,'&#;');
  35. $character=trim($character,'&;');
  36. $entities[$numeric] = $icon;
  37. $entities[$character] = $icon;
  38. }
  39. }
  40. $entities[32] = ' ';
  41. $entities['nbsp'] = ' ';
  42. }
  43. ?>