From 16905344219a6293705b71cd526fad3ba07b04eb Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 31 Jan 2010 19:02:14 +0100 Subject: first attempt to centralize all include loading Classes are loaded throug PHP5's class autoloader, all other includes are just loaded by default. This skips a lot of require_once calls. Parser and Plugin stuff isn't handled by the class loader yet. --- inc/load.php | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 inc/load.php (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php new file mode 100644 index 000000000..9d305e3a9 --- /dev/null +++ b/inc/load.php @@ -0,0 +1,98 @@ + + */ + +// setup class autoloader +spl_autoload_register('load_autoload'); + +// require all the common libraries +// for a e few of these order does matter +require_once(DOKU_INC.'inc/DifferenceEngine.php'); +require_once(DOKU_INC.'inc/EmailAddressValidator.php'); +require_once(DOKU_INC.'inc/SimplePie.php'); +require_once(DOKU_INC.'inc/FeedParser.php'); +require_once(DOKU_INC.'inc/HTTPClient.php'); +require_once(DOKU_INC.'inc/IXR_Library.php'); +require_once(DOKU_INC.'inc/JSON.php'); +require_once(DOKU_INC.'inc/JpegMeta.php'); +require_once(DOKU_INC.'inc/TarLib.class.php'); +require_once(DOKU_INC.'inc/ZipLib.class.php'); +require_once(DOKU_INC.'inc/adLDAP.php'); +require_once(DOKU_INC.'inc/blowfish.php'); +require_once(DOKU_INC.'inc/feedcreator.class.php'); +require_once(DOKU_INC.'inc/geshi.php'); +require_once(DOKU_INC.'inc/actions.php'); +require_once(DOKU_INC.'inc/cache.php'); +require_once(DOKU_INC.'inc/changelog.php'); +require_once(DOKU_INC.'inc/cliopts.php'); +require_once(DOKU_INC.'inc/common.php'); +require_once(DOKU_INC.'inc/confutils.php'); +require_once(DOKU_INC.'inc/pluginutils.php'); +require_once(DOKU_INC.'inc/plugin.php'); +require_once(DOKU_INC.'inc/plugincontroller.class.php'); +require_once(DOKU_INC.'inc/events.php'); +require_once(DOKU_INC.'inc/form.php'); +require_once(DOKU_INC.'inc/fulltext.php'); +require_once(DOKU_INC.'inc/html.php'); +require_once(DOKU_INC.'inc/httputils.php'); +require_once(DOKU_INC.'inc/indexer.php'); +require_once(DOKU_INC.'inc/infoutils.php'); +require_once(DOKU_INC.'inc/init.php'); +require_once(DOKU_INC.'inc/io.php'); +require_once(DOKU_INC.'inc/load.php'); +require_once(DOKU_INC.'inc/mail.php'); +require_once(DOKU_INC.'inc/media.php'); +require_once(DOKU_INC.'inc/pageutils.php'); +require_once(DOKU_INC.'inc/parserutils.php'); +require_once(DOKU_INC.'inc/search.php'); +require_once(DOKU_INC.'inc/subscription.php'); +require_once(DOKU_INC.'inc/template.php'); +require_once(DOKU_INC.'inc/toolbar.php'); +require_once(DOKU_INC.'inc/utf8.php'); +require_once(DOKU_INC.'inc/auth.php'); + +/** + * spl_autoload_register callback + * + * Contains a static list of DokuWiki's core classes and automatically + * requires their associated php files when an object is instantiated. + * + * @author Andreas Gohr + * @todo add generic loading of plugins here + */ +function load_autoload($name){ + static $classes = null; + if(is_null($classes)) $classes = array( + 'DokuHTTPClient' => DOKU_INC.'inc/HTTPClient.php', + 'DokuEvent' => DOKU_INC.'inc/', + 'JSON' => DOKU_INC.'inc/JSON.php', + 'adLDAP' => DOKU_INC.'inc/adLDAP.php', + 'Diff' => DOKU_INC.'inc/DifferenceEngine.php', + 'UnifiedDiffFormatter' => DOKU_INC.'inc/DifferenceEngine.php', + 'TableDiffFormatter' => DOKU_INC.'inc/DifferenceEngine.php', + 'cache' => DOKU_INC.'inc/cache.php', + 'cache_parser' => DOKU_INC.'inc/cache.php', + 'cache_instructions' => DOKU_INC.'inc/cache.php', + 'cache_renderer' => DOKU_INC.'inc/cache.php', + 'Doku_Event' => DOKU_INC.'inc/events.php', + 'Doku_Event_Handler' => DOKU_INC.'inc/events.php', + 'Doku_Form' => DOKU_INC.'inc/form.php', + 'EmailAddressValidator' => DOKU_INC.'inc/EmailAddressValidator.php', + 'JpegMeta' => DOKU_INC.'inc/JpegMeta.php', + 'FeedParser' => DOKU_INC.'inc/FeedParser.php', + 'utf8_entity_decoder' => DOKU_INC.'inc/utf8.php', + 'IXR_Server' => DOKU_INC.'inc/IXR_Library.php', + 'IXR_Client' => DOKU_INC.'inc/IXR_Library.php', + 'Doku_Plugin_Controller'=> DOKU_INC.'inc/plugincontroller.class.php', + 'GeSHi' => DOKU_INC.'inc/geshi.php', + ); + + if(isset($classes[$name])){ + require_once($classes[$name]); + return; + } +} + -- cgit v1.2.3 From 2dcde3047b0cbc7cb75b3d9f84fd05a217b7fced Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 1 Feb 2010 15:18:39 +0100 Subject: do not autorequire class only libraries those are loaded on demand through the autoloader mechanism Also cliopts.php is not loaded automatically at all --- inc/load.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index 9d305e3a9..792f05e27 100644 --- a/inc/load.php +++ b/inc/load.php @@ -10,29 +10,17 @@ spl_autoload_register('load_autoload'); // require all the common libraries // for a e few of these order does matter -require_once(DOKU_INC.'inc/DifferenceEngine.php'); -require_once(DOKU_INC.'inc/EmailAddressValidator.php'); -require_once(DOKU_INC.'inc/SimplePie.php'); -require_once(DOKU_INC.'inc/FeedParser.php'); -require_once(DOKU_INC.'inc/HTTPClient.php'); require_once(DOKU_INC.'inc/IXR_Library.php'); -require_once(DOKU_INC.'inc/JSON.php'); -require_once(DOKU_INC.'inc/JpegMeta.php'); -require_once(DOKU_INC.'inc/TarLib.class.php'); -require_once(DOKU_INC.'inc/ZipLib.class.php'); require_once(DOKU_INC.'inc/adLDAP.php'); require_once(DOKU_INC.'inc/blowfish.php'); require_once(DOKU_INC.'inc/feedcreator.class.php'); require_once(DOKU_INC.'inc/geshi.php'); require_once(DOKU_INC.'inc/actions.php'); -require_once(DOKU_INC.'inc/cache.php'); require_once(DOKU_INC.'inc/changelog.php'); -require_once(DOKU_INC.'inc/cliopts.php'); require_once(DOKU_INC.'inc/common.php'); require_once(DOKU_INC.'inc/confutils.php'); require_once(DOKU_INC.'inc/pluginutils.php'); require_once(DOKU_INC.'inc/plugin.php'); -require_once(DOKU_INC.'inc/plugincontroller.class.php'); require_once(DOKU_INC.'inc/events.php'); require_once(DOKU_INC.'inc/form.php'); require_once(DOKU_INC.'inc/fulltext.php'); @@ -58,7 +46,7 @@ require_once(DOKU_INC.'inc/auth.php'); * spl_autoload_register callback * * Contains a static list of DokuWiki's core classes and automatically - * requires their associated php files when an object is instantiated. + * require()s their associated php files when an object is instantiated. * * @author Andreas Gohr * @todo add generic loading of plugins here @@ -67,7 +55,6 @@ function load_autoload($name){ static $classes = null; if(is_null($classes)) $classes = array( 'DokuHTTPClient' => DOKU_INC.'inc/HTTPClient.php', - 'DokuEvent' => DOKU_INC.'inc/', 'JSON' => DOKU_INC.'inc/JSON.php', 'adLDAP' => DOKU_INC.'inc/adLDAP.php', 'Diff' => DOKU_INC.'inc/DifferenceEngine.php', @@ -79,15 +66,16 @@ function load_autoload($name){ 'cache_renderer' => DOKU_INC.'inc/cache.php', 'Doku_Event' => DOKU_INC.'inc/events.php', 'Doku_Event_Handler' => DOKU_INC.'inc/events.php', - 'Doku_Form' => DOKU_INC.'inc/form.php', 'EmailAddressValidator' => DOKU_INC.'inc/EmailAddressValidator.php', 'JpegMeta' => DOKU_INC.'inc/JpegMeta.php', + 'SimplePie' => DOKU_INC.'inc/SimplePie.php', 'FeedParser' => DOKU_INC.'inc/FeedParser.php', - 'utf8_entity_decoder' => DOKU_INC.'inc/utf8.php', 'IXR_Server' => DOKU_INC.'inc/IXR_Library.php', 'IXR_Client' => DOKU_INC.'inc/IXR_Library.php', 'Doku_Plugin_Controller'=> DOKU_INC.'inc/plugincontroller.class.php', 'GeSHi' => DOKU_INC.'inc/geshi.php', + 'TarLib' => DOKU_INC.'inc/TarLib.class.php', + 'ZibLib' => DOKU_INC.'inc/ZipLib.class.php', ); if(isset($classes[$name])){ -- cgit v1.2.3 From c2a6d81662045023bdf1617b6b49f71c274d55ca Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 1 Feb 2010 16:10:25 +0100 Subject: plugin related autoloading This patch moved the place where DOKU_PLUGIN is defined. It no longer can be set from a normal config (only via preload) --- inc/load.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index 792f05e27..e06a2c63d 100644 --- a/inc/load.php +++ b/inc/load.php @@ -76,6 +76,11 @@ function load_autoload($name){ 'GeSHi' => DOKU_INC.'inc/geshi.php', 'TarLib' => DOKU_INC.'inc/TarLib.class.php', 'ZibLib' => DOKU_INC.'inc/ZipLib.class.php', + + 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', + 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', + 'DokuWiki_Syntax_Plugin' => DOKU_PLUGIN.'syntax.php', + ); if(isset($classes[$name])){ -- cgit v1.2.3 From 05ed2c25ea0dc45eef2af0f9f4176c939af41100 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 12 Mar 2010 14:09:57 +0100 Subject: some more load fixes --- inc/load.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index e06a2c63d..dad03875a 100644 --- a/inc/load.php +++ b/inc/load.php @@ -9,12 +9,8 @@ spl_autoload_register('load_autoload'); // require all the common libraries -// for a e few of these order does matter -require_once(DOKU_INC.'inc/IXR_Library.php'); -require_once(DOKU_INC.'inc/adLDAP.php'); +// for a few of these order does matter require_once(DOKU_INC.'inc/blowfish.php'); -require_once(DOKU_INC.'inc/feedcreator.class.php'); -require_once(DOKU_INC.'inc/geshi.php'); require_once(DOKU_INC.'inc/actions.php'); require_once(DOKU_INC.'inc/changelog.php'); require_once(DOKU_INC.'inc/common.php'); @@ -49,7 +45,7 @@ require_once(DOKU_INC.'inc/auth.php'); * require()s their associated php files when an object is instantiated. * * @author Andreas Gohr - * @todo add generic loading of plugins here + * @todo add generic loading of plugins and other generically named classes */ function load_autoload($name){ static $classes = null; @@ -76,6 +72,8 @@ function load_autoload($name){ 'GeSHi' => DOKU_INC.'inc/geshi.php', 'TarLib' => DOKU_INC.'inc/TarLib.class.php', 'ZibLib' => DOKU_INC.'inc/ZipLib.class.php', + 'DokuWikiFeedCreator' => DOKU_INC.'inc/feedcreator.class.php', + 'Doku_Parser_Mode' => DOKU_INC.'inc/parser/parser.php', 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', -- cgit v1.2.3 From c7cb395c4ee1339709918b7675e91d3d3b10050d Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 15 Mar 2010 12:16:23 +0100 Subject: Load libraries after init --- inc/load.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index dad03875a..796ccec77 100644 --- a/inc/load.php +++ b/inc/load.php @@ -24,9 +24,7 @@ require_once(DOKU_INC.'inc/html.php'); require_once(DOKU_INC.'inc/httputils.php'); require_once(DOKU_INC.'inc/indexer.php'); require_once(DOKU_INC.'inc/infoutils.php'); -require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/io.php'); -require_once(DOKU_INC.'inc/load.php'); require_once(DOKU_INC.'inc/mail.php'); require_once(DOKU_INC.'inc/media.php'); require_once(DOKU_INC.'inc/pageutils.php'); -- cgit v1.2.3 From 94d621b02d20870ce6ddac900faf60ae784f8747 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Tue, 16 Mar 2010 12:07:44 +0100 Subject: Typo in ZipLib autoloader --- inc/load.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index 796ccec77..f0945c5bc 100644 --- a/inc/load.php +++ b/inc/load.php @@ -69,7 +69,7 @@ function load_autoload($name){ 'Doku_Plugin_Controller'=> DOKU_INC.'inc/plugincontroller.class.php', 'GeSHi' => DOKU_INC.'inc/geshi.php', 'TarLib' => DOKU_INC.'inc/TarLib.class.php', - 'ZibLib' => DOKU_INC.'inc/ZipLib.class.php', + 'ZipLib' => DOKU_INC.'inc/ZipLib.class.php', 'DokuWikiFeedCreator' => DOKU_INC.'inc/feedcreator.class.php', 'Doku_Parser_Mode' => DOKU_INC.'inc/parser/parser.php', -- cgit v1.2.3 From 5ce4ea1542521e553f96e379988478345646bcb6 Mon Sep 17 00:00:00 2001 From: Michael Klier Date: Tue, 16 Mar 2010 14:50:15 +0100 Subject: added missing IXR_IntrospectionServer to autoload classes --- inc/load.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index f0945c5bc..faf4e9570 100644 --- a/inc/load.php +++ b/inc/load.php @@ -66,6 +66,7 @@ function load_autoload($name){ 'FeedParser' => DOKU_INC.'inc/FeedParser.php', 'IXR_Server' => DOKU_INC.'inc/IXR_Library.php', 'IXR_Client' => DOKU_INC.'inc/IXR_Library.php', + 'IXR_IntrospectionServer' => DOKU_INC.'inc/IXR_Library.php', 'Doku_Plugin_Controller'=> DOKU_INC.'inc/plugincontroller.class.php', 'GeSHi' => DOKU_INC.'inc/geshi.php', 'TarLib' => DOKU_INC.'inc/TarLib.class.php', -- cgit v1.2.3 From f03fd957525a714da1cde7e2957939046bd51bd5 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 4 Apr 2010 20:28:39 +0200 Subject: new fnencode option FS#1649 This patch adds an option to choose how filenames are encoded when saved to the file system. You can choose between urlencoding (url), the new SafeFn method (safe) and storing real UTF-8 (utf-8). --- inc/load.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/load.php') diff --git a/inc/load.php b/inc/load.php index faf4e9570..2f5be6d63 100644 --- a/inc/load.php +++ b/inc/load.php @@ -73,6 +73,7 @@ function load_autoload($name){ 'ZipLib' => DOKU_INC.'inc/ZipLib.class.php', 'DokuWikiFeedCreator' => DOKU_INC.'inc/feedcreator.class.php', 'Doku_Parser_Mode' => DOKU_INC.'inc/parser/parser.php', + 'SafeFN' => DOKU_INC.'inc/SafeFN.class.php', 'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php', 'DokuWiki_Admin_Plugin' => DOKU_PLUGIN.'admin.php', -- cgit v1.2.3