Completed
Branch dev (1399ad)
by
unknown
60:04 queued 50:49
created
core/admin/EE_Help_Tour.core.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
     public function get_stops()
257 257
     {
258 258
         foreach ($this->_stops as $ind => $stop) {
259
-            if (! isset($stop['button_text'])) {
260
-                $this->_stops[ $ind ]['button_text'] = $this->_options['button_text'];
259
+            if ( ! isset($stop['button_text'])) {
260
+                $this->_stops[$ind]['button_text'] = $this->_options['button_text'];
261 261
             }
262 262
         }
263 263
         return $this->_stops;
@@ -277,6 +277,6 @@  discard block
 block discarded – undo
277 277
                 $this->_options['pauseAfter'][] = $ind;
278 278
             }
279 279
         }
280
-        return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this);
280
+        return apply_filters('FHEE__'.get_class($this).'__get_options', $this->_options, $this);
281 281
     }
282 282
 }
Please login to merge, or discard this patch.
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -15,269 +15,269 @@
 block discarded – undo
15 15
 abstract class EE_Help_Tour extends EE_Base
16 16
 {
17 17
 
18
-    /**
19
-     * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the
20
-     * constructor of the child class.
21
-     *
22
-     * @access protected
23
-     * @var string
24
-     */
25
-    protected $_label = '';
26
-
27
-
28
-    /**
29
-     * This is the slug for the tour.  It should be unique from all tours and is used for starting a tour and setting
30
-     * cookies for the tour. Set this in the constructor of the child class.
31
-     *
32
-     * @access protected
33
-     * @var string
34
-     */
35
-    protected $_slug = '';
36
-
37
-
38
-    /**
39
-     * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for
40
-     * setting up a tour on a given page. format for array is: array(
41
-     *        0 => array(
42
-     *            'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take
43
-     *            precendence even if you also set class.
44
-     *            'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use
45
-     *            this param. The first element for that class is the anchor. If the class or the id are empty then the
46
-     *            stop will be a modal on the page anchored to the main body.
47
-     *            'custom_class' => 'some_custom_class', //optional custom class to add for this stop.
48
-     *            'button_text' => 'custom text for button', //optional
49
-     *            'content' => 'The content for the stop', //required
50
-     *            'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get
51
-     *            added to the pauseAfter global option array setup for the joyride instance. This is only applicable
52
-     *            when this tour has been set to run on timer.
53
-     *            'options' => array(
54
-     *                //override any of the global options set via the help_tour "option_callback" for the joyride
55
-     *                instance on this specific stop.
56
-     *                )
57
-     *            )
58
-     *        );
59
-     *
60
-     * @access protected
61
-     * @var array
62
-     */
63
-    protected $_stops = array();
64
-
65
-
66
-    /**
67
-     * This contains any stop specific options for the tour.
68
-     * defaults are set but child classes can override.
69
-     *
70
-     * @access protected
71
-     * @var array
72
-     */
73
-    protected $_options = array();
74
-
75
-
76
-    /**
77
-     * holds anything found in the $_REQUEST object (however we override any _gets with _post data).
78
-     *
79
-     * @access protected
80
-     * @var array
81
-     */
82
-    protected $_req_data = array();
83
-
84
-
85
-    /**
86
-     * a flag that is set on init for whether this help_tour is happening on a caf install or not.
87
-     *
88
-     * @var boolean
89
-     */
90
-    protected $_is_caf = false;
91
-
92
-
93
-    /**
94
-     * _constructor
95
-     * initialized the tour object and sets up important properties required to setup the tour.
96
-     *
97
-     * @access public
98
-     * @param boolean $caf used to indicate if this tour is happening on caf install or not.
99
-     * @return void
100
-     */
101
-    public function __construct($caf = false)
102
-    {
103
-        $this->_is_caf = $caf;
104
-        $this->_req_data = array_merge($_GET, $_POST);
105
-        $this->_set_tour_properties();
106
-        $this->_set_tour_stops();
107
-        $this->_set_tour_options();
108
-
109
-        // make sure the last tour stop has "end tour" for its button
110
-        $end = array_pop($this->_stops);
111
-        $end['button_text'] = __('End Tour', 'event_espresso');
112
-        // add back to stops
113
-        $this->_stops[] = $end;
114
-    }
115
-
116
-
117
-    /**
118
-     * required method that has the sole purpose of setting up the tour $_label and $_slug properties
119
-     *
120
-     * @abstract
121
-     * @access protected
122
-     * @return void
123
-     */
124
-    abstract protected function _set_tour_properties();
125
-
126
-
127
-    /**
128
-     * required method that's sole purpose is to setup the $_stops property
129
-     *
130
-     * @abstract
131
-     * @access protected
132
-     * @return void
133
-     */
134
-    abstract protected function _set_tour_stops();
135
-
136
-
137
-    /**
138
-     * The method can optionally be overridden by child classes to set the _options array if there are any default
139
-     * options the child wishes to override for a this tour. See property definition for more info
140
-     *
141
-     * @access protected
142
-     * @return void
143
-     */
144
-    protected function _set_tour_options($options = array())
145
-    {
146
-        $defaults = array(
147
-            'tipLocation'           => 'bottom',
148
-            // 'top', 'bottom', 'right', 'left' in relation to parent
149
-            'nubPosition'           => 'auto',
150
-            // override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left"
151
-            'tipAdjustmentY'        => 0,
152
-            // allow for adjustment of tip
153
-            'tipAdjustmentX'        => 0,
154
-            // allow for adjustment of tip
155
-            'scroll'                => true,
156
-            // whether to scrollTo the next step or not
157
-            'scrollSpeed'           => 300,
158
-            // Page scrolling speed in ms
159
-            'timer'                 => 0,
160
-            // 0 = off, all other numbers = time(ms)
161
-            'autoStart'             => true,
162
-            // true or false - false tour starts when restart called
163
-            'startTimerOnClick'     => true,
164
-            // true/false to start timer on first click
165
-            'nextButton'            => true,
166
-            // true/false for next button visibility
167
-            'button_text'           => __('Next', 'event_espresso'),
168
-            'tipAnimation'          => 'fade',
169
-            // 'pop' or 'fade' in each tip
170
-            'pauseAfter'            => array(),
171
-            // array of indexes where to pause the tour after
172
-            'tipAnimationFadeSpeed' => 300,
173
-            // if 'fade'- speed in ms of transition
174
-            'cookieMonster'         => true,
175
-            // true/false for whether cookies are used
176
-            'cookieName'            => $this->get_slug(),
177
-            // choose your own cookie name (setup will add the prefix for the specific page joyride)
178
-            // set to false or yoursite.com
179
-            'cookieDomain'          => false,
180
-            // Where the tip be attached if not inline
181
-            // 'tipContainer' => 'body',
182
-            'modal'                 => false,
183
-            // Whether to cover page with modal during the tour
184
-            'expose'                => false,
185
-            // Whether to expose the elements at each step in the tour (requires modal:true),
186
-            'postExposeCallback'    => 'EEHelpTour.postExposeCallback',
187
-            // A method to call after an element has been exposed
188
-            'preRideCallback'       => 'EEHelpTour_preRideCallback',
189
-            // A method to call before the tour starts (passed index, tip, and cloned exposed element)
190
-            'postRideCallback'      => 'EEHelpTour_postRideCallback',
191
-            // a method to call once the tour closes.  This will correspond to the name of a js method that will have to be defined in loaded js.
192
-            'preStepCallback'       => 'EEHelpTour_preStepCallback',
193
-            // A method to call before each step
194
-            'postStepCallback'      => 'EEHelpTour_postStepCallback',
195
-            // A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/
196
-        );
197
-
198
-        $options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults;
199
-        $this->_options = $options;
200
-    }
201
-
202
-
203
-    /**
204
-     * getter functions to return all the properties for the tour.
205
-     */
206
-
207
-
208
-    /**
209
-     * get_slug
210
-     *
211
-     * @return string slug for the tour
212
-     */
213
-    public function get_slug()
214
-    {
215
-        if (empty($this->_slug)) {
216
-            throw new EE_Error(
217
-                sprintf(
218
-                    __(
219
-                        'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor',
220
-                        'event_espresso'
221
-                    ),
222
-                    get_class($this)
223
-                )
224
-            );
225
-        }
226
-        return $this->_slug;
227
-    }
228
-
229
-
230
-    /**
231
-     * get_label
232
-     *
233
-     * @return string
234
-     */
235
-    public function get_label()
236
-    {
237
-        if (empty($this->_label)) {
238
-            throw new EE_Error(
239
-                sprintf(
240
-                    __(
241
-                        'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor',
242
-                        'event_espresso'
243
-                    ),
244
-                    get_class($this)
245
-                )
246
-            );
247
-        }
248
-        return $this->_label;
249
-    }
250
-
251
-
252
-    /**
253
-     * get_stops
254
-     *
255
-     * @return array
256
-     */
257
-    public function get_stops()
258
-    {
259
-        foreach ($this->_stops as $ind => $stop) {
260
-            if (! isset($stop['button_text'])) {
261
-                $this->_stops[ $ind ]['button_text'] = $this->_options['button_text'];
262
-            }
263
-        }
264
-        return $this->_stops;
265
-    }
266
-
267
-
268
-    /**
269
-     * get options
270
-     *
271
-     * @return array
272
-     */
273
-    public function get_options()
274
-    {
275
-        // let's make sure there are not pauses set
276
-        foreach ($this->_stops as $ind => $stop) {
277
-            if (isset($stop['pause_after']) && $stop['pause_after']) {
278
-                $this->_options['pauseAfter'][] = $ind;
279
-            }
280
-        }
281
-        return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this);
282
-    }
18
+	/**
19
+	 * This is the label for the tour. It is used when regenerating restart buttons for the tour. Set this in the
20
+	 * constructor of the child class.
21
+	 *
22
+	 * @access protected
23
+	 * @var string
24
+	 */
25
+	protected $_label = '';
26
+
27
+
28
+	/**
29
+	 * This is the slug for the tour.  It should be unique from all tours and is used for starting a tour and setting
30
+	 * cookies for the tour. Set this in the constructor of the child class.
31
+	 *
32
+	 * @access protected
33
+	 * @var string
34
+	 */
35
+	protected $_slug = '';
36
+
37
+
38
+	/**
39
+	 * This will contain the formatted array for the stops that gets used by EE_Admin_Page->_add_help_tour() for
40
+	 * setting up a tour on a given page. format for array is: array(
41
+	 *        0 => array(
42
+	 *            'id' => 'id_element', //if attached to an css id for an element then use this param. id's will take
43
+	 *            precendence even if you also set class.
44
+	 *            'class' => 'class_element', //if attached to a css class for an element anchoring the stop then use
45
+	 *            this param. The first element for that class is the anchor. If the class or the id are empty then the
46
+	 *            stop will be a modal on the page anchored to the main body.
47
+	 *            'custom_class' => 'some_custom_class', //optional custom class to add for this stop.
48
+	 *            'button_text' => 'custom text for button', //optional
49
+	 *            'content' => 'The content for the stop', //required
50
+	 *            'pause_after' => false, //indicate if you want the tour to pause after this stop and it will get
51
+	 *            added to the pauseAfter global option array setup for the joyride instance. This is only applicable
52
+	 *            when this tour has been set to run on timer.
53
+	 *            'options' => array(
54
+	 *                //override any of the global options set via the help_tour "option_callback" for the joyride
55
+	 *                instance on this specific stop.
56
+	 *                )
57
+	 *            )
58
+	 *        );
59
+	 *
60
+	 * @access protected
61
+	 * @var array
62
+	 */
63
+	protected $_stops = array();
64
+
65
+
66
+	/**
67
+	 * This contains any stop specific options for the tour.
68
+	 * defaults are set but child classes can override.
69
+	 *
70
+	 * @access protected
71
+	 * @var array
72
+	 */
73
+	protected $_options = array();
74
+
75
+
76
+	/**
77
+	 * holds anything found in the $_REQUEST object (however we override any _gets with _post data).
78
+	 *
79
+	 * @access protected
80
+	 * @var array
81
+	 */
82
+	protected $_req_data = array();
83
+
84
+
85
+	/**
86
+	 * a flag that is set on init for whether this help_tour is happening on a caf install or not.
87
+	 *
88
+	 * @var boolean
89
+	 */
90
+	protected $_is_caf = false;
91
+
92
+
93
+	/**
94
+	 * _constructor
95
+	 * initialized the tour object and sets up important properties required to setup the tour.
96
+	 *
97
+	 * @access public
98
+	 * @param boolean $caf used to indicate if this tour is happening on caf install or not.
99
+	 * @return void
100
+	 */
101
+	public function __construct($caf = false)
102
+	{
103
+		$this->_is_caf = $caf;
104
+		$this->_req_data = array_merge($_GET, $_POST);
105
+		$this->_set_tour_properties();
106
+		$this->_set_tour_stops();
107
+		$this->_set_tour_options();
108
+
109
+		// make sure the last tour stop has "end tour" for its button
110
+		$end = array_pop($this->_stops);
111
+		$end['button_text'] = __('End Tour', 'event_espresso');
112
+		// add back to stops
113
+		$this->_stops[] = $end;
114
+	}
115
+
116
+
117
+	/**
118
+	 * required method that has the sole purpose of setting up the tour $_label and $_slug properties
119
+	 *
120
+	 * @abstract
121
+	 * @access protected
122
+	 * @return void
123
+	 */
124
+	abstract protected function _set_tour_properties();
125
+
126
+
127
+	/**
128
+	 * required method that's sole purpose is to setup the $_stops property
129
+	 *
130
+	 * @abstract
131
+	 * @access protected
132
+	 * @return void
133
+	 */
134
+	abstract protected function _set_tour_stops();
135
+
136
+
137
+	/**
138
+	 * The method can optionally be overridden by child classes to set the _options array if there are any default
139
+	 * options the child wishes to override for a this tour. See property definition for more info
140
+	 *
141
+	 * @access protected
142
+	 * @return void
143
+	 */
144
+	protected function _set_tour_options($options = array())
145
+	{
146
+		$defaults = array(
147
+			'tipLocation'           => 'bottom',
148
+			// 'top', 'bottom', 'right', 'left' in relation to parent
149
+			'nubPosition'           => 'auto',
150
+			// override on a per tooltip bases. can be "auto", "right", "top", "bottom", "left"
151
+			'tipAdjustmentY'        => 0,
152
+			// allow for adjustment of tip
153
+			'tipAdjustmentX'        => 0,
154
+			// allow for adjustment of tip
155
+			'scroll'                => true,
156
+			// whether to scrollTo the next step or not
157
+			'scrollSpeed'           => 300,
158
+			// Page scrolling speed in ms
159
+			'timer'                 => 0,
160
+			// 0 = off, all other numbers = time(ms)
161
+			'autoStart'             => true,
162
+			// true or false - false tour starts when restart called
163
+			'startTimerOnClick'     => true,
164
+			// true/false to start timer on first click
165
+			'nextButton'            => true,
166
+			// true/false for next button visibility
167
+			'button_text'           => __('Next', 'event_espresso'),
168
+			'tipAnimation'          => 'fade',
169
+			// 'pop' or 'fade' in each tip
170
+			'pauseAfter'            => array(),
171
+			// array of indexes where to pause the tour after
172
+			'tipAnimationFadeSpeed' => 300,
173
+			// if 'fade'- speed in ms of transition
174
+			'cookieMonster'         => true,
175
+			// true/false for whether cookies are used
176
+			'cookieName'            => $this->get_slug(),
177
+			// choose your own cookie name (setup will add the prefix for the specific page joyride)
178
+			// set to false or yoursite.com
179
+			'cookieDomain'          => false,
180
+			// Where the tip be attached if not inline
181
+			// 'tipContainer' => 'body',
182
+			'modal'                 => false,
183
+			// Whether to cover page with modal during the tour
184
+			'expose'                => false,
185
+			// Whether to expose the elements at each step in the tour (requires modal:true),
186
+			'postExposeCallback'    => 'EEHelpTour.postExposeCallback',
187
+			// A method to call after an element has been exposed
188
+			'preRideCallback'       => 'EEHelpTour_preRideCallback',
189
+			// A method to call before the tour starts (passed index, tip, and cloned exposed element)
190
+			'postRideCallback'      => 'EEHelpTour_postRideCallback',
191
+			// a method to call once the tour closes.  This will correspond to the name of a js method that will have to be defined in loaded js.
192
+			'preStepCallback'       => 'EEHelpTour_preStepCallback',
193
+			// A method to call before each step
194
+			'postStepCallback'      => 'EEHelpTour_postStepCallback',
195
+			// A method to call after each step (remember this will correspond with a js method that you will have to define in a js file BEFORE ee-help-tour.js loads, if the default methods do not exist, then ee-help-tour.js just substitues empty functions $.noop)/**/
196
+		);
197
+
198
+		$options = ! empty($options) && is_array($options) ? array_merge($defaults, $options) : $defaults;
199
+		$this->_options = $options;
200
+	}
201
+
202
+
203
+	/**
204
+	 * getter functions to return all the properties for the tour.
205
+	 */
206
+
207
+
208
+	/**
209
+	 * get_slug
210
+	 *
211
+	 * @return string slug for the tour
212
+	 */
213
+	public function get_slug()
214
+	{
215
+		if (empty($this->_slug)) {
216
+			throw new EE_Error(
217
+				sprintf(
218
+					__(
219
+						'There is no slug set for the help tour class (%s). Make sure that the $_slug property is set in the class constructor',
220
+						'event_espresso'
221
+					),
222
+					get_class($this)
223
+				)
224
+			);
225
+		}
226
+		return $this->_slug;
227
+	}
228
+
229
+
230
+	/**
231
+	 * get_label
232
+	 *
233
+	 * @return string
234
+	 */
235
+	public function get_label()
236
+	{
237
+		if (empty($this->_label)) {
238
+			throw new EE_Error(
239
+				sprintf(
240
+					__(
241
+						'There is no label set for the help tour class (%s). Make sure that the $_label property is set in the class constructor',
242
+						'event_espresso'
243
+					),
244
+					get_class($this)
245
+				)
246
+			);
247
+		}
248
+		return $this->_label;
249
+	}
250
+
251
+
252
+	/**
253
+	 * get_stops
254
+	 *
255
+	 * @return array
256
+	 */
257
+	public function get_stops()
258
+	{
259
+		foreach ($this->_stops as $ind => $stop) {
260
+			if (! isset($stop['button_text'])) {
261
+				$this->_stops[ $ind ]['button_text'] = $this->_options['button_text'];
262
+			}
263
+		}
264
+		return $this->_stops;
265
+	}
266
+
267
+
268
+	/**
269
+	 * get options
270
+	 *
271
+	 * @return array
272
+	 */
273
+	public function get_options()
274
+	{
275
+		// let's make sure there are not pauses set
276
+		foreach ($this->_stops as $ind => $stop) {
277
+			if (isset($stop['pause_after']) && $stop['pause_after']) {
278
+				$this->_options['pauseAfter'][] = $ind;
279
+			}
280
+		}
281
+		return apply_filters('FHEE__' . get_class($this) . '__get_options', $this->_options, $this);
282
+	}
283 283
 }
Please login to merge, or discard this patch.
core/admin/templates/about_admin_wrapper.template.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4,19 +4,19 @@
 block discarded – undo
4 4
     <div class="about-text"><?php echo ! empty($admin_page_subtitle) ? $admin_page_subtitle : ''; ?></div>
5 5
     <div class="ee-badge"><img class="" src=" <?php echo EE_GLOBAL_ASSETS_URL; ?>images/event-espresso-cup-90x90.png"
6 6
                                width="90" height="90" alt="<?php
7
-                                                        printf(
8
-                                                            esc_attr__('%s Logo', 'event_espresso'),
9
-                                                            'Event Espresso'
10
-                                                        ); ?>"/>
7
+														printf(
8
+															esc_attr__('%s Logo', 'event_espresso'),
9
+															'Event Espresso'
10
+														); ?>"/>
11 11
         <br/><?php printf(__('Version %s', 'event_espresso'), EVENT_ESPRESSO_VERSION); ?></div>
12 12
 
13 13
     <?php echo $nav_tabs; ?>
14 14
 
15 15
 
16 16
     <?php
17
-    do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
18
-    echo $about_admin_page_content;
19
-    do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
20
-    ?>
17
+	do_action('AHEE__admin_wrapper__template__before_about_admin_page_content');
18
+	echo $about_admin_page_content;
19
+	do_action('AHEE__admin_wrapper__template__after_about_admin_page_content');
20
+	?>
21 21
 
22 22
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@
 block discarded – undo
7 7
     <?php echo $nav_tabs; ?>
8 8
 
9 9
     <?php
10
-    do_action('AHEE__admin_wrapper__template__before_admin_page_content');
11
-    echo $before_admin_page_content;
12
-    echo $admin_page_content;
13
-    echo $after_admin_page_content;
14
-    do_action('AHEE__admin_wrapper__template__after_admin_page_content');
15
-    ?>
10
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
11
+	echo $before_admin_page_content;
12
+	echo $admin_page_content;
13
+	echo $after_admin_page_content;
14
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
15
+	?>
16 16
 
17 17
 </div>
Please login to merge, or discard this patch.
core/admin/templates/admin_details_metabox_column_wrapper.template.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@
 block discarded – undo
9 9
         </div> <!-- post-body-content -->
10 10
 
11 11
         <?php
12
-        // let's loop through the columns
13
-        for ($i = 1; $i <= $num_columns; $i++) {
14
-            $metaref = ($i === 1) ? 'normal' : 'side';
15
-            $metaref = ($i > 2) ? 'column' . $i : $metaref;
16
-            ?>
12
+		// let's loop through the columns
13
+		for ($i = 1; $i <= $num_columns; $i++) {
14
+			$metaref = ($i === 1) ? 'normal' : 'side';
15
+			$metaref = ($i > 2) ? 'column' . $i : $metaref;
16
+			?>
17 17
 
18 18
             <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'>
19 19
                 <?php do_meta_boxes($current_page, $metaref, null); ?>
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
         // let's loop through the columns
13 13
         for ($i = 1; $i <= $num_columns; $i++) {
14 14
             $metaref = ($i === 1) ? 'normal' : 'side';
15
-            $metaref = ($i > 2) ? 'column' . $i : $metaref;
15
+            $metaref = ($i > 2) ? 'column'.$i : $metaref;
16 16
             ?>
17 17
 
18 18
             <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'>
Please login to merge, or discard this patch.
admin/templates/admin_general_metabox_contents_espresso_links.template.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -2,16 +2,16 @@  discard block
 block discarded – undo
2 2
     <ul class="infolinks">
3 3
         <li>
4 4
             <?php
5
-            echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">'
6
-                 . __(
7
-                     'Installation',
8
-                     'event_espresso'
9
-                 )
10
-                 . '</a>  &amp; <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">'
11
-                 . __(
12
-                     'Usage Guide',
13
-                     'event_espresso'
14
-                 ) . '</a>'; ?>
5
+			echo '<a href="http://eventespresso.com/wiki/installation/" target="_blank">'
6
+				 . __(
7
+					 'Installation',
8
+					 'event_espresso'
9
+				 )
10
+				 . '</a>  &amp; <a href="http://eventespresso.com/wiki/setting-up-event-espresso/" target="_blank">'
11
+				 . __(
12
+					 'Usage Guide',
13
+					 'event_espresso'
14
+				 ) . '</a>'; ?>
15 15
         </li>
16 16
         <li>
17 17
             <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank">
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
         </li>
42 42
         <li>
43 43
             <?php echo '<a href="http://eventespresso.com/pricing/" target="_blank">'
44
-                       . __(
45
-                           'Plugins',
46
-                           'event_espresso'
47
-                       )
48
-                       . '</a> &amp; <a href="http://eventespresso.com/add-ons/" target="_blank">'
49
-                       . __(
50
-                           'Add-ons',
51
-                           'event_espresso'
52
-                       ) . '</a>'; ?><br/>
44
+					   . __(
45
+						   'Plugins',
46
+						   'event_espresso'
47
+					   )
48
+					   . '</a> &amp; <a href="http://eventespresso.com/add-ons/" target="_blank">'
49
+					   . __(
50
+						   'Add-ons',
51
+						   'event_espresso'
52
+					   ) . '</a>'; ?><br/>
53 53
             <br/>
54 54
             <ol>
55 55
                 <li>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
                  . __(
12 12
                      'Usage Guide',
13 13
                      'event_espresso'
14
-                 ) . '</a>'; ?>
14
+                 ).'</a>'; ?>
15 15
         </li>
16 16
         <li>
17 17
             <a href="http://eventespresso.com/wiki/put-custom-templates/" target="_blank">
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                        . __(
50 50
                            'Add-ons',
51 51
                            'event_espresso'
52
-                       ) . '</a>'; ?><br/>
52
+                       ).'</a>'; ?><br/>
53 53
             <br/>
54 54
             <ol>
55 55
                 <li>
Please login to merge, or discard this patch.
core/admin/templates/admin_wrapper_ajax.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@
 block discarded – undo
3 3
 
4 4
     <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div>
5 5
     <?php
6
-    do_action('AHEE__admin_wrapper__template__before_admin_page_content');
7
-    echo $before_admin_page_content;
8
-    echo $admin_page_content;
9
-    echo $after_admin_page_content;
10
-    do_action('AHEE__admin_wrapper__template__after_admin_page_content');
11
-    ?>
6
+	do_action('AHEE__admin_wrapper__template__before_admin_page_content');
7
+	echo $before_admin_page_content;
8
+	echo $admin_page_content;
9
+	echo $after_admin_page_content;
10
+	do_action('AHEE__admin_wrapper__template__after_admin_page_content');
11
+	?>
12 12
 </div>
13 13
 <!-- espresso-admin -->
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper_no_sidebar.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 <div id="<?php echo $admin_page_wrapper_div_id; ?>">
8 8
     <div id="post-body" class="metabox-holder columns-1">
9 9
 
10
-        <?php if (! empty($admin_page_header)) : ?>
10
+        <?php if ( ! empty($admin_page_header)) : ?>
11 11
             <div id="admin-page-header">
12 12
                 <?php echo $admin_page_header; ?>
13 13
             </div>
Please login to merge, or discard this patch.
core/libraries/plugin_api/db/EEE_Base_Class.lib.php 2 patches
Indentation   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -32,126 +32,126 @@
 block discarded – undo
32 32
 class EEE_Base_Class
33 33
 {
34 34
 
35
-    const extending_method_prefix = 'ext_';
36
-    const dynamic_callback_method_prefix = 'dynamic_callback_method_';
37
-    /**
38
-     * The model name that is extended (not classname)
39
-     *
40
-     * @var string
41
-     */
42
-    protected $_model_name_extended = null;
43
-    /**
44
-     * The model this extends
45
-     *
46
-     * @var EE_Base_Class
47
-     */
48
-    protected $_ = null;
35
+	const extending_method_prefix = 'ext_';
36
+	const dynamic_callback_method_prefix = 'dynamic_callback_method_';
37
+	/**
38
+	 * The model name that is extended (not classname)
39
+	 *
40
+	 * @var string
41
+	 */
42
+	protected $_model_name_extended = null;
43
+	/**
44
+	 * The model this extends
45
+	 *
46
+	 * @var EE_Base_Class
47
+	 */
48
+	protected $_ = null;
49 49
 
50
-    public function __construct()
51
-    {
52
-        if (! $this->_model_name_extended) {
53
-            throw new EE_Error(
54
-                sprintf(
55
-                    __(
56
-                        "When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'",
57
-                        "event_espresso"
58
-                    )
59
-                )
60
-            );
61
-        }
62
-        if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) {
63
-            throw new EE_Error(
64
-                sprintf(
65
-                    __(
66
-                        "Hooked in model object extension '%s' too late! The model object %s has already been used!",
67
-                        "event_espresso"
68
-                    ),
69
-                    get_class($this),
70
-                    $this->_model_name_extended
71
-                )
72
-            );
73
-        }
74
-        $this->_register_extending_methods();
75
-    }
50
+	public function __construct()
51
+	{
52
+		if (! $this->_model_name_extended) {
53
+			throw new EE_Error(
54
+				sprintf(
55
+					__(
56
+						"When declaring a class extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'",
57
+						"event_espresso"
58
+					)
59
+				)
60
+			);
61
+		}
62
+		if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) {
63
+			throw new EE_Error(
64
+				sprintf(
65
+					__(
66
+						"Hooked in model object extension '%s' too late! The model object %s has already been used!",
67
+						"event_espresso"
68
+					),
69
+					get_class($this),
70
+					$this->_model_name_extended
71
+				)
72
+			);
73
+		}
74
+		$this->_register_extending_methods();
75
+	}
76 76
 
77
-    /**
78
-     * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
79
-     * model extended. (Internally uses filters, and the __call magic method)
80
-     */
81
-    protected function _register_extending_methods()
82
-    {
83
-        $all_methods = get_class_methods(get_class($this));
84
-        foreach ($all_methods as $method_name) {
85
-            if (strpos($method_name, self::extending_method_prefix) === 0) {
86
-                $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
87
-                $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
88
-                add_filter(
89
-                    $callback_name,
90
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
91
-                    10,
92
-                    10
93
-                );
94
-            }
95
-        }
96
-    }
77
+	/**
78
+	 * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
79
+	 * model extended. (Internally uses filters, and the __call magic method)
80
+	 */
81
+	protected function _register_extending_methods()
82
+	{
83
+		$all_methods = get_class_methods(get_class($this));
84
+		foreach ($all_methods as $method_name) {
85
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
86
+				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
87
+				$callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
88
+				add_filter(
89
+					$callback_name,
90
+					array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
91
+					10,
92
+					10
93
+				);
94
+			}
95
+		}
96
+	}
97 97
 
98
-    /**
99
-     * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
100
-     * model extended. (Internally uses filters, and the __call magic method)
101
-     */
102
-    public function deregister()
103
-    {
104
-        $all_methods = get_class_methods(get_class($this));
105
-        foreach ($all_methods as $method_name) {
106
-            if (strpos($method_name, self::extending_method_prefix) === 0) {
107
-                $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
108
-                $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
109
-                remove_filter(
110
-                    $callback_name,
111
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
112
-                    10
113
-                );
114
-            }
115
-        }
116
-    }
98
+	/**
99
+	 * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
100
+	 * model extended. (Internally uses filters, and the __call magic method)
101
+	 */
102
+	public function deregister()
103
+	{
104
+		$all_methods = get_class_methods(get_class($this));
105
+		foreach ($all_methods as $method_name) {
106
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
107
+				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
108
+				$callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
109
+				remove_filter(
110
+					$callback_name,
111
+					array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
112
+					10
113
+				);
114
+			}
115
+		}
116
+	}
117 117
 
118 118
 
119
-    public function __call($callback_method_name, $args)
120
-    {
121
-        if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
122
-            // it's a dynamic callback for a method name
123
-            $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
124
-            $original_return_val = $args[0];
125
-            $model_called = $args[1];
126
-            // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction
127
-            $this->_ = $model_called;
128
-            // phpcs:enable
129
-            $args_provided_to_method_on_model = $args[2];
130
-            $extending_method = self::extending_method_prefix . $method_called_on_model;
131
-            if (method_exists($this, $extending_method)) {
132
-                return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
133
-            } else {
134
-                throw new EE_Error(
135
-                    sprintf(
136
-                        __(
137
-                            "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)",
138
-                            "event_espresso"
139
-                        ),
140
-                        $this->_model_name_extended,
141
-                        get_class($this),
142
-                        $extending_method,
143
-                        $extending_method
144
-                    )
145
-                );
146
-            }
147
-        } else {
148
-            throw new EE_Error(
149
-                sprintf(
150
-                    __("There is no method named '%s' on '%s'", "event_espresso"),
151
-                    $callback_method_name,
152
-                    get_class($this)
153
-                )
154
-            );
155
-        }
156
-    }
119
+	public function __call($callback_method_name, $args)
120
+	{
121
+		if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
122
+			// it's a dynamic callback for a method name
123
+			$method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
124
+			$original_return_val = $args[0];
125
+			$model_called = $args[1];
126
+			// phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction
127
+			$this->_ = $model_called;
128
+			// phpcs:enable
129
+			$args_provided_to_method_on_model = $args[2];
130
+			$extending_method = self::extending_method_prefix . $method_called_on_model;
131
+			if (method_exists($this, $extending_method)) {
132
+				return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
133
+			} else {
134
+				throw new EE_Error(
135
+					sprintf(
136
+						__(
137
+							"An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)",
138
+							"event_espresso"
139
+						),
140
+						$this->_model_name_extended,
141
+						get_class($this),
142
+						$extending_method,
143
+						$extending_method
144
+					)
145
+				);
146
+			}
147
+		} else {
148
+			throw new EE_Error(
149
+				sprintf(
150
+					__("There is no method named '%s' on '%s'", "event_espresso"),
151
+					$callback_method_name,
152
+					get_class($this)
153
+				)
154
+			);
155
+		}
156
+	}
157 157
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function __construct()
51 51
     {
52
-        if (! $this->_model_name_extended) {
52
+        if ( ! $this->_model_name_extended) {
53 53
             throw new EE_Error(
54 54
                 sprintf(
55 55
                     __(
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 )
60 60
             );
61 61
         }
62
-        if (did_action('AHEE__EE_' . $this->_model_name_extended . '__construct__end')) {
62
+        if (did_action('AHEE__EE_'.$this->_model_name_extended.'__construct__end')) {
63 63
             throw new EE_Error(
64 64
                 sprintf(
65 65
                     __(
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
88 88
                 add_filter(
89 89
                     $callback_name,
90
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
90
+                    array($this, self::dynamic_callback_method_prefix.$method_name_on_model),
91 91
                     10,
92 92
                     10
93 93
                 );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $callback_name = "FHEE__EE_{$this->_model_name_extended}__$method_name_on_model";
109 109
                 remove_filter(
110 110
                     $callback_name,
111
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
111
+                    array($this, self::dynamic_callback_method_prefix.$method_name_on_model),
112 112
                     10
113 113
                 );
114 114
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $this->_ = $model_called;
128 128
             // phpcs:enable
129 129
             $args_provided_to_method_on_model = $args[2];
130
-            $extending_method = self::extending_method_prefix . $method_called_on_model;
130
+            $extending_method = self::extending_method_prefix.$method_called_on_model;
131 131
             if (method_exists($this, $extending_method)) {
132 132
                 return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
133 133
             } else {
Please login to merge, or discard this patch.
core/libraries/plugin_api/db/EEME_Base.lib.php 2 patches
Indentation   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -44,211 +44,211 @@
 block discarded – undo
44 44
 abstract class EEME_Base
45 45
 {
46 46
 
47
-    const extending_method_prefix = 'ext_';
48
-    const dynamic_callback_method_prefix = 'dynamic_callback_method_';
49
-
50
-    protected $_extra_tables = array();
51
-    protected $_extra_fields = array();
52
-    protected $_extra_relations = array();
53
-
54
-    /**
55
-     * The model name that is extended (not classname)
56
-     *
57
-     * @var string
58
-     */
59
-    protected $_model_name_extended = null;
60
-
61
-    /**
62
-     * The model this extends
63
-     *
64
-     * @var EEM_Base
65
-     */
66
-    protected $_ = null;
67
-
68
-
69
-    /**
70
-     * @throws \EE_Error
71
-     */
72
-    public function __construct()
73
-    {
74
-        if (! $this->_model_name_extended) {
75
-            throw new EE_Error(
76
-                __(
77
-                    "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'",
78
-                    "event_espresso"
79
-                )
80
-            );
81
-        }
82
-        $construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end';
83
-        if (did_action($construct_end_action)) {
84
-            throw new EE_Error(
85
-                sprintf(
86
-                    __(
87
-                        "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired",
88
-                        "event_espresso"
89
-                    ),
90
-                    get_class($this),
91
-                    $this->_model_name_extended,
92
-                    $construct_end_action
93
-                )
94
-            );
95
-        }
96
-        add_filter(
97
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
98
-            array($this, 'add_extra_tables_on_filter')
99
-        );
100
-        add_filter(
101
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
102
-            array($this, 'add_extra_fields_on_filter')
103
-        );
104
-        add_filter(
105
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
106
-            array($this, 'add_extra_relations_on_filter')
107
-        );
108
-        $this->_register_extending_methods();
109
-    }
110
-
111
-
112
-    /**
113
-     * @param array $existing_tables
114
-     * @return array
115
-     */
116
-    public function add_extra_tables_on_filter($existing_tables)
117
-    {
118
-        return array_merge((array) $existing_tables, $this->_extra_tables);
119
-    }
120
-
121
-
122
-    /**
123
-     * @param array $existing_fields
124
-     * @return array
125
-     */
126
-    public function add_extra_fields_on_filter($existing_fields)
127
-    {
128
-        if ($this->_extra_fields) {
129
-            foreach ($this->_extra_fields as $table_alias => $fields) {
130
-                if (! isset($existing_fields[ $table_alias ])) {
131
-                    $existing_fields[ $table_alias ] = array();
132
-                }
133
-                $existing_fields[ $table_alias ] = array_merge(
134
-                    (array) $existing_fields[ $table_alias ],
135
-                    $this->_extra_fields[ $table_alias ]
136
-                );
137
-            }
138
-        }
139
-        return $existing_fields;
140
-    }
141
-
142
-
143
-    /**
144
-     * @param array $existing_relations
145
-     * @return array
146
-     */
147
-    public function add_extra_relations_on_filter($existing_relations)
148
-    {
149
-        return array_merge((array) $existing_relations, $this->_extra_relations);
150
-    }
151
-
152
-
153
-    /**
154
-     * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
155
-     * model extended. (Internally uses filters, and the __call magic method)
156
-     */
157
-    protected function _register_extending_methods()
158
-    {
159
-        $all_methods = get_class_methods(get_class($this));
160
-        foreach ($all_methods as $method_name) {
161
-            if (strpos($method_name, self::extending_method_prefix) === 0) {
162
-                $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
163
-                $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
164
-                add_filter(
165
-                    $callback_name,
166
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
167
-                    10,
168
-                    10
169
-                );
170
-            }
171
-        }
172
-    }
173
-
174
-    /**
175
-     * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
176
-     * model extended. (Internally uses filters, and the __call magic method)
177
-     */
178
-    public function deregister()
179
-    {
180
-        remove_filter(
181
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
182
-            array($this, 'add_extra_tables_on_filter')
183
-        );
184
-        remove_filter(
185
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
186
-            array($this, 'add_extra_fields_on_filter')
187
-        );
188
-        remove_filter(
189
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
190
-            array($this, 'add_extra_relations_on_filter')
191
-        );
192
-        $all_methods = get_class_methods(get_class($this));
193
-        foreach ($all_methods as $method_name) {
194
-            if (strpos($method_name, self::extending_method_prefix) === 0) {
195
-                $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
196
-                $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
197
-                remove_filter(
198
-                    $callback_name,
199
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
200
-                    10
201
-                );
202
-            }
203
-        }
204
-        /** @var EEM_Base $model_to_reset */
205
-        $model_to_reset = 'EEM_' . $this->_model_name_extended;
206
-        if (class_exists($model_to_reset)) {
207
-            $model_to_reset::reset();
208
-        }
209
-    }
210
-
211
-
212
-    /**
213
-     * @param string $callback_method_name
214
-     * @param array  $args
215
-     * @return mixed
216
-     * @throws EE_Error
217
-     */
218
-    public function __call($callback_method_name, $args)
219
-    {
220
-        if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
221
-            // it's a dynamic callback for a method name
222
-            $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
223
-            list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args;
224
-            // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction
225
-            $this->_ = $model_called;
226
-            // phpcs:enable
227
-            $extending_method = self::extending_method_prefix . $method_called_on_model;
228
-            if (method_exists($this, $extending_method)) {
229
-                return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
230
-            } else {
231
-                throw new EE_Error(
232
-                    sprintf(
233
-                        __(
234
-                            "An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)",
235
-                            "event_espresso"
236
-                        ),
237
-                        $this->_model_name_extended,
238
-                        get_class($this),
239
-                        $extending_method,
240
-                        $extending_method
241
-                    )
242
-                );
243
-            }
244
-        } else {
245
-            throw new EE_Error(
246
-                sprintf(
247
-                    __("There is no method named '%s' on '%s'", "event_espresso"),
248
-                    $callback_method_name,
249
-                    get_class($this)
250
-                )
251
-            );
252
-        }
253
-    }
47
+	const extending_method_prefix = 'ext_';
48
+	const dynamic_callback_method_prefix = 'dynamic_callback_method_';
49
+
50
+	protected $_extra_tables = array();
51
+	protected $_extra_fields = array();
52
+	protected $_extra_relations = array();
53
+
54
+	/**
55
+	 * The model name that is extended (not classname)
56
+	 *
57
+	 * @var string
58
+	 */
59
+	protected $_model_name_extended = null;
60
+
61
+	/**
62
+	 * The model this extends
63
+	 *
64
+	 * @var EEM_Base
65
+	 */
66
+	protected $_ = null;
67
+
68
+
69
+	/**
70
+	 * @throws \EE_Error
71
+	 */
72
+	public function __construct()
73
+	{
74
+		if (! $this->_model_name_extended) {
75
+			throw new EE_Error(
76
+				__(
77
+					"When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'",
78
+					"event_espresso"
79
+				)
80
+			);
81
+		}
82
+		$construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end';
83
+		if (did_action($construct_end_action)) {
84
+			throw new EE_Error(
85
+				sprintf(
86
+					__(
87
+						"Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired",
88
+						"event_espresso"
89
+					),
90
+					get_class($this),
91
+					$this->_model_name_extended,
92
+					$construct_end_action
93
+				)
94
+			);
95
+		}
96
+		add_filter(
97
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
98
+			array($this, 'add_extra_tables_on_filter')
99
+		);
100
+		add_filter(
101
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
102
+			array($this, 'add_extra_fields_on_filter')
103
+		);
104
+		add_filter(
105
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
106
+			array($this, 'add_extra_relations_on_filter')
107
+		);
108
+		$this->_register_extending_methods();
109
+	}
110
+
111
+
112
+	/**
113
+	 * @param array $existing_tables
114
+	 * @return array
115
+	 */
116
+	public function add_extra_tables_on_filter($existing_tables)
117
+	{
118
+		return array_merge((array) $existing_tables, $this->_extra_tables);
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param array $existing_fields
124
+	 * @return array
125
+	 */
126
+	public function add_extra_fields_on_filter($existing_fields)
127
+	{
128
+		if ($this->_extra_fields) {
129
+			foreach ($this->_extra_fields as $table_alias => $fields) {
130
+				if (! isset($existing_fields[ $table_alias ])) {
131
+					$existing_fields[ $table_alias ] = array();
132
+				}
133
+				$existing_fields[ $table_alias ] = array_merge(
134
+					(array) $existing_fields[ $table_alias ],
135
+					$this->_extra_fields[ $table_alias ]
136
+				);
137
+			}
138
+		}
139
+		return $existing_fields;
140
+	}
141
+
142
+
143
+	/**
144
+	 * @param array $existing_relations
145
+	 * @return array
146
+	 */
147
+	public function add_extra_relations_on_filter($existing_relations)
148
+	{
149
+		return array_merge((array) $existing_relations, $this->_extra_relations);
150
+	}
151
+
152
+
153
+	/**
154
+	 * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the
155
+	 * model extended. (Internally uses filters, and the __call magic method)
156
+	 */
157
+	protected function _register_extending_methods()
158
+	{
159
+		$all_methods = get_class_methods(get_class($this));
160
+		foreach ($all_methods as $method_name) {
161
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
162
+				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
163
+				$callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
164
+				add_filter(
165
+					$callback_name,
166
+					array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
167
+					10,
168
+					10
169
+				);
170
+			}
171
+		}
172
+	}
173
+
174
+	/**
175
+	 * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the
176
+	 * model extended. (Internally uses filters, and the __call magic method)
177
+	 */
178
+	public function deregister()
179
+	{
180
+		remove_filter(
181
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
182
+			array($this, 'add_extra_tables_on_filter')
183
+		);
184
+		remove_filter(
185
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
186
+			array($this, 'add_extra_fields_on_filter')
187
+		);
188
+		remove_filter(
189
+			'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
190
+			array($this, 'add_extra_relations_on_filter')
191
+		);
192
+		$all_methods = get_class_methods(get_class($this));
193
+		foreach ($all_methods as $method_name) {
194
+			if (strpos($method_name, self::extending_method_prefix) === 0) {
195
+				$method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name);
196
+				$callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
197
+				remove_filter(
198
+					$callback_name,
199
+					array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
200
+					10
201
+				);
202
+			}
203
+		}
204
+		/** @var EEM_Base $model_to_reset */
205
+		$model_to_reset = 'EEM_' . $this->_model_name_extended;
206
+		if (class_exists($model_to_reset)) {
207
+			$model_to_reset::reset();
208
+		}
209
+	}
210
+
211
+
212
+	/**
213
+	 * @param string $callback_method_name
214
+	 * @param array  $args
215
+	 * @return mixed
216
+	 * @throws EE_Error
217
+	 */
218
+	public function __call($callback_method_name, $args)
219
+	{
220
+		if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) {
221
+			// it's a dynamic callback for a method name
222
+			$method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name);
223
+			list($original_return_val, $model_called, $args_provided_to_method_on_model) = (array) $args;
224
+			// phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction
225
+			$this->_ = $model_called;
226
+			// phpcs:enable
227
+			$extending_method = self::extending_method_prefix . $method_called_on_model;
228
+			if (method_exists($this, $extending_method)) {
229
+				return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
230
+			} else {
231
+				throw new EE_Error(
232
+					sprintf(
233
+						__(
234
+							"An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)",
235
+							"event_espresso"
236
+						),
237
+						$this->_model_name_extended,
238
+						get_class($this),
239
+						$extending_method,
240
+						$extending_method
241
+					)
242
+				);
243
+			}
244
+		} else {
245
+			throw new EE_Error(
246
+				sprintf(
247
+					__("There is no method named '%s' on '%s'", "event_espresso"),
248
+					$callback_method_name,
249
+					get_class($this)
250
+				)
251
+			);
252
+		}
253
+	}
254 254
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function __construct()
73 73
     {
74
-        if (! $this->_model_name_extended) {
74
+        if ( ! $this->_model_name_extended) {
75 75
             throw new EE_Error(
76 76
                 __(
77 77
                     "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'",
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 )
80 80
             );
81 81
         }
82
-        $construct_end_action = 'AHEE__EEM_' . $this->_model_name_extended . '__construct__end';
82
+        $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end';
83 83
         if (did_action($construct_end_action)) {
84 84
             throw new EE_Error(
85 85
                 sprintf(
@@ -94,15 +94,15 @@  discard block
 block discarded – undo
94 94
             );
95 95
         }
96 96
         add_filter(
97
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
97
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',
98 98
             array($this, 'add_extra_tables_on_filter')
99 99
         );
100 100
         add_filter(
101
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
101
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',
102 102
             array($this, 'add_extra_fields_on_filter')
103 103
         );
104 104
         add_filter(
105
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
105
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',
106 106
             array($this, 'add_extra_relations_on_filter')
107 107
         );
108 108
         $this->_register_extending_methods();
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
     {
128 128
         if ($this->_extra_fields) {
129 129
             foreach ($this->_extra_fields as $table_alias => $fields) {
130
-                if (! isset($existing_fields[ $table_alias ])) {
131
-                    $existing_fields[ $table_alias ] = array();
130
+                if ( ! isset($existing_fields[$table_alias])) {
131
+                    $existing_fields[$table_alias] = array();
132 132
                 }
133
-                $existing_fields[ $table_alias ] = array_merge(
134
-                    (array) $existing_fields[ $table_alias ],
135
-                    $this->_extra_fields[ $table_alias ]
133
+                $existing_fields[$table_alias] = array_merge(
134
+                    (array) $existing_fields[$table_alias],
135
+                    $this->_extra_fields[$table_alias]
136 136
                 );
137 137
             }
138 138
         }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
164 164
                 add_filter(
165 165
                     $callback_name,
166
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
166
+                    array($this, self::dynamic_callback_method_prefix.$method_name_on_model),
167 167
                     10,
168 168
                     10
169 169
                 );
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
     public function deregister()
179 179
     {
180 180
         remove_filter(
181
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__tables',
181
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',
182 182
             array($this, 'add_extra_tables_on_filter')
183 183
         );
184 184
         remove_filter(
185
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__fields',
185
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',
186 186
             array($this, 'add_extra_fields_on_filter')
187 187
         );
188 188
         remove_filter(
189
-            'FHEE__EEM_' . $this->_model_name_extended . '__construct__model_relations',
189
+            'FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',
190 190
             array($this, 'add_extra_relations_on_filter')
191 191
         );
192 192
         $all_methods = get_class_methods(get_class($this));
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
                 $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model";
197 197
                 remove_filter(
198 198
                     $callback_name,
199
-                    array($this, self::dynamic_callback_method_prefix . $method_name_on_model),
199
+                    array($this, self::dynamic_callback_method_prefix.$method_name_on_model),
200 200
                     10
201 201
                 );
202 202
             }
203 203
         }
204 204
         /** @var EEM_Base $model_to_reset */
205
-        $model_to_reset = 'EEM_' . $this->_model_name_extended;
205
+        $model_to_reset = 'EEM_'.$this->_model_name_extended;
206 206
         if (class_exists($model_to_reset)) {
207 207
             $model_to_reset::reset();
208 208
         }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             // phpcs:disable WordPress.WP.I18n.SingleUnderscoreGetTextFunction
225 225
             $this->_ = $model_called;
226 226
             // phpcs:enable
227
-            $extending_method = self::extending_method_prefix . $method_called_on_model;
227
+            $extending_method = self::extending_method_prefix.$method_called_on_model;
228 228
             if (method_exists($this, $extending_method)) {
229 229
                 return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model);
230 230
             } else {
Please login to merge, or discard this patch.