Page Loop
The page loop is determined by the index.php file in the web root.
The loop goes through several stages before being completed by the reactor_exit();
Stages
- Include all the necessary files.
- Start PHP session
- Theme Handler(): Load theme.
- Start Routing and parse the incoming url to set variables.
- Connect to database.
- Start Cache. Depending on which class is loaded it will use memory or disk cache.
- Start Factory. The factory is used to generate html.
- Plugin_handler(): Load plugins.
- Taxonomy_handler(): Load and cache taxonomies for use.
- Load settings.
- Theme_switcher(): Register style for selected theme.
- Upload_handler(): Handle chunked file uploads.
- Upload_handler_direct(): Handle single file uploads.
- Form_handler(): handle form input
- Rewrite url to template.
- Close all connections.
Index.php
global $reactor,$parser,$factory,$routing;
/*
* The main CMS file.
* copyright {c) 2019 Patriek Jeuriens
*/
require_once '../config/definitions.php';
require_once '../config/bootstrap.php';
// start session
$session = new core_session();
$session->start($reactor->defaults->session['name'],$reactor->defaults->session['timeout']);
// handle theme
theme_handler();
// start routing
$routing = new core_routing();
// routing redirect
$routing->incoming();
// connect database
$sqldb = new core_sql(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
// start cache
$cache = new core_memcache();
// start factory
$factory = new core_factory();
// handle plugins
plugin_handler();
// pre-load taxonomies
taxonomy_handler();
// load settings
$reactor->site->settings = get_settings("site_settings");
// switch themes
theme_switcher();
// handle ajax requests
ajax_handler();
if (is_logged_in()) {
// handle upload requests
upload_handler();
// handle upload requests
upload_handler_direct();
// handle form requests
form_handler();
}
// routing rewrite
$routing->rewrite();
reactor_exit();