Creating repository for dokuwiki modifications for sudaraka.org
[sudaraka-org:dokuwiki-mods.git] / inc / load.php
1 <?php
2 /**
3  * Load all internal libraries and setup class autoloader
4  *
5  * @author Andreas Gohr <andi@splitbrain.org>
6  */
7
8 // setup class autoloader
9 spl_autoload_register('load_autoload');
10
11 // require all the common libraries
12 // for a few of these order does matter
13 require_once(DOKU_INC.'inc/blowfish.php');
14 require_once(DOKU_INC.'inc/actions.php');
15 require_once(DOKU_INC.'inc/changelog.php');
16 require_once(DOKU_INC.'inc/common.php');
17 require_once(DOKU_INC.'inc/confutils.php');
18 require_once(DOKU_INC.'inc/pluginutils.php');
19 require_once(DOKU_INC.'inc/plugin.php');
20 require_once(DOKU_INC.'inc/events.php');
21 require_once(DOKU_INC.'inc/form.php');
22 require_once(DOKU_INC.'inc/fulltext.php');
23 require_once(DOKU_INC.'inc/html.php');
24 require_once(DOKU_INC.'inc/httputils.php');
25 require_once(DOKU_INC.'inc/indexer.php');
26 require_once(DOKU_INC.'inc/infoutils.php');
27 require_once(DOKU_INC.'inc/io.php');
28 require_once(DOKU_INC.'inc/mail.php');
29 require_once(DOKU_INC.'inc/media.php');
30 require_once(DOKU_INC.'inc/pageutils.php');
31 require_once(DOKU_INC.'inc/parserutils.php');
32 require_once(DOKU_INC.'inc/search.php');
33 require_once(DOKU_INC.'inc/subscription.php');
34 require_once(DOKU_INC.'inc/template.php');
35 require_once(DOKU_INC.'inc/toolbar.php');
36 require_once(DOKU_INC.'inc/utf8.php');
37 require_once(DOKU_INC.'inc/auth.php');
38
39 /**
40  * spl_autoload_register callback
41  *
42  * Contains a static list of DokuWiki's core classes and automatically
43  * require()s their associated php files when an object is instantiated.
44  *
45  * @author Andreas Gohr <andi@splitbrain.org>
46  * @todo   add generic loading of renderers and auth backends
47  */
48 function load_autoload($name){
49     static $classes = null;
50     if(is_null($classes)) $classes = array(
51         'DokuHTTPClient'        => DOKU_INC.'inc/HTTPClient.php',
52         'JSON'                  => DOKU_INC.'inc/JSON.php',
53         'adLDAP'                => DOKU_INC.'inc/adLDAP.php',
54         'Diff'                  => DOKU_INC.'inc/DifferenceEngine.php',
55         'UnifiedDiffFormatter'  => DOKU_INC.'inc/DifferenceEngine.php',
56         'TableDiffFormatter'    => DOKU_INC.'inc/DifferenceEngine.php',
57         'cache'                 => DOKU_INC.'inc/cache.php',
58         'cache_parser'          => DOKU_INC.'inc/cache.php',
59         'cache_instructions'    => DOKU_INC.'inc/cache.php',
60         'cache_renderer'        => DOKU_INC.'inc/cache.php',
61         'Doku_Event'            => DOKU_INC.'inc/events.php',
62         'Doku_Event_Handler'    => DOKU_INC.'inc/events.php',
63         'EmailAddressValidator' => DOKU_INC.'inc/EmailAddressValidator.php',
64         'JpegMeta'              => DOKU_INC.'inc/JpegMeta.php',
65         'SimplePie'             => DOKU_INC.'inc/SimplePie.php',
66         'FeedParser'            => DOKU_INC.'inc/FeedParser.php',
67         'IXR_Server'            => DOKU_INC.'inc/IXR_Library.php',
68         'IXR_Client'            => DOKU_INC.'inc/IXR_Library.php',
69         'IXR_IntrospectionServer' => DOKU_INC.'inc/IXR_Library.php',
70         'Doku_Plugin_Controller'=> DOKU_INC.'inc/plugincontroller.class.php',
71         'GeSHi'                 => DOKU_INC.'inc/geshi.php',
72         'TarLib'                => DOKU_INC.'inc/TarLib.class.php',
73         'ZipLib'                => DOKU_INC.'inc/ZipLib.class.php',
74         'DokuWikiFeedCreator'   => DOKU_INC.'inc/feedcreator.class.php',
75         'Doku_Parser_Mode'      => DOKU_INC.'inc/parser/parser.php',
76         'SafeFN'                => DOKU_INC.'inc/SafeFN.class.php',
77         'Sitemapper'            => DOKU_INC.'inc/Sitemapper.php',
78         'PassHash'              => DOKU_INC.'inc/PassHash.class.php',
79
80         'DokuWiki_Action_Plugin' => DOKU_PLUGIN.'action.php',
81         'DokuWiki_Admin_Plugin'  => DOKU_PLUGIN.'admin.php',
82         'DokuWiki_Syntax_Plugin' => DOKU_PLUGIN.'syntax.php',
83
84     );
85
86     if(isset($classes[$name])){
87         require_once($classes[$name]);
88         return;
89     }
90
91     // Plugin loading
92     if(preg_match('/^(helper|syntax|action|admin|renderer)_plugin_([^_]+)(?:_([^_]+))?$/',
93                   $name, $m)) {
94                 //try to load the wanted plugin file
95         // include, but be silent. Maybe some other autoloader has an idea
96         // how to load this class.
97         $c = ((count($m) === 4) ? "/{$m[3]}" : '');
98         @include DOKU_PLUGIN . "{$m[2]}/{$m[1]}$c.php";
99         return;
100     }
101 }
102