/** * Includes jquery and initializes the datepicker, if not already done. * * @return void * * @global array The paths of system files and folders. * @global string The current language. * @global string The (X)HTML fragment for insertion into the HEAD element. * @global array The configuration of the core. * @global array The configuration of the plugins. * @global array The localization of the plugins. */ function Advancedform_initJQuery() { global $pth, $sl, $hjs, $cf, $plugin_cf, $plugin_tx; if (defined('ADVFRM_JQUERY_INITIALIZED')) { return; } $ptx = $plugin_tx['advancedform']; if (include_once $pth['folder']['plugins'] . 'jquery/jquery.inc.php') { include_jQuery(); include_jQueryUI(); } $date_format = $ptx['date_order'][0] . $ptx['date_order'][0] . $ptx['date_delimiter'] . $ptx['date_order'][1] . $ptx['date_order'][1] . $ptx['date_delimiter'] . $ptx['date_order'][2] . $ptx['date_order'][2]; $lang = strlen($sl) == 2 ? $sl : $cf['language']['default']; $fn = $pth['folder']['plugins'] . 'advancedform/languages/jquery.ui.datepicker-' . $lang . '.js'; if (file_exists($fn)) { $hjs .= '<script type="text/javascript" src="' . $fn . '"></script>' . PHP_EOL; } else { if ($sl != 'en') { e('missing', 'language', $fn); } } $hjs .= <<<SCRIPT <script type="text/javascript">/* <![CDATA[ */ jQuery(function() { jQuery.datepicker.setDefaults(jQuery.datepicker.regional['{$lang}']); jQuery.datepicker.setDefaults({dateFormat: '{$date_format}'}); }) /* ]]> */</script> SCRIPT; define('ADVFRM_JQUERY_INITIALIZED', true); }
} return Advancedform_formsAdministration(); } /* * Register the plugin menu items. */ if (function_exists('XH_registerStandardPluginMenuItems')) { XH_registerStandardPluginMenuItems(true); } /* * Handle the plugin administration. */ if (isset($advancedform) && $advancedform == 'true') { if (include_once $pth['folder']['plugins'] . 'jquery/jquery.inc.php') { include_jQuery(); include_jQueryUI(); } if (Advancedform_updateLangJs()) { $hjs .= PHP_EOL . '<script type="text/javascript" src="' . $pth['folder']['plugins'] . 'advancedform/languages/' . $sl . '.js">' . '</script>' . PHP_EOL; } $hjs .= '<script type="text/javascript" src="' . $pth['folder']['plugins'] . 'advancedform/admin.js"></script>' . PHP_EOL; $o .= print_plugin_admin('on'); switch ($admin) { case '': $o .= Advancedform_version() . Advancedform_systemCheck(); break; case 'plugin_main': switch ($action) { case 'new': $o .= Advancedform_createForm(); break;