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

Generates an include stub for users who do not want to use the autoloader. More...

Go to the source code of this file.

Functions

 get_dependency_lookup ($file)
 Returns a lookup array of dependencies for a file. More...
 
 dep_sort ($files)
 Sorts files based on dependencies. More...
 

Variables

 $FS = new FSTools()
 
 $exclude_dirs
 
 $exclude_files
 
 $raw_files = $FS->globr('.', '*.php')
 
 $files = array()
 
 foreach ( $raw_files as $file)
 
 $version = trim(file_get_contents('../VERSION'))
 
 $php
 
 $__dir = dirname(__FILE__)
 

Detailed Description

Generates an include stub for users who do not want to use the autoloader.

This file was auto-generated by generate-includes.php and includes all of the core files required by HTML Purifier.

When new files are added to HTML Purifier's main codebase, this file should be called.

This is a convenience stub that includes all files using dirname(FILE) and require_once. PLEASE DO NOT EDIT THIS FILE, changes will be overwritten the next time the script is run.

Changes to include_path are not necessary.

Definition in file generate-includes.php.

Function Documentation

◆ dep_sort()

dep_sort (   $files)

Sorts files based on dependencies.

This function is lazy and will not group files with dependencies together; it will merely ensure that a file is never included before its dependencies are.

Parameters
$filesFiles array to sort.
Returns
Sorted array ($files is not modified by reference!)

Definition at line 112 of file generate-includes.php.

113{
114 $ret = array();
115 $cache = array();
116 foreach ($files as $file) {
117 if (isset($cache[$file])) continue;
119 foreach (array_keys($deps) as $dep) {
120 if (!isset($cache[$dep])) {
121 $ret[] = $dep;
122 $cache[$dep] = true;
123 }
124 }
125 $cache[$file] = true;
126 $ret[] = $file;
127 }
128 return $ret;
129}
get_dependency_lookup($file)
Returns a lookup array of dependencies for a file.
$ret
Definition: parser.php:6
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file

References $file, $files, $ret, and get_dependency_lookup().

+ Here is the call graph for this function:

◆ get_dependency_lookup()

get_dependency_lookup (   $file)

Returns a lookup array of dependencies for a file.

Note
This function expects that format $name extends $parent on one line
Parameters
string$fileFile to check dependencies of.
Returns
array Lookup array of files the file is dependent on, sorted accordingly.

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

70{
71 static $cache = array();
72 if (isset($cache[$file])) return $cache[$file];
73 if (!file_exists($file)) {
74 echo "File doesn't exist: $file\n";
75 return array();
76 }
77 $fh = fopen($file, 'r');
78 $deps = array();
79 while (!feof($fh)) {
80 $line = fgets($fh);
81 if (strncmp('class', $line, 5) === 0) {
82 // The implementation here is fragile and will break if we attempt
83 // to use interfaces. Beware!
84 $arr = explode(' extends ', trim($line, ' {'."\n\r"), 2);
85 if (count($arr) < 2) break;
86 $parent = $arr[1];
87 $dep_file = HTMLPurifier_Bootstrap::getPath($parent);
88 if (!$dep_file) break;
89 $deps[$dep_file] = true;
90 break;
91 }
92 }
93 fclose($fh);
94 foreach (array_keys($deps) as $file) {
95 // Extra dependencies must come *before* base dependencies
96 $deps = get_dependency_lookup($file) + $deps;
97 }
98 $cache[$file] = $deps;
99 return $deps;
100}
static getPath($class)
Returns the path for a specific class.
Definition: Bootstrap.php:58

References $fh, $file, get_dependency_lookup(), and HTMLPurifier_Bootstrap\getPath().

Referenced by dep_sort(), and get_dependency_lookup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ $__dir

$__dir = dirname(__FILE__)

Definition at line 180 of file generate-includes.php.

◆ $exclude_dirs

$exclude_dirs
Initial value:
= array(
'HTMLPurifier/Language/',
'HTMLPurifier/ConfigSchema/',
'HTMLPurifier/Filter/',
'HTMLPurifier/Printer/',
)

Definition at line 20 of file generate-includes.php.

◆ $exclude_files

$exclude_files
Initial value:
= array(
'HTMLPurifier/Lexer/PEARSax3.php',
'HTMLPurifier/Lexer/PH5P.php',
'HTMLPurifier/Printer.php',
)

Definition at line 29 of file generate-includes.php.

◆ $files

$files = array()

Definition at line 39 of file generate-includes.php.

Referenced by dep_sort().

◆ $FS

$FS = new FSTools()

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

◆ $php

$php
Initial value:
= "<?php
";
foreach ($files as $file) {
$php .= "require '$file'

Definition at line 138 of file generate-includes.php.

◆ $raw_files

$raw_files = $FS->globr('.', '*.php')

Definition at line 37 of file generate-includes.php.

◆ $version

$version = trim(file_get_contents('../VERSION'))

Definition at line 135 of file generate-includes.php.

Referenced by GuzzleHttp\Psr7\Request\__construct(), GuzzleHttp\Psr7\ServerRequest\__construct(), GuzzleHttp\Psr7\Response\__construct(), getID3_cached_mysql\__construct(), getID3_cached_mysqli\__construct(), getID3_cached_sqlite3\__construct(), ilvCard\__construct(), PHPExcel_Reader_Excel5\_readBof(), PHPExcel_Reader_Excel5\_readColor(), PHPExcel_Writer_Excel5_BIFFwriter\_storeBof(), IMSGlobal\LTI\ToolProvider\ToolProvider\authenticate(), ilLTIToolProvider\authenticate(), sspmod_oauth_OAuthStore\authorize(), ilSetup\checkPHPVersion(), Monolog\Handler\HipChatHandlerTest\createHandler(), getid3_dts\dialogNormalization(), TCPDF_STATIC\get_mqr(), ilDataSet\getJsonRepresentation(), getid3_lyrics3\getLyrics3Data(), ilObjFileListGUI\getProperties(), ilObjRemoteFileListGUI\getProperties(), ilPlugin\getVersion(), ilMDLifecycle\getVersion(), TCPDF\ImageEps(), ilLDAPSettingsGUI\initForm(), ilUtil\isConvertVersionAtLeast(), ilDBMySQL\isMysql4_0OrHigher(), ilDBMySQL\isMysql4_1(), ilDBMySQL\isMysql4_1OrHigher(), ilDBMySQL\isMysql5_6OrHigher(), HTMLPurifier_DefinitionCache\isOld(), MDB2_Driver_Common\loadModule(), getid3_mp3\MPEGaudioFrameLength(), sspmod_oauth_OAuthStore\new_request_token(), GuzzleHttp\Psr7\parse_request(), ilPluginAdmin\parsePluginPhp(), ilUtil\processConvertVersion(), ilDBUpdate\readCustomUpdatesFileVersion(), ilDBUpdate\readFileVersion(), ilDBUpdate\readHotfixFileVersion(), IMSGlobal\LTI\ToolProvider\ToolProvider\result(), ilLTIToolProvider\result(), assFileUpload\savePreviewData(), SAML2\SOAPClient\send(), TCPDF_STATIC\set_mqr(), ilDBMySQL\setMaxAllowedPacket(), TCPDF\setPDFVersion(), ilTextAreaInputGUI\setRTESupport(), SimpleSAML\Store\SQL\setTableVersion(), ilTextAreaInputGUI\setUseRte(), ilvCard\setVersion(), IMSGlobal\LTI\ToolProvider\ToolConsumer\signParameters(), GuzzleHttp\Psr7\withProtocolVersion(), Slim\Http\Message\withProtocolVersion(), and getid3_mp3\XingVBRidOffset().

◆ foreach

foreach($raw_files as $file) (   $raw_files as)

Definition at line 40 of file generate-includes.php.