wolfcms/wolfcms — pull request #484 by dedlfix (2013-02-20 13:59:50+00:00)
Title: separate initialization from starting the main routing

Currently there is only one entry point: the CMS_ROOT/index.php. If I want to use functionality of the framework… it's not possible because it is prevented by IN_CMS check. Of course I can set my own IN_CMS, but that's not all. In addition I have to initialize the framework by hand, copying about 160 lines of code from CMS_ROOT/index.php. And copying of code is not the best case for maintenance…

This pull request separates the init logic (additionally changing/improving some bits of code) from calling the main routing, so I can use e.g. in a plugin

define('IN_CMS', true);
require_once '../../../init.php';

followed by framework code, e.g.

$settings = Plugin::getAllSettings('pluginname');
...

Actually I want to use this for a partial rewrite of the Ace plugin. Currently this plugin writes (after changing the settings in the admin UI) a JavaScript file into it's own code directory - which is not the best way. My rewrite will work like both markdown.php and textile.php, creating the JavaScript code on the fly. But I need some framework functionality to get the values out of the database.