PluginProbe
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings / 7.2
MLSImport: IDX Plugin & MLS Plugin for Real Estate Listings v7.2
7.2.1 7.2 7.1.2 7.1.1 7.1 7.0.4 7.0.6 7.0.7 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 6.3.1 trunk 5.7.3 5.7.5 5.8.1 5.8.2 5.8.3 5.8.4 5.8.6 6.0.4 6.0.5 All 36 releases
← All changes | includes/class-mlsimport-loader.php +12 -0 6.3.57.2 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +// Guard: block direct web access — only load when WordPress is bootstrapped.
2 3 if ( ! defined( 'ABSPATH' ) ) {
3 4 exit; // Exit if accessed directly
4 5 }
5 6
@@ -6,8 +7,12 @@
6 7
7 8 /**
8 9 * Register all actions and filters for the plugin
9 10 *
11 + * File role: the hook registry (WordPress Plugin Boilerplate "Loader" pattern). Admin/public
12 + * classes queue their hooks here via add_action()/add_filter(); the core class then calls
13 + * run() once to bind every queued hook to WordPress in a single pass.
14 + *
10 15 * @link http://mlsimport.com/
11 16 * @since 1.0.0
12 17 *
13 18 * @package Mlsimport
@@ -52,8 +57,9 @@
52 57 * @since 1.0.0
53 58 */
54 59 public function __construct() {
55 60
61 + // Start with empty queues; hooks are appended as components register them.
56 62 $this->actions = array();
57 63 $this->filters = array();
58 64 }
59 65
@@ -67,8 +73,9 @@
67 73 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
68 74 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1.
69 75 */
70 76 public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
77 + // Append this action to the actions queue via the shared add() helper.
71 78 $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
72 79 }
73 80
74 81 /**
@@ -81,8 +88,9 @@
81 88 * @param int $priority Optional. The priority at which the function should be fired. Default is 10.
82 89 * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1
83 90 */
84 91 public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
92 + // Append this filter to the filters queue via the shared add() helper.
85 93 $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
86 94 }
87 95
88 96 /**
@@ -100,8 +108,9 @@
100 108 * @return array The collection of actions and filters registered with WordPress.
101 109 */
102 110 private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
103 111
112 + // Store the hook definition as an associative array for later binding in run().
104 113 $hooks[] = array(
105 114 'hook' => $hook,
106 115 'component' => $component,
107 116 'callback' => $callback,
@@ -108,8 +117,9 @@
108 117 'priority' => $priority,
109 118 'accepted_args' => $accepted_args,
110 119 );
111 120
121 + // Return the extended collection back to the caller for reassignment.
112 122 return $hooks;
113 123 }
114 124
115 125 /**
@@ -118,12 +128,14 @@
118 128 * @since 1.0.0
119 129 */
120 130 public function run() {
121 131
132 + // Bind every queued filter to WordPress via add_filter().
122 133 foreach ( $this->filters as $hook ) {
123 134 add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
124 135 }
125 136
137 + // Bind every queued action to WordPress via add_action().
126 138 foreach ( $this->actions as $hook ) {
127 139 add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
128 140 }
129 141 }