root/dev/mods/xajax/init.php @ 363

Revision 363, 1.4 KB (checked in by exi, 13 years ago)

Commit of the reworked ajax mod
Preview of the new ajcron mod (80% done)

Line 
1<?
2// common/includes/class.page.php
3// templates/index.tpl
4// you should not change anything in this file but the image generator / whatever bypass change the functions.php
5
6// bypass some of the image generators..
7if ($page != "thumb" && $page != "mapview" && $page != "sig")
8{
9        require_once('mods/xajax/xajax_core/xajax.inc.php');
10    $xajax = new xajax();
11        require_once('mods/xajax/functions.php');
12    event::register('page_assembleheader', 'mod_xajax::insertHTML');
13
14    // if mods depend on xajax they can register to mod_xajax_initialised
15    // it gets called after all mods have been initialized
16    event::register('mods_initialised', 'mod_xajax::lateProcess');
17}
18
19class mod_xajax
20{
21    function xajax()
22    {
23        global $mod_xajax_enable;
24        $mod_xajax_enable = true;
25    }
26
27    // on page assembly look wether xajax is needed or not
28        function insertHTML($obj)
29    {
30            global $mod_xajax_enable;
31            if (!isset($mod_xajax_enable))
32            {
33                return;
34            }
35
36            global $xajax;
37        $obj->addBody($xajax->getJavascript("mods/xajax/"));
38    }
39
40    function lateProcess()
41    {
42        // let all mods know we're here so they can register their functions
43        event::call('mod_xajax_initialised', $this);
44
45        // now process all xajax calls
46        global $xajax;
47        $xajax->processRequest();
48    }
49}
Note: See TracBrowser for help on using the browser.