PluginProbe ʕ •ᴥ•ʔ
Nested Pages / 2.0.1
Nested Pages v2.0.1
3.2.14 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 trunk 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.2 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.3.1 1.6.3.2 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.6 1.6.7 1.6.8 1.7.0 1.7.1 2.0.1 2.0.2 2.0.3 2.0.4 3.0.1 3.0.10 3.0.11 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.21 3.1.22 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7
wp-nested-pages / app / Form / Events.php
wp-nested-pages / app / Form Last commit date
Listeners 8 years ago Validation 8 years ago Events.php 8 years ago
Events.php
81 lines
1 <?php
2 namespace NestedPages\Form;
3
4 /**
5 * Registers the WP Actions/Handlers
6 */
7 class Events
8 {
9 /**
10 * Actions
11 * @var array
12 */
13 private $actions;
14
15 /**
16 * Handler Class
17 * @var stdClass obj
18 */
19 private $handlers;
20
21 public function __construct()
22 {
23 $this->registerEvents();
24 }
25
26 /**
27 * Set the Form Actions
28 */
29 public function registerEvents()
30 {
31 $this->actions = array(
32 'wp_ajax_npsort',
33 'wp_ajax_npquickEdit',
34 'wp_ajax_npsyncMenu',
35 'wp_ajax_npnestToggle',
36 'wp_ajax_npquickEditLink',
37 'wp_ajax_npgetTaxonomies',
38 'wp_ajax_npnewChild',
39 'admin_post_npListingSort',
40 'wp_ajax_npEmptyTrash',
41 'admin_post_npSearch',
42 'wp_ajax_npclonePost',
43 'wp_ajax_npmenuSearch',
44 'wp_ajax_npnewMenuItem',
45 'admin_post_npCategoryFilter',
46 'admin_post_npBulkActions',
47 'wp_ajax_npmanualMenuSync',
48 'admin_post_npBulkEdit',
49 'wp_ajax_nppostSearch',
50 'wp_ajax_npWpmlTranslations'
51 );
52 $this->setHandlers();
53 }
54
55 /**
56 * Set the Handlers Object
57 */
58 public function setHandlers()
59 {
60 foreach($this->actions as $key => $action){
61 $class = str_replace('admin_post_np', '', $action); // Non-AJAX forms
62 $class = ucfirst(str_replace('wp_ajax_np', '', $class)); // AJAX forms
63 $this->handlers[$key] = new \stdClass();
64 $this->handlers[$key]->action = $action;
65 $this->handlers[$key]->class = 'NestedPages\Form\Listeners\\' . $class;
66 }
67 $this->build();
68 }
69
70 /**
71 * Register the WP Actions
72 */
73 public function build()
74 {
75 foreach($this->handlers as $handler){
76 add_action($handler->action, function() use ($handler) {
77 new $handler->class;
78 });
79 }
80 }
81 }