function onAfterRoute() { if (defined('CANVAS_PLUGIN')) { CANVASBot::preload(); $template = CANVAS::detect(); if ($template) { // load the language $this->loadLanguage(); CANVASBot::beforeInit(); CANVAS::init($template); CANVASBot::afterInit(); //load CANVAS plugins JPluginHelper::importPlugin('canvas'); if (is_file(CANVAS_TEMPLATE_PATH . '/templateHook.php')) { include_once CANVAS_TEMPLATE_PATH . '/templateHook.php'; } $tplHookCls = preg_replace('/(^[^A-Z_]+|[^A-Z0-9_])/i', '', CANVAS_TEMPLATE . 'Hook'); $dispatcher = JDispatcher::getInstance(); if (class_exists($tplHookCls)) { new $tplHookCls($dispatcher, array()); } $dispatcher->trigger('onCANVASInit'); //check and execute the canvasaction CANVAS::checkAction(); //check and change template for ajax CANVAS::checkAjax(); } } }