| @@ -27,9 +27,9 @@ | ||
| 27 | 27 | * |
| 28 | 28 | */ |
| 29 | 29 | protected function doListen() { |
| 30 | 30 | // Define CJT AJAX access point! |
| 31 | - add_action("wp_ajax_{$this->pageId}_api", array(&$this, 'route')); | |
| 31 | + add_action("wp_ajax_{$this->pageId}_api", array(&$this, 'route'), 10, 0); | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * put your comment there... |
| @@ -34,9 +34,9 @@ | ||
| 34 | 34 | /** |
| 35 | 35 | * put your comment there... |
| 36 | 36 | * |
| 37 | 37 | */ |
| 38 | - public function route() { | |
| 38 | + public function route($loadView = null, $request = null) { | |
| 39 | 39 | // Initializing! |
| 40 | 40 | $controller = false; |
| 41 | 41 | // Controllers allowed to be Loaded if not installed |
| 42 | 42 | $notInstalledAllowedControllers = array('installer', 'setup'); |
| @@ -43,10 +43,19 @@ | ||
| 43 | 43 | // Veil access point unless CJT installed or the controller is installer (to allow instalaltion throught AJAX)! |
| 44 | 44 | if (CJTPlugin::getInstance()->isInstalled() || in_array($this->controllerName, $notInstalledAllowedControllers)) { |
| 45 | 45 | // Connected! |
| 46 | 46 | $this->connected(); |
| 47 | + // IF Module-Prefix passed THEN Point to correct Controller path | |
| 48 | + if (isset($_REQUEST['cjtajaxmodule'])) { | |
| 49 | + # try to get module associated to passed module | |
| 50 | + $accessPointClassLoader = CJT_Framework_Autoload_Loader::autoLoad($_REQUEST['cjtajaxmodule']); | |
| 51 | + if ($accessPointClassLoader) { | |
| 52 | + $this->overrideControllersPath = $accessPointClassLoader->getPath() . DIRECTORY_SEPARATOR . 'controllers'; | |
| 53 | + $this->overrideControllersPrefix = $accessPointClassLoader->getPrefix(); | |
| 54 | + } | |
| 55 | + } | |
| 47 | 56 | // Instantiate controller. |
| 48 | - $controller = parent::route(); | |
| 57 | + $controller = parent::route($loadView, $request); | |
| 49 | 58 | // Dispatch the call as its originally requested from ajax action! |
| 50 | 59 | $action = "wp_ajax_{$this->pageId}_{$_REQUEST['CJTAjaxAction']}"; |
| 51 | 60 | // Fire Ajax action. |
| 52 | 61 | do_action($action); |