ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
generate-entity-file.php File Reference

Parses *.ent files into an entity lookup table, and then serializes and writes the whole kaboodle to a file. More...

Go to the source code of this file.

Functions

 unichr ($dec)
 

Variables

 $entity_dir = '../docs/entities/'
 
 $output_file = '../library/HTMLPurifier/EntityLookup/entities.ser'
 
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file$output = serialize($entity_table)
 
 $fh = fopen($output_file, 'w')
 

Detailed Description

Parses *.ent files into an entity lookup table, and then serializes and writes the whole kaboodle to a file.

The resulting file is cached so that this script does not need to be run. This script should rarely, if ever, be run, since HTML's entities are fairly immutable.

Definition in file generate-entity-file.php.

Function Documentation

◆ unichr()

unichr (   $dec)

Definition at line 24 of file generate-entity-file.php.

References $contents, $entity_dir, $file, $output_file, array, and exit.

Referenced by TCPDF_FONTS\unichrASCII(), TCPDF_FONTS\unichrUnicode(), and TCPDF_FONTS\UTF8ArrSubString().

25 {
26  if ($dec < 128) {
27  $utf = chr($dec);
28  } elseif ($dec < 2048) {
29  $utf = chr(192 + (($dec - ($dec % 64)) / 64));
30  $utf .= chr(128 + ($dec % 64));
31  } else {
32  $utf = chr(224 + (($dec - ($dec % 4096)) / 4096));
33  $utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64));
34  $utf .= chr(128 + ($dec % 64));
35  }
36  return $utf;
37 }
38 
39 if ( !is_dir($entity_dir) ) exit("Fatal Error: Can't find entity directory.\n");
40 if ( file_exists($output_file) ) exit("Fatal Error: output file already exists.\n");
41 
42 $dh = @opendir($entity_dir);
43 if ( !$dh ) exit("Fatal Error: Cannot read entity directory.\n");
44 
45 $entity_files = array();
46 while (($file = readdir($dh)) !== false) {
47  if (@$file[0] === '.') continue;
48  if (substr(strrchr($file, "."), 1) !== 'ent') continue;
49  $entity_files[] = $file;
50 }
51 closedir($dh);
52 
53 if ( !$entity_files ) exit("Fatal Error: No entity files to parse.\n");
54 
55 $entity_table = array();
56 $regexp = '/<!ENTITY\s+([A-Za-z0-9]+)\s+"&#(?:38;#)?([0-9]+);">/';
57 
58 foreach ( $entity_files as $file ) {
59  $contents = file_get_contents($entity_dir . $file);
60  $matches = array();
61  preg_match_all($regexp, $contents, $matches, PREG_SET_ORDER);
62  foreach ($matches as $match) {
63  $entity_table[$match[1]] = unichr($match[2]);
64  }
65 }
Create styles array
The data for the language used.
unichr($dec)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the caller graph for this function:

Variable Documentation

◆ $entity_dir

$entity_dir = '../docs/entities/'

Definition at line 18 of file generate-entity-file.php.

Referenced by unichr().

◆ $fh

$fh = fopen($output_file, 'w')

Definition at line 69 of file generate-entity-file.php.

Referenced by PHPExcel_Shared_OLE\_readInt1(), PHPExcel_Shared_OLE\_readInt2(), PHPExcel_Shared_OLE\_readInt4(), PHPExcel_Shared_OLE\_readPpsWks(), PHPExcel_Reader_Gnumeric\canRead(), ilSCORM13Player\createSummary(), ilPublicUserProfileGUI\deliverVCard(), ilCalendarFileHandler\downloadFilesForEvents(), ilObjContentObject\exportHTML(), ilFileUtils\fastBase64Decode(), ilFileUtils\fastBase64Encode(), assKprimChoiceImport\fromXML(), assFlashQuestionImport\fromXML(), assSingleChoiceImport\fromXML(), assImagemapQuestionImport\fromXML(), assJavaAppletImport\fromXML(), assMultipleChoiceImport\fromXML(), assOrderingQuestionImport\fromXML(), get_dependency_lookup(), PHPExcel_Shared_OLE\getData(), ilIndependentTemplate\getFile(), HTML_Template_IT\getFile(), ilUserXMLWriter\getPictureValue(), ilObjSurveyQuestionPool\importObject(), ilObjSurvey\importObject(), HTMLPurifier_StringHashParser\parseFile(), HTMLPurifier_StringHashParser\parseHandle(), HTMLPurifier_StringHashParser\parseMultiFile(), PHPExcel_Shared_OLE\read(), ilIndividualAssessmentFileStorage\readDir(), ilCertificate\saveCertificate(), assMatchingQuestionImport\saveImage(), ilUserImportParser\saveTempImage(), assKprimChoiceExport\toXML(), assFlashQuestionExport\toXML(), assMatchingQuestionExport\toXML(), assSingleChoiceExport\toXML(), assMultipleChoiceExport\toXML(), assJavaAppletExport\toXML(), assImagemapQuestionExport\toXML(), assOrderingQuestionExport\toXML(), ilObjQuestionPoolGUI\uploadQplObject(), and ilDAVServer\writelog().

◆ $output

if ( !is_dir($entity_dir) ) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach ($entity_files as $file) $output = serialize($entity_table)

Definition at line 67 of file generate-entity-file.php.

Referenced by Slim\Handlers\NotFound\__invoke(), Slim\Handlers\NotAllowed\__invoke(), Slim\Handlers\PhpError\__invoke(), Slim\Handlers\Error\__invoke(), Slim\Http\Response\__toString(), Text_Diff_Renderer\_block(), _tree_struct\_dump(), ilObjCategoryGUI\_importCategoriesForm(), PHPExcel_Calculation\_parseFormula(), PHPExcel_Calculation\_processTokenStack(), ilPCTableGUI\_renderTable(), ilObjRoleGUI\adoptPermObject(), getid3_shorten\Analyze(), ilInternalLinkGUI\changeTargetObject(), ilObjLanguageFolder\checkAllLanguages(), Parser\closeList(), ilSystemStyleSkinContainer\compileLess(), ilGlossaryTermGUI\confirmDefinitionDeletion(), ilObjGlossaryGUI\confirmDefinitionDeletion(), SimpleSAML_Stats\createOutput(), assClozeTest\deleteGap(), ilPageObjectGUI\displayMedia(), Twig_Test_IntegrationTestCase\doIntegrationTest(), IMSGlobal\LTI\ToolProvider\ResourceLink\domnodeToArray(), Symfony\Component\Yaml\Dumper\dump(), Whoops\Util\TemplateHelper\dump(), Symfony\Component\Yaml\Inline\dumpArray(), ilImageMapEditorGUI\editMapArea(), ilImageMapEditorGUI\editMapAreas(), ilDclRecordListGUI\endImport(), ilLMEditorGUI\executeCommand(), cweagans\Composer\Patches\executeCommand(), ilSAHSPresentationGUI\explorer(), ilSCORMPresentationGUI\explorer(), ilObjContentObjectGUI\explorer(), ilSCORM2004Item\exportAsXML(), ilObjSCORM2004LearningModule\exportHTML(), ilCOPageHTMLExport\exportHTMLMOB(), ilSCORM2004Asset\exportHTMLPageObjects(), ilObjSCORM2004LearningModule\exportHTMLScoObjects(), ilObjMediaObject\exportMediaFullscreen(), ilSCORM2004Asset\exportScorm(), ilObjSCORM2004LearningModule\exportScorm(), ilPCTable\extractText(), Monolog\Formatter\LineFormatter\format(), Monolog\Formatter\HtmlFormatter\format(), Context\from_language(), EvalMath\funcs(), ilPageLayout\generatePreview(), ilHtmlToPdfTransformerFactory\generateTempPath(), assClozeTestGUI\getAnswerFeedbackOutput(), TCPDF\getCellCode(), ilSystemStyleLessFile\getContent(), getid3_lib\getFileSizeSyscall(), ilCertificate\getFormFieldsFromFO(), assQuestionGUI\getGenericFeedbackOutput(), ilImageMapEditorGUI\getImageMapOutput(), ilMail\getMailsOfFolder(), assClozeTestGUI\getPreview(), ilTestServiceGUI\getQuestionResultForTestUsers(), assClozeTestGUI\getSolutionOutput(), assTextSubsetGUI\getSpecificFeedbackOutput(), assNumericGUI\getSpecificFeedbackOutput(), assOrderingHorizontalGUI\getSpecificFeedbackOutput(), assFlashQuestionGUI\getSpecificFeedbackOutput(), assFileUploadGUI\getSpecificFeedbackOutput(), assSingleChoiceGUI\getSpecificFeedbackOutput(), assJavaAppletGUI\getSpecificFeedbackOutput(), assMultipleChoiceGUI\getSpecificFeedbackOutput(), assImagemapQuestionGUI\getSpecificFeedbackOutput(), assQuestion\getSuggestedSolutionOutput(), assClozeTestGUI\getTestOutput(), Twig_Tests_Node_Expression_NameTest\getTests(), Whoops\Run\handleException(), humanreadable(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilMedia(), ilDclGenericMultiInputGUI\insert(), ilOrgUnitMultiLineInputGUI\insert(), ilOrgUnitGenericMultiInputGUI\insert(), ilGlossaryPresentationGUI\listDefinitions(), ilGlossaryTermGUI\listDefinitions(), League\Flysystem\Adapter\Ftp\listDirectoryContentsRecursive(), Parser\magicLinkCallback(), RobRichards\XMLSecLibs\XMLSecurityKey\makeAsnSegment(), ilGlossaryPresentationGUI\media(), ilPersonalDesktopGUI\multiarray_sort(), EvalMath\nfx(), ilGlossaryTermGUI\output(), Symfony\Component\Yaml\Inline\parseMapping(), Symfony\Component\Yaml\Inline\parseQuotedScalar(), Symfony\Component\Yaml\Inline\parseScalar(), Symfony\Component\Yaml\Inline\parseSequence(), ilAssQuestionPageGUI\postOutputProcessing(), ilWikiPageGUI\postOutputProcessing(), ilObjSurvey\processPrintoutput2FO(), ilObjTest\processPrintoutput2FO(), ilCertificate\processXHTML2FO(), ilvCard\quoted_printable_encode(), ilInternalLinkGUI\refreshRepositorySelector(), ilDclLinkButton\render(), Text_Diff_Renderer\render(), EasyPeasyICS\render(), Slim\Handlers\PhpError\renderHtmlErrorMessage(), Slim\Handlers\Error\renderHtmlErrorMessage(), Slim\Handlers\NotAllowed\renderHtmlNotAllowedMessage(), ilGhostscriptRenderer\renderImages(), ilPageObjectGUI\replaceCurlyBrackets(), ilLTIToolProvider\result(), Slim\App\run(), ilSCORM2004ScoGUI\sco_preview(), ilObjRoleGUI\selectDesktopItemObject(), phpCAS\serviceWeb(), CAS_Client\serviceWeb(), ilPDSelectedItemsBlockGUI\setFooterLinks(), ilObjContentObjectGUI\showEntrySelector(), ilObjMediaPoolGUI\showMedia(), ilPageObjectGUI\showMediaFullscreen(), ilMediaPoolPageGUI\showPage(), ilPortfolioPageGUI\showPage(), ilSCORM2004PageGUI\showPage(), ilPageObjectGUI\showPage(), ilContainerGUI\showPasteTreeObject(), ilLMPresentationGUI\showPrintView(), ilObjectCopyGUI\showSourceSelectionTree(), ilObjectCopyGUI\showTargetSelectionTree(), ilRepositoryGUI\showTree(), ilObjSCORM2004LearningModuleGUI\showTree(), assQuestionGUI\suggestedsolution(), Twig_Tests_EnvironmentTest\testExtensionsAreNotInitializedWhenRenderingACompiledTemplate(), Twig_Tests_NativeExtensionTest\testGetProperties(), grammarTest\testGrammar(), enshrined\svgSanitize\Tests\SanitizerTest\testMinifiedOptions(), Twig_Tests_Extension_CoreTest\testReverseFilterOnNonUTF8String(), ilDatabaseImplementationBaseTest\testSelectUsrData(), Twig_Tests_Extension_TextTest\testTruncate(), FastRoute\HackTypecheckerTest\testTypechecks(), Gettext\Generators\YamlDictionary\toString(), assClozeTest\updateClozeTextFromGaps(), EvalMath\vars(), ilObjStudyProgrammeTreeGUI\view(), cweagans\Composer\Patches\writePatchReport(), and Whoops\Run\writeToOutputNow().

◆ $output_file

$output_file = '../library/HTMLPurifier/EntityLookup/entities.ser'

Definition at line 21 of file generate-entity-file.php.

Referenced by unichr().