PluginProbe
CSS & JavaScript Toolbox / 6.0.6
CSS & JavaScript Toolbox v6.0.6
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
← All changes | access.points/ajax.accesspoint.php +15 -44 trunk6.0.6 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 -*
3 +*
4 4 */
5 5
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
@@ -6,15 +6,15 @@
6 6 // Disallow direct access.
7 7 defined('ABSPATH') or die("Access denied");
8 8
9 9 /**
10 -*
10 +*
11 11 */
12 12 class CJTAjaxAccessPoint extends CJTAccessPoint {
13 -
13 +
14 14 /**
15 15 * put your comment there...
16 - *
16 + *
17 17 */
18 18 public function __construct() {
19 19 // Initialize Access Point base!
20 20 parent::__construct();
@@ -23,67 +23,38 @@
23 23 }
24 24
25 25 /**
26 26 * put your comment there...
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'), 10, 0);
31 + add_action("wp_ajax_{$this->pageId}_api", array(&$this, 'route'));
32 32 }
33 -
33 +
34 34 /**
35 35 * put your comment there...
36 - *
36 + *
37 37 */
38 - public function route($loadView = null, $request = null) {
38 + public function route() {
39 39 // Initializing!
40 40 $controller = false;
41 41 // Controllers allowed to be Loaded if not installed
42 42 $notInstalledAllowedControllers = array('installer', 'setup');
43 - // Veil access point unless CJT installed or the controller is installer (to allow instalaltion through AJAX)!
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 - // Module prefixes are plain identifiers. Reject anything else so the
50 - // request can never steer the controllers path outside the plugin.
51 - $module = preg_replace('/[^A-Za-z0-9_]/', '', (string) $_REQUEST['cjtajaxmodule']);
52 -
53 - if ($module === 'ECMEHD') {
54 - // CJT PLUS environment controllers live at a fixed location.
55 - $this->overrideControllersPath = dirname(__DIR__) . '-plus/CJTEnv/controllers';
56 - $this->overrideControllersPrefix = $module;
57 - }
58 - else if ($module !== '') {
59 - # Resolve WITHOUT registering. autoLoad() builds a pathless loader
60 - # for any unknown prefix, so every arbitrary module name used to
61 - # "resolve" and then produce a bogus "/controllers" path.
62 - $accessPointClassLoader = CJT_Framework_Autoload_Loader::getRegisteredLoader($module);
63 - $loaderPath = $accessPointClassLoader ? $accessPointClassLoader->getPath() : null;
64 -
65 - // Only override when the loader actually resolved a path.
66 - if ($loaderPath) {
67 - $this->overrideControllersPath = $loaderPath . DIRECTORY_SEPARATOR . 'controllers';
68 - $this->overrideControllersPrefix = $accessPointClassLoader->getPrefix();
69 - }
70 - }
71 - }
72 47 // Instantiate controller.
73 - $controller = parent::route($loadView, $request);
48 + $controller = parent::route();
74 49 // Dispatch the call as its originally requested from ajax action!
75 - if (isset($_REQUEST['CJTAjaxAction'])) {
76 - $ajaxAction = preg_replace('/[^A-Za-z0-9_]/', '', (string) $_REQUEST['CJTAjaxAction']);
77 - if ($ajaxAction !== '') {
78 - // Fire Ajax action.
79 - do_action("wp_ajax_{$this->pageId}_{$ajaxAction}");
80 - }
81 - }
50 + $action = "wp_ajax_{$this->pageId}_{$_REQUEST['CJTAjaxAction']}";
51 + // Fire Ajax action.
52 + do_action($action);
82 53 }
83 54 return $controller;
84 55 }
85 -
56 +
86 57 } // End class.
87 58
88 59 // Hookable!
89 60 CJTAjaxAccessPoint::define('CJTAjaxAccessPoint', array('hookType' => CJTWordpressEvents::HOOK_FILTER));