diff --git a/doku.php b/doku.php
index 95d5c3101d7aeec1c92c9469df1b4041eb37a240..54b1d00e9b23791318d39fb41633bd7dced1cd9a 100644
--- a/doku.php
+++ b/doku.php
@@ -20,13 +20,8 @@ if (isset($_SERVER['HTTP_X_DOKUWIKI_DO'])){
     $ACT = 'show';
 }
 
+// load and initialize the core system
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/events.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/html.php');
-require_once(DOKU_INC.'inc/auth.php');
-require_once(DOKU_INC.'inc/actions.php');
 
 //import variables
 $QUERY = trim($_REQUEST['id']);
diff --git a/feed.php b/feed.php
index 0ad1c2c303027c8ab0f6f5d1b786fbf1a3c261a1..73227e055b0216c9112335dacf2a118a17bd987a 100644
--- a/feed.php
+++ b/feed.php
@@ -8,13 +8,6 @@
 
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/');
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/events.php');
-require_once(DOKU_INC.'inc/parserutils.php');
-require_once(DOKU_INC.'inc/feedcreator.class.php');
-require_once(DOKU_INC.'inc/auth.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/httputils.php');
 
 //close session
 session_write_close();
diff --git a/inc/FeedParser.php b/inc/FeedParser.php
index f37888f01264a05fbd13b3f950389e9f8aad1b9e..9d00e7abf88ec9dacbfd2fc6de86e718bd0faf46 100644
--- a/inc/FeedParser.php
+++ b/inc/FeedParser.php
@@ -6,9 +6,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/HTTPClient.php');
-require_once(DOKU_INC.'inc/SimplePie.php');
-
 
 /**
  * We override some methods of the original SimplePie class here
diff --git a/inc/IXR_Library.php b/inc/IXR_Library.php
index 25d1066b058e6df9938b11f94881db4015e389f7..afa496aed75a3e26b0fa65e4fae4d15deb999e8e 100644
--- a/inc/IXR_Library.php
+++ b/inc/IXR_Library.php
@@ -364,7 +364,6 @@ EOD;
             #$result = $this->$method($args);
             $result = call_user_func_array(array(&$this,$method),$args);
         } elseif (substr($method, 0, 7) == 'plugin:') {
-            require_once(DOKU_INC.'inc/pluginutils.php');
             list($pluginname, $callback) = explode(':', substr($method, 7), 2);
             if(!plugin_isdisabled($pluginname)) {
                 $plugin = plugin_load('action', $pluginname);
diff --git a/inc/JSON.php b/inc/JSON.php
index 7ec40009283265b2c05a0ae719c62265c2e30e51..332827f4ca08ea63911298956b0a317234bc483a 100644
--- a/inc/JSON.php
+++ b/inc/JSON.php
@@ -59,7 +59,6 @@
 
 // for DokuWiki
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/utf8.php');
 
 /**
  * Marker constant for JSON::decode(), used to flag stack state
diff --git a/inc/actions.php b/inc/actions.php
index 6ce67eb9aa3ec1bfe6164e75cd458b12859ececa..66068cd362cabe5662f77073427f7dec4e061521 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -7,8 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/template.php');
-
 
 /**
  * Call the needed action handlers
@@ -623,7 +621,6 @@ function act_subscription($act){
     $action = $params['action'];
 
     // Perform action.
-    require_once DOKU_INC . 'inc/subscription.php';
     if (!subscription_set($_SERVER['REMOTE_USER'], $target, $style, $data)) {
         throw new Exception(sprintf($lang["subscr_{$action}_error"],
                                     hsc($INFO['userinfo']['name']),
diff --git a/inc/auth.php b/inc/auth.php
index c18104487ccdcc510f0e50c835bd37e79321605d..33626cf80a93467a65ecb845fc9647ffab99ddc1 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -10,8 +10,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/io.php');
 
 // some ACL level defines
 define('AUTH_NONE',0);
@@ -22,15 +20,23 @@ define('AUTH_UPLOAD',8);
 define('AUTH_DELETE',16);
 define('AUTH_ADMIN',255);
 
-global $conf;
-
-if($conf['useacl']){
-    require_once(DOKU_INC.'inc/blowfish.php');
-    require_once(DOKU_INC.'inc/mail.php');
-
+/**
+ * Initialize the auth system.
+ *
+ * This function is automatically called at the end of init.php
+ *
+ * This used to be the main() of the auth.php
+ *
+ * @todo backend loading maybe should be handled by the class autoloader
+ * @todo maybe split into multiple functions at the XXX marked positions
+ */
+function auth_setup(){
+    global $conf;
     global $auth;
 
-    // load the the backend auth functions and instantiate the auth object
+    if(!$conf['useacl']) return false;
+
+    // load the the backend auth functions and instantiate the auth object XXX
     if (@file_exists(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php')) {
         require_once(DOKU_INC.'inc/auth/basic.class.php');
         require_once(DOKU_INC.'inc/auth/'.$conf['authtype'].'.class.php');
@@ -50,51 +56,49 @@ if($conf['useacl']){
     } else {
         nice_die($lang['authmodfailed']);
     }
-}
 
-// do the login either by cookie or provided credentials
-if($conf['useacl']){
-    if($auth){
-        if (!isset($_REQUEST['u'])) $_REQUEST['u'] = '';
-        if (!isset($_REQUEST['p'])) $_REQUEST['p'] = '';
-        if (!isset($_REQUEST['r'])) $_REQUEST['r'] = '';
-        $_REQUEST['http_credentials'] = false;
-        if (!$conf['rememberme']) $_REQUEST['r'] = false;
-
-        // streamline HTTP auth credentials (IIS/rewrite -> mod_php)
-        if(isset($_SERVER['HTTP_AUTHORIZATION'])){
-            list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) =
-                explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
-        }
+    if(!$auth) return;
 
-        // if no credentials were given try to use HTTP auth (for SSO)
-        if(empty($_REQUEST['u']) && empty($_COOKIE[DOKU_COOKIE]) && !empty($_SERVER['PHP_AUTH_USER'])){
-            $_REQUEST['u'] = $_SERVER['PHP_AUTH_USER'];
-            $_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];
-            $_REQUEST['http_credentials'] = true;
-        }
+    // do the login either by cookie or provided credentials XXX
+    if (!isset($_REQUEST['u'])) $_REQUEST['u'] = '';
+    if (!isset($_REQUEST['p'])) $_REQUEST['p'] = '';
+    if (!isset($_REQUEST['r'])) $_REQUEST['r'] = '';
+    $_REQUEST['http_credentials'] = false;
+    if (!$conf['rememberme']) $_REQUEST['r'] = false;
 
-        // apply cleaning
-        $_REQUEST['u'] = $auth->cleanUser($_REQUEST['u']);
+    // streamline HTTP auth credentials (IIS/rewrite -> mod_php)
+    if(isset($_SERVER['HTTP_AUTHORIZATION'])){
+        list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) =
+            explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+    }
 
-        if(isset($_REQUEST['authtok'])){
-            // when an authentication token is given, trust the session
-            auth_validateToken($_REQUEST['authtok']);
-        }elseif(!is_null($auth) && $auth->canDo('external')){
-            // external trust mechanism in place
-            $auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
-        }else{
-            $evdata = array(
-                    'user'     => $_REQUEST['u'],
-                    'password' => $_REQUEST['p'],
-                    'sticky'   => $_REQUEST['r'],
-                    'silent'   => $_REQUEST['http_credentials'],
-                    );
-            trigger_event('AUTH_LOGIN_CHECK', $evdata, 'auth_login_wrapper');
-        }
+    // if no credentials were given try to use HTTP auth (for SSO)
+    if(empty($_REQUEST['u']) && empty($_COOKIE[DOKU_COOKIE]) && !empty($_SERVER['PHP_AUTH_USER'])){
+        $_REQUEST['u'] = $_SERVER['PHP_AUTH_USER'];
+        $_REQUEST['p'] = $_SERVER['PHP_AUTH_PW'];
+        $_REQUEST['http_credentials'] = true;
+    }
+
+    // apply cleaning
+    $_REQUEST['u'] = $auth->cleanUser($_REQUEST['u']);
+
+    if(isset($_REQUEST['authtok'])){
+        // when an authentication token is given, trust the session
+        auth_validateToken($_REQUEST['authtok']);
+    }elseif(!is_null($auth) && $auth->canDo('external')){
+        // external trust mechanism in place
+        $auth->trustExternal($_REQUEST['u'],$_REQUEST['p'],$_REQUEST['r']);
+    }else{
+        $evdata = array(
+                'user'     => $_REQUEST['u'],
+                'password' => $_REQUEST['p'],
+                'sticky'   => $_REQUEST['r'],
+                'silent'   => $_REQUEST['http_credentials'],
+                );
+        trigger_event('AUTH_LOGIN_CHECK', $evdata, 'auth_login_wrapper');
     }
 
-    //load ACL into a global array
+    //load ACL into a global array XXX
     global $AUTH_ACL;
     if(is_readable(DOKU_CONF.'acl.auth.php')){
         $AUTH_ACL = file(DOKU_CONF.'acl.auth.php');
diff --git a/inc/cache.php b/inc/cache.php
index 2e22edfb11555b5390b2c7354e48cdcbc7553704..571b314cde1842f5d16bc363e54911ed96c387dc 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -7,9 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/io.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/parserutils.php');
 
 class cache {
     var $key = '';          // primary identifier for this item
diff --git a/inc/common.php b/inc/common.php
index 6601ae4781794358737d5b9603be620a549d4ea9..d1a722f45adfcae71b9f4006f1e35e132ecf496b 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -7,13 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/io.php');
-require_once(DOKU_INC.'inc/changelog.php');
-require_once(DOKU_INC.'inc/utf8.php');
-require_once(DOKU_INC.'inc/mail.php');
-require_once(DOKU_INC.'inc/parserutils.php');
-require_once(DOKU_INC.'inc/infoutils.php');
-require_once DOKU_INC.'inc/subscription.php';
 
 /**
  * These constants are used with the recents function
@@ -1031,7 +1024,6 @@ function saveWikiText($id,$text,$summary,$minor=false){
 
     // if useheading is enabled, purge the cache of all linking pages
     if(useHeading('content')){
-        require_once(DOKU_INC.'inc/fulltext.php');
         $pages = ft_backlinks($id);
         foreach ($pages as $page) {
             $cache = new cache_renderer($page, wikiFN($page), 'xhtml');
@@ -1119,7 +1111,6 @@ function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){
     }elseif($rev){
         $subject = $lang['mail_changed'].' '.$id;
         $text = str_replace('@OLDPAGE@',wl($id,"rev=$rev",true,'&'),$text);
-        require_once(DOKU_INC.'inc/DifferenceEngine.php');
         $df  = new Diff(explode("\n",rawWiki($id,$rev)),
                         explode("\n",rawWiki($id)));
         $dformat = new UnifiedDiffFormatter();
diff --git a/inc/events.php b/inc/events.php
index e6b608f20abd9c66b2ef94fa9dce449763d8d9bd..1c82af003007f1e6f70fadf534b4a14963fa5909 100644
--- a/inc/events.php
+++ b/inc/events.php
@@ -7,7 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/pluginutils.php');
 
 class Doku_Event {
 
diff --git a/inc/form.php b/inc/form.php
index 0a6bc2bba2958c8e266eecfebc27ffb08b10b6a8..cebaf4608e8cbd5eeb45fcb44b1a20038e79d60d 100644
--- a/inc/form.php
+++ b/inc/form.php
@@ -7,7 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/html.php');
 
 /**
  * Class for creating simple HTML forms.
diff --git a/inc/fulltext.php b/inc/fulltext.php
index 4f4dc1bfdbbda72ae439285df2e26f919e511f54..14286252957dec0bc64bad0894d8519dfd27249e 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -7,7 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/indexer.php');
 
 /**
  * create snippets for the first few results only
@@ -139,7 +138,6 @@ function ft_backlinks($id){
     $docs    = array_keys(ft_resultCombine(array_values($matches)));
     $docs    = array_filter($docs,'isVisiblePage'); // discard hidden pages
     if(!count($docs)) return $result;
-    require_once(DOKU_INC.'inc/parserutils.php');
 
     // check metadata for matching links
     foreach($docs as $match){
diff --git a/inc/html.php b/inc/html.php
index 3ebba65c8ed48bc4da992de435630705a4faa2f5..23eadebc490bf01ae190fd55ea68d4984564b039 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -8,8 +8,6 @@
 
 if(!defined('DOKU_INC')) die('meh.');
 if(!defined('NL')) define('NL',"\n");
-require_once(DOKU_INC.'inc/parserutils.php');
-require_once(DOKU_INC.'inc/form.php');
 
 /**
  * Convenience function to quickly build a wikilink
@@ -313,8 +311,6 @@ function html_hilight_callback($m) {
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_search(){
-    require_once(DOKU_INC.'inc/search.php');
-    require_once(DOKU_INC.'inc/fulltext.php');
     global $conf;
     global $QUERY;
     global $ID;
@@ -707,7 +703,6 @@ function html_recent($first=0){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_index($ns){
-    require_once(DOKU_INC.'inc/search.php');
     global $conf;
     global $ID;
     $dir = $conf['datadir'];
@@ -845,7 +840,6 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
  * @author Michael Klier <chi@chimeric.de>
  */
 function html_backlinks(){
-    require_once(DOKU_INC.'inc/fulltext.php');
     global $ID;
     global $conf;
     global $lang;
@@ -873,7 +867,6 @@ function html_backlinks(){
  * @author Andreas Gohr <andi@splitbrain.org>
  */
 function html_diff($text='',$intro=true){
-    require_once(DOKU_INC.'inc/DifferenceEngine.php');
     global $ID;
     global $REV;
     global $lang;
diff --git a/inc/indexer.php b/inc/indexer.php
index 39592e8f4e40df286c1d4af23b2291cce2a1e796..07b67c014793a9f300475c319a4285d179289f9a 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -7,9 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/io.php');
-require_once(DOKU_INC.'inc/utf8.php');
-require_once(DOKU_INC.'inc/parserutils.php');
 
 // set the minimum token length to use in the index (note, this doesn't apply to numeric tokens)
 if (!defined('IDX_MINWORDLENGTH')) define('IDX_MINWORDLENGTH',2);
diff --git a/inc/infoutils.php b/inc/infoutils.php
index 001a33f6619bea060fde467be4f565b4a6c8443c..32baa94507d786dc04cbf4bf1ed229d2a2ff9267 100644
--- a/inc/infoutils.php
+++ b/inc/infoutils.php
@@ -7,7 +7,6 @@
  */
 if(!defined('DOKU_INC')) die('meh.');
 if(!defined('DOKU_MESSAGEURL')) define('DOKU_MESSAGEURL','http://update.dokuwiki.org/check/');
-require_once(DOKU_INC.'inc/HTTPClient.php');
 
 /**
  * Check for new messages from upstream
@@ -223,7 +222,6 @@ function check(){
         msg('The current page is not writable by you',0);
     }
 
-    require_once(DOKU_INC.'inc/HTTPClient.php');
     $check = wl('','',true).'data/_dummy';
     $http = new DokuHTTPClient();
     $http->timeout = 6;
diff --git a/inc/init.php b/inc/init.php
index 6fb9559ceab5853a0f112591b5088edd56bd164b..7f4792cfa2a3dff19ffc6c77d14052888b2cd2f6 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -20,6 +20,9 @@ if (@file_exists($preload)) include($preload);
 // define the include path
 if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/');
 
+// define Plugin dir
+if(!defined('DOKU_PLUGIN'))  define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
+
 // define config path (packagers may want to change this to /etc/dokuwiki/)
 if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/');
 
@@ -37,6 +40,9 @@ if (!defined('DOKU_E_LEVEL')) {
     error_reporting(DOKU_E_LEVEL);
 }
 
+// load libraries
+require_once(DOKU_INC.'inc/load.php');
+
 // init memory caches
 global $cache_revinfo;
        $cache_revinfo = array();
@@ -155,8 +161,6 @@ if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t");
 // define cookie and session id, append server port when securecookie is configured FS#1664
 if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:'')));
 
-// define Plugin dir
-if(!defined('DOKU_PLUGIN'))  define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 
 // define main script
 if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php');
@@ -245,6 +249,8 @@ init_files();
 scriptify(DOKU_CONF.'users.auth');
 scriptify(DOKU_CONF.'acl.auth');
 
+// setup authentication system
+auth_setup();
 
 /**
  * Checks paths from config file
@@ -526,7 +532,6 @@ EOT;
     exit;
 }
 
-
 /**
  * A realpath() replacement
  *
@@ -588,5 +593,3 @@ function fullpath($path,$exists=false){
     return $finalpath;
 }
 
-
-
diff --git a/inc/io.php b/inc/io.php
index 32a6f7b8e0a07f32f0c1c7bd8db4dde18d97c774..1d69dabc916015742ef3f75824f6c188437c2508 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -7,10 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/HTTPClient.php');
-require_once(DOKU_INC.'inc/events.php');
-require_once(DOKU_INC.'inc/utf8.php');
 
 /**
  * Removes empty directories
diff --git a/inc/load.php b/inc/load.php
new file mode 100644
index 0000000000000000000000000000000000000000..dad03875ab820364b28c105c359e9f63a964b707
--- /dev/null
+++ b/inc/load.php
@@ -0,0 +1,89 @@
+<?php
+/**
+ * Load all internal libraries and setup class autoloader
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+
+// setup class autoloader
+spl_autoload_register('load_autoload');
+
+// require all the common libraries
+// for a few of these order does matter
+require_once(DOKU_INC.'inc/blowfish.php');
+require_once(DOKU_INC.'inc/actions.php');
+require_once(DOKU_INC.'inc/changelog.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/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
+ * require()s their associated php files when an object is instantiated.
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @todo   add generic loading of plugins and other generically named classes
+ */
+function load_autoload($name){
+    static $classes = null;
+    if(is_null($classes)) $classes = array(
+        'DokuHTTPClient'        => DOKU_INC.'inc/HTTPClient.php',
+        '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',
+        'EmailAddressValidator' => DOKU_INC.'inc/EmailAddressValidator.php',
+        'JpegMeta'              => DOKU_INC.'inc/JpegMeta.php',
+        'SimplePie'             => DOKU_INC.'inc/SimplePie.php',
+        'FeedParser'            => DOKU_INC.'inc/FeedParser.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',
+        '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',
+        'DokuWiki_Syntax_Plugin' => DOKU_PLUGIN.'syntax.php',
+
+    );
+
+    if(isset($classes[$name])){
+        require_once($classes[$name]);
+        return;
+    }
+}
+
diff --git a/inc/mail.php b/inc/mail.php
index 3b0592b8bdb5103f21bd5b12ef4798181a1379e6..6d1652fc0b6b4f6f7550fbb4b043404cbbc614f0 100644
--- a/inc/mail.php
+++ b/inc/mail.php
@@ -7,8 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/utf8.php');
-require_once(DOKU_INC.'inc/EmailAddressValidator.php');
 
 // end of line for mail lines - RFC822 says CRLF but postfix (and other MTAs?)
 // think different
diff --git a/inc/media.php b/inc/media.php
index 3850f4e333272a478bacedf7e71fe625bbd8d306..668f42d6aee3905d358452172073c4a6ad074f33 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -8,9 +8,6 @@
 
 if(!defined('DOKU_INC')) die('meh.');
 if(!defined('NL')) define('NL',"\n");
-require_once(DOKU_INC.'inc/html.php');
-require_once(DOKU_INC.'inc/search.php');
-require_once(DOKU_INC.'inc/JpegMeta.php');
 
 /**
  * Lists pages which currently use a media file selected for deletion
@@ -152,7 +149,6 @@ function media_inuse($id) {
     global $conf;
     $mediareferences = array();
     if($conf['refcheck']){
-        require_once(DOKU_INC.'inc/fulltext.php');
         $mediareferences = ft_mediause($id,$conf['refshow']);
         if(!count($mediareferences)) {
             return false;
@@ -230,7 +226,6 @@ function media_delete($id,$auth){
 function media_upload($ns,$auth){
     if($auth < AUTH_UPLOAD) return false;
     if(!checkSecurityToken()) return false;
-    require_once(DOKU_INC.'inc/confutils.php');
     global $lang;
     global $conf;
 
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 631e4149cd99b420f0a64bc0debb1c90ca7c88b7..4102ee7118b1eec6843ba081c13c1bbcabfe8a32 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -8,10 +8,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/confutils.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/pluginutils.php');
-require_once(DOKU_INC.'inc/cache.php');
 
 /**
  * Returns the parsed Wikitext in XHTML for the given id and revision.
@@ -648,8 +644,6 @@ function p_xhtml_cached_geshi($code, $language, $wrapper='pre') {
 
     } else {
 
-        require_once(DOKU_INC . 'inc/geshi.php');
-
         $geshi = new GeSHi($code, $language, DOKU_INC . 'inc/geshi');
         $geshi->set_encoding('utf-8');
         $geshi->enable_classes();
diff --git a/inc/pluginutils.php b/inc/pluginutils.php
index 8294d1ec85165c74768416a2f8952d719d6ebf5f..a8656a96a24301ce81a37eb2caed76ee8f055a59 100644
--- a/inc/pluginutils.php
+++ b/inc/pluginutils.php
@@ -8,7 +8,6 @@
 
 // plugin related constants
 if(!defined('DOKU_PLUGIN'))  define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_INC.'inc/plugincontroller.class.php');
 
 $plugin_types = array('admin','syntax','action','renderer', 'helper');
 
diff --git a/inc/search.php b/inc/search.php
index 2b9a51fb36b107006c20a100c5823e37181008ec..9e096440401a37ac5a06b16cf6bc622899e3dfcc 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -7,7 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/common.php');
 
 /**
  * recurse direcory
@@ -195,7 +194,6 @@ function search_media(&$data,$base,$file,$type,$lvl,$opts){
     $info['writable'] = is_writable($base.'/'.$file);
     if(preg_match("/\.(jpe?g|gif|png)$/",$file)){
         $info['isimg'] = true;
-        require_once(DOKU_INC.'inc/JpegMeta.php');
         $info['meta']  = new JpegMeta($base.'/'.$file);
     }else{
         $info['isimg'] = false;
@@ -321,7 +319,6 @@ function search_backlinks(&$data,$base,$file,$type,$lvl,$opts){
     }
 
     //fetch instructions
-    require_once(DOKU_INC.'inc/parserutils.php');
     $instructions = p_cached_instructions($base.$file,true);
     if(is_null($instructions)) return false;
 
diff --git a/inc/subscription.php b/inc/subscription.php
index f844fea1da655ae4f7ec2816d83f6d1830669ebb..e5938d9bdb6775e19fa77ea7eeb1da0c6473823d 100644
--- a/inc/subscription.php
+++ b/inc/subscription.php
@@ -14,8 +14,6 @@
  * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
  */
 
-require_once DOKU_INC.'/inc/pageutils.php';
-
 /**
  * Get the name of the metafile tracking subscriptions to target page or
  * namespace
@@ -277,7 +275,6 @@ function subscription_send_digest($subscriber_mail, $change, $lastupdate) {
     if (!is_null($rev)) {
         $subject = 'changed';
         $replaces['OLDPAGE'] = wl($id, "rev=$rev", true, '&');
-        require_once DOKU_INC.'inc/DifferenceEngine.php';
         $df = new Diff(explode("\n", rawWiki($id, $rev)),
                         explode("\n", rawWiki($id)));
         $dformat = new UnifiedDiffFormatter();
diff --git a/inc/template.php b/inc/template.php
index 7fe440b18279627c7f273c5b72069af9f15f2604..7b0ef466b11a79cb33c5db2e938449ecbff99dd6 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -338,11 +338,9 @@ function tpl_metaheaders($alt=true){
             'href'=>DOKU_BASE.'lib/exe/css.php?s=print&t='.$conf['template'].'&tseed='.$tseed);
 
     // make $INFO and other vars available to JavaScripts
-    require_once(DOKU_INC.'inc/JSON.php');
     $json = new JSON();
     $script = "var NS='".$INFO['namespace']."';";
     if($conf['useacl'] && $_SERVER['REMOTE_USER']){
-        require_once(DOKU_INC.'inc/toolbar.php');
         $script .= "var SIG='".toolbar_signature()."';";
     }
     $script .= 'var JSINFO = '.$json->encode($JSINFO).';';
diff --git a/inc/toolbar.php b/inc/toolbar.php
index 21819d138270e3e9c5d7773dce17c21544d7ef71..a07bfb93dc73b29598f907a490000f622e7c701a 100644
--- a/inc/toolbar.php
+++ b/inc/toolbar.php
@@ -7,8 +7,6 @@
  */
 
 if(!defined('DOKU_INC')) die('meh.');
-require_once(DOKU_INC.'inc/JSON.php');
-
 
 /**
  * Prepares and prints an JavaScript array with all toolbar buttons
diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php
index 465bd18460d6b713cf6b812b7b4f15f4658243f5..4c74709b8c7cb802848b5c78634b8d0fc8480899 100644
--- a/lib/exe/ajax.php
+++ b/lib/exe/ajax.php
@@ -13,10 +13,7 @@ if(!count($_POST) && $HTTP_RAW_POST_DATA){
 
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/auth.php');
-//close sesseion
+//close session
 session_write_close();
 
 header('Content-Type: text/html; charset=utf-8');
@@ -57,9 +54,6 @@ function ajax_qsearch(){
   if(empty($query)) $query = cleanID($_GET['q']);
   if(empty($query)) return;
 
-  require_once(DOKU_INC.'inc/html.php');
-  require_once(DOKU_INC.'inc/fulltext.php');
-
   $data = array();
   $data = ft_pageLookup($query);
 
@@ -95,10 +89,6 @@ function ajax_suggestions() {
   if(empty($query)) $query = cleanID($_GET['q']);
   if(empty($query)) return;
 
-  require_once(DOKU_INC.'inc/html.php');
-  require_once(DOKU_INC.'inc/fulltext.php');
-  require_once(DOKU_INC.'inc/JSON.php');
-
   $data = array();
   $data = ft_pageLookup($query);
   if(!count($data)) return;
@@ -181,8 +171,6 @@ function ajax_draftdel(){
  */
 function ajax_medians(){
   global $conf;
-  require_once(DOKU_INC.'inc/search.php');
-  require_once(DOKU_INC.'inc/media.php');
 
   // wanted namespace
   $ns  = cleanID($_POST['ns']);
@@ -208,8 +196,6 @@ function ajax_medians(){
 function ajax_medialist(){
   global $conf;
   global $NS;
-  require_once(DOKU_INC.'inc/media.php');
-  require_once(DOKU_INC.'inc/template.php');
 
   $NS = $_POST['ns'];
   tpl_mediaContent(true);
@@ -222,7 +208,6 @@ function ajax_medialist(){
  */
 function ajax_mediasearchlist(){
   global $conf;
-  require_once(DOKU_INC.'inc/media.php');
 
   media_searchlist($_POST['ns']);
 }
@@ -234,8 +219,6 @@ function ajax_mediasearchlist(){
  */
 function ajax_index(){
   global $conf;
-  require_once(DOKU_INC.'inc/search.php');
-  require_once(DOKU_INC.'inc/html.php');
 
   // wanted namespace
   $ns  = cleanID($_POST['idx']);
@@ -263,7 +246,6 @@ function ajax_index(){
 function ajax_linkwiz(){
   global $conf;
   global $lang;
-  require_once(DOKU_INC.'inc/html.php');
 
   $q  = ltrim($_POST['q'],':');
   $id = noNS($q);
@@ -279,8 +261,6 @@ function ajax_linkwiz(){
   if($q && !$ns){
 
     // use index to lookup matching pages
-    require_once(DOKU_INC.'inc/fulltext.php');
-    require_once(DOKU_INC.'inc/parserutils.php');
     $pages = array();
     $pages = ft_pageLookup($id,false);
 
@@ -312,7 +292,6 @@ function ajax_linkwiz(){
 
   }else{
 
-    require_once(DOKU_INC.'inc/search.php');
     $opts = array(
       'depth' => 1,
       'listfiles' => true,
diff --git a/lib/exe/css.php b/lib/exe/css.php
index cb689d0158dd6728ace8f593736869faa6f85576..38017af9d52f4c4feee6fc3f036522dfab25b94c 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -10,10 +10,6 @@ if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
 if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session or authentication here (better caching)
 if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT',1); // we gzip ourself here
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/httputils.php');
-require_once(DOKU_INC.'inc/io.php');
-require_once(DOKU_INC.'inc/confutils.php');
 
 // Main (don't run when UNIT test)
 if(!defined('SIMPLE_TEST')){
diff --git a/lib/exe/detail.php b/lib/exe/detail.php
index f30e039d407cbb505fce5bb3d2c99c083eb4058e..3a04b7b098b1c924d370f7b26c4ca791cc26ef25 100644
--- a/lib/exe/detail.php
+++ b/lib/exe/detail.php
@@ -2,13 +2,6 @@
   if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
   define('DOKU_MEDIADETAIL',1);
   require_once(DOKU_INC.'inc/init.php');
-  require_once(DOKU_INC.'inc/common.php');
-  require_once(DOKU_INC.'inc/lang/en/lang.php');
-  require_once(DOKU_INC.'inc/lang/'.$conf['lang'].'/lang.php');
-  require_once(DOKU_INC.'inc/JpegMeta.php');
-  require_once(DOKU_INC.'inc/html.php');
-  require_once(DOKU_INC.'inc/template.php');
-  require_once(DOKU_INC.'inc/auth.php');
   //close session
   session_write_close();
 
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php
index 968ee9436f06aa6545f3390802f07e3bcef1144a..680fd9ae41473a3165cad562bc153838e1507377 100644
--- a/lib/exe/fetch.php
+++ b/lib/exe/fetch.php
@@ -9,14 +9,8 @@
   if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
   define('DOKU_DISABLE_GZIP_OUTPUT', 1);
   require_once(DOKU_INC.'inc/init.php');
-  require_once(DOKU_INC.'inc/common.php');
-  require_once(DOKU_INC.'inc/media.php');
-  require_once(DOKU_INC.'inc/pageutils.php');
-  require_once(DOKU_INC.'inc/httputils.php');
-  require_once(DOKU_INC.'inc/confutils.php');
-  require_once(DOKU_INC.'inc/auth.php');
-
-  //close sesseion
+
+  //close session
   session_write_close();
 
   $mimetypes = getMimeTypes();
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index 82116347324dc556643e159b771b93b08cd15e8c..eb56700058d3882c90d691c9342b61fab1c652e7 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -8,8 +8,6 @@
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../');
 define('DOKU_DISABLE_GZIP_OUTPUT',1);
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/auth.php');
-require_once(DOKU_INC.'inc/events.php');
 session_write_close();  //close session
 if(!defined('NL')) define('NL',"\n");
 
@@ -177,8 +175,6 @@ function runIndexer(){
     }
     if($conf['dperm']) chmod($lock, $conf['dperm']);
 
-    require_once(DOKU_INC.'inc/indexer.php');
-
     // upgrade to version 2
     if (!@file_exists($conf['indexdir'].'/pageword.idx'))
         idx_upgradePageWords();
@@ -211,11 +207,8 @@ function metaUpdate(){
     if (@file_exists($file)) return false;
     if (!@file_exists(wikiFN($ID))) return false;
 
-    require_once(DOKU_INC.'inc/common.php');
-    require_once(DOKU_INC.'inc/parserutils.php');
     global $conf;
 
-
     // gather some additional info from changelog
     $info = io_grep($conf['changelog'],
                     '/^(\d+)\t(\d+\.\d+\.\d+\.\d+)\t'.preg_quote($ID,'/').'\t([^\t]+)\t([^\t\n]+)/',
@@ -348,7 +341,6 @@ function sendDigest() {
     if (!$conf['subscribers']) {
         return;
     }
-    require_once DOKU_INC . 'inc/subscription.php';
     $subscriptions = subscription_find($ID, array('style' => '(digest|list)',
                                                   'escaped' => true));
     global $auth;
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 5d93a69a431cd8322657106619ffa453741f4af2..0eb43b2465d45de42950ca62c4fd6689698cde7c 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -11,10 +11,6 @@ if(!defined('NOSESSION')) define('NOSESSION',true); // we do not use a session o
 if(!defined('NL')) define('NL',"\n");
 if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT',1); // we gzip ourself here
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/httputils.php');
-require_once(DOKU_INC.'inc/io.php');
-require_once(DOKU_INC.'inc/JSON.php');
 
 // Main (don't run when UNIT test)
 if(!defined('SIMPLE_TEST')){
@@ -96,7 +92,6 @@ function js_out(){
     echo 'LANG = '.$json->encode($lang['js']).";\n";
 
     // load toolbar
-    require_once(DOKU_INC.'inc/toolbar.php');
     toolbar_JSdefines('toolbar');
 
     // load files
diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index f6e91b8584128e84d2ae06b669f60ea00ff78164..1fe3639850bfbd4e8f3e60ec1e209267a3f3349d 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -6,13 +6,6 @@
     @ini_set('session.use_only_cookies',0);
 
     require_once(DOKU_INC.'inc/init.php');
-    require_once(DOKU_INC.'inc/lang/en/lang.php');
-    require_once(DOKU_INC.'inc/lang/'.$conf['lang'].'/lang.php');
-    require_once(DOKU_INC.'inc/media.php');
-    require_once(DOKU_INC.'inc/common.php');
-    require_once(DOKU_INC.'inc/search.php');
-    require_once(DOKU_INC.'inc/template.php');
-    require_once(DOKU_INC.'inc/auth.php');
 
     trigger_event('MEDIAMANAGER_STARTED',$tmp=array());
     session_write_close();  //close session
diff --git a/lib/exe/xmlrpc.php b/lib/exe/xmlrpc.php
index 155812d22878d28f10c790f61d628e73212d9c29..670ab5d7e4356f2255578defbe42753b076e00e0 100644
--- a/lib/exe/xmlrpc.php
+++ b/lib/exe/xmlrpc.php
@@ -10,15 +10,10 @@ if(isset($HTTP_RAW_POST_DATA)) $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
 define('DOKU_XMLRPC_API_VERSION',3);
 
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/auth.php');
 session_write_close();  //close session
 
 if(!$conf['xmlrpc']) die('XML-RPC server not enabled.');
 
-require_once(DOKU_INC.'inc/IXR_Library.php');
-
-
 /**
  * Contains needed wrapper functions and registers all available
  * XMLRPC functions.
@@ -384,7 +379,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         $ns = cleanID($ns);
         $dir = utf8_encodeFN(str_replace(':', '/', $ns));
         $data = array();
-        require_once(DOKU_INC.'inc/search.php');
         $opts['skipacl'] = 0; // no ACL skipping for XMLRPC
         search($data, $conf['datadir'], 'search_allpages', $opts, $dir);
         return $data;
@@ -448,7 +442,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
             $dir = utf8_encodeFN(str_replace(':', '/', $ns));
 
             $data = array();
-            require_once(DOKU_INC.'inc/search.php');
             search($data, $conf['mediadir'], 'search_media', $options, $dir);
             $len = count($data);
             if(!$len) return array();
@@ -467,7 +460,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
      * Return a list of backlinks
      */
     function listBackLinks($id){
-        require_once(DOKU_INC.'inc/fulltext.php');
         return ft_backlinks($id);
     }
 
@@ -560,8 +552,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
             }
             if($conf['dperm']) chmod($lock, $conf['dperm']);
 
-            require_once(DOKU_INC.'inc/indexer.php');
-
             // do the work
             idx_addPage($id);
 
@@ -613,7 +603,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
                     return new IXR_ERROR(1, $lang['uploadexist'].'1');
                 }
                 // check for valid content
-                @require_once(DOKU_INC.'inc/media.php');
                 $ok = media_contentcheck($ftmp, $imime);
                 if($ok == -1) {
                     return new IXR_ERROR(1, sprintf($lang['uploadexist'].'2', ".$iext"));
@@ -631,7 +620,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
                 $data[4] = $overwrite;
 
                 // trigger event
-                require_once(DOKU_INC.'inc/events.php');
                 return trigger_event('MEDIA_UPLOAD_FINISH', $data, array($this, '_media_upload_action'), true);
 
             } else {
@@ -656,14 +644,12 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         // check for references if needed
         $mediareferences = array();
         if($conf['refcheck']){
-            require_once(DOKU_INC.'inc/fulltext.php');
             $mediareferences = ft_mediause($id,$conf['refshow']);
         }
 
         if(!count($mediareferences)){
             $file = mediaFN($id);
             if(@unlink($file)){
-                require_once(DOKU_INC.'inc/changelog.php');
                 addMediaLogEntry(time(), $id, DOKU_CHANGE_TYPE_DELETE);
                 io_sweepNS($id,'mediadir');
                 return 0;
@@ -689,7 +675,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
                 chmod($data[1], $conf['fmode']);
                 media_notify($data[2], $data[1], $data[3]);
                 // add a log entry to the media changelog
-                require_once(DOKU_INC.'inc/changelog.php');
                 if ($data[4]) {
                     addMediaLogEntry(time(), $data[2], DOKU_CHANGE_TYPE_EDIT);
                 } else {
@@ -769,9 +754,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         if(strlen($timestamp) != 10)
             return new IXR_Error(20, 'The provided value is not a valid timestamp');
 
-        require_once(DOKU_INC.'inc/changelog.php');
-        require_once(DOKU_INC.'inc/pageutils.php');
-
         $recents = getRecentsSince($timestamp);
 
         $changes = array();
@@ -805,9 +787,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         if(strlen($timestamp) != 10)
             return new IXR_Error(20, 'The provided value is not a valid timestamp');
 
-        require_once(DOKU_INC.'inc/changelog.php');
-        require_once(DOKU_INC.'inc/pageutils.php');
-
         $recents = getRecentsSince($timestamp, null, '', RECENTS_MEDIA_CHANGES);
 
         $changes = array();
@@ -844,8 +823,6 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
         if(empty($id))
             return new IXR_Error(1, 'Empty page ID');
 
-        require_once(DOKU_INC.'inc/changelog.php');
-
         $revisions = getRevisions($id, $first, $conf['recent']+1);
 
         if(count($revisions)==0 && $first!=0) {
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index a7037047afe740271172c36c4b595b17b03f09ea..b38d2ac6eddf8a308d7938eba35a6625df22185b 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -10,9 +10,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'admin.php');
-
 /**
  * All DokuWiki plugins to extend the admin function
  * need to inherit from this class
@@ -216,7 +213,6 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
      * @author Andreas Gohr <andi@splitbrain.org>
      */
     function _html_explorer(){
-        require_once(DOKU_INC.'inc/search.php');
         global $conf;
         global $ID;
         global $lang;
diff --git a/lib/plugins/acl/ajax.php b/lib/plugins/acl/ajax.php
index d3e88d932edb4429c06aec20b0f1f4512c8be6a6..d91586a5dac65b088544ff733ce7b33023664c20 100644
--- a/lib/plugins/acl/ajax.php
+++ b/lib/plugins/acl/ajax.php
@@ -13,9 +13,6 @@ if(!count($_POST) && $HTTP_RAW_POST_DATA){
 
 if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
 require_once(DOKU_INC.'inc/init.php');
-require_once(DOKU_INC.'inc/common.php');
-require_once(DOKU_INC.'inc/pageutils.php');
-require_once(DOKU_INC.'inc/auth.php');
 //close session
 session_write_close();
 
@@ -24,8 +21,6 @@ if(!checkSecurityToken()) die('CRSF Attack');
 
 $ID    = getID();
 
-require_once(DOKU_INC.'inc/pluginutils.php');
-require_once(DOKU_INC.'inc/html.php');
 $acl = plugin_load('admin','acl');
 $acl->handle();
 
@@ -35,7 +30,6 @@ header('Content-Type: text/html; charset=utf-8');
 if($ajax == 'info'){
     $acl->_html_info();
 }elseif($ajax == 'tree'){
-    require_once(DOKU_INC.'inc/search.php');
     global $conf;
     global $ID;
 
diff --git a/lib/plugins/action.php b/lib/plugins/action.php
index a26bc654a3bcf7375bf5a58cae984ffec01e4bae..885bd7c963f43e1dd9cd7d734062cebcd325a5cb 100644
--- a/lib/plugins/action.php
+++ b/lib/plugins/action.php
@@ -8,9 +8,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_INC.'inc/plugin.php');
-
 /**
  * All DokuWiki plugins to interfere with the event system
  * need to inherit from this class
diff --git a/lib/plugins/admin.php b/lib/plugins/admin.php
index 2eeda3f7b9be81c922e1f8385851e397b1c1edb1..25f01b65791192bd49d68579c68be3435d97b5b8 100644
--- a/lib/plugins/admin.php
+++ b/lib/plugins/admin.php
@@ -8,9 +8,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_INC.'inc/plugin.php');
-
 /**
  * All DokuWiki plugins to extend the admin function
  * need to inherit from this class
diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php
index cbee3440a68da6157af6d30f4a3967813e91ae7e..7cc2918f4b374393ce6b3c5889c97ad4dc96473c 100644
--- a/lib/plugins/config/admin.php
+++ b/lib/plugins/config/admin.php
@@ -9,9 +9,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'admin.php');
-
 define('CM_KEYMARKER','____');            // used for settings with multiple dimensions of array indices
 
 define('PLUGIN_SELF',dirname(__FILE__).'/');
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index a6f652d79b706bc6531507cb7f7c8bbf6660aa64..b7428bf6c421ec8d4478d2993a9487a74de13d04 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -528,8 +528,6 @@ if (!class_exists('setting_password')) {
 }
 
 if (!class_exists('setting_email')) {
-
-  require_once(DOKU_INC.'inc/mail.php');
   if (!defined('SETTING_EMAIL_PATTERN')) define('SETTING_EMAIL_PATTERN','<^'.PREG_PATTERN_VALID_EMAIL.'$>');
 
   class setting_email extends setting_string {
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php
index dc0a7d2fc89ae9b75dae6be7b4b477439c1be08e..ba2831a901f6da32d0716805c8a86e995a28b9b7 100644
--- a/lib/plugins/info/syntax.php
+++ b/lib/plugins/info/syntax.php
@@ -9,9 +9,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'syntax.php');
-
 /**
  * All DokuWiki plugins to extend the parser/rendering mechanism
  * need to inherit from this class
diff --git a/lib/plugins/plugin/admin.php b/lib/plugins/plugin/admin.php
index 198512a43df33936de748bbe3fd3ae9b90aab66e..c662b565a970c6f7eabc1508947cd36f124021c2 100644
--- a/lib/plugins/plugin/admin.php
+++ b/lib/plugins/plugin/admin.php
@@ -13,8 +13,6 @@ if(!defined('DOKU_INC')) die();
 // - allow a plugin to contain extras to be copied to the current template (extra/tpl/)
 // - to images (lib/images/) [ not needed, should go in lib/plugin/images/ ]
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'admin.php');
 require_once(DOKU_PLUGIN."/plugin/classes/ap_manage.class.php");
 
 //--------------------------[ GLOBALS ]------------------------------------------------
diff --git a/lib/plugins/plugin/classes/ap_download.class.php b/lib/plugins/plugin/classes/ap_download.class.php
index 90e5de53b22a7f4ff693f2e5811ac2f6ed7fa693..6ad048d722a853746247f89349a19038dc803fe5 100644
--- a/lib/plugins/plugin/classes/ap_download.class.php
+++ b/lib/plugins/plugin/classes/ap_download.class.php
@@ -197,8 +197,6 @@ class ap_download extends ap_manage {
 
         $ext = $this->guess_archive($file);
         if (in_array($ext, array('tar','bz','gz'))) {
-            require_once(DOKU_INC."inc/TarLib.class.php");
-
             switch($ext){
                 case 'bz':
                     $compress_type = COMPRESS_BZIP;
@@ -227,7 +225,6 @@ class ap_download extends ap_manage {
             }
             return true;
         } else if ($ext == 'zip') {
-            require_once(DOKU_INC."inc/ZipLib.class.php");
 
             $zip = new ZipLib();
             $ok = $zip->Extract($file, $target);
diff --git a/lib/plugins/popularity/admin.php b/lib/plugins/popularity/admin.php
index d084f5b5815d5777d681524efb7aaf09c1e70d69..c72beafdba7cfb397ba1d5c9dbe49bed63b5abc1 100644
--- a/lib/plugins/popularity/admin.php
+++ b/lib/plugins/popularity/admin.php
@@ -8,12 +8,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'admin.php');
-require_once(DOKU_INC.'inc/infoutils.php');
-require_once(DOKU_INC.'inc/pluginutils.php');
-require_once(DOKU_INC.'inc/search.php');
-
 /**
  * All DokuWiki plugins to extend the admin function
  * need to inherit from this class
diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php
index b24b1ff6ea31892876157e84910ff38050206248..1a327ca8a8abd66b952a9efe7be4d716eb4bccd0 100644
--- a/lib/plugins/revert/admin.php
+++ b/lib/plugins/revert/admin.php
@@ -2,10 +2,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_PLUGIN.'admin.php');
-require_once(DOKU_INC.'inc/changelog.php');
-
 /**
  * All DokuWiki plugins to extend the admin function
  * need to inherit from this class
diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php
index 633e001d23807594f372f3a02a19b91045e8af18..601b5591e5a0bfe357714243c873aa98b67ada79 100644
--- a/lib/plugins/syntax.php
+++ b/lib/plugins/syntax.php
@@ -8,9 +8,6 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
-require_once(DOKU_INC.'inc/parser/parser.php');
-
 /**
  * All DokuWiki plugins to extend the parser/rendering mechanism
  * need to inherit from this class
diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php
index da6029bbf4d65301a1677e94e61c196171ba549a..4eb923bb1e25ebb932522d088a00f4f3d7d4404d 100644
--- a/lib/plugins/usermanager/admin.php
+++ b/lib/plugins/usermanager/admin.php
@@ -13,9 +13,7 @@
 // must be run within Dokuwiki
 if(!defined('DOKU_INC')) die();
 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
 if(!defined('DOKU_PLUGIN_IMAGES')) define('DOKU_PLUGIN_IMAGES',DOKU_BASE.'lib/plugins/usermanager/images/');
-require_once(DOKU_PLUGIN.'admin.php');
 
 /**
  * All DokuWiki plugins to extend the admin function