| 1 |
<?php
|
| 2 |
/* $Id$ */
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Includes xajax functionality and looks for xajax hooks in all loaded modules.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Require xajax library.
|
| 11 |
*/
|
| 12 |
|
| 13 |
require_once('inc/xajax.inc.php' );
|
| 14 |
|
| 15 |
/**
|
| 16 |
* Implementation of hook_help().
|
| 17 |
*/
|
| 18 |
/**
|
| 19 |
* Display help and module information
|
| 20 |
* @param section which section of the site we're displaying help
|
| 21 |
* @return help text for section
|
| 22 |
*/
|
| 23 |
function xajax_help($section='') {
|
| 24 |
|
| 25 |
$output = '';
|
| 26 |
|
| 27 |
switch ($section = '') {
|
| 28 |
case "admin/help#xajax":
|
| 29 |
$output = '<p>'. t("Adds xajax support to your modules."). '</p>';
|
| 30 |
break;
|
| 31 |
}
|
| 32 |
|
| 33 |
return $output;
|
| 34 |
} // function xajax_help
|
| 35 |
|
| 36 |
/**
|
| 37 |
* Implementation of hook_menu().
|
| 38 |
*/
|
| 39 |
function xajax_menu($may_cache) {
|
| 40 |
// initialise xajax
|
| 41 |
$xajax = new xajax('/index.php');
|
| 42 |
|
| 43 |
$modules=module_list();
|
| 44 |
foreach($modules as $mod){
|
| 45 |
if(function_exists($mod . '_xajax_init')){
|
| 46 |
$xajax = call_user_func($mod .'_xajax_init',$xajax);
|
| 47 |
}
|
| 48 |
}
|
| 49 |
|
| 50 |
// let xajax process ajax requests
|
| 51 |
$xajax->processRequests();
|
| 52 |
|
| 53 |
// include javascript in html header
|
| 54 |
drupal_set_html_head($xajax->getJavascript('/sites/all/modules/xajax/inc'));
|
| 55 |
|
| 56 |
|
| 57 |
}
|