Completed
Branch BUG-8957-add-countries (301f85)
by
unknown
32:21 queued 18:11
created
core/admin/PostShortcodeTracking.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
      * @param  int $ID
260 260
      * @param      $shortcode_class
261 261
      * @param      $shortcode_posts
262
-     * @param      $page_for_posts
262
+     * @param      string $page_for_posts
263 263
      * @param bool $update_post_shortcodes
264 264
      * @return bool
265 265
      */
Please login to merge, or discard this patch.
Indentation   +445 added lines, -445 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\admin;
3 3
 
4 4
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
5
+	exit( 'No direct script access allowed' );
6 6
 }
7 7
 
8 8
 
@@ -19,450 +19,450 @@  discard block
 block discarded – undo
19 19
 class PostShortcodeTracking
20 20
 {
21 21
 
22
-    /**
23
-     * set_hooks_admin
24
-     *
25
-     * @access    public
26
-     */
27
-    public static function set_hooks_admin()
28
-    {
29
-        add_action(
30
-            'save_post',
31
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
32
-            100,
33
-            2
34
-        );
35
-        add_action(
36
-            'delete_post',
37
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
38
-            100,
39
-            1
40
-        );
41
-        add_action(
42
-            'add_option_page_for_posts',
43
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
44
-            100,
45
-            2
46
-        );
47
-        add_action(
48
-            'update_option',
49
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
50
-            100,
51
-            3
52
-        );
53
-        add_action(
54
-            'delete_option',
55
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
56
-            100,
57
-            1
58
-        );
59
-    }
60
-
61
-
62
-
63
-    /**
64
-     *    parse_post_content_on_save
65
-     *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
66
-     *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before
67
-     *    the_content() runs. this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the
68
-     *    shortcodes are actually used on
69
-     *
70
-     * @access    public
71
-     * @param int      $post_ID
72
-     * @param \WP_Post $post
73
-     * @return    void
74
-     */
75
-    public static function parse_post_content_on_save( $post_ID, $post )
76
-    {
77
-        // if the post is trashed, then let's remove our post shortcode tracking
78
-        if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
-            PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
80
-            return;
81
-        }
82
-        // default post types
83
-        $post_types = array( 'post' => 0, 'page' => 1 );
84
-        // add CPTs
85
-        $CPTs = \EE_Register_CPTs::get_CPTs();
86
-        $post_types = array_merge( $post_types, $CPTs );
87
-        // for default or CPT posts...
88
-        if ( isset( $post_types[ $post->post_type ] ) ) {
89
-            // post on frontpage ?
90
-            $page_for_posts = \EE_Config::get_page_for_posts();
91
-            if ( $post->post_name === $page_for_posts ) {
92
-                PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
93
-                return;
94
-            }
95
-            // array of shortcodes indexed by post name
96
-            \EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
97
-                ? \EE_Registry::CFG()->core->post_shortcodes
98
-                : array();
99
-            // whether to proceed with update
100
-            $update_post_shortcodes = false;
101
-            // empty both arrays
102
-            \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
103
-            // check that posts page is already being tracked
104
-            if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
105
-                // if not, then ensure that it is properly added
106
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
107
-            }
108
-            // loop thru shortcodes
109
-            foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
110
-                // convert to UPPERCASE to get actual shortcode
111
-                $EES_Shortcode = strtoupper( $EES_Shortcode );
112
-                // is the shortcode in the post_content ?
113
-                if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
114
-                    // map shortcode to post names and post IDs
115
-                    \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
116
-                    // and add this shortcode to the tracking for the blog page
117
-                    PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
-                        $post_ID );
119
-                    $update_post_shortcodes = true;
120
-                } else {
121
-                    // shortcode is not present in post content, so check if we were tracking it previously
122
-                    // stop tracking if shortcode is not used in this specific post
123
-                    if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
125
-                        $update_post_shortcodes = true;
126
-                    }
127
-                    // make sure that something is set for the shortcode posts (even though we may remove this)
128
-                    $shortcode_posts = isset(
129
-                        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
130
-                    )
131
-                        ? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
132
-                        : array();
133
-                    // and stop tracking for this shortcode on the blog page if it is not used
134
-                    $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
135
-                        $post_ID,
136
-                        $EES_Shortcode,
137
-                        $shortcode_posts,
138
-                        $page_for_posts,
139
-                        $update_post_shortcodes
140
-                    )
141
-                        ? true
142
-                        : $update_post_shortcodes;
143
-                }
144
-            }
145
-            if ( $update_post_shortcodes ) {
146
-                PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
147
-            }
148
-        }
149
-    }
150
-
151
-
152
-
153
-    /**
154
-     * set_post_shortcodes_for_posts_page (plz note: shortcodes is plural)
155
-     * called when updating the WordPress Posts Page,
156
-     * and adds shortcode tracking for the Posts Page, for all shortcodes currently tracked on individual posts
157
-     *
158
-     * @access protected
159
-     * @param  string $page_for_posts
160
-     * @return void
161
-     */
162
-    protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
163
-    {
164
-        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
165
-        // loop thru shortcodes
166
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
-            foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
-                PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
169
-            }
170
-        }
171
-        PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
172
-    }
173
-
174
-
175
-
176
-    /**
177
-     * set_post_shortcode_for_posts_page (plz note: shortcode is singular)
178
-     * adds Posts Page shortcode tracking for the supplied shortcode for an individual post
179
-     *
180
-     * @access protected
181
-     * @param  string $page_for_posts
182
-     * @param         $EES_Shortcode
183
-     * @param         $post_ID
184
-     */
185
-    protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
186
-    {
187
-        // critical page shortcodes that we do NOT want added to the Posts page (blog)
188
-        $critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189
-        // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
-        if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
191
-            return;
192
-        }
193
-        // add shortcode to "Posts page" tracking
194
-        if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
195
-            // make sure tracking is in form of an array
196
-            if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
-                    \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
199
-                );
200
-            }
201
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
202
-        } else {
203
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
204
-        }
205
-    }
206
-
207
-
208
-
209
-    /**
210
-     * unset_post_shortcodes_on_delete
211
-     *
212
-     * @access protected
213
-     * @param  int $ID
214
-     * @return void
215
-     */
216
-    public static function unset_post_shortcodes_on_delete( $ID )
217
-    {
218
-        $update_post_shortcodes = false;
219
-        // post on frontpage ?
220
-        $page_for_posts = \EE_Config::get_page_for_posts();
221
-        // looking for any references to this post
222
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
223
-            // is this the "Posts Page" (blog) ?
224
-            if ( $post_name === $page_for_posts ) {
225
-                // loop thru shortcodes registered for the posts page
226
-                foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
227
-                    $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228
-                        $ID,
229
-                        $shortcode_class,
230
-                        $shortcode_posts,
231
-                        $page_for_posts,
232
-                        $update_post_shortcodes
233
-                    )
234
-                        ? true
235
-                        : $update_post_shortcodes;
236
-                }
237
-            } else {
238
-                // loop thru shortcodes registered for each page
239
-                foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
240
-                    // if this is page is being deleted, then don't track any post shortcodes for it
241
-                    if ( $post_ID === $ID ) {
242
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
243
-                        $update_post_shortcodes = true;
244
-                    }
245
-                }
246
-            }
247
-        }
248
-        if ( $update_post_shortcodes ) {
249
-            PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
250
-        }
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * unset_post_shortcodes_on_delete
257
-     *
258
-     * @access protected
259
-     * @param  int $ID
260
-     * @param      $shortcode_class
261
-     * @param      $shortcode_posts
262
-     * @param      $page_for_posts
263
-     * @param bool $update_post_shortcodes
264
-     * @return bool
265
-     */
266
-    protected static function unset_posts_page_shortcode_for_post(
267
-        $ID,
268
-        $shortcode_class,
269
-        $shortcode_posts,
270
-        $page_for_posts,
271
-        $update_post_shortcodes = false
272
-    ) {
273
-        // make sure that an array of post IDs is being tracked for each  shortcode
274
-        if ( ! is_array( $shortcode_posts ) ) {
275
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
276
-                $shortcode_posts => true,
277
-            );
278
-            $update_post_shortcodes = true;
279
-        }
280
-        // now if the ID of the post being deleted is in the $shortcode_posts array
281
-        if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
283
-            $update_post_shortcodes = true;
284
-        }
285
-        // if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
-        if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
288
-            $update_post_shortcodes = true;
289
-        }
290
-        return $update_post_shortcodes;
291
-    }
292
-
293
-
294
-
295
-    /**
296
-     *    update_post_shortcodes
297
-     *
298
-     * @access    public
299
-     * @param $page_for_posts
300
-     * @return    void
301
-     */
302
-    public static function update_post_shortcodes( $page_for_posts = '' )
303
-    {
304
-        // make sure page_for_posts is set
305
-        $page_for_posts = ! empty( $page_for_posts )
306
-            ? $page_for_posts
307
-            : \EE_Config::get_page_for_posts();
308
-        // allow others to mess stuff up :D
309
-        do_action(
310
-            'AHEE__\EventEspresso\core\admin\PostShortcodeTracking__update_post_shortcodes',
311
-            \EE_Config::instance()->core->post_shortcodes,
312
-            $page_for_posts
313
-        );
314
-        // keep old hookpoint for now, will deprecate later
315
-        do_action(
316
-            'AHEE__EE_Config__update_post_shortcodes',
317
-            \EE_Config::instance()->core->post_shortcodes,
318
-            $page_for_posts
319
-        );
320
-        // verify that post_shortcodes is set
321
-        \EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
-                                                        && is_array( \EE_Config::instance()->core->post_shortcodes )
323
-            ? \EE_Config::instance()->core->post_shortcodes
324
-            : array();
325
-        // cycle thru post_shortcodes
326
-        foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
327
-            // are there any shortcodes to track ?
328
-            if ( ! empty( $shortcodes ) ) {
329
-                // skip the posts page, because we want all shortcodes registered for it
330
-                if ( $post_name === $page_for_posts ) {
331
-                    continue;
332
-                }
333
-                // loop thru list of tracked shortcodes
334
-                foreach ( $shortcodes as $shortcode => $post_id ) {
335
-                    // make sure post still exists
336
-                    $post = get_post( $post_id );
337
-                    // check that the post name matches what we have saved
338
-                    if ( $post && $post->post_name === $post_name ) {
339
-                        // if so, then break before hitting the unset below
340
-                        continue;
341
-                    }
342
-                    // we don't like missing posts around here >:(
343
-                    unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
344
-                }
345
-            } else {
346
-                // you got no shortcodes to keep track of !
347
-                unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
348
-            }
349
-        }
350
-        // critical page shortcodes that we do NOT want added to the Posts page (blog)
351
-        $critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
-        $critical_shortcodes = array_flip( $critical_shortcodes );
353
-        foreach ( $critical_shortcodes as $critical_shortcode ) {
354
-            unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
355
-        }
356
-        //only show errors
357
-        \EE_Config::instance()->update_espresso_config();
358
-    }
359
-
360
-
361
-
362
-    /**
363
-     * reset_page_for_posts_on_initial_set
364
-     * if an admin is on the WP Reading Settings page and sets the option for "Posts page",
365
-     * when it had previously been unset,
366
-     * then we need to attribute any actively used shortcodes to the new blog page
367
-     *
368
-     * @access public
369
-     * @param  string $option
370
-     * @param  string $value
371
-     * @return void
372
-     */
373
-    public static function reset_page_for_posts_on_initial_set( $option, $value )
374
-    {
375
-        PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
376
-    }
377
-
378
-
379
-
380
-    /**
381
-     *    reset_page_for_posts_on_change
382
-     *    if an admin is on the WP Reading Settings page and changes the option for "Posts page",
383
-     * then we need to attribute any actively used shortcodes for the previous blog page to the new blog page
384
-     *
385
-     * @access public
386
-     * @param  string $option
387
-     * @param  string $old_value
388
-     * @param  string $value
389
-     * @return void
390
-     */
391
-    public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
392
-    {
393
-        if ( $option === 'page_for_posts' ) {
394
-            global $wpdb;
395
-            $table = $wpdb->posts;
396
-            $SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
-            $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
399
-        }
400
-    }
401
-
402
-
403
-
404
-    /**
405
-     * reset_page_for_posts_on_delete
406
-     * if an admin deletes a page designated as the WP "Posts page",
407
-     * then we need to attribute any actively used shortcodes for that blog page to a generic 'posts' page
408
-     *
409
-     * @access public
410
-     * @param  string $option
411
-     * @return void
412
-     */
413
-    public static function reset_page_for_posts_on_delete( $option )
414
-    {
415
-        if ( $option === 'page_for_posts' ) {
416
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
417
-        }
418
-    }
419
-
420
-
421
-
422
-    /**
423
-     * @param array|string $shortcodes
424
-     * @param bool         $index_results if passing more than one shortcode for the $shortcodes parameter above,
425
-     *                                    then setting this to true, will return as associative array indexed by
426
-     *                                    the shortcodes. If false, then the returned array will be unindexed
427
-     * @return array
428
-     */
429
-    public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
430
-    {
431
-        $post_ids = array();
432
-        if ( is_array( $shortcodes ) ) {
433
-            foreach ( $shortcodes as $shortcode ) {
434
-                $new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435
-                    $shortcode,
436
-                    $index_results
437
-                );
438
-                foreach ( $new_post_ids as $new_post_id ) {
439
-                    if ( $index_results ) {
440
-                        $post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
441
-                    } else {
442
-                        $post_ids[ $new_post_id ] = $new_post_id;
443
-                    }
444
-                }
445
-            }
446
-        } else {
447
-            $shortcode = strtoupper( $shortcodes );
448
-            $shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449
-            $page_for_posts = \EE_Config::get_page_for_posts();
450
-            // looking for any references to this post
451
-            foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
452
-                // if this is the "Posts Page" (blog), then skip it
453
-                if ( $post_name === $page_for_posts ) {
454
-                    continue;
455
-                }
456
-                // loop thru shortcodes registered for each page, and grab post id for matches
457
-                foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
-                    if ( $post_shortcode === $shortcode ) {
459
-                        $post_ids[ $post_ID ] = $post_ID;
460
-                    }
461
-                }
462
-            }
463
-        }
464
-        return $post_ids;
465
-    }
22
+	/**
23
+	 * set_hooks_admin
24
+	 *
25
+	 * @access    public
26
+	 */
27
+	public static function set_hooks_admin()
28
+	{
29
+		add_action(
30
+			'save_post',
31
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
32
+			100,
33
+			2
34
+		);
35
+		add_action(
36
+			'delete_post',
37
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
38
+			100,
39
+			1
40
+		);
41
+		add_action(
42
+			'add_option_page_for_posts',
43
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
44
+			100,
45
+			2
46
+		);
47
+		add_action(
48
+			'update_option',
49
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
50
+			100,
51
+			3
52
+		);
53
+		add_action(
54
+			'delete_option',
55
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
56
+			100,
57
+			1
58
+		);
59
+	}
60
+
61
+
62
+
63
+	/**
64
+	 *    parse_post_content_on_save
65
+	 *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
66
+	 *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before
67
+	 *    the_content() runs. this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the
68
+	 *    shortcodes are actually used on
69
+	 *
70
+	 * @access    public
71
+	 * @param int      $post_ID
72
+	 * @param \WP_Post $post
73
+	 * @return    void
74
+	 */
75
+	public static function parse_post_content_on_save( $post_ID, $post )
76
+	{
77
+		// if the post is trashed, then let's remove our post shortcode tracking
78
+		if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
+			PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
80
+			return;
81
+		}
82
+		// default post types
83
+		$post_types = array( 'post' => 0, 'page' => 1 );
84
+		// add CPTs
85
+		$CPTs = \EE_Register_CPTs::get_CPTs();
86
+		$post_types = array_merge( $post_types, $CPTs );
87
+		// for default or CPT posts...
88
+		if ( isset( $post_types[ $post->post_type ] ) ) {
89
+			// post on frontpage ?
90
+			$page_for_posts = \EE_Config::get_page_for_posts();
91
+			if ( $post->post_name === $page_for_posts ) {
92
+				PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
93
+				return;
94
+			}
95
+			// array of shortcodes indexed by post name
96
+			\EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
97
+				? \EE_Registry::CFG()->core->post_shortcodes
98
+				: array();
99
+			// whether to proceed with update
100
+			$update_post_shortcodes = false;
101
+			// empty both arrays
102
+			\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
103
+			// check that posts page is already being tracked
104
+			if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
105
+				// if not, then ensure that it is properly added
106
+				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
107
+			}
108
+			// loop thru shortcodes
109
+			foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
110
+				// convert to UPPERCASE to get actual shortcode
111
+				$EES_Shortcode = strtoupper( $EES_Shortcode );
112
+				// is the shortcode in the post_content ?
113
+				if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
114
+					// map shortcode to post names and post IDs
115
+					\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
116
+					// and add this shortcode to the tracking for the blog page
117
+					PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
+						$post_ID );
119
+					$update_post_shortcodes = true;
120
+				} else {
121
+					// shortcode is not present in post content, so check if we were tracking it previously
122
+					// stop tracking if shortcode is not used in this specific post
123
+					if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
+						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
125
+						$update_post_shortcodes = true;
126
+					}
127
+					// make sure that something is set for the shortcode posts (even though we may remove this)
128
+					$shortcode_posts = isset(
129
+						\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
130
+					)
131
+						? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
132
+						: array();
133
+					// and stop tracking for this shortcode on the blog page if it is not used
134
+					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
135
+						$post_ID,
136
+						$EES_Shortcode,
137
+						$shortcode_posts,
138
+						$page_for_posts,
139
+						$update_post_shortcodes
140
+					)
141
+						? true
142
+						: $update_post_shortcodes;
143
+				}
144
+			}
145
+			if ( $update_post_shortcodes ) {
146
+				PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
147
+			}
148
+		}
149
+	}
150
+
151
+
152
+
153
+	/**
154
+	 * set_post_shortcodes_for_posts_page (plz note: shortcodes is plural)
155
+	 * called when updating the WordPress Posts Page,
156
+	 * and adds shortcode tracking for the Posts Page, for all shortcodes currently tracked on individual posts
157
+	 *
158
+	 * @access protected
159
+	 * @param  string $page_for_posts
160
+	 * @return void
161
+	 */
162
+	protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
163
+	{
164
+		\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
165
+		// loop thru shortcodes
166
+		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
+			foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
+				PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
169
+			}
170
+		}
171
+		PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
172
+	}
173
+
174
+
175
+
176
+	/**
177
+	 * set_post_shortcode_for_posts_page (plz note: shortcode is singular)
178
+	 * adds Posts Page shortcode tracking for the supplied shortcode for an individual post
179
+	 *
180
+	 * @access protected
181
+	 * @param  string $page_for_posts
182
+	 * @param         $EES_Shortcode
183
+	 * @param         $post_ID
184
+	 */
185
+	protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
186
+	{
187
+		// critical page shortcodes that we do NOT want added to the Posts page (blog)
188
+		$critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189
+		// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
+		if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
191
+			return;
192
+		}
193
+		// add shortcode to "Posts page" tracking
194
+		if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
195
+			// make sure tracking is in form of an array
196
+			if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
+				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
+					\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
199
+				);
200
+			}
201
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
202
+		} else {
203
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
204
+		}
205
+	}
206
+
207
+
208
+
209
+	/**
210
+	 * unset_post_shortcodes_on_delete
211
+	 *
212
+	 * @access protected
213
+	 * @param  int $ID
214
+	 * @return void
215
+	 */
216
+	public static function unset_post_shortcodes_on_delete( $ID )
217
+	{
218
+		$update_post_shortcodes = false;
219
+		// post on frontpage ?
220
+		$page_for_posts = \EE_Config::get_page_for_posts();
221
+		// looking for any references to this post
222
+		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
223
+			// is this the "Posts Page" (blog) ?
224
+			if ( $post_name === $page_for_posts ) {
225
+				// loop thru shortcodes registered for the posts page
226
+				foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
227
+					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228
+						$ID,
229
+						$shortcode_class,
230
+						$shortcode_posts,
231
+						$page_for_posts,
232
+						$update_post_shortcodes
233
+					)
234
+						? true
235
+						: $update_post_shortcodes;
236
+				}
237
+			} else {
238
+				// loop thru shortcodes registered for each page
239
+				foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
240
+					// if this is page is being deleted, then don't track any post shortcodes for it
241
+					if ( $post_ID === $ID ) {
242
+						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
243
+						$update_post_shortcodes = true;
244
+					}
245
+				}
246
+			}
247
+		}
248
+		if ( $update_post_shortcodes ) {
249
+			PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
250
+		}
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * unset_post_shortcodes_on_delete
257
+	 *
258
+	 * @access protected
259
+	 * @param  int $ID
260
+	 * @param      $shortcode_class
261
+	 * @param      $shortcode_posts
262
+	 * @param      $page_for_posts
263
+	 * @param bool $update_post_shortcodes
264
+	 * @return bool
265
+	 */
266
+	protected static function unset_posts_page_shortcode_for_post(
267
+		$ID,
268
+		$shortcode_class,
269
+		$shortcode_posts,
270
+		$page_for_posts,
271
+		$update_post_shortcodes = false
272
+	) {
273
+		// make sure that an array of post IDs is being tracked for each  shortcode
274
+		if ( ! is_array( $shortcode_posts ) ) {
275
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
276
+				$shortcode_posts => true,
277
+			);
278
+			$update_post_shortcodes = true;
279
+		}
280
+		// now if the ID of the post being deleted is in the $shortcode_posts array
281
+		if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
+			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
283
+			$update_post_shortcodes = true;
284
+		}
285
+		// if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
+		if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
+			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
288
+			$update_post_shortcodes = true;
289
+		}
290
+		return $update_post_shortcodes;
291
+	}
292
+
293
+
294
+
295
+	/**
296
+	 *    update_post_shortcodes
297
+	 *
298
+	 * @access    public
299
+	 * @param $page_for_posts
300
+	 * @return    void
301
+	 */
302
+	public static function update_post_shortcodes( $page_for_posts = '' )
303
+	{
304
+		// make sure page_for_posts is set
305
+		$page_for_posts = ! empty( $page_for_posts )
306
+			? $page_for_posts
307
+			: \EE_Config::get_page_for_posts();
308
+		// allow others to mess stuff up :D
309
+		do_action(
310
+			'AHEE__\EventEspresso\core\admin\PostShortcodeTracking__update_post_shortcodes',
311
+			\EE_Config::instance()->core->post_shortcodes,
312
+			$page_for_posts
313
+		);
314
+		// keep old hookpoint for now, will deprecate later
315
+		do_action(
316
+			'AHEE__EE_Config__update_post_shortcodes',
317
+			\EE_Config::instance()->core->post_shortcodes,
318
+			$page_for_posts
319
+		);
320
+		// verify that post_shortcodes is set
321
+		\EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
+														&& is_array( \EE_Config::instance()->core->post_shortcodes )
323
+			? \EE_Config::instance()->core->post_shortcodes
324
+			: array();
325
+		// cycle thru post_shortcodes
326
+		foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
327
+			// are there any shortcodes to track ?
328
+			if ( ! empty( $shortcodes ) ) {
329
+				// skip the posts page, because we want all shortcodes registered for it
330
+				if ( $post_name === $page_for_posts ) {
331
+					continue;
332
+				}
333
+				// loop thru list of tracked shortcodes
334
+				foreach ( $shortcodes as $shortcode => $post_id ) {
335
+					// make sure post still exists
336
+					$post = get_post( $post_id );
337
+					// check that the post name matches what we have saved
338
+					if ( $post && $post->post_name === $post_name ) {
339
+						// if so, then break before hitting the unset below
340
+						continue;
341
+					}
342
+					// we don't like missing posts around here >:(
343
+					unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
344
+				}
345
+			} else {
346
+				// you got no shortcodes to keep track of !
347
+				unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
348
+			}
349
+		}
350
+		// critical page shortcodes that we do NOT want added to the Posts page (blog)
351
+		$critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
+		$critical_shortcodes = array_flip( $critical_shortcodes );
353
+		foreach ( $critical_shortcodes as $critical_shortcode ) {
354
+			unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
355
+		}
356
+		//only show errors
357
+		\EE_Config::instance()->update_espresso_config();
358
+	}
359
+
360
+
361
+
362
+	/**
363
+	 * reset_page_for_posts_on_initial_set
364
+	 * if an admin is on the WP Reading Settings page and sets the option for "Posts page",
365
+	 * when it had previously been unset,
366
+	 * then we need to attribute any actively used shortcodes to the new blog page
367
+	 *
368
+	 * @access public
369
+	 * @param  string $option
370
+	 * @param  string $value
371
+	 * @return void
372
+	 */
373
+	public static function reset_page_for_posts_on_initial_set( $option, $value )
374
+	{
375
+		PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
376
+	}
377
+
378
+
379
+
380
+	/**
381
+	 *    reset_page_for_posts_on_change
382
+	 *    if an admin is on the WP Reading Settings page and changes the option for "Posts page",
383
+	 * then we need to attribute any actively used shortcodes for the previous blog page to the new blog page
384
+	 *
385
+	 * @access public
386
+	 * @param  string $option
387
+	 * @param  string $old_value
388
+	 * @param  string $value
389
+	 * @return void
390
+	 */
391
+	public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
392
+	{
393
+		if ( $option === 'page_for_posts' ) {
394
+			global $wpdb;
395
+			$table = $wpdb->posts;
396
+			$SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
+			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
399
+		}
400
+	}
401
+
402
+
403
+
404
+	/**
405
+	 * reset_page_for_posts_on_delete
406
+	 * if an admin deletes a page designated as the WP "Posts page",
407
+	 * then we need to attribute any actively used shortcodes for that blog page to a generic 'posts' page
408
+	 *
409
+	 * @access public
410
+	 * @param  string $option
411
+	 * @return void
412
+	 */
413
+	public static function reset_page_for_posts_on_delete( $option )
414
+	{
415
+		if ( $option === 'page_for_posts' ) {
416
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
417
+		}
418
+	}
419
+
420
+
421
+
422
+	/**
423
+	 * @param array|string $shortcodes
424
+	 * @param bool         $index_results if passing more than one shortcode for the $shortcodes parameter above,
425
+	 *                                    then setting this to true, will return as associative array indexed by
426
+	 *                                    the shortcodes. If false, then the returned array will be unindexed
427
+	 * @return array
428
+	 */
429
+	public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
430
+	{
431
+		$post_ids = array();
432
+		if ( is_array( $shortcodes ) ) {
433
+			foreach ( $shortcodes as $shortcode ) {
434
+				$new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435
+					$shortcode,
436
+					$index_results
437
+				);
438
+				foreach ( $new_post_ids as $new_post_id ) {
439
+					if ( $index_results ) {
440
+						$post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
441
+					} else {
442
+						$post_ids[ $new_post_id ] = $new_post_id;
443
+					}
444
+				}
445
+			}
446
+		} else {
447
+			$shortcode = strtoupper( $shortcodes );
448
+			$shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449
+			$page_for_posts = \EE_Config::get_page_for_posts();
450
+			// looking for any references to this post
451
+			foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
452
+				// if this is the "Posts Page" (blog), then skip it
453
+				if ( $post_name === $page_for_posts ) {
454
+					continue;
455
+				}
456
+				// loop thru shortcodes registered for each page, and grab post id for matches
457
+				foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
+					if ( $post_shortcode === $shortcode ) {
459
+						$post_ids[ $post_ID ] = $post_ID;
460
+					}
461
+				}
462
+			}
463
+		}
464
+		return $post_ids;
465
+	}
466 466
 
467 467
 
468 468
 
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\admin;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+    exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
     {
29 29
         add_action(
30 30
             'save_post',
31
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
31
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save'),
32 32
             100,
33 33
             2
34 34
         );
35 35
         add_action(
36 36
             'delete_post',
37
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
37
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete'),
38 38
             100,
39 39
             1
40 40
         );
41 41
         add_action(
42 42
             'add_option_page_for_posts',
43
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
43
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set'),
44 44
             100,
45 45
             2
46 46
         );
47 47
         add_action(
48 48
             'update_option',
49
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
49
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change'),
50 50
             100,
51 51
             3
52 52
         );
53 53
         add_action(
54 54
             'delete_option',
55
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
55
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete'),
56 56
             100,
57 57
             1
58 58
         );
@@ -72,63 +72,63 @@  discard block
 block discarded – undo
72 72
      * @param \WP_Post $post
73 73
      * @return    void
74 74
      */
75
-    public static function parse_post_content_on_save( $post_ID, $post )
75
+    public static function parse_post_content_on_save($post_ID, $post)
76 76
     {
77 77
         // if the post is trashed, then let's remove our post shortcode tracking
78
-        if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
-            PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
78
+        if ($post instanceof \WP_Post && $post->post_status === 'trash') {
79
+            PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID);
80 80
             return;
81 81
         }
82 82
         // default post types
83
-        $post_types = array( 'post' => 0, 'page' => 1 );
83
+        $post_types = array('post' => 0, 'page' => 1);
84 84
         // add CPTs
85 85
         $CPTs = \EE_Register_CPTs::get_CPTs();
86
-        $post_types = array_merge( $post_types, $CPTs );
86
+        $post_types = array_merge($post_types, $CPTs);
87 87
         // for default or CPT posts...
88
-        if ( isset( $post_types[ $post->post_type ] ) ) {
88
+        if (isset($post_types[$post->post_type])) {
89 89
             // post on frontpage ?
90 90
             $page_for_posts = \EE_Config::get_page_for_posts();
91
-            if ( $post->post_name === $page_for_posts ) {
92
-                PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
91
+            if ($post->post_name === $page_for_posts) {
92
+                PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts);
93 93
                 return;
94 94
             }
95 95
             // array of shortcodes indexed by post name
96
-            \EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
96
+            \EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes)
97 97
                 ? \EE_Registry::CFG()->core->post_shortcodes
98 98
                 : array();
99 99
             // whether to proceed with update
100 100
             $update_post_shortcodes = false;
101 101
             // empty both arrays
102
-            \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
102
+            \EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array();
103 103
             // check that posts page is already being tracked
104
-            if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
104
+            if ( ! isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
105 105
                 // if not, then ensure that it is properly added
106
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
106
+                \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
107 107
             }
108 108
             // loop thru shortcodes
109
-            foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
109
+            foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
110 110
                 // convert to UPPERCASE to get actual shortcode
111
-                $EES_Shortcode = strtoupper( $EES_Shortcode );
111
+                $EES_Shortcode = strtoupper($EES_Shortcode);
112 112
                 // is the shortcode in the post_content ?
113
-                if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
113
+                if (strpos($post->post_content, $EES_Shortcode) !== false) {
114 114
                     // map shortcode to post names and post IDs
115
-                    \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
115
+                    \EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
116 116
                     // and add this shortcode to the tracking for the blog page
117
-                    PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
-                        $post_ID );
117
+                    PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode,
118
+                        $post_ID);
119 119
                     $update_post_shortcodes = true;
120 120
                 } else {
121 121
                     // shortcode is not present in post content, so check if we were tracking it previously
122 122
                     // stop tracking if shortcode is not used in this specific post
123
-                    if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
123
+                    if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) {
124
+                        unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]);
125 125
                         $update_post_shortcodes = true;
126 126
                     }
127 127
                     // make sure that something is set for the shortcode posts (even though we may remove this)
128 128
                     $shortcode_posts = isset(
129
-                        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
129
+                        \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
130 130
                     )
131
-                        ? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
131
+                        ? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
132 132
                         : array();
133 133
                     // and stop tracking for this shortcode on the blog page if it is not used
134 134
                     $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
                         : $update_post_shortcodes;
143 143
                 }
144 144
             }
145
-            if ( $update_post_shortcodes ) {
146
-                PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
145
+            if ($update_post_shortcodes) {
146
+                PostShortcodeTracking::update_post_shortcodes($page_for_posts);
147 147
             }
148 148
         }
149 149
     }
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
      * @param  string $page_for_posts
160 160
      * @return void
161 161
      */
162
-    protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
162
+    protected static function set_post_shortcodes_for_posts_page($page_for_posts)
163 163
     {
164
-        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
164
+        \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
165 165
         // loop thru shortcodes
166
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
-            foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
-                PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
166
+        foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
167
+            foreach ($post_shortcodes as $EES_Shortcode => $post_ID) {
168
+                PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
169 169
             }
170 170
         }
171
-        PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
171
+        PostShortcodeTracking::update_post_shortcodes($page_for_posts);
172 172
     }
173 173
 
174 174
 
@@ -182,25 +182,25 @@  discard block
 block discarded – undo
182 182
      * @param         $EES_Shortcode
183 183
      * @param         $post_ID
184 184
      */
185
-    protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
185
+    protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID)
186 186
     {
187 187
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
188 188
         $critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189 189
         // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
-        if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
190
+        if (in_array($EES_Shortcode, $critical_shortcodes)) {
191 191
             return;
192 192
         }
193 193
         // add shortcode to "Posts page" tracking
194
-        if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
194
+        if (isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
195 195
             // make sure tracking is in form of an array
196
-            if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
-                    \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
196
+            if ( ! is_array(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
197
+                \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array(
198
+                    \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] => true,
199 199
                 );
200 200
             }
201
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
201
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] += array($post_ID => true);
202 202
         } else {
203
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
203
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array($post_ID => true);
204 204
         }
205 205
     }
206 206
 
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
      * @param  int $ID
214 214
      * @return void
215 215
      */
216
-    public static function unset_post_shortcodes_on_delete( $ID )
216
+    public static function unset_post_shortcodes_on_delete($ID)
217 217
     {
218 218
         $update_post_shortcodes = false;
219 219
         // post on frontpage ?
220 220
         $page_for_posts = \EE_Config::get_page_for_posts();
221 221
         // looking for any references to this post
222
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
222
+        foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
223 223
             // is this the "Posts Page" (blog) ?
224
-            if ( $post_name === $page_for_posts ) {
224
+            if ($post_name === $page_for_posts) {
225 225
                 // loop thru shortcodes registered for the posts page
226
-                foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
226
+                foreach ($post_shortcodes as $shortcode_class => $shortcode_posts) {
227 227
                     $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228 228
                         $ID,
229 229
                         $shortcode_class,
@@ -236,17 +236,17 @@  discard block
 block discarded – undo
236 236
                 }
237 237
             } else {
238 238
                 // loop thru shortcodes registered for each page
239
-                foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
239
+                foreach ($post_shortcodes as $shortcode_class => $post_ID) {
240 240
                     // if this is page is being deleted, then don't track any post shortcodes for it
241
-                    if ( $post_ID === $ID ) {
242
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
241
+                    if ($post_ID === $ID) {
242
+                        unset(\EE_Registry::CFG()->core->post_shortcodes[$post_name]);
243 243
                         $update_post_shortcodes = true;
244 244
                     }
245 245
                 }
246 246
             }
247 247
         }
248
-        if ( $update_post_shortcodes ) {
249
-            PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
248
+        if ($update_post_shortcodes) {
249
+            PostShortcodeTracking::update_post_shortcodes($page_for_posts);
250 250
         }
251 251
     }
252 252
 
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
         $update_post_shortcodes = false
272 272
     ) {
273 273
         // make sure that an array of post IDs is being tracked for each  shortcode
274
-        if ( ! is_array( $shortcode_posts ) ) {
275
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
274
+        if ( ! is_array($shortcode_posts)) {
275
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array(
276 276
                 $shortcode_posts => true,
277 277
             );
278 278
             $update_post_shortcodes = true;
279 279
         }
280 280
         // now if the ID of the post being deleted is in the $shortcode_posts array
281
-        if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
281
+        if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) {
282
+            unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]);
283 283
             $update_post_shortcodes = true;
284 284
         }
285 285
         // if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
-        if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
286
+        if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) {
287
+            unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]);
288 288
             $update_post_shortcodes = true;
289 289
         }
290 290
         return $update_post_shortcodes;
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
      * @param $page_for_posts
300 300
      * @return    void
301 301
      */
302
-    public static function update_post_shortcodes( $page_for_posts = '' )
302
+    public static function update_post_shortcodes($page_for_posts = '')
303 303
     {
304 304
         // make sure page_for_posts is set
305
-        $page_for_posts = ! empty( $page_for_posts )
305
+        $page_for_posts = ! empty($page_for_posts)
306 306
             ? $page_for_posts
307 307
             : \EE_Config::get_page_for_posts();
308 308
         // allow others to mess stuff up :D
@@ -318,40 +318,40 @@  discard block
 block discarded – undo
318 318
             $page_for_posts
319 319
         );
320 320
         // verify that post_shortcodes is set
321
-        \EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
-                                                        && is_array( \EE_Config::instance()->core->post_shortcodes )
321
+        \EE_Config::instance()->core->post_shortcodes = isset(\EE_Config::instance()->core->post_shortcodes)
322
+                                                        && is_array(\EE_Config::instance()->core->post_shortcodes)
323 323
             ? \EE_Config::instance()->core->post_shortcodes
324 324
             : array();
325 325
         // cycle thru post_shortcodes
326
-        foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
326
+        foreach (\EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes) {
327 327
             // are there any shortcodes to track ?
328
-            if ( ! empty( $shortcodes ) ) {
328
+            if ( ! empty($shortcodes)) {
329 329
                 // skip the posts page, because we want all shortcodes registered for it
330
-                if ( $post_name === $page_for_posts ) {
330
+                if ($post_name === $page_for_posts) {
331 331
                     continue;
332 332
                 }
333 333
                 // loop thru list of tracked shortcodes
334
-                foreach ( $shortcodes as $shortcode => $post_id ) {
334
+                foreach ($shortcodes as $shortcode => $post_id) {
335 335
                     // make sure post still exists
336
-                    $post = get_post( $post_id );
336
+                    $post = get_post($post_id);
337 337
                     // check that the post name matches what we have saved
338
-                    if ( $post && $post->post_name === $post_name ) {
338
+                    if ($post && $post->post_name === $post_name) {
339 339
                         // if so, then break before hitting the unset below
340 340
                         continue;
341 341
                     }
342 342
                     // we don't like missing posts around here >:(
343
-                    unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
343
+                    unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
344 344
                 }
345 345
             } else {
346 346
                 // you got no shortcodes to keep track of !
347
-                unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
347
+                unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
348 348
             }
349 349
         }
350 350
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
351 351
         $critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
-        $critical_shortcodes = array_flip( $critical_shortcodes );
353
-        foreach ( $critical_shortcodes as $critical_shortcode ) {
354
-            unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
352
+        $critical_shortcodes = array_flip($critical_shortcodes);
353
+        foreach ($critical_shortcodes as $critical_shortcode) {
354
+            unset(\EE_Config::instance()->core->post_shortcodes[$page_for_posts][$critical_shortcode]);
355 355
         }
356 356
         //only show errors
357 357
         \EE_Config::instance()->update_espresso_config();
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
      * @param  string $value
371 371
      * @return void
372 372
      */
373
-    public static function reset_page_for_posts_on_initial_set( $option, $value )
373
+    public static function reset_page_for_posts_on_initial_set($option, $value)
374 374
     {
375
-        PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
375
+        PostShortcodeTracking::reset_page_for_posts_on_change($option, '', $value);
376 376
     }
377 377
 
378 378
 
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
      * @param  string $value
389 389
      * @return void
390 390
      */
391
-    public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
391
+    public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '')
392 392
     {
393
-        if ( $option === 'page_for_posts' ) {
393
+        if ($option === 'page_for_posts') {
394 394
             global $wpdb;
395 395
             $table = $wpdb->posts;
396 396
             $SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
-            $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
397
+            $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
398
+            PostShortcodeTracking::set_post_shortcodes_for_posts_page($new_page_for_posts);
399 399
         }
400 400
     }
401 401
 
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
      * @param  string $option
411 411
      * @return void
412 412
      */
413
-    public static function reset_page_for_posts_on_delete( $option )
413
+    public static function reset_page_for_posts_on_delete($option)
414 414
     {
415
-        if ( $option === 'page_for_posts' ) {
416
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
415
+        if ($option === 'page_for_posts') {
416
+            PostShortcodeTracking::set_post_shortcodes_for_posts_page('posts');
417 417
         }
418 418
     }
419 419
 
@@ -426,37 +426,37 @@  discard block
 block discarded – undo
426 426
      *                                    the shortcodes. If false, then the returned array will be unindexed
427 427
      * @return array
428 428
      */
429
-    public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
429
+    public static function get_post_ids_for_shortcode($shortcodes, $index_results = true)
430 430
     {
431 431
         $post_ids = array();
432
-        if ( is_array( $shortcodes ) ) {
433
-            foreach ( $shortcodes as $shortcode ) {
432
+        if (is_array($shortcodes)) {
433
+            foreach ($shortcodes as $shortcode) {
434 434
                 $new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435 435
                     $shortcode,
436 436
                     $index_results
437 437
                 );
438
-                foreach ( $new_post_ids as $new_post_id ) {
439
-                    if ( $index_results ) {
440
-                        $post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
438
+                foreach ($new_post_ids as $new_post_id) {
439
+                    if ($index_results) {
440
+                        $post_ids[$shortcode][$new_post_id] = $new_post_id;
441 441
                     } else {
442
-                        $post_ids[ $new_post_id ] = $new_post_id;
442
+                        $post_ids[$new_post_id] = $new_post_id;
443 443
                     }
444 444
                 }
445 445
             }
446 446
         } else {
447
-            $shortcode = strtoupper( $shortcodes );
448
-            $shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
447
+            $shortcode = strtoupper($shortcodes);
448
+            $shortcode = strpos($shortcode, 'ESPRESSO_') !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449 449
             $page_for_posts = \EE_Config::get_page_for_posts();
450 450
             // looking for any references to this post
451
-            foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
451
+            foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
452 452
                 // if this is the "Posts Page" (blog), then skip it
453
-                if ( $post_name === $page_for_posts ) {
453
+                if ($post_name === $page_for_posts) {
454 454
                     continue;
455 455
                 }
456 456
                 // loop thru shortcodes registered for each page, and grab post id for matches
457
-                foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
-                    if ( $post_shortcode === $shortcode ) {
459
-                        $post_ids[ $post_ID ] = $post_ID;
457
+                foreach ((array) $post_shortcodes as $post_shortcode => $post_ID) {
458
+                    if ($post_shortcode === $shortcode) {
459
+                        $post_ids[$post_ID] = $post_ID;
460 460
                     }
461 461
                 }
462 462
             }
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/countries_settings.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <div class="padding">
7 7
 
8
-	<h2 class="ee-admin-settings-hdr"><?php _e('Countries and States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_select_info');?></h2>
8
+	<h2 class="ee-admin-settings-hdr"><?php _e('Countries and States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_select_info'); ?></h2>
9 9
 	<table class="form-table">
10 10
 		<tbody>
11
-        <?php echo EEH_Form_Fields::generate_form_input( $countries ); ?>
11
+        <?php echo EEH_Form_Fields::generate_form_input($countries); ?>
12 12
 		</tbody>
13 13
 	</table>
14 14
 	<br/>
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
         <?php _e('The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.', 'event_espresso'); ?>
17 17
 	</p>
18 18
 	<div id="country-details-settings-dv">
19
-		<h2 class="ee-admin-settings-hdr"><?php _e('Country Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_details_info');?></h2>
19
+		<h2 class="ee-admin-settings-hdr"><?php _e('Country Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_details_info'); ?></h2>
20 20
 		<div id="country-details-dv"><?php  echo $country_details_settings; ?></div>
21 21
 	</div>
22 22
 
23 23
 	<div id="country-states-settings-dv">
24
-		<h2 class="ee-admin-settings-hdr"><?php _e( 'States/Provinces', 'event_espresso' );?> <?php echo EEH_Template::get_help_tab_link('country_states_info');?></h2>
24
+		<h2 class="ee-admin-settings-hdr"><?php _e('States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_states_info'); ?></h2>
25 25
 		<div id="country-states-dv"><?php  echo $country_states_settings; ?></div>
26 26
 	</div>
27 27
 
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/admin_option_settings.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 ?>
7 7
 <div class="padding">
8 8
 
9
-	<?php do_action( 'AHEE__admin_option_settings__template__before', $template_args ); ?>
9
+	<?php do_action('AHEE__admin_option_settings__template__before', $template_args); ?>
10 10
 
11 11
 	<?php /* @todo put back once we have a dashboard widget to use
12 12
 	<h2 class="ee-admin-settings-hdr">
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	</table>
72 72
 <?php endif; */ ?>
73 73
 
74
-	<?php if ( EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'display_admin_settings_options_promote_and_affiliate' ) ) : ?>
74
+	<?php if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'display_admin_settings_options_promote_and_affiliate')) : ?>
75 75
 		<h2 class="ee-admin-settings-hdr">
76 76
 			<?php _e('Promote Event Espresso', 'event_espresso'); ?> <span id="affiliate_info"><?php echo EEH_Template::get_help_tab_link('affiliate_info'); ?></span>
77 77
 		</h2>
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 						</label>
87 87
 					</th>
88 88
 					<td>
89
-						<?php echo EEH_Form_Fields::select_input('show_reg_footer', $values, $show_reg_footer ); ?>
89
+						<?php echo EEH_Form_Fields::select_input('show_reg_footer', $values, $show_reg_footer); ?>
90 90
 					</td>
91 91
 				</tr>
92 92
 
93 93
 				<tr>
94 94
 					<th>
95 95
                         <label for="affiliate_id">
96
-                        <?php printf( __('Event Espresso %sAffiliate%s ID', 'event_espresso'), '<a href="http://eventespresso.com/affiliates/" target="_blank">', '</a>' ); ?>
96
+                        <?php printf(__('Event Espresso %sAffiliate%s ID', 'event_espresso'), '<a href="http://eventespresso.com/affiliates/" target="_blank">', '</a>'); ?>
97 97
                         </label>
98 98
                     </th>
99 99
 					<td>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 					</label>
124 124
 				</th>
125 125
 				<td>
126
-					<?php echo EEH_Form_Fields::select_input('help_tour_activation', $values, $help_tour_activation ); ?>
126
+					<?php echo EEH_Form_Fields::select_input('help_tour_activation', $values, $help_tour_activation); ?>
127 127
 				</td>
128 128
 			</tr>
129 129
 		</tbody>
Please login to merge, or discard this patch.
core/admin/EE_Admin_Page.core.php 3 patches
Indentation   +69 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1311,8 +1311,8 @@  discard block
 block discarded – undo
1311 1311
 	 * 		verifies user access for this admin page
1312 1312
 	 * 		@param string $route_to_check if present then the capability for the route matching this string is checked.
1313 1313
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1314
-	*		@return 		BOOL|wp_die()
1315
-	*/
1314
+	 *		@return 		BOOL|wp_die()
1315
+	 */
1316 1316
 	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1317 1317
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1318 1318
 		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
@@ -1698,11 +1698,11 @@  discard block
 block discarded – undo
1698 1698
 
1699 1699
 
1700 1700
 	/**
1701
-	*		admin_footer_scripts_eei18n_js_strings
1702
-	*
1703
-	*		@access 		public
1704
-	*		@return 		void
1705
-	*/
1701
+	 *		admin_footer_scripts_eei18n_js_strings
1702
+	 *
1703
+	 *		@access 		public
1704
+	 *		@return 		void
1705
+	 */
1706 1706
 	public function admin_footer_scripts_eei18n_js_strings() {
1707 1707
 
1708 1708
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
@@ -1758,11 +1758,11 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
 
1760 1760
 	/**
1761
-	*		load enhanced xdebug styles for ppl with failing eyesight
1762
-	*
1763
-	*		@access 		public
1764
-	*		@return 		void
1765
-	*/
1761
+	 *		load enhanced xdebug styles for ppl with failing eyesight
1762
+	 *
1763
+	 *		@access 		public
1764
+	 *		@return 		void
1765
+	 */
1766 1766
 	public function add_xdebug_style() {
1767 1767
 		echo '<style>.xdebug-error { font-size:1.5em; }</style>';
1768 1768
 	}
@@ -1819,9 +1819,9 @@  discard block
 block discarded – undo
1819 1819
 
1820 1820
 	/**
1821 1821
 	 * 		set current view for List Table
1822
-	*		@access public
1823
-	*		@return array
1824
-	*/
1822
+	 *		@access public
1823
+	 *		@return array
1824
+	 */
1825 1825
 	protected function _set_list_table_view() {
1826 1826
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1827 1827
 
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
 	 * @access protected
1911 1911
 	 * @param int $max_entries total number of rows in the table
1912 1912
 	 * @return string
1913
-	*/
1913
+	 */
1914 1914
 	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1915 1915
 
1916 1916
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -1955,9 +1955,9 @@  discard block
 block discarded – undo
1955 1955
 
1956 1956
 	/**
1957 1957
 	 * 		_set_search_attributes
1958
-	*		@access 		protected
1959
-	*		@return 		void
1960
-	*/
1958
+	 *		@access 		protected
1959
+	 *		@return 		void
1960
+	 */
1961 1961
 	public function _set_search_attributes() {
1962 1962
 		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1963 1963
 		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 	 * @link http://codex.wordpress.org/Function_Reference/add_meta_box
1978 1978
 	 * @access private
1979 1979
 	 * @return void
1980
-	*/
1980
+	 */
1981 1981
 	private function _add_registered_meta_boxes() {
1982 1982
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1983 1983
 
@@ -2027,13 +2027,13 @@  discard block
 block discarded – undo
2027 2027
 	 * @return void
2028 2028
 	 */
2029 2029
 	private function _add_screen_columns() {
2030
-        if (
2031
-		        is_array($this->_route_config)
2032
-                && isset( $this->_route_config['columns'] )
2033
-                && is_array($this->_route_config['columns'])
2034
-                && count( $this->_route_config['columns'] ) === 2
2035
-        ) {
2036
-            add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2030
+		if (
2031
+				is_array($this->_route_config)
2032
+				&& isset( $this->_route_config['columns'] )
2033
+				&& is_array($this->_route_config['columns'])
2034
+				&& count( $this->_route_config['columns'] ) === 2
2035
+		) {
2036
+			add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2037 2037
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2038 2038
 			$screen_id = $this->_current_screen->id;
2039 2039
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
@@ -2213,7 +2213,6 @@  discard block
 block discarded – undo
2213 2213
 	 * Note: currently there is no validation for this.  However if you want the delete button, the
2214 2214
 	 * save, and save and close buttons to work properly, then you will want to include a
2215 2215
 	 * values for the name and id arguments.
2216
-
2217 2216
 	 *
2218 2217
 *@todo  Add in validation for name/id arguments.
2219 2218
 	 * @param    string  $name                    key used for the action ID (i.e. event_id)
@@ -2272,9 +2271,9 @@  discard block
 block discarded – undo
2272 2271
 
2273 2272
 	/**
2274 2273
 	 * 		displays an error message to ppl who have javascript disabled
2275
-	*		@access 		private
2276
-	*		@return 		string
2277
-	*/
2274
+	 *		@access 		private
2275
+	 *		@return 		string
2276
+	 */
2278 2277
 	private function _display_no_javascript_warning() {
2279 2278
 		?>
2280 2279
 		<noscript>
@@ -2297,9 +2296,9 @@  discard block
 block discarded – undo
2297 2296
 
2298 2297
 	/**
2299 2298
 	 * 		displays espresso success and/or error notices
2300
-	*		@access 		private
2301
-	*		@return 		string
2302
-	*/
2299
+	 *		@access 		private
2300
+	 *		@return 		string
2301
+	 */
2303 2302
 	private function _display_espresso_notices() {
2304 2303
 		$notices = $this->_get_transient( TRUE );
2305 2304
 		echo stripslashes($notices);
@@ -2311,10 +2310,10 @@  discard block
 block discarded – undo
2311 2310
 
2312 2311
 
2313 2312
 	/**
2314
-	*		spinny things pacify the masses
2315
-	*		@access private
2316
-	*		@return string
2317
-	*/
2313
+	 *		spinny things pacify the masses
2314
+	 *		@access private
2315
+	 *		@return string
2316
+	 */
2318 2317
 	protected function _add_admin_page_ajax_loading_img() {
2319 2318
 		?>
2320 2319
 			<div id="espresso-ajax-loading" class="ajax-loading-grey">
@@ -2328,10 +2327,10 @@  discard block
 block discarded – undo
2328 2327
 
2329 2328
 
2330 2329
 	/**
2331
-	*		add admin page overlay for modal boxes
2332
-	*		@access private
2333
-	*		@return string
2334
-	*/
2330
+	 *		add admin page overlay for modal boxes
2331
+	 *		@access private
2332
+	 *		@return string
2333
+	 */
2335 2334
 	protected function _add_admin_page_overlay() {
2336 2335
 		?>
2337 2336
 		<div id="espresso-admin-page-overlay-dv" class=""></div>
@@ -2393,10 +2392,10 @@  discard block
 block discarded – undo
2393 2392
 
2394 2393
 
2395 2394
 	/**
2396
-	*		generates  HTML wrapper for an admin details page
2397
-	*		@access public
2398
-	*		@return void
2399
-	*/
2395
+	 *		generates  HTML wrapper for an admin details page
2396
+	 *		@access public
2397
+	 *		@return void
2398
+	 */
2400 2399
 	public function display_admin_page_with_sidebar() {
2401 2400
 
2402 2401
 		$this->_display_admin_page(TRUE);
@@ -2406,10 +2405,10 @@  discard block
 block discarded – undo
2406 2405
 
2407 2406
 
2408 2407
 	/**
2409
-	*		generates  HTML wrapper for an admin details page (except no sidebar)
2410
-	*		@access public
2411
-	*		@return void
2412
-	*/
2408
+	 *		generates  HTML wrapper for an admin details page (except no sidebar)
2409
+	 *		@access public
2410
+	 *		@return void
2411
+	 */
2413 2412
 	public function display_admin_page_with_no_sidebar() {
2414 2413
 		$this->_display_admin_page();
2415 2414
 	}
@@ -2448,18 +2447,18 @@  discard block
 block discarded – undo
2448 2447
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
2449 2448
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2450 2449
 		$this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route
2451
-            ? 'poststuff'
2452
-            : 'espresso-default-admin';
2450
+			? 'poststuff'
2451
+			: 'espresso-default-admin';
2453 2452
 
2454
-        $template_path = $sidebar
2455
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2456
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2453
+		$template_path = $sidebar
2454
+			? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2455
+			: EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2457 2456
 
2458 2457
 		if ( defined('DOING_AJAX' ) && DOING_AJAX ){
2459 2458
 			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2460
-        }
2459
+		}
2461 2460
 
2462
-        $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2461
+		$template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2463 2462
 
2464 2463
 		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2465 2464
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
@@ -2672,11 +2671,11 @@  discard block
 block discarded – undo
2672 2671
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2673 2672
 		if ( NULL === error_get_last() || ! headers_sent() )
2674 2673
 			header('Content-Type: application/json; charset=UTF-8');
2675
-                if( function_exists( 'wp_json_encode' ) ) {
2676
-                    echo wp_json_encode( $json );
2677
-                } else {
2678
-                    echo json_encode( $json );
2679
-                }
2674
+				if( function_exists( 'wp_json_encode' ) ) {
2675
+					echo wp_json_encode( $json );
2676
+				} else {
2677
+					echo json_encode( $json );
2678
+				}
2680 2679
 		exit();
2681 2680
 	}
2682 2681
 
@@ -2715,11 +2714,11 @@  discard block
 block discarded – undo
2715 2714
 
2716 2715
 
2717 2716
 	/**
2718
-	*		generates  HTML wrapper with Tabbed nav for an admin page
2719
-	*		@access public
2720
-	*		@param  boolean $about whether to use the special about page wrapper or default.
2721
-	*		@return void
2722
-	*/
2717
+	 *		generates  HTML wrapper with Tabbed nav for an admin page
2718
+	 *		@access public
2719
+	 *		@param  boolean $about whether to use the special about page wrapper or default.
2720
+	 *		@return void
2721
+	 */
2723 2722
 	public function admin_page_wrapper($about = FALSE) {
2724 2723
 
2725 2724
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2776,9 +2775,9 @@  discard block
 block discarded – undo
2776 2775
 	 */
2777 2776
 	private function _sort_nav_tabs( $a, $b ) {
2778 2777
 		if ($a['order'] == $b['order']) {
2779
-	        return 0;
2780
-	    }
2781
-	    return ($a['order'] < $b['order']) ? -1 : 1;
2778
+			return 0;
2779
+		}
2780
+		return ($a['order'] < $b['order']) ? -1 : 1;
2782 2781
 	}
2783 2782
 
2784 2783
 
Please login to merge, or discard this patch.
Spacing   +611 added lines, -611 removed lines patch added patch discarded remove patch
@@ -158,9 +158,9 @@  discard block
 block discarded – undo
158 158
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
159 159
 	 * 		@access public
160 160
 	 */
161
-	public function __construct( $routing = TRUE ) {
161
+	public function __construct($routing = TRUE) {
162 162
 
163
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
163
+		if (strpos($this->_get_dir(), 'caffeinated') !== false)
164 164
 			$this->_is_caf = TRUE;
165 165
 
166 166
 		$this->_yes_no_values = array(
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 
173 173
 		//set the _req_data property.
174
-		$this->_req_data = array_merge( $_GET, $_POST );
174
+		$this->_req_data = array_merge($_GET, $_POST);
175 175
 
176 176
 
177 177
 		//routing enabled?
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$this->_do_other_page_hooks();
193 193
 
194 194
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
195
-		if ( method_exists( $this, '_before_page_setup' ) )
195
+		if (method_exists($this, '_before_page_setup'))
196 196
 			$this->_before_page_setup();
197 197
 
198 198
 		//set up page dependencies
@@ -462,16 +462,16 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	protected function _global_ajax_hooks() {
464 464
 		//for lazy loading of metabox content
465
-		add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 );
465
+		add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10);
466 466
 	}
467 467
 
468 468
 
469 469
 
470 470
 	public function ajax_metabox_content() {
471
-		$contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : '';
472
-		$url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : '';
471
+		$contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : '';
472
+		$url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : '';
473 473
 
474
-		self::cached_rss_display( $contentid, $url );
474
+		self::cached_rss_display($contentid, $url);
475 475
 		wp_die();
476 476
 	}
477 477
 
@@ -490,87 +490,87 @@  discard block
 block discarded – undo
490 490
 		//requires?
491 491
 
492 492
 		//admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can.  But keep in mind, not everything is available from the EE_Admin Page object at this point.
493
-		add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 );
493
+		add_action('admin_init', array($this, 'admin_init_global'), 5);
494 494
 
495 495
 
496 496
 		//next verify if we need to load anything...
497
-		$this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : '';
498
-		$this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) );
497
+		$this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : '';
498
+		$this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this))));
499 499
 
500 500
 		global $ee_menu_slugs;
501 501
 		$ee_menu_slugs = (array) $ee_menu_slugs;
502 502
 
503
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
503
+		if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE;
504 504
 
505 505
 
506 506
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
507
-		if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) {
508
-			$this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
507
+		if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) {
508
+			$this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action'];
509 509
 		}
510 510
 		// then set blank or -1 action values to 'default'
511
-		$this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default';
511
+		$this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default';
512 512
 
513 513
 		//if action is 'default' after the above BUT we have  'route' var set, then let's use the route as the action.  This covers cases where we're coming in from a list table that isn't on the default route.
514
-		$this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action;
514
+		$this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
515 515
 
516 516
 		//however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be
517 517
 		$this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action;
518 518
 
519 519
 		$this->_current_view = $this->_req_action;
520
-		$this->_req_nonce = $this->_req_action . '_nonce';
520
+		$this->_req_nonce = $this->_req_action.'_nonce';
521 521
 		$this->_define_page_props();
522 522
 
523
-		$this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ),  $this->_admin_base_url );
523
+		$this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url);
524 524
 
525 525
 		//default things
526
-		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' );
526
+		$this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box');
527 527
 
528 528
 		//set page configs
529 529
 		$this->_set_page_routes();
530 530
 		$this->_set_page_config();
531 531
 
532 532
 		//let's include any referrer data in our default_query_args for this route for "stickiness".
533
-		if ( isset( $this->_req_data['wp_referer'] ) ) {
533
+		if (isset($this->_req_data['wp_referer'])) {
534 534
 			$this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer'];
535 535
 		}
536 536
 
537 537
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
538
-		if ( method_exists( $this, '_extend_page_config' ) )
538
+		if (method_exists($this, '_extend_page_config'))
539 539
 			$this->_extend_page_config();
540 540
 
541 541
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
542
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
542
+		if (method_exists($this, '_extend_page_config_for_cpt'))
543 543
 			$this->_extend_page_config_for_cpt();
544 544
 
545 545
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
546
-		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
547
-		$this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this );
546
+		$this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this);
547
+		$this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this);
548 548
 
549 549
 
550 550
 		//if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action
551
-		if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) {
552
-			add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 );
551
+		if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) {
552
+			add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2);
553 553
 		}
554 554
 
555 555
 
556 556
 		//next route only if routing enabled
557
-		if ( $this->_routing && !defined('DOING_AJAX') ) {
557
+		if ($this->_routing && ! defined('DOING_AJAX')) {
558 558
 
559 559
 			$this->_verify_routes();
560 560
 
561 561
 			//next let's just check user_access and kill if no access
562 562
 			$this->check_user_access();
563 563
 
564
-			if ( $this->_is_UI_request ) {
564
+			if ($this->_is_UI_request) {
565 565
 				//admin_init stuff - global, all views for this page class, specific view
566
-				add_action( 'admin_init', array( $this, 'admin_init' ), 10 );
567
-				if ( method_exists( $this, 'admin_init_' . $this->_current_view )) {
568
-					add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 );
566
+				add_action('admin_init', array($this, 'admin_init'), 10);
567
+				if (method_exists($this, 'admin_init_'.$this->_current_view)) {
568
+					add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15);
569 569
 				}
570 570
 
571 571
 			} else {
572 572
 				//hijack regular WP loading and route admin request immediately
573
-				@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
573
+				@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
574 574
 				$this->route_admin_request();
575 575
 			}
576 576
 		}
@@ -587,18 +587,18 @@  discard block
 block discarded – undo
587 587
 	 * @return void
588 588
 	 */
589 589
 	private function _do_other_page_hooks() {
590
-		$registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() );
590
+		$registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array());
591 591
 
592
-		foreach ( $registered_pages as $page ) {
592
+		foreach ($registered_pages as $page) {
593 593
 
594 594
 			//now let's setup the file name and class that should be present
595 595
 			$classname = str_replace('.class.php', '', $page);
596 596
 
597 597
 			//autoloaders should take care of loading file
598
-			if ( !class_exists( $classname ) ) {
599
-				$error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page);
600
-				$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname );
601
-				throw new EE_Error( implode( '||', $error_msg ));
598
+			if ( ! class_exists($classname)) {
599
+				$error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page);
600
+				$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname);
601
+				throw new EE_Error(implode('||', $error_msg));
602 602
 			}
603 603
 
604 604
 			$a = new ReflectionClass($classname);
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	public function load_page_dependencies() {
614 614
 		try {
615 615
 			$this->_load_page_dependencies();
616
-		} catch ( EE_Error $e ) {
616
+		} catch (EE_Error $e) {
617 617
 			$e->get_error();
618 618
 		}
619 619
 	}
@@ -631,16 +631,16 @@  discard block
 block discarded – undo
631 631
 		$this->_current_screen = get_current_screen();
632 632
 
633 633
 		//load admin_notices - global, page class, and view specific
634
-		add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 );
635
-		add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 );
636
-		if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) {
637
-			add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 );
634
+		add_action('admin_notices', array($this, 'admin_notices_global'), 5);
635
+		add_action('admin_notices', array($this, 'admin_notices'), 10);
636
+		if (method_exists($this, 'admin_notices_'.$this->_current_view)) {
637
+			add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15);
638 638
 		}
639 639
 
640 640
 		//load network admin_notices - global, page class, and view specific
641
-		add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 );
642
-		if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) {
643
-			add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) );
641
+		add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5);
642
+		if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) {
643
+			add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view));
644 644
 		}
645 645
 
646 646
 		//this will save any per_page screen options if they are present
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
 		//add screen options - global, page child class, and view specific
657 657
 		$this->_add_global_screen_options();
658 658
 		$this->_add_screen_options();
659
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
660
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
659
+		if (method_exists($this, '_add_screen_options_'.$this->_current_view))
660
+			call_user_func(array($this, '_add_screen_options_'.$this->_current_view));
661 661
 
662 662
 
663 663
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -668,33 +668,33 @@  discard block
 block discarded – undo
668 668
 		//add feature_pointers - global, page child class, and view specific
669 669
 		$this->_add_feature_pointers();
670 670
 		$this->_add_global_feature_pointers();
671
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
672
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
671
+		if (method_exists($this, '_add_feature_pointer_'.$this->_current_view))
672
+			call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view));
673 673
 
674 674
 		//enqueue scripts/styles - global, page class, and view specific
675
-		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
676
-		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
677
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
678
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
675
+		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5);
676
+		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10);
677
+		if (method_exists($this, 'load_scripts_styles_'.$this->_current_view))
678
+			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15);
679 679
 
680
-		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
680
+		add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100);
681 681
 
682 682
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
683
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
684
-		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
685
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
686
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
683
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99);
684
+		add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100);
685
+		if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view))
686
+			add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101);
687 687
 
688 688
 		//admin footer scripts
689
-		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
690
-		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
691
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
692
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
689
+		add_action('admin_footer', array($this, 'admin_footer_global'), 99);
690
+		add_action('admin_footer', array($this, 'admin_footer'), 100);
691
+		if (method_exists($this, 'admin_footer_'.$this->_current_view))
692
+			add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101);
693 693
 
694 694
 
695
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
695
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug);
696 696
 		//targeted hook
697
-		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action );
697
+		do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action);
698 698
 
699 699
 	}
700 700
 
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	private function _set_defaults() {
710 710
 		$this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL;
711 711
 
712
-		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config =  $this->_default_route_query_args = array();
712
+		$this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array();
713 713
 
714 714
 		$this->default_nav_tab_name = 'overview';
715 715
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	public function route_admin_request() {
737 737
 		try {
738 738
 			$this->_route_admin_request();
739
-		} catch ( EE_Error $e ) {
739
+		} catch (EE_Error $e) {
740 740
 			$e->get_error();
741 741
 		}
742 742
 	}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		$this->_wp_page_slug = $wp_page_slug;
748 748
 
749 749
 		//if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls...
750
-		if ( is_network_admin() ) {
750
+		if (is_network_admin()) {
751 751
 			$this->_wp_page_slug .= '-network';
752 752
 		}
753 753
 	}
@@ -760,53 +760,53 @@  discard block
 block discarded – undo
760 760
 	 * @return void
761 761
 	 */
762 762
 	protected function _verify_routes() {
763
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
763
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
764 764
 
765
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
765
+		if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE;
766 766
 
767 767
 		$this->_route = FALSE;
768 768
 		$func = FALSE;
769 769
 		$args = array();
770 770
 
771 771
 		// check that the page_routes array is not empty
772
-		if ( empty( $this->_page_routes )) {
772
+		if (empty($this->_page_routes)) {
773 773
 			// user error msg
774
-			$error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title );
774
+			$error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
775 775
 			// developer error msg
776
-			$error_msg .=  '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' );
777
-			throw new EE_Error( $error_msg );
776
+			$error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso');
777
+			throw new EE_Error($error_msg);
778 778
 		}
779 779
 
780 780
 		// and that the requested page route exists
781
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
782
-			$this->_route = $this->_page_routes[ $this->_req_action ];
781
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
782
+			$this->_route = $this->_page_routes[$this->_req_action];
783 783
 			$this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array();
784 784
 		} else {
785 785
 			// user error msg
786
-			$error_msg =  sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
786
+			$error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
787 787
 			// developer error msg
788
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action );
789
-			throw new EE_Error( $error_msg );
788
+			$error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action);
789
+			throw new EE_Error($error_msg);
790 790
 		}
791 791
 
792 792
 		// and that a default route exists
793
-		if ( ! array_key_exists( 'default', $this->_page_routes )) {
793
+		if ( ! array_key_exists('default', $this->_page_routes)) {
794 794
 			// user error msg
795
-			$error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title );
795
+			$error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title);
796 796
 			// developer error msg
797
-			$error_msg .=  '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' );
798
-			throw new EE_Error( $error_msg );
797
+			$error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso');
798
+			throw new EE_Error($error_msg);
799 799
 		}
800 800
 
801 801
 
802 802
 		//first lets' catch if the UI request has EVER been set.
803
-		if ( $this->_is_UI_request === NULL ) {
803
+		if ($this->_is_UI_request === NULL) {
804 804
 			//lets set if this is a UI request or not.
805
-			$this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE;
805
+			$this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE;
806 806
 
807 807
 
808 808
 			//wait a minute... we might have a noheader in the route array
809
-			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
809
+			$this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request;
810 810
 		}
811 811
 
812 812
 		$this->_set_current_labels();
@@ -821,15 +821,15 @@  discard block
 block discarded – undo
821 821
 	 * @param  string $route the route name we're verifying
822 822
 	 * @return mixed  (bool|Exception)      we'll throw an exception if this isn't a valid route.
823 823
 	 */
824
-	protected function _verify_route( $route ) {
825
-		if ( array_key_exists( $this->_req_action, $this->_page_routes )) {
824
+	protected function _verify_route($route) {
825
+		if (array_key_exists($this->_req_action, $this->_page_routes)) {
826 826
 			return true;
827 827
 		} else {
828 828
 			// user error msg
829
-			$error_msg =  sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title );
829
+			$error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title);
830 830
 			// developer error msg
831
-			$error_msg .=  '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route );
832
-			throw new EE_Error( $error_msg );
831
+			$error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route);
832
+			throw new EE_Error($error_msg);
833 833
 		}
834 834
 	}
835 835
 
@@ -843,18 +843,18 @@  discard block
 block discarded – undo
843 843
 	 * @param  string $nonce_ref The nonce reference string (name0)
844 844
 	 * @return mixed (bool|die)
845 845
 	 */
846
-	protected function _verify_nonce( $nonce, $nonce_ref ) {
846
+	protected function _verify_nonce($nonce, $nonce_ref) {
847 847
 		// verify nonce against expected value
848
-		if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) {
848
+		if ( ! wp_verify_nonce($nonce, $nonce_ref)) {
849 849
 			// these are not the droids you are looking for !!!
850
-			$msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' );
851
-			if ( WP_DEBUG ) {
852
-				$msg .= "\n  " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__  );
850
+			$msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>');
851
+			if (WP_DEBUG) {
852
+				$msg .= "\n  ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__);
853 853
 			}
854
-			if ( ! defined( 'DOING_AJAX' )) {
855
-				wp_die( $msg );
854
+			if ( ! defined('DOING_AJAX')) {
855
+				wp_die($msg);
856 856
 			} else {
857
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
857
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
858 858
 				$this->_return_json();
859 859
 			}
860 860
 		}
@@ -872,63 +872,63 @@  discard block
 block discarded – undo
872 872
 	 * @return void
873 873
 	 */
874 874
 	protected function _route_admin_request() {
875
-		if (  ! $this->_is_UI_request )
875
+		if ( ! $this->_is_UI_request)
876 876
 			$this->_verify_routes();
877 877
 
878
-		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
878
+		$nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE;
879 879
 
880
-		if ( $this->_req_action != 'default' && $nonce_check ) {
880
+		if ($this->_req_action != 'default' && $nonce_check) {
881 881
 			// set nonce from post data
882
-			$nonce = isset($this->_req_data[ $this->_req_nonce  ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce  ] ) : '';
883
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
882
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
883
+			$this->_verify_nonce($nonce, $this->_req_nonce);
884 884
 		}
885 885
 		//set the nav_tabs array but ONLY if this is  UI_request
886
-		if ( $this->_is_UI_request )
886
+		if ($this->_is_UI_request)
887 887
 			$this->_set_nav_tabs();
888 888
 
889 889
 		// grab callback function
890
-		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
890
+		$func = is_array($this->_route) ? $this->_route['func'] : $this->_route;
891 891
 
892 892
 		// check if callback has args
893
-		$args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array();
893
+		$args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array();
894 894
 
895 895
 		$error_msg = '';
896 896
 
897 897
 		//action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request')
898
-		if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) {
899
-			do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this );
898
+		if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) {
899
+			do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this);
900 900
 		}
901 901
 
902 902
 		//right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing).
903
-		$_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) );
903
+		$_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI']));
904 904
 
905
-		if ( ! empty( $func )) {
905
+		if ( ! empty($func)) {
906 906
 			$base_call = $addon_call = FALSE;
907 907
 			//try to access page route via this class
908
-			if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func  ), $args ) ) === FALSE ) {
908
+			if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) {
909 909
 				// user error msg
910
-				$error_msg =  __( 'An error occurred. The  requested page route could not be found.', 'event_espresso' );
910
+				$error_msg = __('An error occurred. The  requested page route could not be found.', 'event_espresso');
911 911
 				// developer error msg
912
-				$error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func );
912
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func);
913 913
 			}
914 914
 
915 915
 			//for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method)
916 916
 			$args['admin_page_object'] = $this; //send along this admin page object for access by addons.
917 917
 
918
-			if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) {
919
-				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' );
920
-				$error_msg .= '||' . sprintf( __('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func );
918
+			if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) {
919
+				$error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso');
920
+				$error_msg .= '||'.sprintf(__('Page route "%s" could not be called.  Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func);
921 921
 			}
922 922
 
923 923
 
924
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
925
-				throw new EE_Error( $error_msg );
924
+			if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE)
925
+				throw new EE_Error($error_msg);
926 926
 		}
927 927
 
928 928
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
929 929
 		//now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent.
930
-		if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) {
931
-			$this->_reset_routing_properties( $this->_route['headers_sent_route'] );
930
+		if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) {
931
+			$this->_reset_routing_properties($this->_route['headers_sent_route']);
932 932
 		}
933 933
 	}
934 934
 
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 	 * @param  string    $new_route   New (non header) route to redirect to.
945 945
 	 * @return   void
946 946
 	 */
947
-	protected function _reset_routing_properties( $new_route ) {
947
+	protected function _reset_routing_properties($new_route) {
948 948
 		$this->_is_UI_request = TRUE;
949 949
 		//now we set the current route to whatever the headers_sent_route is set at
950 950
 		$this->_req_data['action'] = $new_route;
@@ -990,23 +990,23 @@  discard block
 block discarded – undo
990 990
 	 * @param   bool    $exclude_nonce  If true, the the nonce will be excluded from the generated nonce.
991 991
 	 * 	@return string
992 992
 	 */
993
-	public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) {
993
+	public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) {
994 994
 
995 995
 		//if there is a _wp_http_referer include the values from the request but only if sticky = true
996
-		if ( $sticky ) {
996
+		if ($sticky) {
997 997
 			$request = $_REQUEST;
998
-			unset( $request['_wp_http_referer'] );
999
-			unset( $request['wp_referer'] );
1000
-			foreach ( $request as $key => $value ) {
998
+			unset($request['_wp_http_referer']);
999
+			unset($request['wp_referer']);
1000
+			foreach ($request as $key => $value) {
1001 1001
 				//do not add nonces
1002
-				if ( strpos( $key, 'nonce' ) !== false ) {
1002
+				if (strpos($key, 'nonce') !== false) {
1003 1003
 					continue;
1004 1004
 				}
1005
-				$args['wp_referer[' . $key . ']'] = $value;
1005
+				$args['wp_referer['.$key.']'] = $value;
1006 1006
 			}
1007 1007
 		}
1008 1008
 
1009
-		return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce );
1009
+		return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce);
1010 1010
 	}
1011 1011
 
1012 1012
 
@@ -1022,8 +1022,8 @@  discard block
 block discarded – undo
1022 1022
 	 * @uses EEH_Template::get_help_tab_link()
1023 1023
 	 * @return string              generated link
1024 1024
 	 */
1025
-	protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) {
1026
-		return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text );
1025
+	protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) {
1026
+		return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text);
1027 1027
 	}
1028 1028
 
1029 1029
 
@@ -1040,30 +1040,30 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	protected function _add_help_tabs() {
1042 1042
 		$tour_buttons = '';
1043
-		if ( isset( $this->_page_config[$this->_req_action] ) ) {
1043
+		if (isset($this->_page_config[$this->_req_action])) {
1044 1044
 			$config = $this->_page_config[$this->_req_action];
1045 1045
 
1046 1046
 			//is there a help tour for the current route?  if there is let's setup the tour buttons
1047
-			if ( isset( $this->_help_tour[$this->_req_action]) ) {
1047
+			if (isset($this->_help_tour[$this->_req_action])) {
1048 1048
 				$tb = array();
1049 1049
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1050
-				foreach ( $this->_help_tour['tours'] as $tour ) {
1050
+				foreach ($this->_help_tour['tours'] as $tour) {
1051 1051
 					//if this is the end tour then we don't need to setup a button
1052
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1052
+					if ($tour instanceof EE_Help_Tour_final_stop)
1053 1053
 						continue;
1054
-					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1054
+					$tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>';
1055 1055
 				}
1056 1056
 				$tour_buttons .= implode('<br />', $tb);
1057 1057
 				$tour_buttons .= '</div></div>';
1058 1058
 			}
1059 1059
 
1060 1060
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1061
-			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1061
+			if (is_array($config) && isset($config['help_sidebar'])) {
1062 1062
 				//check that the callback given is valid
1063
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1064
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1063
+				if ( ! method_exists($this, $config['help_sidebar']))
1064
+					throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this)));
1065 1065
 
1066
-				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1066
+				$content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar'])));
1067 1067
 
1068 1068
 				$content .= $tour_buttons; //add help tour buttons.
1069 1069
 
@@ -1072,49 +1072,49 @@  discard block
 block discarded – undo
1072 1072
 			}
1073 1073
 
1074 1074
 			//if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar.
1075
-			if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) {
1075
+			if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) {
1076 1076
 				$this->_current_screen->set_help_sidebar($tour_buttons);
1077 1077
 			}
1078 1078
 
1079 1079
 			//handle if no help_tabs are set so the sidebar will still show for the help tour buttons
1080
-			if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) {
1080
+			if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) {
1081 1081
 				$_ht['id'] = $this->page_slug;
1082 1082
 				$_ht['title'] = __('Help Tours', 'event_espresso');
1083
-				$_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>';
1083
+				$_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>';
1084 1084
 				$this->_current_screen->add_help_tab($_ht);
1085 1085
 				}/**/
1086 1086
 
1087 1087
 
1088
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1088
+			if ( ! isset($config['help_tabs'])) return; //no help tabs for this route
1089 1089
 
1090
-			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1090
+			foreach ((array) $config['help_tabs'] as $tab_id => $cfg) {
1091 1091
 				//we're here so there ARE help tabs!
1092 1092
 
1093 1093
 				//make sure we've got what we need
1094
-				if ( !isset( $cfg['title'] ) )
1095
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1094
+				if ( ! isset($cfg['title']))
1095
+					throw new EE_Error(__('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso'));
1096 1096
 
1097 1097
 
1098
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1099
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1098
+				if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content']))
1099
+					throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso'));
1100 1100
 
1101 1101
 
1102 1102
 
1103 1103
 				//first priority goes to content.
1104
-				if ( !empty($cfg['content'] ) ) {
1105
-					$content = !empty($cfg['content']) ? $cfg['content'] : NULL;
1104
+				if ( ! empty($cfg['content'])) {
1105
+					$content = ! empty($cfg['content']) ? $cfg['content'] : NULL;
1106 1106
 
1107 1107
 				//second priority goes to filename
1108
-				} else if ( !empty($cfg['filename'] ) ) {
1109
-					$file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php';
1108
+				} else if ( ! empty($cfg['filename'])) {
1109
+					$file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php';
1110 1110
 
1111 1111
 
1112 1112
 					//it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too)
1113
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path;
1113
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path;
1114 1114
 
1115 1115
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1116
-					if ( !is_readable($file_path) && !isset($cfg['callback']) ) {
1117
-						EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ );
1116
+					if ( ! is_readable($file_path) && ! isset($cfg['callback'])) {
1117
+						EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content.  Please check that the string you set for the help tab on this route (%s) is the correct spelling.  The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__);
1118 1118
 						return;
1119 1119
 					}
1120 1120
 					$template_args['admin_page_obj'] = $this;
@@ -1125,21 +1125,21 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 
1127 1127
 				//check if callback is valid
1128
-				if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) {
1129
-					EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ );
1128
+				if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) {
1129
+					EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content.  Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__);
1130 1130
 					return;
1131 1131
 				}
1132 1132
 
1133 1133
 				//setup config array for help tab method
1134
-				$id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id;
1134
+				$id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id;
1135 1135
 				$_ht = array(
1136 1136
 					'id' => $id,
1137 1137
 					'title' => $cfg['title'],
1138
-					'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL,
1138
+					'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL,
1139 1139
 					'content' => $content
1140 1140
 					);
1141 1141
 
1142
-				$this->_current_screen->add_help_tab( $_ht );
1142
+				$this->_current_screen->add_help_tab($_ht);
1143 1143
 			}
1144 1144
 		}
1145 1145
 	}
@@ -1159,49 +1159,49 @@  discard block
 block discarded – undo
1159 1159
 		$this->_help_tour = array();
1160 1160
 
1161 1161
 		//exit early if help tours are turned off globally
1162
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1162
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS))
1163 1163
 			return;
1164 1164
 
1165 1165
 		//loop through _page_config to find any help_tour defined
1166
-		foreach ( $this->_page_config as $route => $config ) {
1166
+		foreach ($this->_page_config as $route => $config) {
1167 1167
 			//we're only going to set things up for this route
1168
-			if ( $route !== $this->_req_action )
1168
+			if ($route !== $this->_req_action)
1169 1169
 				continue;
1170 1170
 
1171
-			if ( isset( $config['help_tour'] ) ) {
1171
+			if (isset($config['help_tour'])) {
1172 1172
 
1173
-				foreach( $config['help_tour'] as $tour ) {
1174
-					$file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php';
1173
+				foreach ($config['help_tour'] as $tour) {
1174
+					$file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php';
1175 1175
 					//let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent
1176
-					$file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path;
1176
+					$file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path;
1177 1177
 
1178 1178
 					//if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error.
1179
-					if ( !is_readable($file_path) ) {
1180
-						EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ );
1179
+					if ( ! is_readable($file_path)) {
1180
+						EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path.  Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__);
1181 1181
 						return;
1182 1182
 					}
1183 1183
 
1184 1184
 					require_once $file_path;
1185
-					if ( !class_exists( $tour ) ) {
1186
-						$error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour);
1187
-						$error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) );
1188
-						throw new EE_Error( implode( '||', $error_msg ));
1185
+					if ( ! class_exists($tour)) {
1186
+						$error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour);
1187
+						$error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this));
1188
+						throw new EE_Error(implode('||', $error_msg));
1189 1189
 					}
1190 1190
 					$a = new ReflectionClass($tour);
1191 1191
 					$tour_obj = $a->newInstance($this->_is_caf);
1192 1192
 
1193 1193
 					$tours[] = $tour_obj;
1194
-					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj );
1194
+					$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj);
1195 1195
 				}
1196 1196
 
1197 1197
 				//let's inject the end tour stop element common to all pages... this will only get seen once per machine.
1198 1198
 				$end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf);
1199 1199
 				$tours[] = $end_stop_tour;
1200
-				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour );
1200
+				$this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour);
1201 1201
 			}
1202 1202
 		}
1203 1203
 
1204
-		if ( !empty( $tours ) )
1204
+		if ( ! empty($tours))
1205 1205
 			$this->_help_tour['tours'] = $tours;
1206 1206
 
1207 1207
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
 	 * @return void
1218 1218
 	 */
1219 1219
 	protected function _add_qtips() {
1220
-		if ( isset( $this->_route_config['qtips'] ) ) {
1220
+		if (isset($this->_route_config['qtips'])) {
1221 1221
 			$qtips = (array) $this->_route_config['qtips'];
1222 1222
 			//load qtip loader
1223 1223
 			$path = array(
1224
-				$this->_get_dir() . '/qtips/',
1225
-				EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/'
1224
+				$this->_get_dir().'/qtips/',
1225
+				EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/'
1226 1226
 				);
1227 1227
 			EEH_Qtip_Loader::instance()->register($qtips, $path);
1228 1228
 		}
@@ -1239,41 +1239,41 @@  discard block
 block discarded – undo
1239 1239
 	 * @return void
1240 1240
 	 */
1241 1241
 	protected function _set_nav_tabs() {
1242
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1242
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1243 1243
 		$i = 0;
1244
-		foreach ( $this->_page_config as $slug => $config ) {
1245
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1244
+		foreach ($this->_page_config as $slug => $config) {
1245
+			if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav'])))
1246 1246
 				continue; //no nav tab for this config
1247 1247
 
1248 1248
 			//check for persistent flag
1249
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1249
+			if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action)
1250 1250
 				continue; //nav tab is only to appear when route requested.
1251 1251
 
1252
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1252
+			if ( ! $this->check_user_access($slug, TRUE))
1253 1253
 				continue; //no nav tab becasue current user does not have access.
1254 1254
 
1255
-			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1255
+			$css_class = isset($config['css_class']) ? $config['css_class'].' ' : '';
1256 1256
 			$this->_nav_tabs[$slug] = array(
1257
-				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ),
1258
-				'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ),
1259
-				'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class,
1260
-				'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i
1257
+				'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url),
1258
+				'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)),
1259
+				'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class,
1260
+				'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i
1261 1261
 				);
1262 1262
 			$i++;
1263 1263
 		}
1264 1264
 
1265 1265
 		//if $this->_nav_tabs is empty then lets set the default
1266
-		if ( empty( $this->_nav_tabs ) ) {
1266
+		if (empty($this->_nav_tabs)) {
1267 1267
 			$this->_nav_tabs[$this->default_nav_tab_name] = array(
1268 1268
 				'url' => $this->admin_base_url,
1269
-				'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ),
1269
+				'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)),
1270 1270
 				'css_class' => 'nav-tab-active',
1271 1271
 				'order' => 10
1272 1272
 				);
1273 1273
 		}
1274 1274
 
1275 1275
 		//now let's sort the tabs according to order
1276
-		usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' ));
1276
+		usort($this->_nav_tabs, array($this, '_sort_nav_tabs'));
1277 1277
 
1278 1278
 	}
1279 1279
 
@@ -1289,10 +1289,10 @@  discard block
 block discarded – undo
1289 1289
 	 * @return void
1290 1290
 	 */
1291 1291
 	private function _set_current_labels() {
1292
-		if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) {
1293
-			foreach ( $this->_route_config['labels'] as $label => $text ) {
1294
-				if ( is_array($text) ) {
1295
-					foreach ( $text as $sublabel => $subtext ) {
1292
+		if (is_array($this->_route_config) && isset($this->_route_config['labels'])) {
1293
+			foreach ($this->_route_config['labels'] as $label => $text) {
1294
+				if (is_array($text)) {
1295
+					foreach ($text as $sublabel => $subtext) {
1296 1296
 						$this->_labels[$label][$sublabel] = $subtext;
1297 1297
 					}
1298 1298
 				} else {
@@ -1313,24 +1313,24 @@  discard block
 block discarded – undo
1313 1313
 	 * 		@param bool   $verify_only Default is FALSE which means if user check fails then wp_die().  Otherwise just return false if verify fail.
1314 1314
 	*		@return 		BOOL|wp_die()
1315 1315
 	*/
1316
-	public function check_user_access( $route_to_check = '', $verify_only = FALSE ) {
1317
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1318
-		$route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check;
1319
-		$capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1316
+	public function check_user_access($route_to_check = '', $verify_only = FALSE) {
1317
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1318
+		$route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check;
1319
+		$capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL;
1320 1320
 
1321
-		if ( empty( $capability ) && empty( $route_to_check )  ) {
1322
-			$capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability'];
1321
+		if (empty($capability) && empty($route_to_check)) {
1322
+			$capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability'];
1323 1323
 		} else {
1324
-			$capability = empty( $capability ) ? 'manage_options' : $capability;
1324
+			$capability = empty($capability) ? 'manage_options' : $capability;
1325 1325
 		}
1326 1326
 
1327
-		$id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0;
1327
+		$id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0;
1328 1328
 
1329
-		if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) {
1330
-			if ( $verify_only ) {
1329
+		if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) {
1330
+			if ($verify_only) {
1331 1331
 				return FALSE;
1332 1332
 			} else {
1333
-				wp_die( __('You do not have access to this route.', 'event_espresso' ) );
1333
+				wp_die(__('You do not have access to this route.', 'event_espresso'));
1334 1334
 			}
1335 1335
 		}
1336 1336
 		return TRUE;
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 		$this->_add_admin_page_overlay();
1408 1408
 
1409 1409
 		//if metaboxes are present we need to add the nonce field
1410
-		if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) {
1410
+		if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) {
1411 1411
 			wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
1412 1412
 			wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
1413 1413
 		}
@@ -1426,19 +1426,19 @@  discard block
 block discarded – undo
1426 1426
 	 */
1427 1427
 	public function admin_footer_global() {
1428 1428
 		//dialog container for dialog helper
1429
-		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n";
1429
+		$d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n";
1430 1430
 		$d_cont .= '<div class="ee-notices"></div>';
1431 1431
 		$d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>';
1432 1432
 		$d_cont .= '</div>';
1433 1433
 		echo $d_cont;
1434 1434
 
1435 1435
 		//help tour stuff?
1436
-		if ( isset( $this->_help_tour[$this->_req_action] ) ) {
1436
+		if (isset($this->_help_tour[$this->_req_action])) {
1437 1437
 			echo implode('<br />', $this->_help_tour[$this->_req_action]);
1438 1438
 		}
1439 1439
 
1440 1440
 		//current set timezone for timezone js
1441
-		echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>';
1441
+		echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>';
1442 1442
 	}
1443 1443
 
1444 1444
 
@@ -1462,18 +1462,18 @@  discard block
 block discarded – undo
1462 1462
 	 * @access protected
1463 1463
 	 * @return string content
1464 1464
 	 */
1465
-	protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) {
1465
+	protected function _set_help_popup_content($help_array = array(), $display = FALSE) {
1466 1466
 		$content = '';
1467 1467
 
1468
-		$help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array;
1469
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php';
1468
+		$help_array = empty($help_array) ? $this->_get_help_content() : $help_array;
1469
+		$template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php';
1470 1470
 
1471 1471
 
1472 1472
 		//loop through the array and setup content
1473
-		foreach ( $help_array as $trigger => $help ) {
1473
+		foreach ($help_array as $trigger => $help) {
1474 1474
 			//make sure the array is setup properly
1475
-			if ( !isset($help['title']) || !isset($help['content'] ) ) {
1476
-				throw new EE_Error( __('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') );
1475
+			if ( ! isset($help['title']) || ! isset($help['content'])) {
1476
+				throw new EE_Error(__('Does not look like the popup content array has been setup correctly.  Might want to double check that.  Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso'));
1477 1477
 			}
1478 1478
 
1479 1479
 			//we're good so let'd setup the template vars and then assign parsed template content to our content.
@@ -1483,10 +1483,10 @@  discard block
 block discarded – undo
1483 1483
 				'help_popup_content' => $help['content']
1484 1484
 				);
1485 1485
 
1486
-			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1486
+			$content .= EEH_Template::display_template($template_path, $template_args, TRUE);
1487 1487
 		}
1488 1488
 
1489
-		if ( $display )
1489
+		if ($display)
1490 1490
 			echo $content;
1491 1491
 		else
1492 1492
 			return $content;
@@ -1503,18 +1503,18 @@  discard block
 block discarded – undo
1503 1503
 	 */
1504 1504
 	private function _get_help_content() {
1505 1505
 		//what is the method we're looking for?
1506
-		$method_name = '_help_popup_content_' . $this->_req_action;
1506
+		$method_name = '_help_popup_content_'.$this->_req_action;
1507 1507
 
1508 1508
 		//if method doesn't exist let's get out.
1509
-		if ( !method_exists( $this, $method_name ) )
1509
+		if ( ! method_exists($this, $method_name))
1510 1510
 			return array();
1511 1511
 
1512 1512
 		//k we're good to go let's retrieve the help array
1513
-		$help_array = call_user_func( array( $this, $method_name ) );
1513
+		$help_array = call_user_func(array($this, $method_name));
1514 1514
 
1515 1515
 		//make sure we've got an array!
1516
-		if ( !is_array($help_array) ) {
1517
-			throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) );
1516
+		if ( ! is_array($help_array)) {
1517
+			throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso'));
1518 1518
 		}
1519 1519
 
1520 1520
 		return $help_array;
@@ -1536,27 +1536,27 @@  discard block
 block discarded – undo
1536 1536
 	 * @param array $dimensions an array of dimensions for the box (array(h,w))
1537 1537
 	 * @return string
1538 1538
 	 */
1539
-	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1539
+	protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) {
1540 1540
 
1541
-		if ( defined('DOING_AJAX') ) return;
1541
+		if (defined('DOING_AJAX')) return;
1542 1542
 
1543 1543
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1544 1544
 		$help_array = $this->_get_help_content();
1545 1545
 		$help_content = '';
1546 1546
 
1547
-		if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) {
1547
+		if (empty($help_array) || ! isset($help_array[$trigger_id])) {
1548 1548
 			$help_array[$trigger_id] = array(
1549 1549
 				'title' => __('Missing Content', 'event_espresso'),
1550 1550
 				'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso')
1551 1551
 				);
1552
-			$help_content = $this->_set_help_popup_content( $help_array, FALSE );
1552
+			$help_content = $this->_set_help_popup_content($help_array, FALSE);
1553 1553
 		}
1554 1554
 
1555 1555
 		//let's setup the trigger
1556
-		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557
-		$content = $content . $help_content;
1556
+		$content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557
+		$content = $content.$help_content;
1558 1558
 
1559
-		if ( $display )
1559
+		if ($display)
1560 1560
 			echo $content;
1561 1561
 		else
1562 1562
 			return $content;
@@ -1613,15 +1613,15 @@  discard block
 block discarded – undo
1613 1613
 	public function load_global_scripts_styles() {
1614 1614
 		/** STYLES **/
1615 1615
 		// add debugging styles
1616
-		if ( WP_DEBUG ) {
1617
-			add_action('admin_head', array( $this, 'add_xdebug_style' ));
1616
+		if (WP_DEBUG) {
1617
+			add_action('admin_head', array($this, 'add_xdebug_style'));
1618 1618
 		}
1619 1619
 
1620 1620
 		//register all styles
1621
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION );
1622
-		wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1621
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1622
+		wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
1623 1623
 		//helpers styles
1624
-		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION );
1624
+		wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION);
1625 1625
 		//enqueue global styles
1626 1626
 		wp_enqueue_style('ee-admin-css');
1627 1627
 
@@ -1629,66 +1629,66 @@  discard block
 block discarded – undo
1629 1629
 		/** SCRIPTS **/
1630 1630
 
1631 1631
 		//register all scripts
1632
-		wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1633
-		wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE );
1634
-		wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true );
1632
+		wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1633
+		wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE);
1634
+		wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1635 1635
 
1636
-		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true );
1636
+		wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true);
1637 1637
 		// register jQuery Validate - see /includes/functions/wp_hooks.php
1638
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1638
+		add_filter('FHEE_load_jquery_validate', '__return_true');
1639 1639
 		add_filter('FHEE_load_joyride', '__return_true');
1640 1640
 
1641 1641
 		//script for sorting tables
1642
-		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1642
+		wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
1643 1643
 		//script for parsing uri's
1644
-		wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1644
+		wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1645 1645
 		//and parsing associative serialized form elements
1646
-		wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1646
+		wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1647 1647
 		//helpers scripts
1648
-		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1649
-		wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE );
1650
-		wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE );
1651
-		wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE );
1648
+		wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1649
+		wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE);
1650
+		wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE);
1651
+		wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE);
1652 1652
 
1653 1653
 		//google charts
1654
-		wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false );
1654
+		wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false);
1655 1655
 
1656 1656
 		//enqueue global scripts
1657 1657
 
1658 1658
 		//taking care of metaboxes
1659
-		if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) {
1659
+		if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) {
1660 1660
 			wp_enqueue_script('dashboard');
1661 1661
 		}
1662 1662
 
1663 1663
 		//enqueue thickbox for ee help popups.  default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups
1664
-		if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) {
1664
+		if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) {
1665 1665
 			wp_enqueue_script('ee_admin_js');
1666 1666
 			wp_enqueue_style('ee-admin-css');
1667 1667
 		}
1668 1668
 
1669 1669
 
1670 1670
 		//localize script for ajax lazy loading
1671
-		$lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') );
1672
-		wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1671
+		$lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content'));
1672
+		wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids);
1673 1673
 
1674 1674
 
1675 1675
 		/**
1676 1676
 		 * help tour stuff
1677 1677
 		 */
1678
-		if ( !empty( $this->_help_tour ) ) {
1678
+		if ( ! empty($this->_help_tour)) {
1679 1679
 
1680 1680
 			//register the js for kicking things off
1681
-			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE );
1681
+			wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE);
1682 1682
 
1683 1683
 			//setup tours for the js tour object
1684
-			foreach ( $this->_help_tour['tours'] as $tour ) {
1684
+			foreach ($this->_help_tour['tours'] as $tour) {
1685 1685
 				$tours[] = array(
1686 1686
 					'id' => $tour->get_slug(),
1687 1687
 					'options' => $tour->get_options()
1688 1688
 					);
1689 1689
 			}
1690 1690
 
1691
-			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) );
1691
+			wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours));
1692 1692
 
1693 1693
 			//admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour
1694 1694
 		}
@@ -1706,52 +1706,52 @@  discard block
 block discarded – undo
1706 1706
 	public function admin_footer_scripts_eei18n_js_strings() {
1707 1707
 
1708 1708
 		EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL;
1709
-		EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' );
1710
-
1711
-		EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' );
1712
-		EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' );
1713
-		EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' );
1714
-		EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' );
1715
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1716
-		EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' );
1717
-		EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' );
1718
-		EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' );
1719
-		EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' );
1720
-		EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' );
1721
-		EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' );
1722
-		EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' );
1723
-		EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' );
1724
-		EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' );
1725
-		EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' );
1726
-		EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' );
1727
-		EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' );
1728
-		EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' );
1729
-		EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' );
1730
-		EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' );
1731
-		EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' );
1732
-		EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' );
1733
-		EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' );
1734
-		EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' );
1735
-
1736
-		EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' );
1737
-		EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' );
1738
-		EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' );
1739
-		EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' );
1740
-		EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' );
1741
-		EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' );
1742
-		EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' );
1743
-		EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' );
1744
-		EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' );
1745
-		EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' );
1746
-		EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' );
1747
-		EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' );
1748
-		EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' );
1749
-		EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' );
1709
+		EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso');
1710
+
1711
+		EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso');
1712
+		EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso');
1713
+		EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso');
1714
+		EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso');
1715
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1716
+		EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso');
1717
+		EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso');
1718
+		EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso');
1719
+		EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso');
1720
+		EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso');
1721
+		EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso');
1722
+		EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso');
1723
+		EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso');
1724
+		EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso');
1725
+		EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso');
1726
+		EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso');
1727
+		EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso');
1728
+		EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso');
1729
+		EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso');
1730
+		EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso');
1731
+		EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso');
1732
+		EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso');
1733
+		EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso');
1734
+		EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso');
1735
+
1736
+		EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso');
1737
+		EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso');
1738
+		EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso');
1739
+		EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso');
1740
+		EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso');
1741
+		EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso');
1742
+		EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso');
1743
+		EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso');
1744
+		EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso');
1745
+		EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso');
1746
+		EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso');
1747
+		EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso');
1748
+		EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso');
1749
+		EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso');
1750 1750
 
1751 1751
 		//setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance
1752 1752
 		//admin page when in maintenance mode and ee_admin_js is not loaded then.  This works everywhere else because
1753 1753
 		//espresso_core is listed as a dependency of ee_admin_js.
1754
-		wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings );
1754
+		wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings);
1755 1755
 
1756 1756
 	}
1757 1757
 
@@ -1785,23 +1785,23 @@  discard block
 block discarded – undo
1785 1785
 	protected function _set_list_table() {
1786 1786
 
1787 1787
 		//first is this a list_table view?
1788
-		if ( !isset($this->_route_config['list_table']) )
1788
+		if ( ! isset($this->_route_config['list_table']))
1789 1789
 			return; //not a list_table view so get out.
1790 1790
 
1791 1791
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1792 1792
 
1793
-		if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) {
1793
+		if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) {
1794 1794
 			//user error msg
1795
-			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' );
1795
+			$error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso');
1796 1796
 			//developer error msg
1797
-			$error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action );
1798
-			throw new EE_Error( $error_msg );
1797
+			$error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action);
1798
+			throw new EE_Error($error_msg);
1799 1799
 		}
1800 1800
 
1801 1801
 		//let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally
1802
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views );
1803
-		$this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views );
1804
-		$this->_views = apply_filters( 'FHEE_list_table_views', $this->_views );
1802
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views);
1803
+		$this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views);
1804
+		$this->_views = apply_filters('FHEE_list_table_views', $this->_views);
1805 1805
 
1806 1806
 		$this->_set_list_table_view();
1807 1807
 		$this->_set_list_table_object();
@@ -1823,14 +1823,14 @@  discard block
 block discarded – undo
1823 1823
 	*		@return array
1824 1824
 	*/
1825 1825
 	protected function _set_list_table_view() {
1826
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1826
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1827 1827
 
1828 1828
 
1829 1829
 		// looking at active items or dumpster diving ?
1830
-		if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) {
1831
-			$this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all';
1830
+		if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) {
1831
+			$this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all';
1832 1832
 		} else {
1833
-			$this->_view = sanitize_key( $this->_req_data['status'] );
1833
+			$this->_view = sanitize_key($this->_req_data['status']);
1834 1834
 		}
1835 1835
 	}
1836 1836
 
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 	 * @throws \EE_Error
1844 1844
 	 */
1845 1845
 	protected function _set_list_table_object() {
1846
-		if ( isset( $this->_route_config['list_table'] ) ) {
1847
-			if ( ! class_exists( $this->_route_config['list_table'] ) ) {
1846
+		if (isset($this->_route_config['list_table'])) {
1847
+			if ( ! class_exists($this->_route_config['list_table'])) {
1848 1848
 				throw new EE_Error(
1849 1849
 					sprintf(
1850 1850
 						__(
@@ -1852,12 +1852,12 @@  discard block
 block discarded – undo
1852 1852
 							'event_espresso'
1853 1853
 						),
1854 1854
 						$this->_route_config['list_table'],
1855
-						get_class( $this )
1855
+						get_class($this)
1856 1856
 					)
1857 1857
 				);
1858 1858
 			}
1859 1859
 			$list_table = $this->_route_config['list_table'];
1860
-			$this->_list_table_object = new $list_table( $this );
1860
+			$this->_list_table_object = new $list_table($this);
1861 1861
 		}
1862 1862
 	}
1863 1863
 
@@ -1874,27 +1874,27 @@  discard block
 block discarded – undo
1874 1874
 	 *
1875 1875
 	 * @return array
1876 1876
 	 */
1877
-	public function get_list_table_view_RLs( $extra_query_args = array() ) {
1877
+	public function get_list_table_view_RLs($extra_query_args = array()) {
1878 1878
 
1879
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1879
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1880 1880
 
1881
-		if ( empty( $this->_views )) {
1881
+		if (empty($this->_views)) {
1882 1882
 			$this->_views = array();
1883 1883
 		}
1884 1884
 
1885 1885
 		// cycle thru views
1886
-		foreach ( $this->_views as $key => $view ) {
1886
+		foreach ($this->_views as $key => $view) {
1887 1887
 			$query_args = array();
1888 1888
 			// check for current view
1889
-			$this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1889
+			$this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : '';
1890 1890
 			$query_args['action'] = $this->_req_action;
1891
-			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
1891
+			$query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce');
1892 1892
 			$query_args['status'] = $view['slug'];
1893 1893
 			//merge any other arguments sent in.
1894
-			if ( isset( $extra_query_args[$view['slug']] ) ) {
1895
-				$query_args = array_merge( $query_args, $extra_query_args[$view['slug']] );
1894
+			if (isset($extra_query_args[$view['slug']])) {
1895
+				$query_args = array_merge($query_args, $extra_query_args[$view['slug']]);
1896 1896
 			}
1897
-			$this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url );
1897
+			$this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url);
1898 1898
 		}
1899 1899
 
1900 1900
 		return $this->_views;
@@ -1911,15 +1911,15 @@  discard block
 block discarded – undo
1911 1911
 	 * @param int $max_entries total number of rows in the table
1912 1912
 	 * @return string
1913 1913
 	*/
1914
-	protected function _entries_per_page_dropdown( $max_entries = FALSE ) {
1914
+	protected function _entries_per_page_dropdown($max_entries = FALSE) {
1915 1915
 
1916
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1917
-		$values = array( 10, 25, 50, 100 );
1918
-		$per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10;
1916
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1917
+		$values = array(10, 25, 50, 100);
1918
+		$per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10;
1919 1919
 
1920
-		if ( $max_entries ) {
1920
+		if ($max_entries) {
1921 1921
 			$values[] = $max_entries;
1922
-			sort( $values );
1922
+			sort($values);
1923 1923
 		}
1924 1924
 
1925 1925
 		$entries_per_page_dropdown = '
@@ -1928,15 +1928,15 @@  discard block
 block discarded – undo
1928 1928
 					Show
1929 1929
 					<select id="entries-per-page-slct" name="entries-per-page-slct">';
1930 1930
 
1931
-		foreach ( $values as $value ) {
1932
-			if ( $value < $max_entries ) {
1933
-				$selected = $value == $per_page ?  ' selected="' . $per_page . '"' : '';
1931
+		foreach ($values as $value) {
1932
+			if ($value < $max_entries) {
1933
+				$selected = $value == $per_page ? ' selected="'.$per_page.'"' : '';
1934 1934
 				$entries_per_page_dropdown .= '
1935 1935
 						<option value="'.$value.'"'.$selected.'>'.$value.'&nbsp;&nbsp;</option>';
1936 1936
 			}
1937 1937
 		}
1938 1938
 
1939
-		$selected = $max_entries == $per_page ?  ' selected="' . $per_page . '"' : '';
1939
+		$selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : '';
1940 1940
 		$entries_per_page_dropdown .= '
1941 1941
 						<option value="'.$max_entries.'"'.$selected.'>All&nbsp;&nbsp;</option>';
1942 1942
 
@@ -1959,8 +1959,8 @@  discard block
 block discarded – undo
1959 1959
 	*		@return 		void
1960 1960
 	*/
1961 1961
 	public function _set_search_attributes() {
1962
-		$this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label );
1963
-		$this->_template_args['search']['callback'] = 'search_' . $this->page_slug;
1962
+		$this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label);
1963
+		$this->_template_args['search']['callback'] = 'search_'.$this->page_slug;
1964 1964
 	}
1965 1965
 
1966 1966
 	/*** END LIST TABLE METHODS **/
@@ -1979,10 +1979,10 @@  discard block
 block discarded – undo
1979 1979
 	 * @return void
1980 1980
 	*/
1981 1981
 	private function _add_registered_meta_boxes() {
1982
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1982
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1983 1983
 
1984 1984
 		//we only add meta boxes if the page_route calls for it
1985
-		if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] )
1985
+		if (is_array($this->_route_config) && isset($this->_route_config['metaboxes'])
1986 1986
 			 && is_array(
1987 1987
 			 $this->_route_config['metaboxes']
1988 1988
 			 )
@@ -1990,27 +1990,27 @@  discard block
 block discarded – undo
1990 1990
 			// this simply loops through the callbacks provided
1991 1991
 			// and checks if there is a corresponding callback registered by the child
1992 1992
 			// if there is then we go ahead and process the metabox loader.
1993
-			foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) {
1993
+			foreach ($this->_route_config['metaboxes'] as $metabox_callback) {
1994 1994
 				// first check for Closures
1995
-				if ( $metabox_callback instanceof Closure ) {
1995
+				if ($metabox_callback instanceof Closure) {
1996 1996
 					$result = $metabox_callback();
1997
-				} else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) {
1998
-					$result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) );
1997
+				} else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) {
1998
+					$result = call_user_func(array($metabox_callback[0], $metabox_callback[1]));
1999 1999
 				} else {
2000
-					$result = call_user_func( array( $this, &$metabox_callback ) );
2000
+					$result = call_user_func(array($this, &$metabox_callback));
2001 2001
 				}
2002
-				if ( $result === FALSE ) {
2002
+				if ($result === FALSE) {
2003 2003
 					// user error msg
2004
-					$error_msg =  __( 'An error occurred. The  requested metabox could not be found.', 'event_espresso' );
2004
+					$error_msg = __('An error occurred. The  requested metabox could not be found.', 'event_espresso');
2005 2005
 					// developer error msg
2006
-					$error_msg .= '||' . sprintf(
2006
+					$error_msg .= '||'.sprintf(
2007 2007
 						__(
2008 2008
 							'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.',
2009 2009
 							'event_espresso'
2010 2010
 						),
2011 2011
 						$metabox_callback
2012 2012
 					);
2013
-					throw new EE_Error( $error_msg );
2013
+					throw new EE_Error($error_msg);
2014 2014
 				}
2015 2015
 			}
2016 2016
 		}
@@ -2029,19 +2029,19 @@  discard block
 block discarded – undo
2029 2029
 	private function _add_screen_columns() {
2030 2030
         if (
2031 2031
 		        is_array($this->_route_config)
2032
-                && isset( $this->_route_config['columns'] )
2032
+                && isset($this->_route_config['columns'])
2033 2033
                 && is_array($this->_route_config['columns'])
2034
-                && count( $this->_route_config['columns'] ) === 2
2034
+                && count($this->_route_config['columns']) === 2
2035 2035
         ) {
2036
-            add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) );
2036
+            add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1]));
2037 2037
 			$this->_template_args['num_columns'] = $this->_route_config['columns'][0];
2038 2038
 			$screen_id = $this->_current_screen->id;
2039 2039
 			$screen_columns = (int) get_user_option("screen_layout_$screen_id");
2040
-			$total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2041
-			$this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns;
2040
+			$total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1];
2041
+			$this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns;
2042 2042
 			$this->_template_args['current_page'] = $this->_wp_page_slug;
2043 2043
 			$this->_template_args['screen'] = $this->_current_screen;
2044
-			$this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php';
2044
+			$this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php';
2045 2045
 
2046 2046
 			//finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded.
2047 2047
 			$this->_route_config['has_metaboxes'] = TRUE;
@@ -2058,11 +2058,11 @@  discard block
 block discarded – undo
2058 2058
 	 */
2059 2059
 
2060 2060
 	private function _espresso_news_post_box() {
2061
-		$news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) );
2062
-		add_meta_box( 'espresso_news_post_box', $news_box_title, array(
2061
+		$news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso'));
2062
+		add_meta_box('espresso_news_post_box', $news_box_title, array(
2063 2063
 			$this,
2064 2064
 			'espresso_news_post_box'
2065
-		), $this->_wp_page_slug, 'side' );
2065
+		), $this->_wp_page_slug, 'side');
2066 2066
 	}
2067 2067
 
2068 2068
 
@@ -2070,14 +2070,14 @@  discard block
 block discarded – undo
2070 2070
 	 * Code for setting up espresso ratings request metabox.
2071 2071
 	 */
2072 2072
 	protected function _espresso_ratings_request() {
2073
-		if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) {
2073
+		if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) {
2074 2074
 			return '';
2075 2075
 		}
2076
-		$ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') );
2077
-		add_meta_box( 'espresso_ratings_request', $ratings_box_title, array(
2076
+		$ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso'));
2077
+		add_meta_box('espresso_ratings_request', $ratings_box_title, array(
2078 2078
 			$this,
2079 2079
 			'espresso_ratings_request'
2080
-		), $this->_wp_page_slug, 'side' );
2080
+		), $this->_wp_page_slug, 'side');
2081 2081
 	}
2082 2082
 
2083 2083
 
@@ -2085,34 +2085,34 @@  discard block
 block discarded – undo
2085 2085
 	 * Code for setting up espresso ratings request metabox content.
2086 2086
 	 */
2087 2087
 	public function espresso_ratings_request() {
2088
-		$template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php';
2089
-		EEH_Template::display_template( $template_path, array() );
2088
+		$template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php';
2089
+		EEH_Template::display_template($template_path, array());
2090 2090
 	}
2091 2091
 
2092 2092
 
2093 2093
 
2094 2094
 
2095
-	public static function cached_rss_display( $rss_id, $url ) {
2096
-		$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
2097
-		$doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
2098
-		$pre = '<div class="espresso-rss-display">' . "\n\t";
2099
-		$pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>';
2100
-		$post = '</div>' . "\n";
2095
+	public static function cached_rss_display($rss_id, $url) {
2096
+		$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
2097
+		$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
2098
+		$pre = '<div class="espresso-rss-display">'."\n\t";
2099
+		$pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>';
2100
+		$post = '</div>'."\n";
2101 2101
 
2102
-		$cache_key = 'ee_rss_' . md5( $rss_id );
2103
-		if ( FALSE != ( $output = get_transient( $cache_key ) ) ) {
2104
-			echo $pre . $output . $post;
2102
+		$cache_key = 'ee_rss_'.md5($rss_id);
2103
+		if (FALSE != ($output = get_transient($cache_key))) {
2104
+			echo $pre.$output.$post;
2105 2105
 			return TRUE;
2106 2106
 		}
2107 2107
 
2108
-		if ( ! $doing_ajax ) {
2109
-			echo $pre . $loading . $post;
2108
+		if ( ! $doing_ajax) {
2109
+			echo $pre.$loading.$post;
2110 2110
 			return FALSE;
2111 2111
 		}
2112 2112
 
2113 2113
 		ob_start();
2114
-		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) );
2115
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS );
2114
+		wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5));
2115
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS);
2116 2116
 		return TRUE;
2117 2117
 
2118 2118
 	}
@@ -2124,13 +2124,13 @@  discard block
 block discarded – undo
2124 2124
 	  	<div id="espresso_news_post_box_content" class="infolinks">
2125 2125
 	  		<?php
2126 2126
 	  		// Get RSS Feed(s)
2127
-	  		$feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' );
2127
+	  		$feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/');
2128 2128
 	  		$url = urlencode($feed_url);
2129
-	  		self::cached_rss_display( 'espresso_news_post_box_content', $url );
2129
+	  		self::cached_rss_display('espresso_news_post_box_content', $url);
2130 2130
 
2131 2131
 	  		?>
2132 2132
 	  	</div>
2133
-	  	<?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2133
+	  	<?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?>
2134 2134
 	  </div>
2135 2135
 		<?php
2136 2136
 	}
@@ -2151,32 +2151,32 @@  discard block
 block discarded – undo
2151 2151
 
2152 2152
 	protected function _espresso_sponsors_post_box() {
2153 2153
 
2154
-		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2155
-		if ( $show_sponsors )
2156
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2154
+		$show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE);
2155
+		if ($show_sponsors)
2156
+			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2157 2157
 	}
2158 2158
 
2159 2159
 
2160 2160
 	public function espresso_sponsors_post_box() {
2161
-		$templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php';
2162
-		EEH_Template::display_template( $templatepath );
2161
+		$templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php';
2162
+		EEH_Template::display_template($templatepath);
2163 2163
 	}
2164 2164
 
2165 2165
 
2166 2166
 
2167 2167
 	private function _publish_post_box() {
2168
-		$meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview';
2168
+		$meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview';
2169 2169
 
2170 2170
 		//if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label.  Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes)
2171
-		if ( !empty( $this->_labels['publishbox'] ) ) {
2172
-			$box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2171
+		if ( ! empty($this->_labels['publishbox'])) {
2172
+			$box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox'];
2173 2173
 		} else {
2174 2174
 			$box_label = __('Publish', 'event_espresso');
2175 2175
 		}
2176 2176
 
2177
-		$box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this );
2177
+		$box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this);
2178 2178
 
2179
-		add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' );
2179
+		add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high');
2180 2180
 
2181 2181
 	}
2182 2182
 
@@ -2184,9 +2184,9 @@  discard block
 block discarded – undo
2184 2184
 
2185 2185
 	public function editor_overview() {
2186 2186
 		//if we have extra content set let's add it in if not make sure its empty
2187
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2188
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php';
2189
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2187
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2188
+		$template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php';
2189
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2190 2190
 	}
2191 2191
 
2192 2192
 
@@ -2202,8 +2202,8 @@  discard block
 block discarded – undo
2202 2202
 	 * @see $this->_set_publish_post_box_vars for param details
2203 2203
 	 * @since 4.6.0
2204 2204
 	 */
2205
-	public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) {
2206
-		$this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns );
2205
+	public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) {
2206
+		$this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns);
2207 2207
 	}
2208 2208
 
2209 2209
 
@@ -2231,17 +2231,17 @@  discard block
 block discarded – undo
2231 2231
 		$both_btns = true
2232 2232
 	) {
2233 2233
 		// if Save & Close, use a custom redirect URL or default to the main page?
2234
-		$save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url;
2234
+		$save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url;
2235 2235
 		// create the Save & Close and Save buttons
2236
-		$this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL );
2236
+		$this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL);
2237 2237
 		//if we have extra content set let's add it in if not make sure its empty
2238
-		$this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : '';
2238
+		$this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : '';
2239 2239
 
2240 2240
 
2241
-		if ( $delete && ! empty( $id )  ) {
2241
+		if ($delete && ! empty($id)) {
2242 2242
 			//make sure we have a default if just true is sent.
2243 2243
 			$delete = ! empty($delete) ? $delete : 'delete';
2244
-			$delete_link_args = array( $name => $id );
2244
+			$delete_link_args = array($name => $id);
2245 2245
 			$delete = $this->get_action_link_or_button(
2246 2246
 				$delete,
2247 2247
 				$delete,
@@ -2252,8 +2252,8 @@  discard block
 block discarded – undo
2252 2252
 			);
2253 2253
 		}
2254 2254
 
2255
-		$this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : '';
2256
-		if ( ! empty( $name ) && ! empty( $id ) ) {
2255
+		$this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : '';
2256
+		if ( ! empty($name) && ! empty($id)) {
2257 2257
 			$hidden_field_arr[$name] = array(
2258 2258
 				'type' => 'hidden',
2259 2259
 				'value' => $id
@@ -2263,7 +2263,7 @@  discard block
 block discarded – undo
2263 2263
 			$hf = '';
2264 2264
 		}
2265 2265
 		// add hidden field
2266
-		$this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf;
2266
+		$this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf;
2267 2267
 
2268 2268
 	}
2269 2269
 
@@ -2280,8 +2280,8 @@  discard block
 block discarded – undo
2280 2280
 		<noscript>
2281 2281
 			<div id="no-js-message" class="error">
2282 2282
 				<p style="font-size:1.3em;">
2283
-					<span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span>
2284
-					<?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?>
2283
+					<span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span>
2284
+					<?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?>
2285 2285
 				</p>
2286 2286
 			</div>
2287 2287
 		</noscript>
@@ -2301,7 +2301,7 @@  discard block
 block discarded – undo
2301 2301
 	*		@return 		string
2302 2302
 	*/
2303 2303
 	private function _display_espresso_notices() {
2304
-		$notices = $this->_get_transient( TRUE );
2304
+		$notices = $this->_get_transient(TRUE);
2305 2305
 		echo stripslashes($notices);
2306 2306
 	}
2307 2307
 
@@ -2353,11 +2353,11 @@  discard block
 block discarded – undo
2353 2353
 	 * @param string  $priority      give this metabox a priority (using accepted priorities for wp meta boxes)
2354 2354
 	 * @param boolean $create_func   default is true.  Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box.
2355 2355
 	 */
2356
-	public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) {
2357
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback );
2356
+	public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) {
2357
+		do_action('AHEE_log', __FILE__, __FUNCTION__, $callback);
2358 2358
 
2359 2359
 		//if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated.
2360
-		if ( empty( $callback_args ) && $create_func ) {
2360
+		if (empty($callback_args) && $create_func) {
2361 2361
 			$callback_args = array(
2362 2362
 				'template_path' => $this->_template_path,
2363 2363
 				'template_args' => $this->_template_args,
@@ -2367,7 +2367,7 @@  discard block
 block discarded – undo
2367 2367
 		//if $create_func is true (default) then we automatically create the function for displaying the actual meta box.  If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish)
2368 2368
 		$call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback;
2369 2369
 
2370
-		add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args );
2370
+		add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args);
2371 2371
 	}
2372 2372
 
2373 2373
 
@@ -2380,7 +2380,7 @@  discard block
 block discarded – undo
2380 2380
 	 */
2381 2381
 	public function display_admin_page_with_metabox_columns() {
2382 2382
 		$this->_template_args['post_body_content'] = $this->_template_args['admin_page_content'];
2383
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE);
2383
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE);
2384 2384
 
2385 2385
 		//the final wrapper
2386 2386
 		$this->admin_page_wrapper();
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 	 * @return void
2424 2424
 	 */
2425 2425
 	public function display_about_admin_page() {
2426
-		$this->_display_admin_page( FALSE, TRUE );
2426
+		$this->_display_admin_page(FALSE, TRUE);
2427 2427
 	}
2428 2428
 
2429 2429
 
@@ -2439,10 +2439,10 @@  discard block
 block discarded – undo
2439 2439
 	 * @return void
2440 2440
 	 */
2441 2441
 	private function _display_admin_page($sidebar = false, $about = FALSE) {
2442
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2442
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2443 2443
 
2444 2444
 		//custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages.
2445
-		do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' );
2445
+		do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes');
2446 2446
 
2447 2447
 		// set current wp page slug - looks like: event-espresso_page_event_categories
2448 2448
 		// keep in mind "event-espresso" COULD be something else if the top level menu label has been translated.
@@ -2452,19 +2452,19 @@  discard block
 block discarded – undo
2452 2452
             : 'espresso-default-admin';
2453 2453
 
2454 2454
         $template_path = $sidebar
2455
-            ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php'
2456
-            : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php';
2455
+            ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php'
2456
+            : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php';
2457 2457
 
2458
-		if ( defined('DOING_AJAX' ) && DOING_AJAX ){
2459
-			$template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php';
2458
+		if (defined('DOING_AJAX') && DOING_AJAX) {
2459
+			$template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php';
2460 2460
         }
2461 2461
 
2462
-        $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2462
+        $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path;
2463 2463
 
2464
-		$this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '';
2464
+		$this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '';
2465 2465
 		$this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '';
2466 2466
 		$this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '';
2467
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2467
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2468 2468
 
2469 2469
 
2470 2470
 		// the final template wrapper
@@ -2482,7 +2482,7 @@  discard block
 block discarded – undo
2482 2482
 	 * @return void
2483 2483
 	 * @throws \EE_Error
2484 2484
 	 */
2485
-	public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) {
2485
+	public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) {
2486 2486
 		//let's generate a default preview action button if there isn't one already present.
2487 2487
 		$this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso');
2488 2488
 		$buy_now_url = add_query_arg(
@@ -2495,7 +2495,7 @@  discard block
 block discarded – undo
2495 2495
 			),
2496 2496
 		'http://eventespresso.com/pricing/'
2497 2497
 		);
2498
-		$this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] )
2498
+		$this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button'])
2499 2499
 			? $this->get_action_link_or_button(
2500 2500
 				'',
2501 2501
 				'buy_now',
@@ -2505,13 +2505,13 @@  discard block
 block discarded – undo
2505 2505
 				true
2506 2506
 			)
2507 2507
 			: $this->_template_args['preview_action_button'];
2508
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php';
2508
+		$template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php';
2509 2509
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2510 2510
 			$template_path,
2511 2511
 			$this->_template_args,
2512 2512
 			true
2513 2513
 		);
2514
-		$this->_display_admin_page( $display_sidebar );
2514
+		$this->_display_admin_page($display_sidebar);
2515 2515
 	}
2516 2516
 
2517 2517
 
@@ -2545,49 +2545,49 @@  discard block
 block discarded – undo
2545 2545
 	 * @param boolean $sidebar whether to display with sidebar or not.
2546 2546
 	 * @return void
2547 2547
 	 */
2548
-	private function _display_admin_list_table_page( $sidebar = false ) {
2548
+	private function _display_admin_list_table_page($sidebar = false) {
2549 2549
 		//setup search attributes
2550 2550
 		$this->_set_search_attributes();
2551 2551
 		$this->_template_args['current_page'] = $this->_wp_page_slug;
2552
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php';
2552
+		$template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php';
2553 2553
 
2554
-		$this->_template_args['table_url'] = defined( 'DOING_AJAX')
2555
-			? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url )
2556
-			: add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url);
2554
+		$this->_template_args['table_url'] = defined('DOING_AJAX')
2555
+			? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url)
2556
+			: add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url);
2557 2557
 		$this->_template_args['list_table'] = $this->_list_table_object;
2558 2558
 		$this->_template_args['current_route'] = $this->_req_action;
2559
-		$this->_template_args['list_table_class'] = get_class( $this->_list_table_object );
2559
+		$this->_template_args['list_table_class'] = get_class($this->_list_table_object);
2560 2560
 
2561 2561
 		$ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback();
2562
-		if( ! empty( $ajax_sorting_callback )) {
2562
+		if ( ! empty($ajax_sorting_callback)) {
2563 2563
 			$sortable_list_table_form_fields = wp_nonce_field(
2564
-				$ajax_sorting_callback . '_nonce',
2565
-				$ajax_sorting_callback . '_nonce',
2564
+				$ajax_sorting_callback.'_nonce',
2565
+				$ajax_sorting_callback.'_nonce',
2566 2566
 				FALSE,
2567 2567
 				FALSE
2568 2568
 			);
2569 2569
 //			$reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce';
2570 2570
 //			$sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE );
2571
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />';
2572
-			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />';
2571
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />';
2572
+			$sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />';
2573 2573
 		} else {
2574 2574
 			$sortable_list_table_form_fields = '';
2575 2575
 		}
2576 2576
 
2577 2577
 		$this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields;
2578
-		$hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : '';
2579
-		$nonce_ref = $this->_req_action . '_nonce';
2580
-		$hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">';
2578
+		$hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : '';
2579
+		$nonce_ref = $this->_req_action.'_nonce';
2580
+		$hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">';
2581 2581
 		$this->_template_args['list_table_hidden_fields'] = $hidden_form_fields;
2582 2582
 
2583 2583
 		//display message about search results?
2584 2584
 		$this->_template_args['before_list_table'] .= apply_filters(
2585 2585
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg',
2586
-			! empty( $this->_req_data['s'] )
2587
-				? '<p class="ee-search-results">' . sprintf(
2588
-					__( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ),
2589
-					trim( $this->_req_data['s'], '%' )
2590
-					) . '</p>'
2586
+			! empty($this->_req_data['s'])
2587
+				? '<p class="ee-search-results">'.sprintf(
2588
+					__('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'),
2589
+					trim($this->_req_data['s'], '%')
2590
+					).'</p>'
2591 2591
 				: '',
2592 2592
 			$this->page_slug,
2593 2593
 			$this->_req_data,
@@ -2599,7 +2599,7 @@  discard block
 block discarded – undo
2599 2599
 			true
2600 2600
 		);
2601 2601
 		// the final template wrapper
2602
-		if ( $sidebar )
2602
+		if ($sidebar)
2603 2603
 			$this->display_admin_page_with_sidebar();
2604 2604
 		else
2605 2605
 			$this->display_admin_page_with_no_sidebar();
@@ -2622,9 +2622,9 @@  discard block
 block discarded – undo
2622 2622
 	 * @param  array $items  see above for format of array
2623 2623
 	 * @return string        html string of legend
2624 2624
 	 */
2625
-	protected function _display_legend( $items ) {
2626
-		$this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this );
2627
-		$legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php';
2625
+	protected function _display_legend($items) {
2626
+		$this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this);
2627
+		$legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php';
2628 2628
 		return EEH_Template::display_template($legend_template, $this->_template_args, TRUE);
2629 2629
 	}
2630 2630
 
@@ -2649,33 +2649,33 @@  discard block
 block discarded – undo
2649 2649
 	 *
2650 2650
 	 * @return void
2651 2651
 	 */
2652
-	protected function _return_json( $sticky_notices = false ) {
2652
+	protected function _return_json($sticky_notices = false) {
2653 2653
 
2654 2654
 		//make sure any EE_Error notices have been handled.
2655
-		$this->_process_notices( array(), true, $sticky_notices );
2655
+		$this->_process_notices(array(), true, $sticky_notices);
2656 2656
 
2657 2657
 
2658
-		$data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array();
2658
+		$data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array();
2659 2659
 		unset($this->_template_args['data']);
2660 2660
 		$json = array(
2661
-			'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false,
2662
-			'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false,
2663
-			'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false,
2664
-			'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false,
2661
+			'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false,
2662
+			'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false,
2663
+			'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false,
2664
+			'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false,
2665 2665
 			'notices' => EE_Error::get_notices(),
2666
-			'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '',
2667
-			'data' => array_merge( $data, array('template_args' => $this->_template_args ) ),
2666
+			'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '',
2667
+			'data' => array_merge($data, array('template_args' => $this->_template_args)),
2668 2668
 			'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
2669 2669
 			);
2670 2670
 
2671 2671
 
2672 2672
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2673
-		if ( NULL === error_get_last() || ! headers_sent() )
2673
+		if (NULL === error_get_last() || ! headers_sent())
2674 2674
 			header('Content-Type: application/json; charset=UTF-8');
2675
-                if( function_exists( 'wp_json_encode' ) ) {
2676
-                    echo wp_json_encode( $json );
2675
+                if (function_exists('wp_json_encode')) {
2676
+                    echo wp_json_encode($json);
2677 2677
                 } else {
2678
-                    echo json_encode( $json );
2678
+                    echo json_encode($json);
2679 2679
                 }
2680 2680
 		exit();
2681 2681
 	}
@@ -2689,11 +2689,11 @@  discard block
 block discarded – undo
2689 2689
 	 * @throws EE_Error
2690 2690
 	 */
2691 2691
 	public function return_json() {
2692
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2692
+		if (defined('DOING_AJAX') && DOING_AJAX)
2693 2693
 			$this->_return_json();
2694 2694
 
2695 2695
 		else {
2696
-			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2696
+			throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__));
2697 2697
 		}
2698 2698
 	}
2699 2699
 
@@ -2706,7 +2706,7 @@  discard block
 block discarded – undo
2706 2706
 	 *
2707 2707
 	 * @access   public
2708 2708
 	 */
2709
-	public function set_hook_object( EE_Admin_Hooks $hook_obj ) {
2709
+	public function set_hook_object(EE_Admin_Hooks $hook_obj) {
2710 2710
 		$this->_hook_obj = $hook_obj;
2711 2711
 	}
2712 2712
 
@@ -2722,33 +2722,33 @@  discard block
 block discarded – undo
2722 2722
 	*/
2723 2723
 	public function admin_page_wrapper($about = FALSE) {
2724 2724
 
2725
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2725
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2726 2726
 
2727 2727
 		$this->_nav_tabs = $this->_get_main_nav_tabs();
2728 2728
 
2729 2729
 		$this->_template_args['nav_tabs'] = $this->_nav_tabs;
2730 2730
 		$this->_template_args['admin_page_title'] = $this->_admin_page_title;
2731 2731
 
2732
-		$this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : '');
2733
-		$this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : '');
2732
+		$this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : '');
2733
+		$this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : '');
2734 2734
 
2735 2735
 		$this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content();
2736 2736
 
2737 2737
 
2738 2738
 
2739 2739
 		// load settings page wrapper template
2740
-		$template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php';
2740
+		$template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php';
2741 2741
 
2742 2742
 		//about page?
2743
-		$template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path;
2743
+		$template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path;
2744 2744
 
2745 2745
 
2746
-		if ( defined( 'DOING_AJAX' ) ) {
2747
-			$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2746
+		if (defined('DOING_AJAX')) {
2747
+			$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2748 2748
 
2749 2749
 			$this->_return_json();
2750 2750
 		} else {
2751
-			EEH_Template::display_template( $template_path, $this->_template_args );
2751
+			EEH_Template::display_template($template_path, $this->_template_args);
2752 2752
 		}
2753 2753
 
2754 2754
 	}
@@ -2774,7 +2774,7 @@  discard block
 block discarded – undo
2774 2774
 	 * @param $b
2775 2775
 	 * @return int
2776 2776
 	 */
2777
-	private function _sort_nav_tabs( $a, $b ) {
2777
+	private function _sort_nav_tabs($a, $b) {
2778 2778
 		if ($a['order'] == $b['order']) {
2779 2779
 	        return 0;
2780 2780
 	    }
@@ -2794,7 +2794,7 @@  discard block
 block discarded – undo
2794 2794
 	 * 	@uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php)
2795 2795
 	 * 	@uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php)
2796 2796
 	 */
2797
-	protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) {
2797
+	protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) {
2798 2798
 		$content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars);
2799 2799
 		return $content;
2800 2800
 	}
@@ -2816,25 +2816,25 @@  discard block
 block discarded – undo
2816 2816
 	 * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button).  We can also use this to just dump default actions by submitting some other value.
2817 2817
 	 * @param bool|string|null $referrer if false then we just do the default action on save and close.  Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling).
2818 2818
 	 */
2819
-	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) {
2819
+	protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) {
2820 2820
 		//make sure $text and $actions are in an array
2821 2821
 		$text = (array) $text;
2822 2822
 		$actions = (array) $actions;
2823 2823
 		$referrer_url = empty($referrer) ? '' : $referrer;
2824
-		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />';
2824
+		$referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />';
2825 2825
 
2826
-		$button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') );
2827
-		$default_names = array( 'save', 'save_and_close' );
2826
+		$button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso'));
2827
+		$default_names = array('save', 'save_and_close');
2828 2828
 
2829 2829
 		//add in a hidden index for the current page (so save and close redirects properly)
2830 2830
 		$this->_template_args['save_buttons'] = $referrer_url;
2831 2831
 
2832
-		foreach ( $button_text as $key => $button ) {
2832
+		foreach ($button_text as $key => $button) {
2833 2833
 			$ref = $default_names[$key];
2834
-			$id = $this->_current_view . '_' . $ref;
2835
-			$name = !empty($actions) ? $actions[$key] : $ref;
2836
-			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2837
-			if ( !$both ) break;
2834
+			$id = $this->_current_view.'_'.$ref;
2835
+			$name = ! empty($actions) ? $actions[$key] : $ref;
2836
+			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />';
2837
+			if ( ! $both) break;
2838 2838
 		}
2839 2839
 
2840 2840
 	}
@@ -2849,8 +2849,8 @@  discard block
 block discarded – undo
2849 2849
 	 * @param string $route
2850 2850
 	 * @param array  $additional_hidden_fields
2851 2851
 	 */
2852
-	public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2853
-		$this->_set_add_edit_form_tags( $route, $additional_hidden_fields );
2852
+	public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2853
+		$this->_set_add_edit_form_tags($route, $additional_hidden_fields);
2854 2854
 	}
2855 2855
 
2856 2856
 
@@ -2863,30 +2863,30 @@  discard block
 block discarded – undo
2863 2863
 	 * @param array $additional_hidden_fields any additional hidden fields required in the form header
2864 2864
 	 * @return void
2865 2865
 	 */
2866
-	protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) {
2866
+	protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) {
2867 2867
 
2868
-		if ( empty( $route )) {
2868
+		if (empty($route)) {
2869 2869
 			$user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso');
2870
-			$dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ );
2871
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
2870
+			$dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__);
2871
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
2872 2872
 		}
2873 2873
 		// open form
2874
-		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >';
2874
+		$this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >';
2875 2875
 		// add nonce
2876
-		$nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE );
2876
+		$nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE);
2877 2877
 //		$nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE );
2878
-		$this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce;
2878
+		$this->_template_args['before_admin_page_content'] .= "\n\t".$nonce;
2879 2879
 		// add REQUIRED form action
2880 2880
 		$hidden_fields = array(
2881
-				'action' => array( 'type' => 'hidden', 'value' => $route ),
2881
+				'action' => array('type' => 'hidden', 'value' => $route),
2882 2882
 			);
2883 2883
 		// merge arrays
2884
-		$hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields;
2884
+		$hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields;
2885 2885
 		// generate form fields
2886
-		$form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' );
2886
+		$form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array');
2887 2887
 		// add fields to form
2888
-		foreach ( (array)$form_fields as $field_name => $form_field ) {
2889
-			$this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field'];
2888
+		foreach ((array) $form_fields as $field_name => $form_field) {
2889
+			$this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field'];
2890 2890
 		}
2891 2891
 
2892 2892
 		// close form
@@ -2903,8 +2903,8 @@  discard block
 block discarded – undo
2903 2903
 	 * @see EE_Admin_Page::_redirect_after_action() for params.
2904 2904
 	 * @since 4.5.0
2905 2905
 	 */
2906
-	public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2907
-		$this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite );
2906
+	public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2907
+		$this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite);
2908 2908
 	}
2909 2909
 
2910 2910
 
@@ -2920,38 +2920,38 @@  discard block
 block discarded – undo
2920 2920
 	 *	@access protected
2921 2921
 	 *	@return void
2922 2922
 	 */
2923
-	protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) {
2923
+	protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) {
2924 2924
 
2925
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2925
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2926 2926
 
2927 2927
 		//class name for actions/filters.
2928 2928
 		$classname = get_class($this);
2929 2929
 
2930 2930
 		//set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url
2931
-		$redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url;
2932
-		$notices = EE_Error::get_notices( FALSE );
2931
+		$redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url;
2932
+		$notices = EE_Error::get_notices(FALSE);
2933 2933
 
2934 2934
 		// overwrite default success messages //BUT ONLY if overwrite not overridden
2935
-		if ( ! $override_overwrite || ! empty( $notices['errors'] )) {
2935
+		if ( ! $override_overwrite || ! empty($notices['errors'])) {
2936 2936
 			EE_Error::overwrite_success();
2937 2937
 		}
2938
-		if ( ! empty( $what ) && ! empty( $action_desc ) ) {
2938
+		if ( ! empty($what) && ! empty($action_desc)) {
2939 2939
 			// how many records affected ? more than one record ? or just one ?
2940
-			if ( $success > 1 && empty( $notices[ 'errors' ] ) ) {
2940
+			if ($success > 1 && empty($notices['errors'])) {
2941 2941
 				// set plural msg
2942 2942
 				EE_Error::add_success(
2943 2943
 					sprintf(
2944
-						__( 'The "%s" have been successfully %s.', 'event_espresso' ),
2944
+						__('The "%s" have been successfully %s.', 'event_espresso'),
2945 2945
 						$what,
2946 2946
 						$action_desc
2947 2947
 					),
2948 2948
 					__FILE__, __FUNCTION__, __LINE__
2949 2949
 				);
2950
-			} else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) {
2950
+			} else if ($success == 1 && empty($notices['errors'])) {
2951 2951
 				// set singular msg
2952 2952
 				EE_Error::add_success(
2953 2953
 					sprintf(
2954
-						__( 'The "%s" has been successfully %s.', 'event_espresso' ),
2954
+						__('The "%s" has been successfully %s.', 'event_espresso'),
2955 2955
 						$what,
2956 2956
 						$action_desc
2957 2957
 					),
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
 			}
2961 2961
 		}
2962 2962
 		// check that $query_args isn't something crazy
2963
-		if ( ! is_array( $query_args )) {
2963
+		if ( ! is_array($query_args)) {
2964 2964
 			$query_args = array();
2965 2965
 		}
2966 2966
 
@@ -2973,36 +2973,36 @@  discard block
 block discarded – undo
2973 2973
 		 * @param array $query_args   The original query_args array coming into the
2974 2974
 		 *                          		method.
2975 2975
 		 */
2976
-		do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args );
2976
+		do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args);
2977 2977
 
2978 2978
 		//calculate where we're going (if we have a "save and close" button pushed)
2979
-		if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) {
2979
+		if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) {
2980 2980
 			// even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce
2981
-			$parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] );
2981
+			$parsed_url = parse_url($this->_req_data['save_and_close_referrer']);
2982 2982
 			// regenerate query args array from referrer URL
2983
-			parse_str( $parsed_url['query'], $query_args );
2983
+			parse_str($parsed_url['query'], $query_args);
2984 2984
 			// correct page and action will be in the query args now
2985
-			$redirect_url = admin_url( 'admin.php' );
2985
+			$redirect_url = admin_url('admin.php');
2986 2986
 		}
2987 2987
 
2988 2988
 		//merge any default query_args set in _default_route_query_args property
2989
-		if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) {
2989
+		if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) {
2990 2990
 			$args_to_merge = array();
2991
-			foreach ( $this->_default_route_query_args as $query_param => $query_value ) {
2991
+			foreach ($this->_default_route_query_args as $query_param => $query_value) {
2992 2992
 				//is there a wp_referer array in our _default_route_query_args property?
2993
-				if ( $query_param == 'wp_referer'  ) {
2993
+				if ($query_param == 'wp_referer') {
2994 2994
 					$query_value = (array) $query_value;
2995
-					foreach ( $query_value as $reference => $value ) {
2996
-						if ( strpos( $reference, 'nonce' ) !== false ) {
2995
+					foreach ($query_value as $reference => $value) {
2996
+						if (strpos($reference, 'nonce') !== false) {
2997 2997
 							continue;
2998 2998
 						}
2999 2999
 
3000 3000
 						//finally we will override any arguments in the referer with
3001 3001
 						//what might be set on the _default_route_query_args array.
3002
-						if ( isset( $this->_default_route_query_args[$reference] ) ) {
3003
-							$args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] );
3002
+						if (isset($this->_default_route_query_args[$reference])) {
3003
+							$args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]);
3004 3004
 						} else {
3005
-							$args_to_merge[$reference] = urlencode( $value );
3005
+							$args_to_merge[$reference] = urlencode($value);
3006 3006
 						}
3007 3007
 					}
3008 3008
 					continue;
@@ -3013,7 +3013,7 @@  discard block
 block discarded – undo
3013 3013
 
3014 3014
 			//now let's merge these arguments but override with what was specifically sent in to the
3015 3015
 			//redirect.
3016
-			$query_args = array_merge( $args_to_merge, $query_args );
3016
+			$query_args = array_merge($args_to_merge, $query_args);
3017 3017
 		}
3018 3018
 
3019 3019
 		$this->_process_notices($query_args);
@@ -3022,19 +3022,19 @@  discard block
 block discarded – undo
3022 3022
 		// generate redirect url
3023 3023
 
3024 3024
 		// if redirecting to anything other than the main page, add a nonce
3025
-		if ( isset( $query_args['action'] )) {
3025
+		if (isset($query_args['action'])) {
3026 3026
 			// manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars
3027
-			$query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' );
3027
+			$query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce');
3028 3028
 		}
3029 3029
 
3030 3030
 		//we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that).
3031
-		do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args );
3031
+		do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args);
3032 3032
 
3033
-		$redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args );
3033
+		$redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args);
3034 3034
 
3035 3035
 
3036 3036
 		// check if we're doing ajax.  If we are then lets just return the results and js can handle how it wants.
3037
-		if ( defined('DOING_AJAX' ) ) {
3037
+		if (defined('DOING_AJAX')) {
3038 3038
 			$default_data = array(
3039 3039
 				'close' => TRUE,
3040 3040
 				'redirect_url' => $redirect_url,
@@ -3043,11 +3043,11 @@  discard block
 block discarded – undo
3043 3043
 				);
3044 3044
 
3045 3045
 			$this->_template_args['success'] = $success;
3046
-			$this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data;
3046
+			$this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data;
3047 3047
 			$this->_return_json();
3048 3048
 		}
3049 3049
 
3050
-		wp_safe_redirect( $redirect_url );
3050
+		wp_safe_redirect($redirect_url);
3051 3051
 		exit();
3052 3052
 	}
3053 3053
 
@@ -3063,30 +3063,30 @@  discard block
 block discarded – undo
3063 3063
 	 * @param bool    $sticky_notices      This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice.
3064 3064
 	 * @return void
3065 3065
 	 */
3066
-	protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) {
3066
+	protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) {
3067 3067
 
3068 3068
 		//first let's set individual error properties if doing_ajax and the properties aren't already set.
3069
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3070
-			$notices = EE_Error::get_notices( false );
3071
-			if ( empty( $this->_template_args['success'] ) ) {
3072
-				$this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false;
3069
+		if (defined('DOING_AJAX') && DOING_AJAX) {
3070
+			$notices = EE_Error::get_notices(false);
3071
+			if (empty($this->_template_args['success'])) {
3072
+				$this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false;
3073 3073
 			}
3074 3074
 
3075
-			if ( empty( $this->_template_args['errors'] ) ) {
3076
-				$this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false;
3075
+			if (empty($this->_template_args['errors'])) {
3076
+				$this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false;
3077 3077
 			}
3078 3078
 
3079
-			if ( empty( $this->_template_args['attention'] ) ) {
3080
-				$this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false;
3079
+			if (empty($this->_template_args['attention'])) {
3080
+				$this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false;
3081 3081
 			}
3082 3082
 		}
3083 3083
 
3084 3084
 		$this->_template_args['notices'] = EE_Error::get_notices();
3085 3085
 
3086 3086
 		//IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true)
3087
-		if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) {
3088
-			$route = isset( $query_args['action'] ) ? $query_args['action'] : 'default';
3089
-			$this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify );
3087
+		if ( ! defined('DOING_AJAX') || $sticky_notices) {
3088
+			$route = isset($query_args['action']) ? $query_args['action'] : 'default';
3089
+			$this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify);
3090 3090
 		}
3091 3091
 	}
3092 3092
 
@@ -3116,7 +3116,7 @@  discard block
 block discarded – undo
3116 3116
 		$exclude_nonce = false
3117 3117
 	) {
3118 3118
 		//first let's validate the action (if $base_url is FALSE otherwise validation will happen further along)
3119
-		if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) {
3119
+		if (empty($base_url) && ! isset($this->_page_routes[$action])) {
3120 3120
 			throw new EE_Error(
3121 3121
 				sprintf(
3122 3122
 					__(
@@ -3127,7 +3127,7 @@  discard block
 block discarded – undo
3127 3127
 				)
3128 3128
 			);
3129 3129
 		}
3130
-		if ( ! isset( $this->_labels['buttons'][ $type ] ) ) {
3130
+		if ( ! isset($this->_labels['buttons'][$type])) {
3131 3131
 			throw new EE_Error(
3132 3132
 				sprintf(
3133 3133
 					__(
@@ -3139,8 +3139,8 @@  discard block
 block discarded – undo
3139 3139
 			);
3140 3140
 		}
3141 3141
 		//finally check user access for this button.
3142
-		$has_access = $this->check_user_access( $action, true );
3143
-		if ( ! $has_access ) {
3142
+		$has_access = $this->check_user_access($action, true);
3143
+		if ( ! $has_access) {
3144 3144
 			return '';
3145 3145
 		}
3146 3146
 		$_base_url = ! $base_url ? $this->_admin_base_url : $base_url;
@@ -3148,11 +3148,11 @@  discard block
 block discarded – undo
3148 3148
 			'action' => $action
3149 3149
 		);
3150 3150
 		//merge extra_request args but make sure our original action takes precedence and doesn't get overwritten.
3151
-		if ( ! empty( $extra_request ) ) {
3152
-			$query_args = array_merge( $extra_request, $query_args );
3151
+		if ( ! empty($extra_request)) {
3152
+			$query_args = array_merge($extra_request, $query_args);
3153 3153
 		}
3154
-		$url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce );
3155
-		return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class );
3154
+		$url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce);
3155
+		return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class);
3156 3156
 	}
3157 3157
 
3158 3158
 
@@ -3167,11 +3167,11 @@  discard block
 block discarded – undo
3167 3167
 		$args = array(
3168 3168
 			'label' => $this->_admin_page_title,
3169 3169
 			'default' => 10,
3170
-			'option' => $this->_current_page . '_' . $this->_current_view . '_per_page'
3170
+			'option' => $this->_current_page.'_'.$this->_current_view.'_per_page'
3171 3171
 			);
3172 3172
 		//ONLY add the screen option if the user has access to it.
3173
-		if ( $this->check_user_access( $this->_current_view, true ) ) {
3174
-			add_screen_option( $option, $args );
3173
+		if ($this->check_user_access($this->_current_view, true)) {
3174
+			add_screen_option($option, $args);
3175 3175
 		}
3176 3176
 	}
3177 3177
 
@@ -3187,36 +3187,36 @@  discard block
 block discarded – undo
3187 3187
 	 * @return void
3188 3188
 	 */
3189 3189
 	private function _set_per_page_screen_options() {
3190
-		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3191
-			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3190
+		if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
3191
+			check_admin_referer('screen-options-nonce', 'screenoptionnonce');
3192 3192
 
3193
-			if ( !$user = wp_get_current_user() )
3193
+			if ( ! $user = wp_get_current_user())
3194 3194
 			return;
3195 3195
 			$option = $_POST['wp_screen_options']['option'];
3196 3196
 			$value = $_POST['wp_screen_options']['value'];
3197 3197
 
3198
-			if ( $option != sanitize_key( $option ) )
3198
+			if ($option != sanitize_key($option))
3199 3199
 				return;
3200 3200
 
3201 3201
 			$map_option = $option;
3202 3202
 
3203 3203
 			$option = str_replace('-', '_', $option);
3204 3204
 
3205
-			switch ( $map_option ) {
3206
-				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3205
+			switch ($map_option) {
3206
+				case $this->_current_page.'_'.$this->_current_view.'_per_page':
3207 3207
 					$value = (int) $value;
3208
-					if ( $value < 1 || $value > 999 )
3208
+					if ($value < 1 || $value > 999)
3209 3209
 						return;
3210 3210
 					break;
3211 3211
 				default:
3212
-					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3213
-					if ( false === $value )
3212
+					$value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value);
3213
+					if (false === $value)
3214 3214
 						return;
3215 3215
 					break;
3216 3216
 			}
3217 3217
 
3218 3218
 			update_user_meta($user->ID, $option, $value);
3219
-			wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) );
3219
+			wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()));
3220 3220
 			exit;
3221 3221
 		}
3222 3222
 	}
@@ -3227,8 +3227,8 @@  discard block
 block discarded – undo
3227 3227
 	 * This just allows for setting the $_template_args property if it needs to be set outside the object
3228 3228
 	 * @param array $data array that will be assigned to template args.
3229 3229
 	 */
3230
-	public function set_template_args( $data ) {
3231
-		$this->_template_args = array_merge( $this->_template_args, (array) $data );
3230
+	public function set_template_args($data) {
3231
+		$this->_template_args = array_merge($this->_template_args, (array) $data);
3232 3232
 	}
3233 3233
 
3234 3234
 
@@ -3244,26 +3244,26 @@  discard block
 block discarded – undo
3244 3244
 	 * @param bool $skip_route_verify Used to indicate we want to skip route verification.  This is usually ONLY used when we are adding a transient before page_routes have been defined.
3245 3245
 	 * @return void
3246 3246
 	 */
3247
-	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3247
+	protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) {
3248 3248
 		$user_id = get_current_user_id();
3249 3249
 
3250
-		if ( !$skip_route_verify )
3250
+		if ( ! $skip_route_verify)
3251 3251
 			$this->_verify_route($route);
3252 3252
 
3253 3253
 
3254 3254
 		//now let's set the string for what kind of transient we're setting
3255
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3256
-		$data = $notices ? array( 'notices' => $data ) : $data;
3255
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3256
+		$data = $notices ? array('notices' => $data) : $data;
3257 3257
 		//is there already a transient for this route?  If there is then let's ADD to that transient
3258
-		$existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3259
-		if ( $existing ) {
3260
-			$data = array_merge( (array) $data, (array) $existing );
3258
+		$existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3259
+		if ($existing) {
3260
+			$data = array_merge((array) $data, (array) $existing);
3261 3261
 		}
3262 3262
 
3263
-		if ( is_multisite() && is_network_admin() ) {
3264
-			set_site_transient( $transient, $data, 8 );
3263
+		if (is_multisite() && is_network_admin()) {
3264
+			set_site_transient($transient, $data, 8);
3265 3265
 		} else {
3266
-			set_transient( $transient, $data, 8 );
3266
+			set_transient($transient, $data, 8);
3267 3267
 		}
3268 3268
 	}
3269 3269
 
@@ -3275,18 +3275,18 @@  discard block
 block discarded – undo
3275 3275
 	 * @param bool $notices true we get notices transient. False we just return normal route transient
3276 3276
 	 * @return mixed data
3277 3277
 	 */
3278
-	protected function _get_transient( $notices = FALSE, $route = FALSE ) {
3278
+	protected function _get_transient($notices = FALSE, $route = FALSE) {
3279 3279
 		$user_id = get_current_user_id();
3280
-		$route = !$route ? $this->_req_action : $route;
3281
-		$transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id;
3282
-		$data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient );
3280
+		$route = ! $route ? $this->_req_action : $route;
3281
+		$transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id;
3282
+		$data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient);
3283 3283
 		//delete transient after retrieval (just in case it hasn't expired);
3284
-		if ( is_multisite() && is_network_admin() ) {
3285
-			delete_site_transient( $transient );
3284
+		if (is_multisite() && is_network_admin()) {
3285
+			delete_site_transient($transient);
3286 3286
 		} else {
3287
-			delete_transient( $transient );
3287
+			delete_transient($transient);
3288 3288
 		}
3289
-		return $notices && isset( $data['notices'] ) ? $data['notices'] : $data;
3289
+		return $notices && isset($data['notices']) ? $data['notices'] : $data;
3290 3290
 	}
3291 3291
 
3292 3292
 
@@ -3303,12 +3303,12 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 		//retrieve all existing transients
3305 3305
 		$query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'";
3306
-		if ( $results = $wpdb->get_results( $query ) ) {
3307
-			foreach ( $results as $result ) {
3308
-				$transient = str_replace( '_transient_', '', $result->option_name );
3309
-				get_transient( $transient );
3310
-				if ( is_multisite() && is_network_admin() ) {
3311
-					get_site_transient( $transient );
3306
+		if ($results = $wpdb->get_results($query)) {
3307
+			foreach ($results as $result) {
3308
+				$transient = str_replace('_transient_', '', $result->option_name);
3309
+				get_transient($transient);
3310
+				if (is_multisite() && is_network_admin()) {
3311
+					get_site_transient($transient);
3312 3312
 				}
3313 3313
 			}
3314 3314
 		}
@@ -3458,23 +3458,23 @@  discard block
 block discarded – undo
3458 3458
 	 * @param string                   $line line no where error occurred
3459 3459
 	 * @return boolean
3460 3460
 	 */
3461
-	protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) {
3461
+	protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') {
3462 3462
 
3463 3463
 		//remove any options that are NOT going to be saved with the config settings.
3464
-		if ( isset( $config->core->ee_ueip_optin ) ) {
3464
+		if (isset($config->core->ee_ueip_optin)) {
3465 3465
 			$config->core->ee_ueip_has_notified = TRUE;
3466 3466
 			// TODO: remove the following two lines and make sure values are migrated from 3.1
3467
-			update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin);
3468
-			update_option( 'ee_ueip_has_notified', TRUE );
3467
+			update_option('ee_ueip_optin', $config->core->ee_ueip_optin);
3468
+			update_option('ee_ueip_has_notified', TRUE);
3469 3469
 		}
3470 3470
 		// and save it (note we're also doing the network save here)
3471
-		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE;
3472
-		$config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE );
3473
-		if ( $config_saved && $net_saved ) {
3474
-			EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab ));
3471
+		$net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE;
3472
+		$config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE);
3473
+		if ($config_saved && $net_saved) {
3474
+			EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab));
3475 3475
 			return TRUE;
3476 3476
 		} else {
3477
-			EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line  );
3477
+			EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line);
3478 3478
 			return FALSE;
3479 3479
 		}
3480 3480
 	}
@@ -3487,7 +3487,7 @@  discard block
 block discarded – undo
3487 3487
 	 * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument.
3488 3488
 	 * @return array
3489 3489
 	 */
3490
-	public function get_yes_no_values(){
3490
+	public function get_yes_no_values() {
3491 3491
 		return $this->_yes_no_values;
3492 3492
 	}
3493 3493
 
@@ -3509,8 +3509,8 @@  discard block
 block discarded – undo
3509 3509
 	 *
3510 3510
 	 * @return string
3511 3511
 	 */
3512
-	protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) {
3513
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3512
+	protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') {
3513
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3514 3514
 	}
3515 3515
 
3516 3516
 
@@ -3524,8 +3524,8 @@  discard block
 block discarded – undo
3524 3524
 	 *
3525 3525
 	 * @return string
3526 3526
 	 */
3527
-	protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) {
3528
-		return '<a class="' . $class . '" href="' . $url . '"></a>';
3527
+	protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') {
3528
+		return '<a class="'.$class.'" href="'.$url.'"></a>';
3529 3529
 	}
3530 3530
 
3531 3531
 
@@ -3544,8 +3544,8 @@  discard block
 block discarded – undo
3544 3544
 	 * @return bool success/fail
3545 3545
 	 */
3546 3546
 	protected function _process_resend_registration() {
3547
-		$this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data );
3548
-		do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data );
3547
+		$this->_template_args['success'] = EED_Messages::process_resend($this->_req_data);
3548
+		do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data);
3549 3549
 		return $this->_template_args['success'];
3550 3550
 	}
3551 3551
 
@@ -3558,11 +3558,11 @@  discard block
 block discarded – undo
3558 3558
 	 * @param \EE_Payment $payment
3559 3559
 	 * @return bool success/fail
3560 3560
 	 */
3561
-	protected function _process_payment_notification( EE_Payment $payment ) {
3562
-		add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' );
3563
-		do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment );
3564
-		$this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment );
3565
-		return $this->_template_args[ 'success' ];
3561
+	protected function _process_payment_notification(EE_Payment $payment) {
3562
+		add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true');
3563
+		do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment);
3564
+		$this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment);
3565
+		return $this->_template_args['success'];
3566 3566
 	}
3567 3567
 
3568 3568
 
Please login to merge, or discard this patch.
Braces   +134 added lines, -84 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -160,8 +162,9 @@  discard block
 block discarded – undo
160 162
 	 */
161 163
 	public function __construct( $routing = TRUE ) {
162 164
 
163
-		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false )
164
-			$this->_is_caf = TRUE;
165
+		if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) {
166
+					$this->_is_caf = TRUE;
167
+		}
165 168
 
166 169
 		$this->_yes_no_values = array(
167 170
 			array('id' => TRUE, 'text' => __('Yes', 'event_espresso')),
@@ -192,8 +195,9 @@  discard block
 block discarded – undo
192 195
 		$this->_do_other_page_hooks();
193 196
 
194 197
 		//This just allows us to have extending clases do something specific before the parent constructor runs _page_setup.
195
-		if ( method_exists( $this, '_before_page_setup' ) )
196
-			$this->_before_page_setup();
198
+		if ( method_exists( $this, '_before_page_setup' ) ) {
199
+					$this->_before_page_setup();
200
+		}
197 201
 
198 202
 		//set up page dependencies
199 203
 		$this->_page_setup();
@@ -500,7 +504,9 @@  discard block
 block discarded – undo
500 504
 		global $ee_menu_slugs;
501 505
 		$ee_menu_slugs = (array) $ee_menu_slugs;
502 506
 
503
-		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE;
507
+		if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) {
508
+			return FALSE;
509
+		}
504 510
 
505 511
 
506 512
 		// becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first
@@ -535,12 +541,14 @@  discard block
 block discarded – undo
535 541
 		}
536 542
 
537 543
 		//for caffeinated and other extended functionality.  If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays
538
-		if ( method_exists( $this, '_extend_page_config' ) )
539
-			$this->_extend_page_config();
544
+		if ( method_exists( $this, '_extend_page_config' ) ) {
545
+					$this->_extend_page_config();
546
+		}
540 547
 
541 548
 		//for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays.
542
-		if ( method_exists( $this, '_extend_page_config_for_cpt' ) )
543
-			$this->_extend_page_config_for_cpt();
549
+		if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) {
550
+					$this->_extend_page_config_for_cpt();
551
+		}
544 552
 
545 553
 		//filter routes and page_config so addons can add their stuff. Filtering done per class
546 554
 		$this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this );
@@ -656,8 +664,9 @@  discard block
 block discarded – undo
656 664
 		//add screen options - global, page child class, and view specific
657 665
 		$this->_add_global_screen_options();
658 666
 		$this->_add_screen_options();
659
-		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) )
660
-			call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
667
+		if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) {
668
+					call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) );
669
+		}
661 670
 
662 671
 
663 672
 		//add help tab(s) and tours- set via page_config and qtips.
@@ -668,28 +677,32 @@  discard block
 block discarded – undo
668 677
 		//add feature_pointers - global, page child class, and view specific
669 678
 		$this->_add_feature_pointers();
670 679
 		$this->_add_global_feature_pointers();
671
-		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) )
672
-			call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
680
+		if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) {
681
+					call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) );
682
+		}
673 683
 
674 684
 		//enqueue scripts/styles - global, page class, and view specific
675 685
 		add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 );
676 686
 		add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 );
677
-		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) )
678
-			add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
687
+		if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) {
688
+					add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 );
689
+		}
679 690
 
680 691
 		add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 );
681 692
 
682 693
 		//admin_print_footer_scripts - global, page child class, and view specific.  NOTE, despite the name, whenever possible, scripts should NOT be loaded using this.  In most cases that's doing_it_wrong().  But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these
683 694
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 );
684 695
 		add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 );
685
-		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) )
686
-			add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
696
+		if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) {
697
+					add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 );
698
+		}
687 699
 
688 700
 		//admin footer scripts
689 701
 		add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 );
690 702
 		add_action('admin_footer', array( $this, 'admin_footer'), 100 );
691
-		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) )
692
-			add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
703
+		if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) {
704
+					add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 );
705
+		}
693 706
 
694 707
 
695 708
 		do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug );
@@ -762,7 +775,9 @@  discard block
 block discarded – undo
762 775
 	protected function _verify_routes() {
763 776
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
764 777
 
765
-		if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE;
778
+		if ( !$this->_current_page && !defined( 'DOING_AJAX')) {
779
+			return FALSE;
780
+		}
766 781
 
767 782
 		$this->_route = FALSE;
768 783
 		$func = FALSE;
@@ -872,8 +887,9 @@  discard block
 block discarded – undo
872 887
 	 * @return void
873 888
 	 */
874 889
 	protected function _route_admin_request() {
875
-		if (  ! $this->_is_UI_request )
876
-			$this->_verify_routes();
890
+		if (  ! $this->_is_UI_request ) {
891
+					$this->_verify_routes();
892
+		}
877 893
 
878 894
 		$nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE;
879 895
 
@@ -883,8 +899,9 @@  discard block
 block discarded – undo
883 899
 			$this->_verify_nonce( $nonce, $this->_req_nonce );
884 900
 		}
885 901
 		//set the nav_tabs array but ONLY if this is  UI_request
886
-		if ( $this->_is_UI_request )
887
-			$this->_set_nav_tabs();
902
+		if ( $this->_is_UI_request ) {
903
+					$this->_set_nav_tabs();
904
+		}
888 905
 
889 906
 		// grab callback function
890 907
 		$func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route;
@@ -921,8 +938,9 @@  discard block
 block discarded – undo
921 938
 			}
922 939
 
923 940
 
924
-			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE )
925
-				throw new EE_Error( $error_msg );
941
+			if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) {
942
+							throw new EE_Error( $error_msg );
943
+			}
926 944
 		}
927 945
 
928 946
 		//if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route.
@@ -1049,8 +1067,9 @@  discard block
 block discarded – undo
1049 1067
 				$tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">';
1050 1068
 				foreach ( $this->_help_tour['tours'] as $tour ) {
1051 1069
 					//if this is the end tour then we don't need to setup a button
1052
-					if ( $tour instanceof EE_Help_Tour_final_stop )
1053
-						continue;
1070
+					if ( $tour instanceof EE_Help_Tour_final_stop ) {
1071
+											continue;
1072
+					}
1054 1073
 					$tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>';
1055 1074
 				}
1056 1075
 				$tour_buttons .= implode('<br />', $tb);
@@ -1060,8 +1079,9 @@  discard block
 block discarded – undo
1060 1079
 			// let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well.
1061 1080
 			if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) {
1062 1081
 				//check that the callback given is valid
1063
-				if ( !method_exists($this, $config['help_sidebar'] ) )
1064
-					throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1082
+				if ( !method_exists($this, $config['help_sidebar'] ) ) {
1083
+									throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option.  However the callback given (%s) is not a valid callback.  Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) );
1084
+				}
1065 1085
 
1066 1086
 				$content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) );
1067 1087
 
@@ -1085,18 +1105,23 @@  discard block
 block discarded – undo
1085 1105
 				}/**/
1086 1106
 
1087 1107
 
1088
-			if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route
1108
+			if ( !isset( $config['help_tabs'] ) ) {
1109
+				return;
1110
+			}
1111
+			//no help tabs for this route
1089 1112
 
1090 1113
 			foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) {
1091 1114
 				//we're here so there ARE help tabs!
1092 1115
 
1093 1116
 				//make sure we've got what we need
1094
-				if ( !isset( $cfg['title'] ) )
1095
-					throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1117
+				if ( !isset( $cfg['title'] ) ) {
1118
+									throw new EE_Error( __('The _page_config array is not set up properly for help tabs.  It is missing a title', 'event_espresso') );
1119
+				}
1096 1120
 
1097 1121
 
1098
-				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) )
1099
-					throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1122
+				if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) {
1123
+									throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') );
1124
+				}
1100 1125
 
1101 1126
 
1102 1127
 
@@ -1159,14 +1184,16 @@  discard block
 block discarded – undo
1159 1184
 		$this->_help_tour = array();
1160 1185
 
1161 1186
 		//exit early if help tours are turned off globally
1162
-		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) )
1163
-			return;
1187
+		if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) {
1188
+					return;
1189
+		}
1164 1190
 
1165 1191
 		//loop through _page_config to find any help_tour defined
1166 1192
 		foreach ( $this->_page_config as $route => $config ) {
1167 1193
 			//we're only going to set things up for this route
1168
-			if ( $route !== $this->_req_action )
1169
-				continue;
1194
+			if ( $route !== $this->_req_action ) {
1195
+							continue;
1196
+			}
1170 1197
 
1171 1198
 			if ( isset( $config['help_tour'] ) ) {
1172 1199
 
@@ -1201,8 +1228,9 @@  discard block
 block discarded – undo
1201 1228
 			}
1202 1229
 		}
1203 1230
 
1204
-		if ( !empty( $tours ) )
1205
-			$this->_help_tour['tours'] = $tours;
1231
+		if ( !empty( $tours ) ) {
1232
+					$this->_help_tour['tours'] = $tours;
1233
+		}
1206 1234
 
1207 1235
 		//thats it!  Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically.
1208 1236
 	}
@@ -1242,15 +1270,21 @@  discard block
 block discarded – undo
1242 1270
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1243 1271
 		$i = 0;
1244 1272
 		foreach ( $this->_page_config as $slug => $config ) {
1245
-			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) )
1246
-				continue; //no nav tab for this config
1273
+			if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) {
1274
+							continue;
1275
+			}
1276
+			//no nav tab for this config
1247 1277
 
1248 1278
 			//check for persistent flag
1249
-			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action )
1250
-				continue; //nav tab is only to appear when route requested.
1279
+			if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) {
1280
+							continue;
1281
+			}
1282
+			//nav tab is only to appear when route requested.
1251 1283
 
1252
-			if ( ! $this->check_user_access( $slug, TRUE ) )
1253
-				continue; //no nav tab becasue current user does not have access.
1284
+			if ( ! $this->check_user_access( $slug, TRUE ) ) {
1285
+							continue;
1286
+			}
1287
+			//no nav tab becasue current user does not have access.
1254 1288
 
1255 1289
 			$css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : '';
1256 1290
 			$this->_nav_tabs[$slug] = array(
@@ -1486,10 +1520,11 @@  discard block
 block discarded – undo
1486 1520
 			$content .= EEH_Template::display_template( $template_path, $template_args, TRUE );
1487 1521
 		}
1488 1522
 
1489
-		if ( $display )
1490
-			echo $content;
1491
-		else
1492
-			return $content;
1523
+		if ( $display ) {
1524
+					echo $content;
1525
+		} else {
1526
+					return $content;
1527
+		}
1493 1528
 	}
1494 1529
 
1495 1530
 
@@ -1506,8 +1541,9 @@  discard block
 block discarded – undo
1506 1541
 		$method_name = '_help_popup_content_' . $this->_req_action;
1507 1542
 
1508 1543
 		//if method doesn't exist let's get out.
1509
-		if ( !method_exists( $this, $method_name ) )
1510
-			return array();
1544
+		if ( !method_exists( $this, $method_name ) ) {
1545
+					return array();
1546
+		}
1511 1547
 
1512 1548
 		//k we're good to go let's retrieve the help array
1513 1549
 		$help_array = call_user_func( array( $this, $method_name ) );
@@ -1538,7 +1574,9 @@  discard block
 block discarded – undo
1538 1574
 	 */
1539 1575
 	protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) {
1540 1576
 
1541
-		if ( defined('DOING_AJAX') ) return;
1577
+		if ( defined('DOING_AJAX') ) {
1578
+			return;
1579
+		}
1542 1580
 
1543 1581
 		//let's check and see if there is any content set for this popup.  If there isn't then we'll include a default title and content so that developers know something needs to be corrected
1544 1582
 		$help_array = $this->_get_help_content();
@@ -1556,10 +1594,11 @@  discard block
 block discarded – undo
1556 1594
 		$content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>';
1557 1595
 		$content = $content . $help_content;
1558 1596
 
1559
-		if ( $display )
1560
-			echo $content;
1561
-		else
1562
-			return $content;
1597
+		if ( $display ) {
1598
+					echo $content;
1599
+		} else {
1600
+					return $content;
1601
+		}
1563 1602
 	}
1564 1603
 
1565 1604
 
@@ -1785,8 +1824,10 @@  discard block
 block discarded – undo
1785 1824
 	protected function _set_list_table() {
1786 1825
 
1787 1826
 		//first is this a list_table view?
1788
-		if ( !isset($this->_route_config['list_table']) )
1789
-			return; //not a list_table view so get out.
1827
+		if ( !isset($this->_route_config['list_table']) ) {
1828
+					return;
1829
+		}
1830
+		//not a list_table view so get out.
1790 1831
 
1791 1832
 		//list table functions are per view specific (because some admin pages might have more than one listtable!)
1792 1833
 
@@ -2152,8 +2193,9 @@  discard block
 block discarded – undo
2152 2193
 	protected function _espresso_sponsors_post_box() {
2153 2194
 
2154 2195
 		$show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE );
2155
-		if ( $show_sponsors )
2156
-			add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2196
+		if ( $show_sponsors ) {
2197
+					add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side');
2198
+		}
2157 2199
 	}
2158 2200
 
2159 2201
 
@@ -2599,10 +2641,11 @@  discard block
 block discarded – undo
2599 2641
 			true
2600 2642
 		);
2601 2643
 		// the final template wrapper
2602
-		if ( $sidebar )
2603
-			$this->display_admin_page_with_sidebar();
2604
-		else
2605
-			$this->display_admin_page_with_no_sidebar();
2644
+		if ( $sidebar ) {
2645
+					$this->display_admin_page_with_sidebar();
2646
+		} else {
2647
+					$this->display_admin_page_with_no_sidebar();
2648
+		}
2606 2649
 	}
2607 2650
 
2608 2651
 
@@ -2670,8 +2713,9 @@  discard block
 block discarded – undo
2670 2713
 
2671 2714
 
2672 2715
 		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
2673
-		if ( NULL === error_get_last() || ! headers_sent() )
2674
-			header('Content-Type: application/json; charset=UTF-8');
2716
+		if ( NULL === error_get_last() || ! headers_sent() ) {
2717
+					header('Content-Type: application/json; charset=UTF-8');
2718
+		}
2675 2719
                 if( function_exists( 'wp_json_encode' ) ) {
2676 2720
                     echo wp_json_encode( $json );
2677 2721
                 } else {
@@ -2689,10 +2733,9 @@  discard block
 block discarded – undo
2689 2733
 	 * @throws EE_Error
2690 2734
 	 */
2691 2735
 	public function return_json() {
2692
-		if ( defined('DOING_AJAX') && DOING_AJAX )
2693
-			$this->_return_json();
2694
-
2695
-		else {
2736
+		if ( defined('DOING_AJAX') && DOING_AJAX ) {
2737
+					$this->_return_json();
2738
+		} else {
2696 2739
 			throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) );
2697 2740
 		}
2698 2741
 	}
@@ -2834,7 +2877,9 @@  discard block
 block discarded – undo
2834 2877
 			$id = $this->_current_view . '_' . $ref;
2835 2878
 			$name = !empty($actions) ? $actions[$key] : $ref;
2836 2879
 			$this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />';
2837
-			if ( !$both ) break;
2880
+			if ( !$both ) {
2881
+				break;
2882
+			}
2838 2883
 		}
2839 2884
 
2840 2885
 	}
@@ -3190,13 +3235,15 @@  discard block
 block discarded – undo
3190 3235
 		if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
3191 3236
 			check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
3192 3237
 
3193
-			if ( !$user = wp_get_current_user() )
3194
-			return;
3238
+			if ( !$user = wp_get_current_user() ) {
3239
+						return;
3240
+			}
3195 3241
 			$option = $_POST['wp_screen_options']['option'];
3196 3242
 			$value = $_POST['wp_screen_options']['value'];
3197 3243
 
3198
-			if ( $option != sanitize_key( $option ) )
3199
-				return;
3244
+			if ( $option != sanitize_key( $option ) ) {
3245
+							return;
3246
+			}
3200 3247
 
3201 3248
 			$map_option = $option;
3202 3249
 
@@ -3205,13 +3252,15 @@  discard block
 block discarded – undo
3205 3252
 			switch ( $map_option ) {
3206 3253
 				case $this->_current_page . '_' .  $this->_current_view . '_per_page':
3207 3254
 					$value = (int) $value;
3208
-					if ( $value < 1 || $value > 999 )
3209
-						return;
3255
+					if ( $value < 1 || $value > 999 ) {
3256
+											return;
3257
+					}
3210 3258
 					break;
3211 3259
 				default:
3212 3260
 					$value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value );
3213
-					if ( false === $value )
3214
-						return;
3261
+					if ( false === $value ) {
3262
+											return;
3263
+					}
3215 3264
 					break;
3216 3265
 			}
3217 3266
 
@@ -3247,8 +3296,9 @@  discard block
 block discarded – undo
3247 3296
 	protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) {
3248 3297
 		$user_id = get_current_user_id();
3249 3298
 
3250
-		if ( !$skip_route_verify )
3251
-			$this->_verify_route($route);
3299
+		if ( !$skip_route_verify ) {
3300
+					$this->_verify_route($route);
3301
+		}
3252 3302
 
3253 3303
 
3254 3304
 		//now let's set the string for what kind of transient we're setting
Please login to merge, or discard this patch.
core/db_classes/EE_Base_Class.class.php 1 patch
Spacing   +483 added lines, -483 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
2
-do_action( 'AHEE_log', __FILE__, ' FILE LOADED', '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2
+do_action('AHEE_log', __FILE__, ' FILE LOADED', '');
3 3
 /**
4 4
  *
5 5
  * Event Espresso
@@ -117,59 +117,59 @@  discard block
 block discarded – undo
117 117
 	 * @throws EE_Error
118 118
 	 * @return \EE_Base_Class
119 119
 	 */
120
-	protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array() ){
120
+	protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '', $date_formats = array()) {
121 121
 
122
-		$className=get_class($this);
122
+		$className = get_class($this);
123 123
 
124
-		do_action("AHEE__{$className}__construct",$this,$fieldValues);
125
-		$model=$this->get_model();
126
-		$model_fields = $model->field_settings( FALSE );
124
+		do_action("AHEE__{$className}__construct", $this, $fieldValues);
125
+		$model = $this->get_model();
126
+		$model_fields = $model->field_settings(FALSE);
127 127
 		// ensure $fieldValues is an array
128
-		$fieldValues = is_array( $fieldValues ) ? $fieldValues : array( $fieldValues );
128
+		$fieldValues = is_array($fieldValues) ? $fieldValues : array($fieldValues);
129 129
 		// EEH_Debug_Tools::printr( $fieldValues, '$fieldValues  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
130 130
 		// verify client code has not passed any invalid field names
131
-		foreach($fieldValues as $field_name=> $field_value){
132
-			if( ! isset( $model_fields[ $field_name] ) ){
133
-				throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"),$field_name,get_class($this),implode(", ",array_keys($model_fields))));
131
+		foreach ($fieldValues as $field_name=> $field_value) {
132
+			if ( ! isset($model_fields[$field_name])) {
133
+				throw new EE_Error(sprintf(__("Invalid field (%s) passed to constructor of %s. Allowed fields are :%s", "event_espresso"), $field_name, get_class($this), implode(", ", array_keys($model_fields))));
134 134
 			}
135 135
 		}
136 136
 		// EEH_Debug_Tools::printr( $model_fields, '$model_fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
137
-		$this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone );
137
+		$this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone);
138 138
 
139
-		if ( ! empty( $date_formats ) && is_array( $date_formats ) ) {
139
+		if ( ! empty($date_formats) && is_array($date_formats)) {
140 140
 			$this->_dt_frmt = $date_formats[0];
141 141
 			$this->_tm_frmt = $date_formats[1];
142 142
 		} else {
143 143
 			//set default formats for date and time
144
-			$this->_dt_frmt = get_option( 'date_format' );
145
-			$this->_tm_frmt = get_option( 'time_format' );
144
+			$this->_dt_frmt = get_option('date_format');
145
+			$this->_tm_frmt = get_option('time_format');
146 146
 		}
147 147
 
148 148
 		//if db model is instantiating
149
-		if ( $bydb ){
149
+		if ($bydb) {
150 150
 			//client code has indicated these field values are from the database
151
-			foreach( $model_fields as $fieldName => $field ){
152
-				$this->set_from_db( $fieldName, isset( $fieldValues[ $fieldName] ) ? $fieldValues[ $fieldName ] : null );
151
+			foreach ($model_fields as $fieldName => $field) {
152
+				$this->set_from_db($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null);
153 153
 			}
154 154
 		} else {
155 155
 			//we're constructing a brand
156 156
 			//new instance of the model object. Generally, this means we'll need to do more field validation
157
-			foreach( $model_fields as $fieldName => $field ){
158
-				$this->set( $fieldName, isset( $fieldValues[ $fieldName ] ) ? $fieldValues[ $fieldName ] : null, true );
157
+			foreach ($model_fields as $fieldName => $field) {
158
+				$this->set($fieldName, isset($fieldValues[$fieldName]) ? $fieldValues[$fieldName] : null, true);
159 159
 			}
160 160
 		}
161 161
 
162 162
 		//remember what values were passed to this constructor
163 163
 		$this->_props_n_values_provided_in_constructor = $fieldValues;
164 164
 		//remember in entity mapper
165
-		if( ! $bydb  && $model->has_primary_key_field() && $this->ID() ){
165
+		if ( ! $bydb && $model->has_primary_key_field() && $this->ID()) {
166 166
 			$model->add_to_entity_map($this);
167 167
 		}
168 168
 		//setup all the relations
169
-		foreach($this->get_model()->relation_settings() as $relation_name=>$relation_obj){
170
-			if($relation_obj instanceof EE_Belongs_To_Relation){
169
+		foreach ($this->get_model()->relation_settings() as $relation_name=>$relation_obj) {
170
+			if ($relation_obj instanceof EE_Belongs_To_Relation) {
171 171
 				$this->_model_relations[$relation_name] = NULL;
172
-			}else{
172
+			} else {
173 173
 				$this->_model_relations[$relation_name] = array();
174 174
 			}
175 175
 		}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		 * Action done at the end of each model object construction
178 178
 		 * @param EE_Base_Class $this the model object just created
179 179
 		 */
180
-		do_action( 'AHEE__EE_Base_Class__construct__finished', $this );
180
+		do_action('AHEE__EE_Base_Class__construct__finished', $this);
181 181
 	}
182 182
 
183 183
 	/**
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param boolean $allow_persist
198 198
 	 * @return boolean
199 199
 	 */
200
-	public function set_allow_persist( $allow_persist ) {
200
+	public function set_allow_persist($allow_persist) {
201 201
 		return $this->_allow_persist = $allow_persist;
202 202
 	}
203 203
 
@@ -211,11 +211,11 @@  discard block
 block discarded – undo
211 211
 	 * @return mixed|null
212 212
 	 * @throws \EE_Error
213 213
 	 */
214
-	public function get_original( $field_name ){
215
-		if( isset( $this->_props_n_values_provided_in_constructor[ $field_name ] ) &&
216
-				$field_settings = $this->get_model()->field_settings_for( $field_name )){
217
-			return $field_settings->prepare_for_get( $this->_props_n_values_provided_in_constructor[ $field_name ] );
218
-		}else{
214
+	public function get_original($field_name) {
215
+		if (isset($this->_props_n_values_provided_in_constructor[$field_name]) &&
216
+				$field_settings = $this->get_model()->field_settings_for($field_name)) {
217
+			return $field_settings->prepare_for_get($this->_props_n_values_provided_in_constructor[$field_name]);
218
+		} else {
219 219
 			return NULL;
220 220
 		}
221 221
 	}
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 * @param EE_Base_Class $obj
226 226
 	 * @return string
227 227
 	 */
228
-	public function get_class($obj){
228
+	public function get_class($obj) {
229 229
 		return get_class($obj);
230 230
 	}
231 231
 
@@ -240,19 +240,19 @@  discard block
 block discarded – undo
240 240
 	 * @param bool      $use_default
241 241
 	 * @throws \EE_Error
242 242
 	 */
243
-	public function set( $field_name, $field_value, $use_default = FALSE ){
244
-		$field_obj = $this->get_model()->field_settings_for( $field_name );
245
-		if ( $field_obj instanceof EE_Model_Field_Base ) {
243
+	public function set($field_name, $field_value, $use_default = FALSE) {
244
+		$field_obj = $this->get_model()->field_settings_for($field_name);
245
+		if ($field_obj instanceof EE_Model_Field_Base) {
246 246
 //			if ( method_exists( $field_obj, 'set_timezone' )) {
247
-			if ( $field_obj instanceof EE_Datetime_Field ) {
248
-				$field_obj->set_timezone( $this->_timezone );
249
-				$field_obj->set_date_format( $this->_dt_frmt );
250
-				$field_obj->set_time_format( $this->_tm_frmt );
247
+			if ($field_obj instanceof EE_Datetime_Field) {
248
+				$field_obj->set_timezone($this->_timezone);
249
+				$field_obj->set_date_format($this->_dt_frmt);
250
+				$field_obj->set_time_format($this->_tm_frmt);
251 251
 			}
252 252
 
253 253
 			$holder_of_value = $field_obj->prepare_for_set($field_value);
254 254
 			//should the value be null?
255
-			if( ($field_value === NULL || $holder_of_value === NULL || $holder_of_value ==='') && $use_default){
255
+			if (($field_value === NULL || $holder_of_value === NULL || $holder_of_value === '') && $use_default) {
256 256
 				$this->_fields[$field_name] = $field_obj->get_default_value();
257 257
 
258 258
 				/**
@@ -264,26 +264,26 @@  discard block
 block discarded – undo
264 264
 				 */
265 265
 				if (
266 266
 					$field_obj instanceof EE_Datetime_Field
267
-					&& $this->_fields[ $field_name ] !== null
267
+					&& $this->_fields[$field_name] !== null
268 268
 					&& ! $this->_fields[$field_name] instanceof DateTime
269 269
 				) {
270
-					empty( $this->_fields[$field_name] )
271
-						? $this->set( $field_name, time() )
272
-						: $this->set( $field_name, $this->_fields[$field_name] );
270
+					empty($this->_fields[$field_name])
271
+						? $this->set($field_name, time())
272
+						: $this->set($field_name, $this->_fields[$field_name]);
273 273
 				}
274 274
 
275
-			}else{
275
+			} else {
276 276
 				$this->_fields[$field_name] = $holder_of_value;
277 277
 			}
278 278
 
279 279
 			//if we're not in the constructor...
280 280
 			//now check if what we set was a primary key
281
-			if(
281
+			if (
282 282
 				//note: props_n_values_provided_in_constructor is only set at the END of the constructor
283 283
 				$this->_props_n_values_provided_in_constructor
284 284
 				&& $field_value
285
-				&& $field_name === self::_get_primary_key_name( get_class( $this ) )
286
-			){
285
+				&& $field_name === self::_get_primary_key_name(get_class($this))
286
+			) {
287 287
 				//if so, we want all this object's fields to be filled either with
288 288
 				//what we've explicitly set on this model
289 289
 				//or what we have in the db
@@ -291,20 +291,20 @@  discard block
 block discarded – undo
291 291
 				$fields_on_model = self::_get_model(get_class($this))->field_settings();
292 292
 
293 293
 				$obj_in_db = self::_get_model(get_class($this))->get_one_by_ID($field_value);
294
-				foreach($fields_on_model as $field_obj){
295
-					if( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor)
296
-						&& $field_obj->get_name() !== $field_name ){
294
+				foreach ($fields_on_model as $field_obj) {
295
+					if ( ! array_key_exists($field_obj->get_name(), $this->_props_n_values_provided_in_constructor)
296
+						&& $field_obj->get_name() !== $field_name) {
297 297
 
298
-						$this->set($field_obj->get_name(),$obj_in_db->get($field_obj->get_name()));
298
+						$this->set($field_obj->get_name(), $obj_in_db->get($field_obj->get_name()));
299 299
 					}
300 300
 				}
301 301
 				//oh this model object has an ID? well make sure its in the entity mapper
302 302
 				$this->get_model()->add_to_entity_map($this);
303 303
 			}
304 304
 			//let's unset any cache for this field_name from the $_cached_properties property.
305
-			$this->_clear_cached_property( $field_name );
306
-		}else{
307
-			throw new EE_Error( sprintf( __( "A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso" ), $field_name  ) );
305
+			$this->_clear_cached_property($field_name);
306
+		} else {
307
+			throw new EE_Error(sprintf(__("A valid EE_Model_Field_Base could not be found for the given field name: %s", "event_espresso"), $field_name));
308 308
 		}
309 309
 
310 310
 	}
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 	 * @return int|bool @see EE_Base_Class::update_extra_meta() for return docs.
322 322
 	 * @throws \EE_Error
323 323
 	 */
324
-	public function set_field_or_extra_meta( $field_name, $field_value ) {
325
-		if ( $this->get_model()->has_field( $field_name ) ) {
326
-			$this->set( $field_name, $field_value );
324
+	public function set_field_or_extra_meta($field_name, $field_value) {
325
+		if ($this->get_model()->has_field($field_name)) {
326
+			$this->set($field_name, $field_value);
327 327
 			return true;
328 328
 		} else {
329 329
 			//ensure this object is saved first so that extra meta can be properly related.
330 330
 			$this->save();
331
-			return $this->update_extra_meta( $field_name, $field_value );
331
+			return $this->update_extra_meta($field_name, $field_value);
332 332
 		}
333 333
 	}
334 334
 
@@ -349,12 +349,12 @@  discard block
 block discarded – undo
349 349
 	 * @return mixed|null  value for the field if found.  null if not found.
350 350
 	 * @throws \EE_Error
351 351
 	 */
352
-	public function get_field_or_extra_meta( $field_name ) {
353
-		if ( $this->get_model()->has_field( $field_name ) ) {
354
-			$column_value = $this->get( $field_name );
352
+	public function get_field_or_extra_meta($field_name) {
353
+		if ($this->get_model()->has_field($field_name)) {
354
+			$column_value = $this->get($field_name);
355 355
 		} else {
356 356
 			//This isn't a column in the main table, let's see if it is in the extra meta.
357
-			$column_value = $this->get_extra_meta( $field_name, true, null );
357
+			$column_value = $this->get_extra_meta($field_name, true, null);
358 358
 		}
359 359
 		return $column_value;
360 360
 	}
@@ -370,18 +370,18 @@  discard block
 block discarded – undo
370 370
 	 * @return void
371 371
 	 * @throws \EE_Error
372 372
 	 */
373
-	public function set_timezone( $timezone = '' ) {
374
-		$this->_timezone = EEH_DTT_Helper::get_valid_timezone_string( $timezone );
373
+	public function set_timezone($timezone = '') {
374
+		$this->_timezone = EEH_DTT_Helper::get_valid_timezone_string($timezone);
375 375
 		//make sure we clear all cached properties because they won't be relevant now
376 376
 		$this->_clear_cached_properties();
377 377
 
378 378
 		//make sure we update field settings and the date for all EE_Datetime_Fields
379
-		$model_fields = $this->get_model()->field_settings( false );
380
-		foreach ( $model_fields as $field_name => $field_obj ) {
381
-			if ( $field_obj instanceof EE_Datetime_Field ) {
382
-				$field_obj->set_timezone( $this->_timezone );
383
-				if ( isset( $this->_fields[$field_name] ) && $this->_fields[$field_name] instanceof DateTime ) {
384
-					$this->_fields[$field_name]->setTimezone( new DateTimeZone( $this->_timezone ) );
379
+		$model_fields = $this->get_model()->field_settings(false);
380
+		foreach ($model_fields as $field_name => $field_obj) {
381
+			if ($field_obj instanceof EE_Datetime_Field) {
382
+				$field_obj->set_timezone($this->_timezone);
383
+				if (isset($this->_fields[$field_name]) && $this->_fields[$field_name] instanceof DateTime) {
384
+					$this->_fields[$field_name]->setTimezone(new DateTimeZone($this->_timezone));
385 385
 				}
386 386
 			}
387 387
 		}
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 	 *
411 411
 	 * @param string $format   should be a format recognizable by PHP date() functions.
412 412
 	 */
413
-	public function set_date_format( $format ) {
413
+	public function set_date_format($format) {
414 414
 		$this->_dt_frmt = $format;
415 415
 		//clear cached_properties because they won't be relevant now.
416 416
 		$this->_clear_cached_properties();
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	 * @since 4.6
427 427
 	 * @param string $format should be a format recognizable by PHP date() functions.
428 428
 	 */
429
-	public function set_time_format( $format ) {
429
+	public function set_time_format($format) {
430 430
 		$this->_tm_frmt = $format;
431 431
 		//clear cached_properties because they won't be relevant now.
432 432
 		$this->_clear_cached_properties();
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @return mixed string|array
445 445
 	 */
446
-	public function get_format( $full = true ) {
447
-		return $full ? $this->_dt_frmt . ' ' . $this->_tm_frmt : array( $this->_dt_frmt, $this->_tm_frmt );
446
+	public function get_format($full = true) {
447
+		return $full ? $this->_dt_frmt.' '.$this->_tm_frmt : array($this->_dt_frmt, $this->_tm_frmt);
448 448
 	}
449 449
 
450 450
 
@@ -462,17 +462,17 @@  discard block
 block discarded – undo
462 462
 	 * @throws EE_Error
463 463
 	 * @return mixed    index into cache, or just TRUE if the relation is of type Belongs_To (because there's only one related thing, no array)
464 464
 	 */
465
-	public function cache( $relationName = '', $object_to_cache = NULL, $cache_id = NULL ){
465
+	public function cache($relationName = '', $object_to_cache = NULL, $cache_id = NULL) {
466 466
 		// its entirely possible that there IS no related object yet in which case there is nothing to cache.
467
-		if ( ! $object_to_cache instanceof EE_Base_Class ) {
467
+		if ( ! $object_to_cache instanceof EE_Base_Class) {
468 468
 			return FALSE;
469 469
 		}
470 470
 		// also get "how" the object is related, or throw an error
471
-		if( ! $relationship_to_model = $this->get_model()->related_settings_for( $relationName )) {
472
-			throw new EE_Error( sprintf( __( 'There is no relationship to %s on a %s. Cannot cache it', 'event_espresso' ), $relationName, get_class( $this )));
471
+		if ( ! $relationship_to_model = $this->get_model()->related_settings_for($relationName)) {
472
+			throw new EE_Error(sprintf(__('There is no relationship to %s on a %s. Cannot cache it', 'event_espresso'), $relationName, get_class($this)));
473 473
 		}
474 474
 		// how many things are related ?
475
-		if( $relationship_to_model instanceof EE_Belongs_To_Relation ){
475
+		if ($relationship_to_model instanceof EE_Belongs_To_Relation) {
476 476
 			// if it's a "belongs to" relationship, then there's only one related model object  eg, if this is a registration, there's only 1 attendee for it
477 477
 			// so for these model objects just set it to be cached
478 478
 			$this->_model_relations[$relationName] = $object_to_cache;
@@ -480,26 +480,26 @@  discard block
 block discarded – undo
480 480
 		} else {
481 481
 			// otherwise, this is the "many" side of a one to many relationship, so we'll add the object to the array of related objects for that type.
482 482
 			// eg: if this is an event, there are many registrations for that event, so we cache the registrations in an array
483
-			if( ! is_array( $this->_model_relations[$relationName] )) {
483
+			if ( ! is_array($this->_model_relations[$relationName])) {
484 484
 				// if for some reason, the cached item is a model object, then stick that in the array, otherwise start with an empty array
485
-				$this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array( $this->_model_relations[$relationName] ) : array();
485
+				$this->_model_relations[$relationName] = $this->_model_relations[$relationName] instanceof EE_Base_Class ? array($this->_model_relations[$relationName]) : array();
486 486
 			}
487 487
 			// first check for a cache_id which is normally empty
488
-			if ( ! empty( $cache_id )) {
488
+			if ( ! empty($cache_id)) {
489 489
 				// if the cache_id exists, then it means we are purposely trying to cache this with a known key that can then be used to retrieve the object later on
490
-				$this->_model_relations[$relationName][ $cache_id ] = $object_to_cache;
490
+				$this->_model_relations[$relationName][$cache_id] = $object_to_cache;
491 491
 				$return = $cache_id;
492
-			} elseif ( $object_to_cache->ID() ) {
492
+			} elseif ($object_to_cache->ID()) {
493 493
 				// OR the cached object originally came from the db, so let's just use it's PK for an ID
494
-				$this->_model_relations[$relationName][ $object_to_cache->ID() ] = $object_to_cache;
494
+				$this->_model_relations[$relationName][$object_to_cache->ID()] = $object_to_cache;
495 495
 				$return = $object_to_cache->ID();
496 496
 			} else {
497 497
 				// OR it's a new object with no ID, so just throw it in the array with an auto-incremented ID
498 498
 				$this->_model_relations[$relationName][] = $object_to_cache;
499 499
 				  // move the internal pointer to the end of the array
500
-				end( $this->_model_relations[$relationName] );
500
+				end($this->_model_relations[$relationName]);
501 501
 				// and grab the key so that we can return it
502
-				$return = key( $this->_model_relations[$relationName] );
502
+				$return = key($this->_model_relations[$relationName]);
503 503
 			}
504 504
 
505 505
 		}
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
 	 * @return void
519 519
 	 * @throws \EE_Error
520 520
 	 */
521
-	protected function _set_cached_property( $fieldname, $value, $cache_type = NULL ) {
521
+	protected function _set_cached_property($fieldname, $value, $cache_type = NULL) {
522 522
 		//first make sure this property exists
523 523
 		$this->get_model()->field_settings_for($fieldname);
524 524
 
525
-		$cache_type = empty( $cache_type ) ? 'standard' : $cache_type;
525
+		$cache_type = empty($cache_type) ? 'standard' : $cache_type;
526 526
 		$this->_cached_properties[$fieldname][$cache_type] = $value;
527 527
 	}
528 528
 
@@ -543,36 +543,36 @@  discard block
 block discarded – undo
543 543
 	 * @return mixed                   whatever the value for the property is we're retrieving
544 544
 	 * @throws \EE_Error
545 545
 	 */
546
-	protected function _get_cached_property( $fieldname, $pretty = FALSE, $extra_cache_ref = NULL ) {
546
+	protected function _get_cached_property($fieldname, $pretty = FALSE, $extra_cache_ref = NULL) {
547 547
 		//verify the field exists
548 548
 		$this->get_model()->field_settings_for($fieldname);
549 549
 
550 550
 		$cache_type = $pretty ? 'pretty' : 'standard';
551
-		$cache_type .= !empty( $extra_cache_ref ) ? '_' . $extra_cache_ref : '';
551
+		$cache_type .= ! empty($extra_cache_ref) ? '_'.$extra_cache_ref : '';
552 552
 
553
-		if ( isset( $this->_cached_properties[$fieldname][$cache_type] ) ) {
553
+		if (isset($this->_cached_properties[$fieldname][$cache_type])) {
554 554
 			return $this->_cached_properties[$fieldname][$cache_type];
555 555
 		}
556 556
 
557 557
 		$field_obj = $this->get_model()->field_settings_for($fieldname);
558
-		if ( $field_obj instanceof EE_Model_Field_Base ) {
558
+		if ($field_obj instanceof EE_Model_Field_Base) {
559 559
 			/**
560 560
 			 * maybe this is EE_Datetime_Field.  If so we need to make sure timezone and
561 561
 			 * formats are correct.
562 562
 			 */
563
-			if ( $field_obj instanceof EE_Datetime_Field ) {
564
-				$field_obj->set_timezone( $this->_timezone );
565
-				$field_obj->set_date_format( $this->_dt_frmt, $pretty );
566
-				$field_obj->set_time_format( $this->_tm_frmt, $pretty );
563
+			if ($field_obj instanceof EE_Datetime_Field) {
564
+				$field_obj->set_timezone($this->_timezone);
565
+				$field_obj->set_date_format($this->_dt_frmt, $pretty);
566
+				$field_obj->set_time_format($this->_tm_frmt, $pretty);
567 567
 			}
568 568
 
569
-			if( ! isset($this->_fields[$fieldname])){
569
+			if ( ! isset($this->_fields[$fieldname])) {
570 570
 				$this->_fields[$fieldname] = NULL;
571 571
 			}
572 572
 			$value = $pretty
573 573
 				? $field_obj->prepare_for_pretty_echoing($this->_fields[$fieldname], $extra_cache_ref)
574
-				: $field_obj->prepare_for_get($this->_fields[$fieldname] );
575
-			$this->_set_cached_property( $fieldname, $value, $cache_type );
574
+				: $field_obj->prepare_for_get($this->_fields[$fieldname]);
575
+			$this->_set_cached_property($fieldname, $value, $cache_type);
576 576
 			return $value;
577 577
 		}
578 578
 		return null;
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 	 * @param  string $property_name the property to remove if it exists (from the _cached_properties array)
599 599
 	 * @return void
600 600
 	 */
601
-	protected function _clear_cached_property( $property_name ) {
602
-		if ( isset( $this->_cached_properties[ $property_name ] ) ) {
603
-			unset( $this->_cached_properties[ $property_name ] );
601
+	protected function _clear_cached_property($property_name) {
602
+		if (isset($this->_cached_properties[$property_name])) {
603
+			unset($this->_cached_properties[$property_name]);
604 604
 		}
605 605
 	}
606 606
 
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
 	 * @return EE_Base_Class
615 615
 	 * @throws \EE_Error
616 616
 	 */
617
-	protected function ensure_related_thing_is_model_obj($object_or_id,$model_name){
617
+	protected function ensure_related_thing_is_model_obj($object_or_id, $model_name) {
618 618
 		$other_model_instance = self::_get_model_instance_with_name(
619
-			self::_get_model_classname( $model_name ),
619
+			self::_get_model_classname($model_name),
620 620
 			$this->_timezone
621 621
 		);
622
-		return $other_model_instance->ensure_is_obj( $object_or_id );
622
+		return $other_model_instance->ensure_is_obj($object_or_id);
623 623
 	}
624 624
 
625 625
 
@@ -636,32 +636,32 @@  discard block
 block discarded – undo
636 636
 	 * @throws EE_Error
637 637
 	 * @return EE_Base_Class | boolean from which was cleared from the cache, or true if we requested to remove a relation from all
638 638
 	 */
639
-	public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE){
639
+	public function clear_cache($relationName, $object_to_remove_or_index_into_array = NULL, $clear_all = FALSE) {
640 640
 		$relationship_to_model = $this->get_model()->related_settings_for($relationName);
641 641
 		$index_in_cache = '';
642
-		if( ! $relationship_to_model){
642
+		if ( ! $relationship_to_model) {
643 643
 			throw new EE_Error(
644 644
 				sprintf(
645
-					__( "There is no relationship to %s on a %s. Cannot clear that cache", 'event_espresso' ),
645
+					__("There is no relationship to %s on a %s. Cannot clear that cache", 'event_espresso'),
646 646
 					$relationName,
647
-					get_class( $this )
647
+					get_class($this)
648 648
 				)
649 649
 			);
650 650
 		}
651
-		if($clear_all){
651
+		if ($clear_all) {
652 652
 			$obj_removed = true;
653 653
 			$this->_model_relations[$relationName]  = null;
654
-		}elseif($relationship_to_model instanceof EE_Belongs_To_Relation){
654
+		}elseif ($relationship_to_model instanceof EE_Belongs_To_Relation) {
655 655
 			$obj_removed = $this->_model_relations[$relationName];
656 656
 			$this->_model_relations[$relationName]  = null;
657
-		}else{
658
-			if($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()){
657
+		} else {
658
+			if ($object_to_remove_or_index_into_array instanceof EE_Base_Class && $object_to_remove_or_index_into_array->ID()) {
659 659
 				$index_in_cache = $object_to_remove_or_index_into_array->ID();
660
-				if( is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])){
660
+				if (is_array($this->_model_relations[$relationName]) && ! isset($this->_model_relations[$relationName][$index_in_cache])) {
661 661
 					$index_found_at = NULL;
662 662
 					//find this object in the array even though it has a different key
663
-					foreach($this->_model_relations[$relationName] as $index=>$obj){
664
-						if(
663
+					foreach ($this->_model_relations[$relationName] as $index=>$obj) {
664
+						if (
665 665
 							$obj instanceof EE_Base_Class
666 666
 							&& (
667 667
 								$obj == $object_to_remove_or_index_into_array
@@ -672,34 +672,34 @@  discard block
 block discarded – undo
672 672
 							break;
673 673
 						}
674 674
 					}
675
-					if($index_found_at){
675
+					if ($index_found_at) {
676 676
 						$index_in_cache = $index_found_at;
677
-					}else{
677
+					} else {
678 678
 						//it wasn't found. huh. well obviously it doesn't need to be removed from teh cache
679 679
 						//if it wasn't in it to begin with. So we're done
680 680
 						return $object_to_remove_or_index_into_array;
681 681
 					}
682 682
 				}
683
-			}elseif($object_to_remove_or_index_into_array instanceof EE_Base_Class){
683
+			}elseif ($object_to_remove_or_index_into_array instanceof EE_Base_Class) {
684 684
 				//so they provided a model object, but it's not yet saved to the DB... so let's go hunting for it!
685
-				foreach($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want){
686
-					if($potentially_obj_we_want == $object_to_remove_or_index_into_array){
685
+				foreach ($this->get_all_from_cache($relationName) as $index => $potentially_obj_we_want) {
686
+					if ($potentially_obj_we_want == $object_to_remove_or_index_into_array) {
687 687
 						$index_in_cache = $index;
688 688
 					}
689 689
 				}
690
-			}else{
690
+			} else {
691 691
 				$index_in_cache = $object_to_remove_or_index_into_array;
692 692
 			}
693 693
 			//supposedly we've found it. But it could just be that the client code
694 694
 			//provided a bad index/object
695 695
 			if (
696 696
 				isset(
697
-					$this->_model_relations[ $relationName ],
698
-					$this->_model_relations[ $relationName ][ $index_in_cache ]
697
+					$this->_model_relations[$relationName],
698
+					$this->_model_relations[$relationName][$index_in_cache]
699 699
 				)
700 700
 			) {
701
-				$obj_removed = $this->_model_relations[ $relationName ][ $index_in_cache ];
702
-				unset( $this->_model_relations[ $relationName ][ $index_in_cache ] );
701
+				$obj_removed = $this->_model_relations[$relationName][$index_in_cache];
702
+				unset($this->_model_relations[$relationName][$index_in_cache]);
703 703
 			} else {
704 704
 				//that thing was never cached anyways.
705 705
 				$obj_removed = null;
@@ -720,24 +720,24 @@  discard block
 block discarded – undo
720 720
 	 * @return boolean TRUE on success, FALSE on fail
721 721
 	 * @throws \EE_Error
722 722
 	 */
723
-	public function update_cache_after_object_save( $relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') {
723
+	public function update_cache_after_object_save($relationName, EE_Base_Class $newly_saved_object, $current_cache_id = '') {
724 724
 		// verify that incoming object is of the correct type
725
-		$obj_class = 'EE_' . $relationName;
726
-		if ( $newly_saved_object instanceof $obj_class ) {
725
+		$obj_class = 'EE_'.$relationName;
726
+		if ($newly_saved_object instanceof $obj_class) {
727 727
 			/* @type EE_Base_Class $newly_saved_object*/
728 728
 			// now get the type of relation
729
-			$relationship_to_model = $this->get_model()->related_settings_for( $relationName );
729
+			$relationship_to_model = $this->get_model()->related_settings_for($relationName);
730 730
 			// if this is a 1:1 relationship
731
-			if( $relationship_to_model instanceof EE_Belongs_To_Relation ) {
731
+			if ($relationship_to_model instanceof EE_Belongs_To_Relation) {
732 732
 				// then just replace the cached object with the newly saved object
733 733
 				$this->_model_relations[$relationName] = $newly_saved_object;
734 734
 				return TRUE;
735 735
 			// or if it's some kind of sordid feral polyamorous relationship...
736
-			} elseif ( is_array( $this->_model_relations[$relationName] ) && isset( $this->_model_relations[$relationName][ $current_cache_id ] )) {
736
+			} elseif (is_array($this->_model_relations[$relationName]) && isset($this->_model_relations[$relationName][$current_cache_id])) {
737 737
 				// then remove the current cached item
738
-				unset( $this->_model_relations[$relationName][ $current_cache_id ] );
738
+				unset($this->_model_relations[$relationName][$current_cache_id]);
739 739
 				// and cache the newly saved object using it's new ID
740
-				$this->_model_relations[$relationName][ $newly_saved_object->ID() ] = $newly_saved_object;
740
+				$this->_model_relations[$relationName][$newly_saved_object->ID()] = $newly_saved_object;
741 741
 				return TRUE;
742 742
 			}
743 743
 		}
@@ -753,11 +753,11 @@  discard block
 block discarded – undo
753 753
 	 * @param string $relationName
754 754
 	 * @return EE_Base_Class
755 755
 	 */
756
-	public function get_one_from_cache($relationName){
757
-		$cached_array_or_object = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : null;
758
-		if(is_array($cached_array_or_object)){
756
+	public function get_one_from_cache($relationName) {
757
+		$cached_array_or_object = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : null;
758
+		if (is_array($cached_array_or_object)) {
759 759
 			return array_shift($cached_array_or_object);
760
-		}else{
760
+		} else {
761 761
 			return $cached_array_or_object;
762 762
 		}
763 763
 	}
@@ -772,23 +772,23 @@  discard block
 block discarded – undo
772 772
 	 * @throws \EE_Error
773 773
 	 * @return EE_Base_Class[] NOT necessarily indexed by primary keys
774 774
 	 */
775
-	public function get_all_from_cache($relationName){
776
-		$objects = isset( $this->_model_relations[$relationName] ) ? $this->_model_relations[$relationName] : array();
775
+	public function get_all_from_cache($relationName) {
776
+		$objects = isset($this->_model_relations[$relationName]) ? $this->_model_relations[$relationName] : array();
777 777
 		// if the result is not an array, but exists, make it an array
778
-		$objects = is_array( $objects ) ? $objects : array( $objects );
778
+		$objects = is_array($objects) ? $objects : array($objects);
779 779
 		//bugfix for https://events.codebasehq.com/projects/event-espresso/tickets/7143
780 780
 		//basically, if this model object was stored in the session, and these cached model objects
781 781
 		//already have IDs, let's make sure they're in their model's entity mapper
782 782
 		//otherwise we will have duplicates next time we call
783 783
 		// EE_Registry::instance()->load_model( $relationName )->get_one_by_ID( $result->ID() );
784
-		$model = EE_Registry::instance()->load_model( $relationName );
785
-		foreach( $objects as $model_object ){
786
-			if( $model instanceof EEM_Base && $model_object instanceof EE_Base_Class ){
784
+		$model = EE_Registry::instance()->load_model($relationName);
785
+		foreach ($objects as $model_object) {
786
+			if ($model instanceof EEM_Base && $model_object instanceof EE_Base_Class) {
787 787
 				//ensure its in the map if it has an ID; otherwise it will be added to the map when its saved
788
-				if( $model_object->ID() ){
789
-					$model->add_to_entity_map( $model_object );
788
+				if ($model_object->ID()) {
789
+					$model->add_to_entity_map($model_object);
790 790
 				}
791
-			}else{
791
+			} else {
792 792
 				throw new EE_Error(
793 793
 					sprintf(
794 794
 						__(
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 							'event_espresso'
797 797
 						),
798 798
 						$relationName,
799
-						gettype( $model_object )
799
+						gettype($model_object)
800 800
 					)
801 801
 				);
802 802
 			}
@@ -818,15 +818,15 @@  discard block
 block discarded – undo
818 818
 	 * @return array|EE_Base_Class[]
819 819
 	 * @throws \EE_Error
820 820
 	 */
821
-	public function next_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
822
-		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
821
+	public function next_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) {
822
+		$field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field()
823 823
 			? $this->get_model()->get_primary_key_field()->get_name()
824 824
 			: $field_to_order_by;
825
-		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
826
-		if ( empty( $field ) || empty( $current_value ) ) {
825
+		$current_value = ! empty($field) ? $this->get($field) : null;
826
+		if (empty($field) || empty($current_value)) {
827 827
 			return array();
828 828
 		}
829
-		return $this->get_model()->next_x( $current_value, $field, $limit, $query_params, $columns_to_select );
829
+		return $this->get_model()->next_x($current_value, $field, $limit, $query_params, $columns_to_select);
830 830
 	}
831 831
 
832 832
 
@@ -843,15 +843,15 @@  discard block
 block discarded – undo
843 843
 	 * @return array|EE_Base_Class[]
844 844
 	 * @throws \EE_Error
845 845
 	 */
846
-	public function previous_x( $field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null ) {
847
-		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
846
+	public function previous_x($field_to_order_by = null, $limit = 1, $query_params = array(), $columns_to_select = null) {
847
+		$field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field()
848 848
 			? $this->get_model()->get_primary_key_field()->get_name()
849 849
 			: $field_to_order_by;
850
-		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
851
-		if ( empty( $field ) || empty( $current_value ) ) {
850
+		$current_value = ! empty($field) ? $this->get($field) : null;
851
+		if (empty($field) || empty($current_value)) {
852 852
 			return array();
853 853
 		}
854
-		return $this->get_model()->previous_x( $current_value, $field, $limit, $query_params, $columns_to_select );
854
+		return $this->get_model()->previous_x($current_value, $field, $limit, $query_params, $columns_to_select);
855 855
 	}
856 856
 
857 857
 
@@ -867,15 +867,15 @@  discard block
 block discarded – undo
867 867
 	 * @return array|EE_Base_Class
868 868
 	 * @throws \EE_Error
869 869
 	 */
870
-	public function next( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
871
-		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
870
+	public function next($field_to_order_by = null, $query_params = array(), $columns_to_select = null) {
871
+		$field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field()
872 872
 			? $this->get_model()->get_primary_key_field()->get_name()
873 873
 			: $field_to_order_by;
874
-		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
875
-		if ( empty( $field ) || empty( $current_value ) ) {
874
+		$current_value = ! empty($field) ? $this->get($field) : null;
875
+		if (empty($field) || empty($current_value)) {
876 876
 			return array();
877 877
 		}
878
-		return $this->get_model()->next( $current_value, $field, $query_params, $columns_to_select );
878
+		return $this->get_model()->next($current_value, $field, $query_params, $columns_to_select);
879 879
 	}
880 880
 
881 881
 
@@ -891,15 +891,15 @@  discard block
 block discarded – undo
891 891
 	 * @return array|EE_Base_Class
892 892
 	 * @throws \EE_Error
893 893
 	 */
894
-	public function previous( $field_to_order_by = null, $query_params = array(), $columns_to_select = null ) {
895
-		$field = empty( $field_to_order_by ) && $this->get_model()->has_primary_key_field()
894
+	public function previous($field_to_order_by = null, $query_params = array(), $columns_to_select = null) {
895
+		$field = empty($field_to_order_by) && $this->get_model()->has_primary_key_field()
896 896
 			? $this->get_model()->get_primary_key_field()->get_name()
897 897
 			: $field_to_order_by;
898
-		$current_value = ! empty( $field ) ? $this->get( $field ) : null;
899
-		if ( empty( $field ) || empty( $current_value ) ) {
898
+		$current_value = ! empty($field) ? $this->get($field) : null;
899
+		if (empty($field) || empty($current_value)) {
900 900
 			return array();
901 901
 		}
902
-		return $this->get_model()->previous( $current_value, $field, $query_params, $columns_to_select );
902
+		return $this->get_model()->previous($current_value, $field, $query_params, $columns_to_select);
903 903
 	}
904 904
 
905 905
 
@@ -912,25 +912,25 @@  discard block
 block discarded – undo
912 912
 	 * @param mixed  $field_value_from_db
913 913
 	 * @throws \EE_Error
914 914
 	 */
915
-	public function set_from_db($field_name,$field_value_from_db){
915
+	public function set_from_db($field_name, $field_value_from_db) {
916 916
 		$field_obj = $this->get_model()->field_settings_for($field_name);
917
-		if ( $field_obj instanceof EE_Model_Field_Base ) {
917
+		if ($field_obj instanceof EE_Model_Field_Base) {
918 918
 			//you would think the DB has no NULLs for non-null label fields right? wrong!
919 919
 			//eg, a CPT model object could have an entry in the posts table, but no
920 920
 			//entry in the meta table. Meaning that all its columns in the meta table
921 921
 			//are null! yikes! so when we find one like that, use defaults for its meta columns
922
-			if($field_value_from_db === NULL ){
923
-				if( $field_obj->is_nullable()){
922
+			if ($field_value_from_db === NULL) {
923
+				if ($field_obj->is_nullable()) {
924 924
 					//if the field allows nulls, then let it be null
925 925
 					$field_value = NULL;
926
-				}else{
926
+				} else {
927 927
 					$field_value = $field_obj->get_default_value();
928 928
 				}
929
-			}else{
930
-				$field_value = $field_obj->prepare_for_set_from_db( $field_value_from_db );
929
+			} else {
930
+				$field_value = $field_obj->prepare_for_set_from_db($field_value_from_db);
931 931
 			}
932 932
 			$this->_fields[$field_name] = $field_value;
933
-			$this->_clear_cached_property( $field_name );
933
+			$this->_clear_cached_property($field_name);
934 934
 		}
935 935
 	}
936 936
 
@@ -946,8 +946,8 @@  discard block
 block discarded – undo
946 946
 	 * @return mixed
947 947
 	 * @throws \EE_Error
948 948
 	 */
949
-	public function get($field_name, $extra_cache_ref = NULL ){
950
-		return $this->_get_cached_property( $field_name, FALSE, $extra_cache_ref );
949
+	public function get($field_name, $extra_cache_ref = NULL) {
950
+		return $this->_get_cached_property($field_name, FALSE, $extra_cache_ref);
951 951
 	}
952 952
 
953 953
 
@@ -980,10 +980,10 @@  discard block
 block discarded – undo
980 980
 	 *                                         just null is returned (because that indicates that likely
981 981
 	 *                                         this field is nullable).
982 982
 	 */
983
-	public function get_DateTime_object( $field_name ) {
984
-		$field_settings = $this->get_model()->field_settings_for( $field_name );
983
+	public function get_DateTime_object($field_name) {
984
+		$field_settings = $this->get_model()->field_settings_for($field_name);
985 985
 
986
-		if ( ! $field_settings instanceof EE_Datetime_Field ) {
986
+		if ( ! $field_settings instanceof EE_Datetime_Field) {
987 987
 			EE_Error::add_error(
988 988
 				sprintf(
989 989
 					__(
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 	 * @return void
1016 1016
 	 * @throws \EE_Error
1017 1017
 	 */
1018
-	public function e($field_name, $extra_cache_ref = NULL){
1018
+	public function e($field_name, $extra_cache_ref = NULL) {
1019 1019
 		echo $this->get_pretty($field_name, $extra_cache_ref);
1020 1020
 	}
1021 1021
 
@@ -1029,8 +1029,8 @@  discard block
 block discarded – undo
1029 1029
 	 * @return void
1030 1030
 	 * @throws \EE_Error
1031 1031
 	 */
1032
-	public function f($field_name){
1033
-		$this->e($field_name,'form_input');
1032
+	public function f($field_name) {
1033
+		$this->e($field_name, 'form_input');
1034 1034
 	}
1035 1035
 
1036 1036
 
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
 	 * @return mixed
1044 1044
 	 * @throws \EE_Error
1045 1045
 	 */
1046
-	public function get_pretty($field_name, $extra_cache_ref = NULL){
1047
-		return  $this->_get_cached_property( $field_name, TRUE, $extra_cache_ref );
1046
+	public function get_pretty($field_name, $extra_cache_ref = NULL) {
1047
+		return  $this->_get_cached_property($field_name, TRUE, $extra_cache_ref);
1048 1048
 	}
1049 1049
 
1050 1050
 
@@ -1062,36 +1062,36 @@  discard block
 block discarded – undo
1062 1062
 	 * @return void | string | bool | EE_Error string on success, FALSE on fail, or EE_Error Exception is thrown if field is not a valid dtt field, or void if echoing
1063 1063
 	 * @throws \EE_Error
1064 1064
 	 */
1065
-	protected function _get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE ) {
1065
+	protected function _get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL, $date_or_time = NULL, $echo = FALSE) {
1066 1066
 
1067
-		$in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt :  $dt_frmt;
1067
+		$in_dt_frmt = empty($dt_frmt) ? $this->_dt_frmt : $dt_frmt;
1068 1068
 		$in_tm_frmt = empty($tm_frmt) ? $this->_tm_frmt : $tm_frmt;
1069 1069
 
1070 1070
 		//validate field for datetime and returns field settings if valid.
1071
-		$field = $this->_get_dtt_field_settings( $field_name );
1071
+		$field = $this->_get_dtt_field_settings($field_name);
1072 1072
 
1073 1073
 		//clear cached property if either formats are not null.
1074
-		if( $dt_frmt !== null || $tm_frmt !== null ) {
1075
-			$this->_clear_cached_property( $field_name );
1074
+		if ($dt_frmt !== null || $tm_frmt !== null) {
1075
+			$this->_clear_cached_property($field_name);
1076 1076
 			//reset format properties because they are used in get()
1077 1077
 			$this->_dt_frmt = $in_dt_frmt;
1078 1078
 			$this->_tm_frmt = $in_tm_frmt;
1079 1079
 		}
1080
-		if ( $echo ) {
1081
-			$field->set_pretty_date_format( $in_dt_frmt );
1080
+		if ($echo) {
1081
+			$field->set_pretty_date_format($in_dt_frmt);
1082 1082
 		} else {
1083
-			$field->set_date_format( $in_dt_frmt );
1083
+			$field->set_date_format($in_dt_frmt);
1084 1084
 		}
1085
-		if ( $echo ) {
1086
-			$field->set_pretty_time_format( $in_tm_frmt );
1085
+		if ($echo) {
1086
+			$field->set_pretty_time_format($in_tm_frmt);
1087 1087
 		} else {
1088
-			$field->set_time_format( $in_tm_frmt );
1088
+			$field->set_time_format($in_tm_frmt);
1089 1089
 		}
1090 1090
 		//set timezone in field object
1091
-		$field->set_timezone( $this->_timezone );
1091
+		$field->set_timezone($this->_timezone);
1092 1092
 
1093 1093
 		//set the output returned
1094
-		switch ( $date_or_time ) {
1094
+		switch ($date_or_time) {
1095 1095
 
1096 1096
 			case 'D' :
1097 1097
 				$field->set_date_time_output('date');
@@ -1106,11 +1106,11 @@  discard block
 block discarded – undo
1106 1106
 		}
1107 1107
 
1108 1108
 
1109
-		if ( $echo ) {
1110
-			$this->e( $field_name, $date_or_time );
1109
+		if ($echo) {
1110
+			$this->e($field_name, $date_or_time);
1111 1111
 			return '';
1112 1112
 		 }
1113
-		return $this->get( $field_name, $date_or_time );
1113
+		return $this->get($field_name, $date_or_time);
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1123,8 +1123,8 @@  discard block
 block discarded – undo
1123 1123
 	 * @return string            datetime value formatted
1124 1124
 	 * @throws \EE_Error
1125 1125
 	 */
1126
-	public function get_date( $field_name, $format = NULL ) {
1127
-		return $this->_get_datetime( $field_name, $format, NULL, 'D' );
1126
+	public function get_date($field_name, $format = NULL) {
1127
+		return $this->_get_datetime($field_name, $format, NULL, 'D');
1128 1128
 	}
1129 1129
 
1130 1130
 
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 	 * @param null $format
1135 1135
 	 * @throws \EE_Error
1136 1136
 	 */
1137
-	public function e_date( $field_name, $format = NULL ) {
1138
-		$this->_get_datetime( $field_name, $format, NULL, 'D', TRUE );
1137
+	public function e_date($field_name, $format = NULL) {
1138
+		$this->_get_datetime($field_name, $format, NULL, 'D', TRUE);
1139 1139
 	}
1140 1140
 
1141 1141
 
@@ -1148,8 +1148,8 @@  discard block
 block discarded – undo
1148 1148
 	 * @return string             datetime value formatted
1149 1149
 	 * @throws \EE_Error
1150 1150
 	 */
1151
-	public function get_time( $field_name, $format = NULL ) {
1152
-		return $this->_get_datetime( $field_name, NULL, $format, 'T' );
1151
+	public function get_time($field_name, $format = NULL) {
1152
+		return $this->_get_datetime($field_name, NULL, $format, 'T');
1153 1153
 	}
1154 1154
 
1155 1155
 
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
 	 * @param null $format
1160 1160
 	 * @throws \EE_Error
1161 1161
 	 */
1162
-	public function e_time( $field_name, $format = NULL ) {
1163
-		$this->_get_datetime( $field_name, NULL, $format, 'T', TRUE );
1162
+	public function e_time($field_name, $format = NULL) {
1163
+		$this->_get_datetime($field_name, NULL, $format, 'T', TRUE);
1164 1164
 	}
1165 1165
 
1166 1166
 
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
 	 * @return string             datetime value formatted
1175 1175
 	 * @throws \EE_Error
1176 1176
 	 */
1177
-	public function get_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) {
1178
-		return $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt );
1177
+	public function get_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) {
1178
+		return $this->_get_datetime($field_name, $dt_frmt, $tm_frmt);
1179 1179
 	}
1180 1180
 
1181 1181
 
@@ -1186,8 +1186,8 @@  discard block
 block discarded – undo
1186 1186
 	 * @param null $tm_frmt
1187 1187
 	 * @throws \EE_Error
1188 1188
 	 */
1189
-	public function e_datetime( $field_name, $dt_frmt = NULL, $tm_frmt = NULL ) {
1190
-		$this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, NULL, TRUE);
1189
+	public function e_datetime($field_name, $dt_frmt = NULL, $tm_frmt = NULL) {
1190
+		$this->_get_datetime($field_name, $dt_frmt, $tm_frmt, NULL, TRUE);
1191 1191
 	}
1192 1192
 
1193 1193
 
@@ -1201,11 +1201,11 @@  discard block
 block discarded – undo
1201 1201
 	 * @throws \EE_Error
1202 1202
 	 *                           field name.
1203 1203
 	 */
1204
-	public function get_i18n_datetime( $field_name, $format = NULL ) {
1205
-		$format = empty( $format ) ? $this->_dt_frmt . ' ' . $this->_tm_frmt : $format;
1204
+	public function get_i18n_datetime($field_name, $format = NULL) {
1205
+		$format = empty($format) ? $this->_dt_frmt.' '.$this->_tm_frmt : $format;
1206 1206
 		return date_i18n(
1207 1207
 			$format,
1208
-			EEH_DTT_Helper::get_timestamp_with_offset( $this->get_raw( $field_name ), $this->_timezone )
1208
+			EEH_DTT_Helper::get_timestamp_with_offset($this->get_raw($field_name), $this->_timezone)
1209 1209
 		);
1210 1210
 	}
1211 1211
 
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 	 * @throws EE_Error
1219 1219
 	 * @return EE_Datetime_Field
1220 1220
 	 */
1221
-	protected function _get_dtt_field_settings( $field_name ) {
1221
+	protected function _get_dtt_field_settings($field_name) {
1222 1222
 		$field = $this->get_model()->field_settings_for($field_name);
1223 1223
 
1224 1224
 		//check if field is dtt
1225
-		if ( $field instanceof EE_Datetime_Field ) {
1225
+		if ($field instanceof EE_Datetime_Field) {
1226 1226
 			return $field;
1227 1227
 		} else {
1228
-			throw new EE_Error( sprintf( __('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field.  Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname( get_class($this) ) ) );
1228
+			throw new EE_Error(sprintf(__('The field name "%s" has been requested for the EE_Base_Class datetime functions and it is not a valid EE_Datetime_Field.  Please check the spelling of the field and make sure it has been setup as a EE_Datetime_Field in the %s model constructor', 'event_espresso'), $field_name, self::_get_model_classname(get_class($this))));
1229 1229
 		}
1230 1230
 	}
1231 1231
 
@@ -1246,8 +1246,8 @@  discard block
 block discarded – undo
1246 1246
 	 * @param string          $fieldname the name of the field the time is being set on (must match a EE_Datetime_Field)
1247 1247
 	 * @throws \EE_Error
1248 1248
 	 */
1249
-	protected function _set_time_for( $time, $fieldname ) {
1250
-		$this->_set_date_time( 'T', $time, $fieldname );
1249
+	protected function _set_time_for($time, $fieldname) {
1250
+		$this->_set_date_time('T', $time, $fieldname);
1251 1251
 	}
1252 1252
 
1253 1253
 
@@ -1260,8 +1260,8 @@  discard block
 block discarded – undo
1260 1260
 	 * @param string          $fieldname the name of the field the date is being set on (must match a EE_Datetime_Field)
1261 1261
 	 * @throws \EE_Error
1262 1262
 	 */
1263
-	protected function _set_date_for( $date, $fieldname ) {
1264
-		$this->_set_date_time( 'D', $date, $fieldname );
1263
+	protected function _set_date_for($date, $fieldname) {
1264
+		$this->_set_date_time('D', $date, $fieldname);
1265 1265
 	}
1266 1266
 
1267 1267
 
@@ -1275,26 +1275,26 @@  discard block
 block discarded – undo
1275 1275
 	 * @param string          $fieldname      the name of the field the date OR time is being set on (must match a EE_Datetime_Field property)
1276 1276
 	 * @throws \EE_Error
1277 1277
 	 */
1278
-	protected function _set_date_time( $what = 'T', $datetime_value, $fieldname ) {
1279
-		$field = $this->_get_dtt_field_settings( $fieldname );
1280
-		$field->set_timezone( $this->_timezone );
1281
-		$field->set_date_format( $this->_dt_frmt );
1282
-		$field->set_time_format( $this->_tm_frmt );
1283
-		switch ( $what ) {
1278
+	protected function _set_date_time($what = 'T', $datetime_value, $fieldname) {
1279
+		$field = $this->_get_dtt_field_settings($fieldname);
1280
+		$field->set_timezone($this->_timezone);
1281
+		$field->set_date_format($this->_dt_frmt);
1282
+		$field->set_time_format($this->_tm_frmt);
1283
+		switch ($what) {
1284 1284
 			case 'T' :
1285
-				$this->_fields[ $fieldname ] = $field->prepare_for_set_with_new_time(
1285
+				$this->_fields[$fieldname] = $field->prepare_for_set_with_new_time(
1286 1286
 					$datetime_value,
1287
-					$this->_fields[ $fieldname ]
1287
+					$this->_fields[$fieldname]
1288 1288
 				);
1289 1289
 				break;
1290 1290
 			case 'D' :
1291
-				$this->_fields[ $fieldname ] = $field->prepare_for_set_with_new_date(
1291
+				$this->_fields[$fieldname] = $field->prepare_for_set_with_new_date(
1292 1292
 					$datetime_value,
1293
-					$this->_fields[ $fieldname ]
1293
+					$this->_fields[$fieldname]
1294 1294
 				);
1295 1295
 				break;
1296 1296
 			case 'B' :
1297
-				$this->_fields[ $fieldname ] = $field->prepare_for_set( $datetime_value );
1297
+				$this->_fields[$fieldname] = $field->prepare_for_set($datetime_value);
1298 1298
 				break;
1299 1299
 		}
1300 1300
 		$this->_clear_cached_property($fieldname);
@@ -1316,17 +1316,17 @@  discard block
 block discarded – undo
1316 1316
 	 * @throws EE_Error
1317 1317
 	 * @return string timestamp
1318 1318
 	 */
1319
-	public function display_in_my_timezone( $field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '' ) {
1319
+	public function display_in_my_timezone($field_name, $callback = 'get_datetime', $args = NULL, $prepend = '', $append = '') {
1320 1320
 		$timezone = EEH_DTT_Helper::get_timezone();
1321
-		if ( $timezone === $this->_timezone ) {
1321
+		if ($timezone === $this->_timezone) {
1322 1322
 			return '';
1323 1323
 		}
1324 1324
 		$original_timezone = $this->_timezone;
1325
-		$this->set_timezone( $timezone );
1325
+		$this->set_timezone($timezone);
1326 1326
 
1327 1327
 		$fn = (array) $field_name;
1328
-		$args = array_merge( $fn, (array) $args );
1329
-		if ( ! method_exists( $this, $callback ) ) {
1328
+		$args = array_merge($fn, (array) $args);
1329
+		if ( ! method_exists($this, $callback)) {
1330 1330
 			throw new EE_Error(
1331 1331
 				sprintf(
1332 1332
 					__(
@@ -1338,9 +1338,9 @@  discard block
 block discarded – undo
1338 1338
 			);
1339 1339
 		}
1340 1340
 		$args = (array) $args;
1341
-		$return =  $prepend . call_user_func_array( array( $this, $callback ), $args ) . $append;
1341
+		$return = $prepend.call_user_func_array(array($this, $callback), $args).$append;
1342 1342
 
1343
-		$this->set_timezone( $original_timezone );
1343
+		$this->set_timezone($original_timezone);
1344 1344
 		return $return;
1345 1345
 	}
1346 1346
 
@@ -1354,7 +1354,7 @@  discard block
 block discarded – undo
1354 1354
 	 * @return boolean | int
1355 1355
 	 * @throws \EE_Error
1356 1356
 	 */
1357
-	public function delete(){
1357
+	public function delete() {
1358 1358
 		/**
1359 1359
 		 * Called just before the `EE_Base_Class::_delete` method call.
1360 1360
 		 * Note: `EE_Base_Class::_delete` might be overridden by child classes so any client code hooking into these actions
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 		 *
1364 1364
 		 * @param EE_Base_Class $model_object about to be 'deleted'
1365 1365
 		 */
1366
-		do_action( 'AHEE__EE_Base_Class__delete__before', $this );
1366
+		do_action('AHEE__EE_Base_Class__delete__before', $this);
1367 1367
 		$result = $this->_delete();
1368 1368
 		/**
1369 1369
 		 * Called just after the `EE_Base_Class::_delete` method call.
@@ -1373,7 +1373,7 @@  discard block
 block discarded – undo
1373 1373
 		 * @param EE_Base_Class $model_object that was just 'deleted'
1374 1374
 		 * @param boolean $result
1375 1375
 		 */
1376
-		do_action( 'AHEE__EE_Base_Class__delete__end', $this, $result );
1376
+		do_action('AHEE__EE_Base_Class__delete__end', $this, $result);
1377 1377
 		return $result;
1378 1378
 	}
1379 1379
 
@@ -1399,22 +1399,22 @@  discard block
 block discarded – undo
1399 1399
 	 * @return bool | int
1400 1400
 	 * @throws \EE_Error
1401 1401
 	 */
1402
-	public function delete_permanently(){
1402
+	public function delete_permanently() {
1403 1403
 		/**
1404 1404
 		 * Called just before HARD deleting a model object
1405 1405
 		 *
1406 1406
 		 * @param EE_Base_Class $model_object about to be 'deleted'
1407 1407
 		 */
1408
-		do_action( 'AHEE__EE_Base_Class__delete_permanently__before', $this );
1409
-		$model=$this->get_model();
1410
-		$result=$model->delete_permanently_by_ID($this->ID());
1408
+		do_action('AHEE__EE_Base_Class__delete_permanently__before', $this);
1409
+		$model = $this->get_model();
1410
+		$result = $model->delete_permanently_by_ID($this->ID());
1411 1411
 		$this->refresh_cache_of_related_objects();
1412 1412
 		/**
1413 1413
 		 * Called just after HARD deleting a model object
1414 1414
 		 * @param EE_Base_Class $model_object that was just 'deleted'
1415 1415
 		 * @param boolean $result
1416 1416
 		 */
1417
-		do_action( 'AHEE__EE_Base_Class__delete_permanently__end', $this, $result );
1417
+		do_action('AHEE__EE_Base_Class__delete_permanently__end', $this, $result);
1418 1418
 		return $result;
1419 1419
 	}
1420 1420
 
@@ -1427,18 +1427,18 @@  discard block
 block discarded – undo
1427 1427
 	 * @throws \EE_Error
1428 1428
 	 */
1429 1429
         public function refresh_cache_of_related_objects() {
1430
-            foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) {
1431
-                if( ! empty( $this->_model_relations[ $relation_name ] ) ) {
1432
-                    $related_objects = $this->_model_relations[ $relation_name ];
1433
-                    if( $relation_obj instanceof EE_Belongs_To_Relation ) {
1430
+            foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) {
1431
+                if ( ! empty($this->_model_relations[$relation_name])) {
1432
+                    $related_objects = $this->_model_relations[$relation_name];
1433
+                    if ($relation_obj instanceof EE_Belongs_To_Relation) {
1434 1434
                         //this relation only stores a single model object, not an array
1435 1435
                         //but let's make it consistent
1436
-                        $related_objects = array( $related_objects );
1436
+                        $related_objects = array($related_objects);
1437 1437
                     }
1438
-                    foreach( $related_objects as $related_object ) {
1438
+                    foreach ($related_objects as $related_object) {
1439 1439
                         //only refresh their cache if they're in memory
1440
-                        if( $related_object instanceof EE_Base_Class ) {
1441
-							$related_object->clear_cache( $this->get_model()->get_this_model_name(), $this );
1440
+                        if ($related_object instanceof EE_Base_Class) {
1441
+							$related_object->clear_cache($this->get_model()->get_this_model_name(), $this);
1442 1442
                         }
1443 1443
                     }
1444 1444
                 }
@@ -1458,17 +1458,17 @@  discard block
 block discarded – undo
1458 1458
 	 * @return int , 1 on a successful update, the ID of the new entry on insert; 0 on failure or if the model object
1459 1459
 	 * isn't allowed to persist (as determined by EE_Base_Class::allow_persist())
1460 1460
 	 */
1461
-	public function save($set_cols_n_values=array()) {
1461
+	public function save($set_cols_n_values = array()) {
1462 1462
 		/**
1463 1463
 		 * Filters the fields we're about to save on the model object
1464 1464
 		 *
1465 1465
 		 * @param array $set_cols_n_values
1466 1466
 		 * @param EE_Base_Class $model_object
1467 1467
 		 */
1468
-		$set_cols_n_values = (array)apply_filters( 'FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this  );
1468
+		$set_cols_n_values = (array) apply_filters('FHEE__EE_Base_Class__save__set_cols_n_values', $set_cols_n_values, $this);
1469 1469
 		//set attributes as provided in $set_cols_n_values
1470
-		foreach($set_cols_n_values as $column=>$value){
1471
-			$this->set($column,$value);
1470
+		foreach ($set_cols_n_values as $column=>$value) {
1471
+			$this->set($column, $value);
1472 1472
 		}
1473 1473
 		/**
1474 1474
 		 * Saving a model object.
@@ -1476,8 +1476,8 @@  discard block
 block discarded – undo
1476 1476
 		 * Before we perform a save, this action is fired.
1477 1477
 		 * @param EE_Base_Class $model_object the model object about to be saved.
1478 1478
 		 */
1479
-		do_action( 'AHEE__EE_Base_Class__save__begin', $this );
1480
-		if( ! $this->allow_persist() ) {
1479
+		do_action('AHEE__EE_Base_Class__save__begin', $this);
1480
+		if ( ! $this->allow_persist()) {
1481 1481
 			return 0;
1482 1482
 		}
1483 1483
 		//now get current attribute values
@@ -1487,61 +1487,61 @@  discard block
 block discarded – undo
1487 1487
 		$old_assumption_concerning_value_preparation = $this->get_model()->get_assumption_concerning_values_already_prepared_by_model_object();
1488 1488
 		$this->get_model()->assume_values_already_prepared_by_model_object(true);
1489 1489
 		//does this model have an autoincrement PK?
1490
-		if($this->get_model()->has_primary_key_field()){
1491
-			if($this->get_model()->get_primary_key_field()->is_auto_increment()){
1490
+		if ($this->get_model()->has_primary_key_field()) {
1491
+			if ($this->get_model()->get_primary_key_field()->is_auto_increment()) {
1492 1492
 				//ok check if it's set, if so: update; if not, insert
1493
-				if ( ! empty( $save_cols_n_values[self::_get_primary_key_name( get_class($this) )] ) ){
1494
-					$results = $this->get_model()->update_by_ID ( $save_cols_n_values, $this->ID() );
1493
+				if ( ! empty($save_cols_n_values[self::_get_primary_key_name(get_class($this))])) {
1494
+					$results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID());
1495 1495
 				} else {
1496
-					unset($save_cols_n_values[self::_get_primary_key_name( get_class( $this) )]);
1497
-					$results = $this->get_model()->insert( $save_cols_n_values );
1498
-					if($results){
1496
+					unset($save_cols_n_values[self::_get_primary_key_name(get_class($this))]);
1497
+					$results = $this->get_model()->insert($save_cols_n_values);
1498
+					if ($results) {
1499 1499
 						//if successful, set the primary key
1500 1500
 						//but don't use the normal SET method, because it will check if
1501 1501
 						//an item with the same ID exists in the mapper & db, then
1502 1502
 						//will find it in the db (because we just added it) and THAT object
1503 1503
 						//will get added to the mapper before we can add this one!
1504 1504
 						//but if we just avoid using the SET method, all that headache can be avoided
1505
-						$pk_field_name =self::_get_primary_key_name( get_class($this));
1505
+						$pk_field_name = self::_get_primary_key_name(get_class($this));
1506 1506
 						$this->_fields[$pk_field_name] = $results;
1507 1507
 						$this->_clear_cached_property($pk_field_name);
1508
-						$this->get_model()->add_to_entity_map( $this );
1508
+						$this->get_model()->add_to_entity_map($this);
1509 1509
 						$this->_update_cached_related_model_objs_fks();
1510 1510
 					}
1511 1511
 				}
1512
-			}else{//PK is NOT auto-increment
1512
+			} else {//PK is NOT auto-increment
1513 1513
 				//so check if one like it already exists in the db
1514
-				if( $this->get_model()->exists_by_ID( $this->ID() ) ){
1515
-					if( WP_DEBUG && ! $this->in_entity_map() ){
1514
+				if ($this->get_model()->exists_by_ID($this->ID())) {
1515
+					if (WP_DEBUG && ! $this->in_entity_map()) {
1516 1516
 						throw new EE_Error(
1517 1517
 							sprintf(
1518
-								__( 'Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso' ),
1518
+								__('Using a model object %1$s that is NOT in the entity map, can lead to unexpected errors. You should either: %4$s 1. Put it in the entity mapper by calling %2$s %4$s 2. Discard this model object and use what is in the entity mapper %4$s 3. Fetch from the database using %3$s', 'event_espresso'),
1519 1519
 								get_class($this),
1520
-								get_class( $this->get_model() ) . '::instance()->add_to_entity_map()',
1521
-								get_class( $this->get_model() ) . '::instance()->get_one_by_ID()',
1520
+								get_class($this->get_model()).'::instance()->add_to_entity_map()',
1521
+								get_class($this->get_model()).'::instance()->get_one_by_ID()',
1522 1522
 								'<br />'
1523 1523
 							)
1524 1524
 						);
1525 1525
 					}
1526 1526
 					$results = $this->get_model()->update_by_ID($save_cols_n_values, $this->ID());
1527
-				}else{
1527
+				} else {
1528 1528
 					$results = $this->get_model()->insert($save_cols_n_values);
1529 1529
 					$this->_update_cached_related_model_objs_fks();
1530 1530
 				}
1531 1531
 			}
1532
-		}else{//there is NO primary key
1532
+		} else {//there is NO primary key
1533 1533
 			$already_in_db = false;
1534
-			foreach($this->get_model()->unique_indexes() as $index){
1534
+			foreach ($this->get_model()->unique_indexes() as $index) {
1535 1535
 				$uniqueness_where_params = array_intersect_key($save_cols_n_values, $index->fields());
1536
-				if($this->get_model()->exists(array($uniqueness_where_params))){
1536
+				if ($this->get_model()->exists(array($uniqueness_where_params))) {
1537 1537
 					$already_in_db = true;
1538 1538
 				}
1539 1539
 			}
1540
-			if( $already_in_db ){
1541
-				$combined_pk_fields_n_values = array_intersect_key( $save_cols_n_values, $this->get_model()->get_combined_primary_key_fields() );
1542
-				$results = $this->get_model()->update( $save_cols_n_values,$combined_pk_fields_n_values );
1543
-			}else{
1544
-				$results = $this->get_model()->insert( $save_cols_n_values );
1540
+			if ($already_in_db) {
1541
+				$combined_pk_fields_n_values = array_intersect_key($save_cols_n_values, $this->get_model()->get_combined_primary_key_fields());
1542
+				$results = $this->get_model()->update($save_cols_n_values, $combined_pk_fields_n_values);
1543
+			} else {
1544
+				$results = $this->get_model()->insert($save_cols_n_values);
1545 1545
 			}
1546 1546
 		}
1547 1547
 		//restore the old assumption about values being prepared by the model object
@@ -1554,7 +1554,7 @@  discard block
 block discarded – undo
1554 1554
 		 * @param boolean|int $results if it were updated, TRUE or FALSE; if it were newly inserted
1555 1555
 		 * the new ID (or 0 if an error occurred and it wasn't updated)
1556 1556
 		 */
1557
-		do_action( 'AHEE__EE_Base_Class__save__end', $this, $results );
1557
+		do_action('AHEE__EE_Base_Class__save__end', $this, $results);
1558 1558
 		return $results;
1559 1559
 	}
1560 1560
 
@@ -1569,15 +1569,15 @@  discard block
 block discarded – undo
1569 1569
 	 * @return void
1570 1570
 	 * @throws \EE_Error
1571 1571
 	 */
1572
-	protected function _update_cached_related_model_objs_fks(){
1573
-		foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ){
1574
-			if( $relation_obj instanceof EE_Has_Many_Relation ){
1575
-				foreach( $this->get_all_from_cache( $relation_name ) as $related_model_obj_in_cache) {
1572
+	protected function _update_cached_related_model_objs_fks() {
1573
+		foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) {
1574
+			if ($relation_obj instanceof EE_Has_Many_Relation) {
1575
+				foreach ($this->get_all_from_cache($relation_name) as $related_model_obj_in_cache) {
1576 1576
 					$fk_to_this = $related_model_obj_in_cache->get_model()->get_foreign_key_to(
1577 1577
 						$this->get_model()->get_this_model_name()
1578 1578
 					);
1579
-					$related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID() );
1580
-					if( $related_model_obj_in_cache->ID() ){
1579
+					$related_model_obj_in_cache->set($fk_to_this->get_name(), $this->ID());
1580
+					if ($related_model_obj_in_cache->ID()) {
1581 1581
 						$related_model_obj_in_cache->save();
1582 1582
 					}
1583 1583
 				}
@@ -1598,21 +1598,21 @@  discard block
 block discarded – undo
1598 1598
 	 * @return int ID of new model object on save; 0 on failure+
1599 1599
 	 * @throws \EE_Error
1600 1600
 	 */
1601
-	public function save_new_cached_related_model_objs(){
1601
+	public function save_new_cached_related_model_objs() {
1602 1602
 		//make sure this has been saved
1603
-		if( ! $this->ID()){
1603
+		if ( ! $this->ID()) {
1604 1604
 			$id = $this->save();
1605
-		}else{
1605
+		} else {
1606 1606
 			$id = $this->ID();
1607 1607
 		}
1608 1608
 		//now save all the NEW cached model objects  (ie they don't exist in the DB)
1609
-		foreach($this->get_model()->relation_settings() as $relationName => $relationObj){
1609
+		foreach ($this->get_model()->relation_settings() as $relationName => $relationObj) {
1610 1610
 
1611 1611
 
1612
-			if($this->_model_relations[$relationName]){
1612
+			if ($this->_model_relations[$relationName]) {
1613 1613
 				//is this a relation where we should expect just ONE related object (ie, EE_Belongs_To_relation)
1614 1614
 				//or MANY related objects (ie, EE_HABTM_Relation or EE_Has_Many_Relation)?
1615
-				if($relationObj instanceof EE_Belongs_To_Relation){
1615
+				if ($relationObj instanceof EE_Belongs_To_Relation) {
1616 1616
 					//add a relation to that relation type (which saves the appropriate thing in the process)
1617 1617
 					//but ONLY if it DOES NOT exist in the DB
1618 1618
 					/* @var $related_model_obj EE_Base_Class */
@@ -1621,8 +1621,8 @@  discard block
 block discarded – undo
1621 1621
 						$this->_add_relation_to($related_model_obj, $relationName);
1622 1622
 						$related_model_obj->save_new_cached_related_model_objs();
1623 1623
 //					}
1624
-				}else{
1625
-					foreach($this->_model_relations[$relationName] as $related_model_obj){
1624
+				} else {
1625
+					foreach ($this->_model_relations[$relationName] as $related_model_obj) {
1626 1626
 						//add a relation to that relation type (which saves the appropriate thing in the process)
1627 1627
 						//but ONLY if it DOES NOT exist in the DB
1628 1628
 //						if( ! $related_model_obj->ID()){
@@ -1643,8 +1643,8 @@  discard block
 block discarded – undo
1643 1643
 	 * @return \EEM_Base | \EEM_CPT_Base
1644 1644
 	 */
1645 1645
 	public function get_model() {
1646
-		$modelName = self::_get_model_classname( get_class($this) );
1647
-		return self::_get_model_instance_with_name($modelName, $this->_timezone );
1646
+		$modelName = self::_get_model_classname(get_class($this));
1647
+		return self::_get_model_instance_with_name($modelName, $this->_timezone);
1648 1648
 	}
1649 1649
 
1650 1650
 
@@ -1655,10 +1655,10 @@  discard block
 block discarded – undo
1655 1655
 	 * @return mixed bool|EE_Base_Class|EEM_CPT_Base
1656 1656
 	 * @throws \EE_Error
1657 1657
 	 */
1658
-	protected static function _get_object_from_entity_mapper($props_n_values, $classname){
1658
+	protected static function _get_object_from_entity_mapper($props_n_values, $classname) {
1659 1659
 		//TODO: will not work for Term_Relationships because they have no PK!
1660
-		$primary_id_ref = self::_get_primary_key_name( $classname );
1661
-		if ( array_key_exists( $primary_id_ref, $props_n_values ) && !empty( $props_n_values[$primary_id_ref] ) ) {
1660
+		$primary_id_ref = self::_get_primary_key_name($classname);
1661
+		if (array_key_exists($primary_id_ref, $props_n_values) && ! empty($props_n_values[$primary_id_ref])) {
1662 1662
 			$id = $props_n_values[$primary_id_ref];
1663 1663
 			return self::_get_model($classname)->get_from_entity_map($id);
1664 1664
 		}
@@ -1679,37 +1679,37 @@  discard block
 block discarded – undo
1679 1679
 	 * @return mixed (EE_Base_Class|bool)
1680 1680
 	 * @throws \EE_Error
1681 1681
 	 */
1682
-	protected static function _check_for_object( $props_n_values, $classname, $timezone = NULL, $date_formats = array() ) {
1682
+	protected static function _check_for_object($props_n_values, $classname, $timezone = NULL, $date_formats = array()) {
1683 1683
 		$existing = null;
1684
-		if ( self::_get_model( $classname )->has_primary_key_field() ) {
1685
-			$primary_id_ref = self::_get_primary_key_name( $classname );
1686
-			if ( array_key_exists( $primary_id_ref, $props_n_values )
1687
-			     && ! empty( $props_n_values[ $primary_id_ref ] )
1684
+		if (self::_get_model($classname)->has_primary_key_field()) {
1685
+			$primary_id_ref = self::_get_primary_key_name($classname);
1686
+			if (array_key_exists($primary_id_ref, $props_n_values)
1687
+			     && ! empty($props_n_values[$primary_id_ref])
1688 1688
 			) {
1689
-				$existing = self::_get_model( $classname, $timezone )->get_one_by_ID(
1690
-					$props_n_values[ $primary_id_ref ]
1689
+				$existing = self::_get_model($classname, $timezone)->get_one_by_ID(
1690
+					$props_n_values[$primary_id_ref]
1691 1691
 				);
1692 1692
 			}
1693
-		} elseif ( self::_get_model( $classname, $timezone )->has_all_combined_primary_key_fields( $props_n_values ) ) {
1693
+		} elseif (self::_get_model($classname, $timezone)->has_all_combined_primary_key_fields($props_n_values)) {
1694 1694
 			//no primary key on this model, but there's still a matching item in the DB
1695
-			$existing = self::_get_model( $classname, $timezone )->get_one_by_ID(
1696
-				self::_get_model( $classname, $timezone )->get_index_primary_key_string( $props_n_values )
1695
+			$existing = self::_get_model($classname, $timezone)->get_one_by_ID(
1696
+				self::_get_model($classname, $timezone)->get_index_primary_key_string($props_n_values)
1697 1697
 			);
1698 1698
 		}
1699
-		if ( $existing ) {
1699
+		if ($existing) {
1700 1700
 
1701 1701
 			//set date formats if present before setting values
1702
-			if ( ! empty( $date_formats ) && is_array( $date_formats ) ) {
1703
-				$existing->set_date_format( $date_formats[0] );
1704
-				$existing->set_time_format( $date_formats[1] );
1702
+			if ( ! empty($date_formats) && is_array($date_formats)) {
1703
+				$existing->set_date_format($date_formats[0]);
1704
+				$existing->set_time_format($date_formats[1]);
1705 1705
 			} else {
1706 1706
 				//set default formats for date and time
1707
-				$existing->set_date_format( get_option( 'date_format' ) );
1708
-				$existing->set_time_format( get_option( 'time_format' ) );
1707
+				$existing->set_date_format(get_option('date_format'));
1708
+				$existing->set_time_format(get_option('time_format'));
1709 1709
 			}
1710 1710
 
1711
-			foreach ( $props_n_values as $property => $field_value ) {
1712
-				$existing->set( $property, $field_value );
1711
+			foreach ($props_n_values as $property => $field_value) {
1712
+				$existing->set($property, $field_value);
1713 1713
 			}
1714 1714
 			return $existing;
1715 1715
 		} else {
@@ -1727,9 +1727,9 @@  discard block
 block discarded – undo
1727 1727
 	 * @throws EE_Error
1728 1728
 	 * @return EEM_Base
1729 1729
 	 */
1730
-	protected static function  _get_model( $classname, $timezone = NULL ){
1730
+	protected static function  _get_model($classname, $timezone = NULL) {
1731 1731
 		//find model for this class
1732
-		if( ! $classname ){
1732
+		if ( ! $classname) {
1733 1733
 			throw new EE_Error(
1734 1734
 				sprintf(
1735 1735
 					__(
@@ -1740,8 +1740,8 @@  discard block
 block discarded – undo
1740 1740
 				)
1741 1741
 			);
1742 1742
 		}
1743
-		$modelName=self::_get_model_classname($classname);
1744
-		return self::_get_model_instance_with_name($modelName, $timezone );
1743
+		$modelName = self::_get_model_classname($classname);
1744
+		return self::_get_model_instance_with_name($modelName, $timezone);
1745 1745
 	}
1746 1746
 
1747 1747
 
@@ -1752,10 +1752,10 @@  discard block
 block discarded – undo
1752 1752
 	 * @param null   $timezone
1753 1753
 	 * @return EEM_Base
1754 1754
 	 */
1755
-	protected static function _get_model_instance_with_name($model_classname, $timezone = NULL){
1756
-		$model_classname = str_replace( 'EEM_', '', $model_classname );
1757
-		$model = EE_Registry::instance()->load_model( $model_classname );
1758
-		$model->set_timezone( $timezone );
1755
+	protected static function _get_model_instance_with_name($model_classname, $timezone = NULL) {
1756
+		$model_classname = str_replace('EEM_', '', $model_classname);
1757
+		$model = EE_Registry::instance()->load_model($model_classname);
1758
+		$model->set_timezone($timezone);
1759 1759
 		return $model;
1760 1760
 	}
1761 1761
 
@@ -1767,10 +1767,10 @@  discard block
 block discarded – undo
1767 1767
 	 * @param null $model_name
1768 1768
 	 * @return string like EEM_Attendee
1769 1769
 	 */
1770
-	private static function _get_model_classname( $model_name = null){
1771
-		if(strpos($model_name,"EE_")===0){
1772
-			$model_classname=str_replace("EE_","EEM_",$model_name);
1773
-		}else{
1770
+	private static function _get_model_classname($model_name = null) {
1771
+		if (strpos($model_name, "EE_") === 0) {
1772
+			$model_classname = str_replace("EE_", "EEM_", $model_name);
1773
+		} else {
1774 1774
 			$model_classname = "EEM_".$model_name;
1775 1775
 		}
1776 1776
 		return $model_classname;
@@ -1784,16 +1784,16 @@  discard block
 block discarded – undo
1784 1784
 	 * @throws EE_Error
1785 1785
 	 * @return string
1786 1786
 	 */
1787
-	protected static function _get_primary_key_name( $classname = NULL ){
1788
-		if( ! $classname){
1787
+	protected static function _get_primary_key_name($classname = NULL) {
1788
+		if ( ! $classname) {
1789 1789
 			throw new EE_Error(
1790 1790
 				sprintf(
1791
-					__( "What were you thinking calling _get_primary_key_name(%s)", "event_espresso" ),
1791
+					__("What were you thinking calling _get_primary_key_name(%s)", "event_espresso"),
1792 1792
 					$classname
1793 1793
 				)
1794 1794
 			);
1795 1795
 		}
1796
-		return self::_get_model( $classname )->get_primary_key_field()->get_name();
1796
+		return self::_get_model($classname)->get_primary_key_field()->get_name();
1797 1797
 	}
1798 1798
 
1799 1799
 
@@ -1807,12 +1807,12 @@  discard block
 block discarded – undo
1807 1807
 	 * @return mixed, if the primary key is of type INT it'll be an int. Otherwise it could be a string
1808 1808
 	 * @throws \EE_Error
1809 1809
 	 */
1810
-	public function ID(){
1810
+	public function ID() {
1811 1811
 		//now that we know the name of the variable, use a variable variable to get its value and return its
1812
-		if( $this->get_model()->has_primary_key_field() ) {
1813
-			return $this->_fields[ self::_get_primary_key_name( get_class($this) ) ];
1814
-		}else{
1815
-			return $this->get_model()->get_index_primary_key_string( $this->_fields );
1812
+		if ($this->get_model()->has_primary_key_field()) {
1813
+			return $this->_fields[self::_get_primary_key_name(get_class($this))];
1814
+		} else {
1815
+			return $this->get_model()->get_index_primary_key_string($this->_fields);
1816 1816
 		}
1817 1817
 	}
1818 1818
 
@@ -1830,38 +1830,38 @@  discard block
 block discarded – undo
1830 1830
 	 * @throws EE_Error
1831 1831
 	 * @return EE_Base_Class the object the relation was added to
1832 1832
 	 */
1833
-	public function _add_relation_to( $otherObjectModelObjectOrID,$relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL ){
1833
+	public function _add_relation_to($otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values = array(), $cache_id = NULL) {
1834 1834
 		//if this thing exists in the DB, save the relation to the DB
1835
-		if( $this->ID() ){
1836
-			$otherObject = $this->get_model()->add_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values );
1835
+		if ($this->ID()) {
1836
+			$otherObject = $this->get_model()->add_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $extra_join_model_fields_n_values);
1837 1837
 			//clear cache so future get_many_related and get_first_related() return new results.
1838
-			$this->clear_cache( $relationName, $otherObject, TRUE );
1839
-                        if( $otherObject instanceof EE_Base_Class ) {
1840
-                            $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this );
1838
+			$this->clear_cache($relationName, $otherObject, TRUE);
1839
+                        if ($otherObject instanceof EE_Base_Class) {
1840
+                            $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this);
1841 1841
                         }
1842 1842
 		} else {
1843 1843
 			//this thing doesn't exist in the DB,  so just cache it
1844
-			if( ! $otherObjectModelObjectOrID instanceof EE_Base_Class){
1845
-				throw new EE_Error( sprintf(
1846
-					__( 'Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso' ),
1844
+			if ( ! $otherObjectModelObjectOrID instanceof EE_Base_Class) {
1845
+				throw new EE_Error(sprintf(
1846
+					__('Before a model object is saved to the database, calls to _add_relation_to must be passed an actual object, not just an ID. You provided %s as the model object to a %s', 'event_espresso'),
1847 1847
 					$otherObjectModelObjectOrID,
1848
-					get_class( $this )
1848
+					get_class($this)
1849 1849
 				));
1850 1850
 			} else {
1851 1851
 				$otherObject = $otherObjectModelObjectOrID;
1852 1852
 			}
1853
-			$this->cache( $relationName, $otherObjectModelObjectOrID, $cache_id );
1853
+			$this->cache($relationName, $otherObjectModelObjectOrID, $cache_id);
1854 1854
 		}
1855
-                if( $otherObject instanceof EE_Base_Class ) {
1855
+                if ($otherObject instanceof EE_Base_Class) {
1856 1856
                     //fix the reciprocal relation too
1857
-                    if( $otherObject->ID() ) {
1857
+                    if ($otherObject->ID()) {
1858 1858
                             //its saved so assumed relations exist in the DB, so we can just
1859 1859
                             //clear the cache so future queries use the updated info in the DB
1860
-                            $otherObject->clear_cache( $this->get_model()->get_this_model_name(), null, true );
1860
+                            $otherObject->clear_cache($this->get_model()->get_this_model_name(), null, true);
1861 1861
                     } else {
1862 1862
 
1863 1863
                             //it's not saved, so it caches relations like this
1864
-                            $otherObject->cache( $this->get_model()->get_this_model_name(), $this );
1864
+                            $otherObject->cache($this->get_model()->get_this_model_name(), $this);
1865 1865
                     }
1866 1866
                 }
1867 1867
 		return $otherObject;
@@ -1885,17 +1885,17 @@  discard block
 block discarded – undo
1885 1885
 	 * @return EE_Base_Class the relation was removed from
1886 1886
 	 * @throws \EE_Error
1887 1887
 	 */
1888
-	public function _remove_relation_to($otherObjectModelObjectOrID,$relationName, $where_query = array() ){
1889
-		if ( $this->ID() ) {
1888
+	public function _remove_relation_to($otherObjectModelObjectOrID, $relationName, $where_query = array()) {
1889
+		if ($this->ID()) {
1890 1890
 			//if this exists in the DB, save the relation change to the DB too
1891
-			$otherObject = $this->get_model()->remove_relationship_to( $this, $otherObjectModelObjectOrID, $relationName, $where_query );
1892
-			$this->clear_cache( $relationName, $otherObject );
1891
+			$otherObject = $this->get_model()->remove_relationship_to($this, $otherObjectModelObjectOrID, $relationName, $where_query);
1892
+			$this->clear_cache($relationName, $otherObject);
1893 1893
 		} else {
1894 1894
 			//this doesn't exist in the DB, just remove it from the cache
1895
-			$otherObject = $this->clear_cache( $relationName, $otherObjectModelObjectOrID );
1895
+			$otherObject = $this->clear_cache($relationName, $otherObjectModelObjectOrID);
1896 1896
 		}
1897
-                if( $otherObject instanceof EE_Base_Class ) {
1898
-                    $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this );
1897
+                if ($otherObject instanceof EE_Base_Class) {
1898
+                    $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this);
1899 1899
                 }
1900 1900
 		return $otherObject;
1901 1901
 	}
@@ -1910,18 +1910,18 @@  discard block
 block discarded – undo
1910 1910
 	 * @return EE_Base_Class
1911 1911
 	 * @throws \EE_Error
1912 1912
 	 */
1913
-	public function _remove_relations($relationName,$where_query_params = array()){
1914
-		if ( $this->ID() ) {
1913
+	public function _remove_relations($relationName, $where_query_params = array()) {
1914
+		if ($this->ID()) {
1915 1915
 			//if this exists in the DB, save the relation change to the DB too
1916
-			$otherObjects = $this->get_model()->remove_relations( $this, $relationName, $where_query_params );
1917
-			$this->clear_cache( $relationName, null, true );
1916
+			$otherObjects = $this->get_model()->remove_relations($this, $relationName, $where_query_params);
1917
+			$this->clear_cache($relationName, null, true);
1918 1918
 		} else {
1919 1919
 			//this doesn't exist in the DB, just remove it from the cache
1920
-			$otherObjects = $this->clear_cache( $relationName, null, true );
1920
+			$otherObjects = $this->clear_cache($relationName, null, true);
1921 1921
 		}
1922
-                if( is_array( $otherObjects ) ) {
1923
-                    foreach ( $otherObjects as $otherObject ) {
1924
-                            $otherObject->clear_cache( $this->get_model()->get_this_model_name(), $this );
1922
+                if (is_array($otherObjects)) {
1923
+                    foreach ($otherObjects as $otherObject) {
1924
+                            $otherObject->clear_cache($this->get_model()->get_this_model_name(), $this);
1925 1925
                     }
1926 1926
                 }
1927 1927
 		return $otherObjects;
@@ -1941,27 +1941,27 @@  discard block
 block discarded – undo
1941 1941
 	 * @throws \EE_Error
1942 1942
 	 *                             or might not be saved yet. Consider using EEM_Base::get_IDs() on these results if you want IDs
1943 1943
 	 */
1944
-	public function get_many_related($relationName,$query_params = array()){
1945
-		if($this->ID()){
1944
+	public function get_many_related($relationName, $query_params = array()) {
1945
+		if ($this->ID()) {
1946 1946
 			//this exists in the DB, so get the related things from either the cache or the DB
1947 1947
 			//if there are query parameters, forget about caching the related model objects.
1948
-			if( $query_params ){
1948
+			if ($query_params) {
1949 1949
 				$related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params);
1950
-			}else{
1950
+			} else {
1951 1951
 				//did we already cache the result of this query?
1952 1952
 				$cached_results = $this->get_all_from_cache($relationName);
1953
-				if ( ! $cached_results ){
1953
+				if ( ! $cached_results) {
1954 1954
 					$related_model_objects = $this->get_model()->get_all_related($this, $relationName, $query_params);
1955 1955
 					//if no query parameters were passed, then we got all the related model objects
1956 1956
 					//for that relation. We can cache them then.
1957
-					foreach($related_model_objects as $related_model_object){
1957
+					foreach ($related_model_objects as $related_model_object) {
1958 1958
 						$this->cache($relationName, $related_model_object);
1959 1959
 					}
1960
-				}else{
1960
+				} else {
1961 1961
 					$related_model_objects = $cached_results;
1962 1962
 				}
1963 1963
 			}
1964
-		}else{
1964
+		} else {
1965 1965
 			//this doesn't exist in the DB, so just get the related things from the cache
1966 1966
 			$related_model_objects = $this->get_all_from_cache($relationName);
1967 1967
 		}
@@ -1979,8 +1979,8 @@  discard block
 block discarded – undo
1979 1979
 	 * @param bool   	$distinct       if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
1980 1980
 	 * @return int
1981 1981
 	 */
1982
-	public function count_related($relation_name, $query_params =array(),$field_to_count = NULL, $distinct = FALSE){
1983
-		return $this->get_model()->count_related($this,$relation_name,$query_params,$field_to_count,$distinct);
1982
+	public function count_related($relation_name, $query_params = array(), $field_to_count = NULL, $distinct = FALSE) {
1983
+		return $this->get_model()->count_related($this, $relation_name, $query_params, $field_to_count, $distinct);
1984 1984
 	}
1985 1985
 
1986 1986
 
@@ -1994,7 +1994,7 @@  discard block
 block discarded – undo
1994 1994
 	 * 						By default, uses primary key (which doesn't make much sense, so you should probably change it)
1995 1995
 	 * @return int
1996 1996
 	 */
1997
-	public function sum_related($relation_name, $query_params = array(), $field_to_sum = null){
1997
+	public function sum_related($relation_name, $query_params = array(), $field_to_sum = null) {
1998 1998
 		return $this->get_model()->sum_related($this, $relation_name, $query_params, $field_to_sum);
1999 1999
 	}
2000 2000
 
@@ -2008,33 +2008,33 @@  discard block
 block discarded – undo
2008 2008
 	 * @return EE_Base_Class (not an array, a single object)
2009 2009
 	 * @throws \EE_Error
2010 2010
 	 */
2011
-	public function get_first_related($relationName,$query_params = array()){
2012
-		if($this->ID()){//this exists in the DB, get from the cache OR the DB
2011
+	public function get_first_related($relationName, $query_params = array()) {
2012
+		if ($this->ID()) {//this exists in the DB, get from the cache OR the DB
2013 2013
 
2014 2014
 			//if they've provided some query parameters, don't bother trying to cache the result
2015 2015
 			//also make sure we're not caching the result of get_first_related
2016 2016
 			//on a relation which should have an array of objects (because the cache might have an array of objects)
2017
-			if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){
2018
-				$related_model_object =  $this->get_model()->get_first_related($this, $relationName, $query_params);
2019
-			}else{
2017
+			if ($query_params || ! $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) {
2018
+				$related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params);
2019
+			} else {
2020 2020
 				//first, check if we've already cached the result of this query
2021 2021
 				$cached_result = $this->get_one_from_cache($relationName);
2022
-				if ( ! $cached_result ){
2022
+				if ( ! $cached_result) {
2023 2023
 
2024 2024
 					$related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params);
2025
-					$this->cache($relationName,$related_model_object);
2026
-				}else{
2025
+					$this->cache($relationName, $related_model_object);
2026
+				} else {
2027 2027
 					$related_model_object = $cached_result;
2028 2028
 				}
2029 2029
 			}
2030
-		}else{
2030
+		} else {
2031 2031
 			$related_model_object = null;
2032 2032
 			//this doesn't exist in the Db, but maybe the relation is of type belongs to, and so the related thing might
2033
-			if( $this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation){
2034
-				$related_model_object =  $this->get_model()->get_first_related($this, $relationName, $query_params);
2033
+			if ($this->get_model()->related_settings_for($relationName) instanceof EE_Belongs_To_Relation) {
2034
+				$related_model_object = $this->get_model()->get_first_related($this, $relationName, $query_params);
2035 2035
 			}
2036 2036
 			//this doesn't exist in the DB and apparently the thing it belongs to doesn't either, just get what's cached on this object
2037
-			if( ! $related_model_object){
2037
+			if ( ! $related_model_object) {
2038 2038
 				$related_model_object = $this->get_one_from_cache($relationName);
2039 2039
 			}
2040 2040
 
@@ -2056,12 +2056,12 @@  discard block
 block discarded – undo
2056 2056
 	 * @return int how many deleted
2057 2057
 	 * @throws \EE_Error
2058 2058
 	 */
2059
-	public function delete_related($relationName,$query_params = array()){
2060
-		if($this->ID()){
2061
-			$count =  $this->get_model()->delete_related($this, $relationName, $query_params);
2062
-		}else{
2059
+	public function delete_related($relationName, $query_params = array()) {
2060
+		if ($this->ID()) {
2061
+			$count = $this->get_model()->delete_related($this, $relationName, $query_params);
2062
+		} else {
2063 2063
 			$count = count($this->get_all_from_cache($relationName));
2064
-			$this->clear_cache($relationName,NULL,TRUE);
2064
+			$this->clear_cache($relationName, NULL, TRUE);
2065 2065
 		}
2066 2066
 		return $count;
2067 2067
 	}
@@ -2080,13 +2080,13 @@  discard block
 block discarded – undo
2080 2080
 	 * @return int how many deleted (including those soft deleted)
2081 2081
 	 * @throws \EE_Error
2082 2082
 	 */
2083
-	public function delete_related_permanently($relationName,$query_params = array()){
2084
-		if($this->ID()){
2085
-			$count =  $this->get_model()->delete_related_permanently($this, $relationName, $query_params);
2086
-		}else{
2083
+	public function delete_related_permanently($relationName, $query_params = array()) {
2084
+		if ($this->ID()) {
2085
+			$count = $this->get_model()->delete_related_permanently($this, $relationName, $query_params);
2086
+		} else {
2087 2087
 			$count = count($this->get_all_from_cache($relationName));
2088 2088
 		}
2089
-		$this->clear_cache($relationName,NULL,TRUE);
2089
+		$this->clear_cache($relationName, NULL, TRUE);
2090 2090
 		return $count;
2091 2091
 	}
2092 2092
 
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
 	 * @param  string $field_name property to check
2103 2103
 	 * @return bool            				  TRUE if existing,FALSE if not.
2104 2104
 	 */
2105
-	public function is_set( $field_name ) {
2105
+	public function is_set($field_name) {
2106 2106
 		return isset($this->_fields[$field_name]);
2107 2107
 	}
2108 2108
 
@@ -2114,11 +2114,11 @@  discard block
 block discarded – undo
2114 2114
 	 * @throws EE_Error
2115 2115
 	 * @return bool                              TRUE if existing, throw EE_Error if not.
2116 2116
 	 */
2117
-	protected function _property_exists( $properties ) {
2117
+	protected function _property_exists($properties) {
2118 2118
 
2119
-		foreach ( (array) $properties as $property_name ) {
2119
+		foreach ((array) $properties as $property_name) {
2120 2120
 			//first make sure this property exists
2121
-			if ( ! $this->_fields[ $property_name ] ) {
2121
+			if ( ! $this->_fields[$property_name]) {
2122 2122
 				throw new EE_Error(
2123 2123
 					sprintf(
2124 2124
 						__(
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
 		$fields = $this->get_model()->field_settings(FALSE);
2147 2147
 		$properties = array();
2148 2148
 		//remove prepended underscore
2149
-		foreach ( $fields as $field_name => $settings ) {
2149
+		foreach ($fields as $field_name => $settings) {
2150 2150
 			$properties[$field_name] = $this->get($field_name);
2151 2151
 		}
2152 2152
 		return $properties;
@@ -2176,10 +2176,10 @@  discard block
 block discarded – undo
2176 2176
 	 * @throws EE_Error
2177 2177
 	 * @return mixed whatever the plugin which calls add_filter decides
2178 2178
 	 */
2179
-	public function __call($methodName,$args){
2180
-		$className=get_class($this);
2181
-		$tagName="FHEE__{$className}__{$methodName}";
2182
-		if ( ! has_filter( $tagName ) ) {
2179
+	public function __call($methodName, $args) {
2180
+		$className = get_class($this);
2181
+		$tagName = "FHEE__{$className}__{$methodName}";
2182
+		if ( ! has_filter($tagName)) {
2183 2183
 			throw new EE_Error(
2184 2184
 				sprintf(
2185 2185
 					__(
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 				)
2193 2193
 			);
2194 2194
 		}
2195
-		return apply_filters($tagName,null,$this,$args);
2195
+		return apply_filters($tagName, null, $this, $args);
2196 2196
 	}
2197 2197
 
2198 2198
 
@@ -2208,7 +2208,7 @@  discard block
 block discarded – undo
2208 2208
 	 * @throws \EE_Error
2209 2209
 	 * NOTE: if the values haven't changed, returns 0
2210 2210
 	 */
2211
-	public function update_extra_meta($meta_key,$meta_value,$previous_value = NULL){
2211
+	public function update_extra_meta($meta_key, $meta_value, $previous_value = NULL) {
2212 2212
 		$query_params = array(
2213 2213
 			array(
2214 2214
 				'EXM_key'  => $meta_key,
@@ -2216,17 +2216,17 @@  discard block
 block discarded – undo
2216 2216
 				'EXM_type' => $this->get_model()->get_this_model_name()
2217 2217
 			)
2218 2218
 		);
2219
-		if ( $previous_value !== null ) {
2219
+		if ($previous_value !== null) {
2220 2220
 			$query_params[0]['EXM_value'] = $meta_value;
2221 2221
 		}
2222
-		$existing_rows_like_that = EEM_Extra_Meta::instance()->get_all( $query_params );
2223
-		if ( ! $existing_rows_like_that ) {
2224
-			return $this->add_extra_meta( $meta_key, $meta_value );
2222
+		$existing_rows_like_that = EEM_Extra_Meta::instance()->get_all($query_params);
2223
+		if ( ! $existing_rows_like_that) {
2224
+			return $this->add_extra_meta($meta_key, $meta_value);
2225 2225
 		} else {
2226
-			foreach ( $existing_rows_like_that as $existing_row ) {
2227
-				$existing_row->save( array( 'EXM_value' => $meta_value ) );
2226
+			foreach ($existing_rows_like_that as $existing_row) {
2227
+				$existing_row->save(array('EXM_value' => $meta_value));
2228 2228
 			}
2229
-			return count( $existing_rows_like_that );
2229
+			return count($existing_rows_like_that);
2230 2230
 		}
2231 2231
 	}
2232 2232
 
@@ -2243,8 +2243,8 @@  discard block
 block discarded – undo
2243 2243
 	 * @return boolean
2244 2244
 	 * @throws \EE_Error
2245 2245
 	 */
2246
-	public function add_extra_meta($meta_key,$meta_value,$unique = false){
2247
-		if ( $unique ) {
2246
+	public function add_extra_meta($meta_key, $meta_value, $unique = false) {
2247
+		if ($unique) {
2248 2248
 			$existing_extra_meta = EEM_Extra_Meta::instance()->get_one(
2249 2249
 				array(
2250 2250
 					array(
@@ -2254,7 +2254,7 @@  discard block
 block discarded – undo
2254 2254
 					)
2255 2255
 				)
2256 2256
 			);
2257
-			if ( $existing_extra_meta ) {
2257
+			if ($existing_extra_meta) {
2258 2258
 				return false;
2259 2259
 			}
2260 2260
 		}
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
 	 * @return int number of extra meta rows deleted
2282 2282
 	 * @throws \EE_Error
2283 2283
 	 */
2284
-	public function delete_extra_meta($meta_key,$meta_value = NULL){
2284
+	public function delete_extra_meta($meta_key, $meta_value = NULL) {
2285 2285
 		$query_params = array(
2286 2286
 			array(
2287 2287
 				'EXM_key'  => $meta_key,
@@ -2289,10 +2289,10 @@  discard block
 block discarded – undo
2289 2289
 				'EXM_type' => $this->get_model()->get_this_model_name()
2290 2290
 			)
2291 2291
 		);
2292
-		if ( $meta_value !== null ) {
2292
+		if ($meta_value !== null) {
2293 2293
 			$query_params[0]['EXM_value'] = $meta_value;
2294 2294
 		}
2295
-		return EEM_Extra_Meta::instance()->delete( $query_params );
2295
+		return EEM_Extra_Meta::instance()->delete($query_params);
2296 2296
 	}
2297 2297
 
2298 2298
 
@@ -2308,25 +2308,25 @@  discard block
 block discarded – undo
2308 2308
 	 * @return mixed single value if $single; array if ! $single
2309 2309
 	 * @throws \EE_Error
2310 2310
 	 */
2311
-	public function get_extra_meta($meta_key,$single = FALSE,$default = NULL){
2312
-		if($single){
2313
-			$result = $this->get_first_related('Extra_Meta',array(array('EXM_key'=>$meta_key)));
2314
-			if ( $result instanceof EE_Extra_Meta ){
2311
+	public function get_extra_meta($meta_key, $single = FALSE, $default = NULL) {
2312
+		if ($single) {
2313
+			$result = $this->get_first_related('Extra_Meta', array(array('EXM_key'=>$meta_key)));
2314
+			if ($result instanceof EE_Extra_Meta) {
2315 2315
 				return $result->value();
2316
-			}else{
2316
+			} else {
2317 2317
 				return $default;
2318 2318
 			}
2319
-		}else{
2320
-			$results =  $this->get_many_related('Extra_Meta',array(array('EXM_key'=>$meta_key)));
2321
-			if($results){
2319
+		} else {
2320
+			$results = $this->get_many_related('Extra_Meta', array(array('EXM_key'=>$meta_key)));
2321
+			if ($results) {
2322 2322
 				$values = array();
2323
-				foreach($results as $result){
2324
-					if ( $result instanceof EE_Extra_Meta ){
2323
+				foreach ($results as $result) {
2324
+					if ($result instanceof EE_Extra_Meta) {
2325 2325
 						$values[$result->ID()] = $result->value();
2326 2326
 					}
2327 2327
 				}
2328 2328
 				return $values;
2329
-			}else{
2329
+			} else {
2330 2330
 				return $default;
2331 2331
 			}
2332 2332
 		}
@@ -2348,20 +2348,20 @@  discard block
 block discarded – undo
2348 2348
 	 * @return array
2349 2349
 	 * @throws \EE_Error
2350 2350
 	 */
2351
-	public function all_extra_meta_array($one_of_each_key = true){
2351
+	public function all_extra_meta_array($one_of_each_key = true) {
2352 2352
 		$return_array = array();
2353
-		if($one_of_each_key){
2353
+		if ($one_of_each_key) {
2354 2354
 			$extra_meta_objs = $this->get_many_related('Extra_Meta', array('group_by'=>'EXM_key'));
2355
-			foreach($extra_meta_objs as $extra_meta_obj){
2356
-				if ( $extra_meta_obj instanceof EE_Extra_Meta ) {
2355
+			foreach ($extra_meta_objs as $extra_meta_obj) {
2356
+				if ($extra_meta_obj instanceof EE_Extra_Meta) {
2357 2357
 					$return_array[$extra_meta_obj->key()] = $extra_meta_obj->value();
2358 2358
 				}
2359 2359
 			}
2360
-		}else{
2360
+		} else {
2361 2361
 			$extra_meta_objs = $this->get_many_related('Extra_Meta');
2362
-			foreach($extra_meta_objs as $extra_meta_obj){
2363
-				if ( $extra_meta_obj instanceof EE_Extra_Meta ) {
2364
-					if( ! isset($return_array[$extra_meta_obj->key()])){
2362
+			foreach ($extra_meta_objs as $extra_meta_obj) {
2363
+				if ($extra_meta_obj instanceof EE_Extra_Meta) {
2364
+					if ( ! isset($return_array[$extra_meta_obj->key()])) {
2365 2365
 						$return_array[$extra_meta_obj->key()] = array();
2366 2366
 					}
2367 2367
 					$return_array[$extra_meta_obj->key()][$extra_meta_obj->ID()] = $extra_meta_obj->value();
@@ -2379,19 +2379,19 @@  discard block
 block discarded – undo
2379 2379
 	 * @return string
2380 2380
 	 * @throws \EE_Error
2381 2381
 	 */
2382
-	public function name(){
2382
+	public function name() {
2383 2383
 		//find a field that's not a text field
2384 2384
 		$field_we_can_use = $this->get_model()->get_a_field_of_type('EE_Text_Field_Base');
2385
-		if($field_we_can_use){
2385
+		if ($field_we_can_use) {
2386 2386
 			return $this->get($field_we_can_use->get_name());
2387
-		}else{
2387
+		} else {
2388 2388
 			$first_few_properties = $this->model_field_array();
2389
-			$first_few_properties = array_slice($first_few_properties,0,3);
2389
+			$first_few_properties = array_slice($first_few_properties, 0, 3);
2390 2390
 			$name_parts = array();
2391
-			foreach( $first_few_properties as $name=> $value ){
2391
+			foreach ($first_few_properties as $name=> $value) {
2392 2392
 				$name_parts[] = "$name:$value";
2393 2393
 			}
2394
-			return implode(",",$name_parts);
2394
+			return implode(",", $name_parts);
2395 2395
 		}
2396 2396
 	}
2397 2397
 
@@ -2404,11 +2404,11 @@  discard block
 block discarded – undo
2404 2404
 	 * @return boolean
2405 2405
 	 * @throws \EE_Error
2406 2406
 	 */
2407
-	public function in_entity_map(){
2408
-		if( $this->ID() && $this->get_model()->get_from_entity_map( $this->ID() ) === $this ) {
2407
+	public function in_entity_map() {
2408
+		if ($this->ID() && $this->get_model()->get_from_entity_map($this->ID()) === $this) {
2409 2409
 			//well, if we looked, did we find it in the entity map?
2410 2410
 			return TRUE;
2411
-		}else{
2411
+		} else {
2412 2412
 			return FALSE;
2413 2413
 		}
2414 2414
 	}
@@ -2419,21 +2419,21 @@  discard block
 block discarded – undo
2419 2419
 	 * @throws EE_Error if this model object isn't in the entity mapper (because then you should
2420 2420
 	 * just use what's in the entity mapper and refresh it) and WP_DEBUG is TRUE
2421 2421
 	 */
2422
-	public function refresh_from_db(){
2423
-		if( $this->ID() && $this->in_entity_map() ){
2424
-			$this->get_model()->refresh_entity_map_from_db( $this->ID() );
2425
-		}else{
2422
+	public function refresh_from_db() {
2423
+		if ($this->ID() && $this->in_entity_map()) {
2424
+			$this->get_model()->refresh_entity_map_from_db($this->ID());
2425
+		} else {
2426 2426
 			//if it doesn't have ID, you shouldn't be asking to refresh it from teh database (because its not in the database)
2427 2427
 			//if it has an ID but it's not in the map, and you're asking me to refresh it
2428 2428
 			//that's kinda dangerous. You should just use what's in the entity map, or add this to the entity map if there's
2429 2429
 			//absolutely nothing in it for this ID
2430
-			if( WP_DEBUG ) {
2430
+			if (WP_DEBUG) {
2431 2431
 				throw new EE_Error(
2432 2432
 					sprintf(
2433
-						__( 'Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso' ),
2433
+						__('Trying to refresh a model object with ID "%1$s" that\'s not in the entity map? First off: you should put it in the entity map by calling %2$s. Second off, if you want what\'s in the database right now, you should just call %3$s yourself and discard this model object.', 'event_espresso'),
2434 2434
 						$this->ID(),
2435
-						get_class( $this->get_model() ) . '::instance()->add_to_entity_map()',
2436
-						get_class( $this->get_model() ) . '::instance()->refresh_entity_map()'
2435
+						get_class($this->get_model()).'::instance()->add_to_entity_map()',
2436
+						get_class($this->get_model()).'::instance()->refresh_entity_map()'
2437 2437
 					)
2438 2438
 				);
2439 2439
 			}
@@ -2447,11 +2447,11 @@  discard block
 block discarded – undo
2447 2447
 	 * (probably a bad assumption they have made, oh well)
2448 2448
 	 * @return string
2449 2449
 	 */
2450
-	public function __toString(){
2450
+	public function __toString() {
2451 2451
 		try {
2452
-			return sprintf( '%s (%s)', $this->name(), $this->ID() );
2453
-		} catch ( Exception $e ) {
2454
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
2452
+			return sprintf('%s (%s)', $this->name(), $this->ID());
2453
+		} catch (Exception $e) {
2454
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
2455 2455
 			return '';
2456 2456
 		}
2457 2457
 	}
@@ -2487,16 +2487,16 @@  discard block
 block discarded – undo
2487 2487
 	 * @throws \EE_Error
2488 2488
 	 */
2489 2489
 	public function __sleep() {
2490
-		foreach( $this->get_model()->relation_settings() as $relation_name => $relation_obj ) {
2491
-			if( $relation_obj instanceof EE_Belongs_To_Relation ) {
2492
-				$classname = 'EE_' . $this->get_model()->get_this_model_name();
2493
-				if( $this->get_one_from_cache( $relation_name ) instanceof $classname &&
2494
-						$this->get_one_from_cache( $relation_name )->ID() ) {
2495
-					$this->clear_cache( $relation_name, $this->get_one_from_cache( $relation_name )->ID() );
2490
+		foreach ($this->get_model()->relation_settings() as $relation_name => $relation_obj) {
2491
+			if ($relation_obj instanceof EE_Belongs_To_Relation) {
2492
+				$classname = 'EE_'.$this->get_model()->get_this_model_name();
2493
+				if ($this->get_one_from_cache($relation_name) instanceof $classname &&
2494
+						$this->get_one_from_cache($relation_name)->ID()) {
2495
+					$this->clear_cache($relation_name, $this->get_one_from_cache($relation_name)->ID());
2496 2496
 				}
2497 2497
 			}
2498 2498
 		}
2499
-		return array_keys( get_object_vars( $this ) );
2499
+		return array_keys(get_object_vars($this));
2500 2500
 	}
2501 2501
 
2502 2502
 
Please login to merge, or discard this patch.
messages/data_class/EE_Messages_Registrations_incoming_data.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3 3
 
4 4
 /**
5 5
  * This prepares data for message types that send messages for multiple registrations (that could span multiple
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	 * @throws EE_Error
21 21
 	 * @access protected
22 22
 	 */
23
-	public function __construct( $data = array() ) {
23
+	public function __construct($data = array()) {
24 24
 
25 25
 		//validate that the first element in the array is an EE_Registration object.
26
-		if ( ! reset( $data ) instanceof EE_Registration ) {
27
-			throw new EE_Error( __( 'The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso' ) );
26
+		if ( ! reset($data) instanceof EE_Registration) {
27
+			throw new EE_Error(__('The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso'));
28 28
 		}
29
-		parent::__construct( $data );
29
+		parent::__construct($data);
30 30
 	}
31 31
 
32 32
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 *
59 59
 	 * @return EE_Registration[]   The data being prepared for the db
60 60
 	 */
61
-	static public function convert_data_for_persistent_storage( $registrations ) {
61
+	static public function convert_data_for_persistent_storage($registrations) {
62 62
 		if (
63
-			! is_array( $registrations )
64
-			|| ! reset( $registrations ) instanceof EE_Registration
63
+			! is_array($registrations)
64
+			|| ! reset($registrations) instanceof EE_Registration
65 65
 		) {
66 66
 			return array();
67 67
 		}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$registration_ids = array_filter(
72 72
 			array_map(
73
-				function( $registration ) {
74
-					if ( $registration instanceof EE_Registration ) {
73
+				function($registration) {
74
+					if ($registration instanceof EE_Registration) {
75 75
 						return $registration->ID();
76 76
 					}
77 77
 				},
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 	 *
96 96
 	 * @return EE_Registration[]
97 97
 	 */
98
-	static public function convert_data_from_persistent_storage( $data ) {
98
+	static public function convert_data_from_persistent_storage($data) {
99 99
 		//since this was added later, we need to account of possible back compat issues where data already queued for generation
100 100
 		//is in the old format, which is an array of EE_Registration objects.  So if that's the case, then let's just return them
101 101
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/10127
102
-		if ( is_array( $data ) && reset( $data ) instanceof EE_Registration ) {
102
+		if (is_array($data) && reset($data) instanceof EE_Registration) {
103 103
 			return $data;
104 104
 		}
105 105
 
106
-		$registrations = is_array( $data )
107
-				? EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $data ) ) ) )
106
+		$registrations = is_array($data)
107
+				? EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $data))))
108 108
 				: array();
109 109
 		return $registrations;
110 110
 	}
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 1 patch
Spacing   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	const SUBMITTED_FORM_DATA_SSN_KEY = 'submitted_form_data';
13 13
 
@@ -71,49 +71,49 @@  discard block
 block discarded – undo
71 71
 	 *                               } @see EE_Form_Section_Validatable::__construct()
72 72
 	 * @throws \EE_Error
73 73
 	 */
74
-	public function __construct( $options_array = array() ){
75
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
74
+	public function __construct($options_array = array()) {
75
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
76 76
 		//call parent first, as it may be setting the name
77 77
 		parent::__construct($options_array);
78 78
 		//if they've included subsections in the constructor, add them now
79
-		if( isset( $options_array['include'] )){
79
+		if (isset($options_array['include'])) {
80 80
 			//we are going to make sure we ONLY have those subsections to include
81 81
 			//AND we are going to make sure they're in that specified order
82 82
 			$reordered_subsections = array();
83
-			foreach($options_array['include'] as $input_name){
84
-				if(isset($this->_subsections[$input_name])){
83
+			foreach ($options_array['include'] as $input_name) {
84
+				if (isset($this->_subsections[$input_name])) {
85 85
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
86 86
 				}
87 87
 			}
88 88
 			$this->_subsections = $reordered_subsections;
89 89
 		}
90
-		if(isset($options_array['exclude'])){
90
+		if (isset($options_array['exclude'])) {
91 91
 			$exclude = $options_array['exclude'];
92 92
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
93 93
 		}
94
-		if(isset($options_array['layout_strategy'])){
94
+		if (isset($options_array['layout_strategy'])) {
95 95
 			$this->_layout_strategy = $options_array['layout_strategy'];
96 96
 		}
97
-		if( ! $this->_layout_strategy){
97
+		if ( ! $this->_layout_strategy) {
98 98
 			$this->_layout_strategy = is_admin() ? new EE_Admin_Two_Column_Layout() : new EE_Two_Column_Layout();
99 99
 		}
100 100
 		$this->_layout_strategy->_construct_finalize($this);
101 101
 
102 102
 		//ok so we are definitely going to want the forms JS,
103 103
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
104
-		if( did_action( 'wp_enqueue_scripts' )
105
-			|| did_action( 'admin_enqueue_scripts' ) ) {
104
+		if (did_action('wp_enqueue_scripts')
105
+			|| did_action('admin_enqueue_scripts')) {
106 106
 			//ok so they've constructed this object after when they should have.
107 107
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
108
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
108
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
109 109
 		} else {
110
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
111
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
110
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
111
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
112 112
 		}
113
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
113
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
114 114
 
115
-		if( isset( $options_array[ 'name' ] ) ) {
116
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
115
+		if (isset($options_array['name'])) {
116
+			$this->_construct_finalize(null, $options_array['name']);
117 117
 		}
118 118
 	}
119 119
 
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
 	 * @param string                 $name
127 127
 	 * @throws \EE_Error
128 128
 	 */
129
-	public function _construct_finalize( $parent_form_section, $name ) {
129
+	public function _construct_finalize($parent_form_section, $name) {
130 130
 		parent::_construct_finalize($parent_form_section, $name);
131 131
 		$this->_set_default_name_if_empty();
132 132
 		$this->_set_default_html_id_if_empty();
133
-		foreach( $this->_subsections as $subsection_name => $subsection ){
134
-			if ( $subsection instanceof EE_Form_Section_Base ) {
135
-				$subsection->_construct_finalize( $this, $subsection_name );
133
+		foreach ($this->_subsections as $subsection_name => $subsection) {
134
+			if ($subsection instanceof EE_Form_Section_Base) {
135
+				$subsection->_construct_finalize($this, $subsection_name);
136 136
 			} else {
137 137
 				throw new EE_Error(
138 138
 					sprintf(
139
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
139
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
140 140
 						$subsection_name,
141 141
 						get_class($this),
142
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
142
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
143 143
 					)
144 144
 				);
145 145
 			}
146 146
 		}
147
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
147
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
148 148
 	}
149 149
 
150 150
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * Gets the layout strategy for this form section
154 154
 	 * @return EE_Form_Section_Layout_Base
155 155
 	 */
156
-	public function get_layout_strategy(){
156
+	public function get_layout_strategy() {
157 157
 		return $this->_layout_strategy;
158 158
 	}
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param EE_Form_Input_Base $input
166 166
 	 * @return string
167 167
 	 */
168
-	public function get_html_for_input($input){
168
+	public function get_html_for_input($input) {
169 169
 		return $this->_layout_strategy->layout_input($input);
170 170
 	}
171 171
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @param null $form_data
179 179
 	 * @return boolean
180 180
 	 */
181
-	public function was_submitted($form_data = NULL){
181
+	public function was_submitted($form_data = NULL) {
182 182
 		return $this->form_data_present_in($form_data);
183 183
 	}
184 184
 
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
 	 *                             (eg you validated the data then stored it in the DB)
204 204
 	 *                             you may want to skip this step.
205 205
 	 */
206
-	public function receive_form_submission( $req_data = null, $validate = true ){
207
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
208
-		if( $req_data === null ){
209
-			$req_data = array_merge( $_GET, $_POST );
206
+	public function receive_form_submission($req_data = null, $validate = true) {
207
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
208
+		if ($req_data === null) {
209
+			$req_data = array_merge($_GET, $_POST);
210 210
 		}
211
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
212
-		$this->_normalize( $req_data );
213
-		if( $validate ){
211
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
212
+		$this->_normalize($req_data);
213
+		if ($validate) {
214 214
 			$this->_validate();
215 215
 			//if it's invalid, we're going to want to re-display so remember what they submitted
216
-			if ( ! $this->is_valid() ) {
216
+			if ( ! $this->is_valid()) {
217 217
 				$this->store_submitted_form_data_in_session();
218 218
 			}
219 219
 		}
220
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
220
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
221 221
 	}
222 222
 
223 223
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	protected function store_submitted_form_data_in_session() {
232 232
 		return EE_Registry::instance()->SSN->set_session_data(
233 233
 			array(
234
-				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values( true )
234
+				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values(true)
235 235
 			)
236 236
 		);
237 237
 	}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	protected function get_submitted_form_data_from_session() {
248 248
 		$session = EE_Registry::instance()->SSN;
249
-		if( $session instanceof EE_Session ) {
249
+		if ($session instanceof EE_Session) {
250 250
 			return $session->get_session_data(
251 251
 				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY
252 252
 			);
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	protected function flush_submitted_form_data_from_session() {
266 266
 		return EE_Registry::instance()->SSN->reset_data(
267
-			array( \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY )
267
+			array(\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY)
268 268
 		);
269 269
 	}
270 270
 
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	public function populate_from_session() {
282 282
 		$form_data_in_session = $this->get_submitted_form_data_from_session();
283
-		if ( empty( $form_data_in_session ) ) {
283
+		if (empty($form_data_in_session)) {
284 284
 			return false;
285 285
 		}
286
-		$this->receive_form_submission( $form_data_in_session );
286
+		$this->receive_form_submission($form_data_in_session);
287 287
 		$this->flush_submitted_form_data_from_session();
288
-		if ( $this->form_data_present_in( $form_data_in_session ) ) {
288
+		if ($this->form_data_present_in($form_data_in_session)) {
289 289
 			return true;
290 290
 		} else {
291 291
 			return false;
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 	 * the value being an array formatted in teh same way
303 303
 	 * @param array $default_data
304 304
 	 */
305
-	public function populate_defaults($default_data){
306
-		foreach($this->subsections() as $subsection_name => $subsection){
307
-			if(isset($default_data[$subsection_name])){
308
-				if($subsection instanceof EE_Form_Input_Base){
305
+	public function populate_defaults($default_data) {
306
+		foreach ($this->subsections() as $subsection_name => $subsection) {
307
+			if (isset($default_data[$subsection_name])) {
308
+				if ($subsection instanceof EE_Form_Input_Base) {
309 309
 					$subsection->set_default($default_data[$subsection_name]);
310
-				}elseif($subsection instanceof EE_Form_Section_Proper){
310
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
311 311
 					$subsection->populate_defaults($default_data[$subsection_name]);
312 312
 				}
313 313
 			}
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
 	 * @param string $name
323 323
 	 * @return boolean
324 324
 	 */
325
-	public function subsection_exists( $name ){
326
-		return isset( $this->_subsections[ $name ] ) ? true : false;
325
+	public function subsection_exists($name) {
326
+		return isset($this->_subsections[$name]) ? true : false;
327 327
 	}
328 328
 
329 329
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 	 * @return EE_Form_Section_Base
342 342
 	 * @throws \EE_Error
343 343
 	 */
344
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
345
-		if( $require_construction_to_be_finalized ){
344
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
345
+		if ($require_construction_to_be_finalized) {
346 346
 			$this->ensure_construct_finalized_called();
347 347
 		}
348
-		return $this->subsection_exists( $name ) ? $this->_subsections[$name] : NULL;
348
+		return $this->subsection_exists($name) ? $this->_subsections[$name] : NULL;
349 349
 	}
350 350
 
351 351
 
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 	 * Gets all the validatable subsections of this form section
355 355
 	 * @return EE_Form_Section_Validatable[]
356 356
 	 */
357
-	public function get_validatable_subsections(){
357
+	public function get_validatable_subsections() {
358 358
 		$validatable_subsections = array();
359
-		foreach($this->subsections() as $name=>$obj){
360
-			if($obj instanceof EE_Form_Section_Validatable){
359
+		foreach ($this->subsections() as $name=>$obj) {
360
+			if ($obj instanceof EE_Form_Section_Validatable) {
361 361
 				$validatable_subsections[$name] = $obj;
362 362
 			}
363 363
 		}
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	 * @return EE_Form_Input_Base
378 378
 	 * @throws EE_Error
379 379
 	 */
380
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
380
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
381 381
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
382
-		if( ! $subsection instanceof EE_Form_Input_Base){
382
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
383 383
 			throw new EE_Error(
384 384
 				sprintf(
385 385
 					__(
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
 						'event_espresso'
388 388
 					),
389 389
 					$name,
390
-					get_class( $this ),
391
-					$subsection ? get_class( $subsection ) : __( "NULL", 'event_espresso' )
390
+					get_class($this),
391
+					$subsection ? get_class($subsection) : __("NULL", 'event_espresso')
392 392
 				)
393 393
 			);
394 394
 		}
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 	 * @return EE_Form_Section_Proper
409 409
 	 * @throws EE_Error
410 410
 	 */
411
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
412
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
413
-		if( ! $subsection instanceof EE_Form_Section_Proper){
411
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
412
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
413
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
414 414
 			throw new EE_Error(
415 415
 				sprintf(
416
-					__( "Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso' ),
416
+					__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),
417 417
 					$name,
418
-					get_class( $this )
418
+					get_class($this)
419 419
 				)
420 420
 			);
421 421
 		}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @return mixed depending on the input's type and its normalization strategy
433 433
 	 * @throws \EE_Error
434 434
 	 */
435
-	public function get_input_value($name){
435
+	public function get_input_value($name) {
436 436
 		$input = $this->get_input($name);
437 437
 		return $input->normalized_value();
438 438
 	}
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @return boolean
446 446
 	 */
447 447
 	public function is_valid() {
448
-		if( ! $this->has_received_submission()){
448
+		if ( ! $this->has_received_submission()) {
449 449
 			throw new EE_Error(
450 450
 				sprintf(
451 451
 					__(
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
 				)
456 456
 			);
457 457
 		}
458
-		if( ! parent::is_valid() ) {
458
+		if ( ! parent::is_valid()) {
459 459
 			return false;
460 460
 		}
461 461
 		// ok so no general errors to this entire form section.
462 462
 		// so let's check the subsections, but only set errors if that hasn't been done yet
463 463
 		$set_submission_errors = $this->submission_error_message() === '' ? true : false;
464
-		foreach( $this->get_validatable_subsections() as $subsection ){
465
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
466
-				if ( $set_submission_errors ) {
467
-					$this->set_submission_error_message( $subsection->get_validation_error_string() );
464
+		foreach ($this->get_validatable_subsections() as $subsection) {
465
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
466
+				if ($set_submission_errors) {
467
+					$this->set_submission_error_message($subsection->get_validation_error_string());
468 468
 				}
469 469
 				return false;
470 470
 			}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 * gets teh default name of this form section if none is specified
479 479
 	 * @return string
480 480
 	 */
481
-	protected function _set_default_name_if_empty(){
482
-		if( ! $this->_name ){
481
+	protected function _set_default_name_if_empty() {
482
+		if ( ! $this->_name) {
483 483
 			$classname = get_class($this);
484 484
 			$default_name = str_replace("EE_", "", $classname);
485
-			$this->_name =  $default_name;
485
+			$this->_name = $default_name;
486 486
 		}
487 487
 	}
488 488
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 *             and get_html when you are about to display the form.
499 499
 	 * @throws \EE_Error
500 500
 	 */
501
-	public function get_html_and_js(){
501
+	public function get_html_and_js() {
502 502
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
503 503
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
504 504
 		$this->enqueue_js();
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param bool $display_previously_submitted_data
514 514
 	 * @return string
515 515
 	 */
516
-	public function get_html( $display_previously_submitted_data = true ){
516
+	public function get_html($display_previously_submitted_data = true) {
517 517
 		$this->ensure_construct_finalized_called();
518
-		if ( $display_previously_submitted_data ) {
518
+		if ($display_previously_submitted_data) {
519 519
 			$this->populate_from_session();
520 520
 		}
521 521
 		return $this->_layout_strategy->layout_form();
@@ -529,9 +529,9 @@  discard block
 block discarded – undo
529 529
 	 * @return string
530 530
 	 * @throws \EE_Error
531 531
 	 */
532
-	public function enqueue_js(){
532
+	public function enqueue_js() {
533 533
 		$this->_enqueue_and_localize_form_js();
534
-		foreach( $this->subsections() as $subsection ) {
534
+		foreach ($this->subsections() as $subsection) {
535 535
 			$subsection->enqueue_js();
536 536
 		}
537 537
 	}
@@ -550,19 +550,19 @@  discard block
 block discarded – undo
550 550
 	 *                                                    to be triggered automatically or not
551 551
 	 * @return void
552 552
 	 */
553
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
554
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
553
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
554
+		add_filter('FHEE_load_jquery_validate', '__return_true');
555 555
 		wp_register_script(
556 556
 			'ee_form_section_validation',
557
-			EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js',
558
-			array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ),
557
+			EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js',
558
+			array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'),
559 559
 			EVENT_ESPRESSO_VERSION,
560 560
 			true
561 561
 		);
562 562
 		wp_localize_script(
563 563
 			'ee_form_section_validation',
564 564
 			'ee_form_section_validation_init',
565
-			array( 'init' => $init_form_validation_automatically ? true : false )
565
+			array('init' => $init_form_validation_automatically ? true : false)
566 566
 		);
567 567
 	}
568 568
 	
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
 	 *
574 574
 	 * @throws \EE_Error
575 575
 	 */
576
-	public function _enqueue_and_localize_form_js(){
576
+	public function _enqueue_and_localize_form_js() {
577 577
 		$this->ensure_construct_finalized_called();
578 578
 		//actually, we don't want to localize just yet. There may be other forms on the page.
579 579
 		//so we need to add our form section data to a static variable accessible by all form sections
580 580
 		//and localize it just before the footer
581 581
 		$this->localize_validation_rules();
582
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
583
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
582
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
583
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
584 584
 	}
585 585
 
586 586
 
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 	 * @return void
593 593
 	 * @throws \EE_Error
594 594
 	 */
595
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
595
+	public function localize_validation_rules($return_for_subsection = FALSE) {
596 596
 		// we only want to localize vars ONCE for the entire form,
597 597
 		// so if the form section doesn't have a parent, then it must be the top dog
598
-		if ( $return_for_subsection || ! $this->parent_section() ) {
599
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
600
-				'form_section_id'=> $this->html_id( TRUE ),
598
+		if ($return_for_subsection || ! $this->parent_section()) {
599
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
600
+				'form_section_id'=> $this->html_id(TRUE),
601 601
 				'validation_rules'=> $this->get_jquery_validation_rules(),
602 602
 				'other_data' => $this->get_other_js_data(),
603 603
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -613,9 +613,9 @@  discard block
 block discarded – undo
613 613
 	 * @param array $form_other_js_data
614 614
 	 * @return array
615 615
 	 */
616
-	public function get_other_js_data( $form_other_js_data = array() ) {
617
-		foreach( $this->subsections() as $subsection ) {
618
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
616
+	public function get_other_js_data($form_other_js_data = array()) {
617
+		foreach ($this->subsections() as $subsection) {
618
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
619 619
 		}
620 620
 		return $form_other_js_data;
621 621
 	}
@@ -626,12 +626,12 @@  discard block
 block discarded – undo
626 626
 	 * Keys are their form names, and values are the inputs themselves
627 627
 	 * @return EE_Form_Input_Base
628 628
 	 */
629
-	public function inputs_in_subsections(){
629
+	public function inputs_in_subsections() {
630 630
 		$inputs = array();
631
-		foreach($this->subsections() as $subsection){
632
-			if( $subsection instanceof EE_Form_Input_Base ){
633
-				$inputs[ $subsection->html_name() ] = $subsection;
634
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
631
+		foreach ($this->subsections() as $subsection) {
632
+			if ($subsection instanceof EE_Form_Input_Base) {
633
+				$inputs[$subsection->html_name()] = $subsection;
634
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
635 635
 				$inputs += $subsection->inputs_in_subsections();
636 636
 			}
637 637
 		}
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
 	 * and values are a string of all their validation errors
645 645
 	 * @return string[]
646 646
 	 */
647
-	public function subsection_validation_errors_by_html_name(){
647
+	public function subsection_validation_errors_by_html_name() {
648 648
 		$inputs = $this->inputs();
649 649
 		$errors = array();
650
-		foreach( $inputs as $form_input ){
651
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
652
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
650
+		foreach ($inputs as $form_input) {
651
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
652
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
653 653
 			}
654 654
 		}
655 655
 		return $errors;
@@ -661,15 +661,15 @@  discard block
 block discarded – undo
661 661
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
662 662
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
663 663
 	 */
664
-	public static function localize_script_for_all_forms(){
664
+	public static function localize_script_for_all_forms() {
665 665
 		//allow inputs and stuff to hook in their JS and stuff here
666
-		do_action( 'AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin' );
666
+		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
667 667
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
668
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
668
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
669 669
 			? EE_Registry::instance()->CFG->registration->email_validation_level
670 670
 			: 'wp_default';
671 671
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
672
-		wp_enqueue_script( 'ee_form_section_validation' );
672
+		wp_enqueue_script('ee_form_section_validation');
673 673
 		wp_localize_script(
674 674
 			'ee_form_section_validation',
675 675
 			'ee_form_section_vars',
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	/**
683 683
 	 * ensure_scripts_localized
684 684
 	 */
685
-	public function ensure_scripts_localized(){
686
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
685
+	public function ensure_scripts_localized() {
686
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
687 687
 			$this->_enqueue_and_localize_form_js();
688 688
 		}
689 689
 	}
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
 	 * is that the key here should be the same as the custom validation rule put in the JS file
696 696
 	 * @return array keys are custom validation rules, and values are internationalized strings
697 697
 	 */
698
-	private static function _get_localized_error_messages(){
698
+	private static function _get_localized_error_messages() {
699 699
 		return array(
700 700
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
701
-			'regex' => __( 'Please check your input', 'event_espresso' ),
701
+			'regex' => __('Please check your input', 'event_espresso'),
702 702
 		);
703 703
 	}
704 704
 
@@ -728,9 +728,9 @@  discard block
 block discarded – undo
728 728
 	 *
729 729
 	 * @return array
730 730
 	 */
731
-	public function get_jquery_validation_rules(){
731
+	public function get_jquery_validation_rules() {
732 732
 		$jquery_validation_rules = array();
733
-		foreach($this->get_validatable_subsections() as $subsection){
733
+		foreach ($this->get_validatable_subsections() as $subsection) {
734 734
 			$jquery_validation_rules = array_merge(
735 735
 				$jquery_validation_rules,
736 736
 				$subsection->get_jquery_validation_rules()
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 	 * @param array $req_data like $_POST
748 748
 	 * @return void
749 749
 	 */
750
-	protected function _normalize( $req_data ) {
750
+	protected function _normalize($req_data) {
751 751
 		$this->_received_submission = true;
752 752
 		$this->_validation_errors = array();
753
-		foreach ( $this->get_validatable_subsections() as $subsection ) {
753
+		foreach ($this->get_validatable_subsections() as $subsection) {
754 754
 			try {
755
-				$subsection->_normalize( $req_data );
756
-			} catch ( EE_Validation_Error $e ) {
757
-				$subsection->add_validation_error( $e );
755
+				$subsection->_normalize($req_data);
756
+			} catch (EE_Validation_Error $e) {
757
+				$subsection->add_validation_error($e);
758 758
 			}
759 759
 		}
760 760
 	}
@@ -771,9 +771,9 @@  discard block
 block discarded – undo
771 771
 	 * calling parent::_validate() first.
772 772
 	 */
773 773
 	protected function _validate() {
774
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
775
-			if(method_exists($this,'_validate_'.$subsection_name)){
776
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
774
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
775
+			if (method_exists($this, '_validate_'.$subsection_name)) {
776
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
777 777
 			}
778 778
 			$subsection->_validate();
779 779
 		}
@@ -785,13 +785,13 @@  discard block
 block discarded – undo
785 785
 	 * Gets all the validated inputs for the form section
786 786
 	 * @return array
787 787
 	 */
788
-	public function valid_data(){
788
+	public function valid_data() {
789 789
 		$inputs = array();
790
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
791
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
792
-				$inputs[ $subsection_name ] = $subsection->valid_data();
793
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
794
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
790
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
791
+			if ($subsection instanceof EE_Form_Section_Proper) {
792
+				$inputs[$subsection_name] = $subsection->valid_data();
793
+			} else if ($subsection instanceof EE_Form_Input_Base) {
794
+				$inputs[$subsection_name] = $subsection->normalized_value();
795 795
 			}
796 796
 		}
797 797
 		return $inputs;
@@ -803,11 +803,11 @@  discard block
 block discarded – undo
803 803
 	 * Gets all the inputs on this form section
804 804
 	 * @return EE_Form_Input_Base[]
805 805
 	 */
806
-	public function inputs(){
806
+	public function inputs() {
807 807
 		$inputs = array();
808
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
809
-			if ( $subsection instanceof EE_Form_Input_Base ){
810
-				$inputs[ $subsection_name ] = $subsection;
808
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
809
+			if ($subsection instanceof EE_Form_Input_Base) {
810
+				$inputs[$subsection_name] = $subsection;
811 811
 			}
812 812
 		}
813 813
 		return $inputs;
@@ -819,10 +819,10 @@  discard block
 block discarded – undo
819 819
 	 * Gets all the subsections which are a proper form
820 820
 	 * @return EE_Form_Section_Proper[]
821 821
 	 */
822
-	public function subforms(){
822
+	public function subforms() {
823 823
 		$form_sections = array();
824
-		foreach($this->subsections() as $name=>$obj){
825
-			if($obj instanceof EE_Form_Section_Proper){
824
+		foreach ($this->subsections() as $name=>$obj) {
825
+			if ($obj instanceof EE_Form_Section_Proper) {
826 826
 				$form_sections[$name] = $obj;
827 827
 			}
828 828
 		}
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 * if you only want form inputs or proper form sections.
838 838
 	 * @return EE_Form_Section_Proper[]
839 839
 	 */
840
-	public function subsections(){
840
+	public function subsections() {
841 841
 		$this->ensure_construct_finalized_called();
842 842
 		return $this->_subsections;
843 843
 	}
@@ -859,8 +859,8 @@  discard block
 block discarded – undo
859 859
 	 *                                        where keys are always subsection names and values are either
860 860
 	 *                                        the input's normalized value, or an array like the top-level array
861 861
 	 */
862
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
863
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
862
+	public function input_values($include_subform_inputs = false, $flatten = false) {
863
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
864 864
 	}
865 865
 
866 866
 	/**
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 	 *                                        where keys are always subsection names and values are either
881 881
 	 *                                        the input's normalized value, or an array like the top-level array
882 882
 	 */
883
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
884
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
883
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
884
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
885 885
 	}
886 886
 
887 887
 	/**
@@ -899,19 +899,19 @@  discard block
 block discarded – undo
899 899
 	 *                                        where keys are always subsection names and values are either
900 900
 	 *                                        the input's normalized value, or an array like the top-level array
901 901
 	 */
902
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
902
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
903 903
 		$input_values = array();
904
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
905
-			if( $subsection instanceof EE_Form_Input_Base ) {
906
-				$input_values[ $subsection_name ] = $pretty
904
+		foreach ($this->subsections() as $subsection_name => $subsection) {
905
+			if ($subsection instanceof EE_Form_Input_Base) {
906
+				$input_values[$subsection_name] = $pretty
907 907
 					? $subsection->pretty_value()
908 908
 					: $subsection->normalized_value();
909
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
910
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
911
-				if( $flatten ) {
912
-					$input_values = array_merge( $input_values, $subform_input_values );
909
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
910
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
911
+				if ($flatten) {
912
+					$input_values = array_merge($input_values, $subform_input_values);
913 913
 				} else {
914
-					$input_values[ $subsection_name ] = $subform_input_values;
914
+					$input_values[$subsection_name] = $subform_input_values;
915 915
 				}
916 916
 			}
917 917
 		}
@@ -932,23 +932,23 @@  discard block
 block discarded – undo
932 932
 	 *                                   where keys are always subsection names and values are either
933 933
 	 *                                   the input's normalized value, or an array like the top-level array
934 934
 	 */
935
-	public function submitted_values( $include_subforms = false ) {
935
+	public function submitted_values($include_subforms = false) {
936 936
 		$submitted_values = array();
937
-		foreach( $this->subsections() as $subsection ) {
938
-			if( $subsection instanceof EE_Form_Input_Base ) {
937
+		foreach ($this->subsections() as $subsection) {
938
+			if ($subsection instanceof EE_Form_Input_Base) {
939 939
 				// is this input part of an array of inputs?
940
-				if ( strpos( $subsection->html_name(), '[' ) !== false ) {
940
+				if (strpos($subsection->html_name(), '[') !== false) {
941 941
 					$full_input_name = \EEH_Array::convert_array_values_to_keys(
942
-						explode( '[', str_replace( ']', '', $subsection->html_name() ) ),
942
+						explode('[', str_replace(']', '', $subsection->html_name())),
943 943
 						$subsection->raw_value()
944 944
 					);
945
-					$submitted_values = array_replace_recursive( $submitted_values, $full_input_name );
945
+					$submitted_values = array_replace_recursive($submitted_values, $full_input_name);
946 946
 				} else {
947
-					$submitted_values[ $subsection->html_name() ] = $subsection->raw_value();
947
+					$submitted_values[$subsection->html_name()] = $subsection->raw_value();
948 948
 				}
949
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subforms ) {
950
-				$subform_input_values = $subsection->submitted_values( $include_subforms );
951
-				$submitted_values = array_replace_recursive( $submitted_values, $subform_input_values );
949
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subforms) {
950
+				$subform_input_values = $subsection->submitted_values($include_subforms);
951
+				$submitted_values = array_replace_recursive($submitted_values, $subform_input_values);
952 952
 			}
953 953
 		}
954 954
 		return $submitted_values;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	 * @return boolean
964 964
 	 * @throws \EE_Error
965 965
 	 */
966
-	public function has_received_submission(){
966
+	public function has_received_submission() {
967 967
 		$this->ensure_construct_finalized_called();
968 968
 		return $this->_received_submission;
969 969
 	}
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
976 976
 	 * @param array $inputs_to_exclude values are the input names
977 977
 	 * @return void
978 978
 	 */
979
-	public function exclude($inputs_to_exclude = array()){
980
-		foreach($inputs_to_exclude as $input_to_exclude_name){
979
+	public function exclude($inputs_to_exclude = array()) {
980
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
981 981
 			unset($this->_subsections[$input_to_exclude_name]);
982 982
 		}
983 983
 	}
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 	 * @param array $inputs_to_hide
989 989
 	 * @throws \EE_Error
990 990
 	 */
991
-	public function hide($inputs_to_hide= array()){
992
-		foreach($inputs_to_hide as $input_to_hide){
991
+	public function hide($inputs_to_hide = array()) {
992
+		foreach ($inputs_to_hide as $input_to_hide) {
993 993
 			$input = $this->get_input($input_to_hide);
994 994
 
995 995
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -1019,21 +1019,21 @@  discard block
 block discarded – undo
1019 1019
 	 * @return void
1020 1020
 	 * @throws \EE_Error
1021 1021
 	 */
1022
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
1023
-		foreach( $new_subsections as $subsection_name => $subsection ){
1024
-			if( ! $subsection instanceof EE_Form_Section_Base ){
1022
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
1023
+		foreach ($new_subsections as $subsection_name => $subsection) {
1024
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
1025 1025
 				EE_Error::add_error(
1026 1026
 					sprintf(
1027 1027
 						__(
1028 1028
 							"Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.",
1029 1029
 							"event_espresso"
1030 1030
 						),
1031
-						get_class( $subsection ),
1031
+						get_class($subsection),
1032 1032
 						$subsection_name,
1033 1033
 						$this->name()
1034 1034
 					)
1035 1035
 				);
1036
-				unset( $new_subsections[ $subsection_name ] );
1036
+				unset($new_subsections[$subsection_name]);
1037 1037
 			}
1038 1038
 		}
1039 1039
 		$this->_subsections = EEH_Array::insert_into_array(
@@ -1044,8 +1044,8 @@  discard block
 block discarded – undo
1044 1044
 		);
1045 1045
 
1046 1046
 
1047
-		if( $this->_construction_finalized ){
1048
-			foreach($this->_subsections as $name => $subsection){
1047
+		if ($this->_construction_finalized) {
1048
+			foreach ($this->_subsections as $name => $subsection) {
1049 1049
 				$subsection->_construct_finalize($this, $name);
1050 1050
 			}
1051 1051
 		}
@@ -1056,8 +1056,8 @@  discard block
 block discarded – undo
1056 1056
 	/**
1057 1057
 	 * Just gets all validatable subsections to clean their sensitive data
1058 1058
 	 */
1059
-	public function clean_sensitive_data(){
1060
-		foreach($this->get_validatable_subsections() as $subsection){
1059
+	public function clean_sensitive_data() {
1060
+		foreach ($this->get_validatable_subsections() as $subsection) {
1061 1061
 			$subsection->clean_sensitive_data();
1062 1062
 		}
1063 1063
 	}
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
 	/**
1068 1068
 	 * @param string $form_submission_error_message
1069 1069
 	 */
1070
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
1071
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message )
1070
+	public function set_submission_error_message($form_submission_error_message = '') {
1071
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message)
1072 1072
 			? $form_submission_error_message
1073
-			: __( 'Form submission failed due to errors', 'event_espresso' );
1073
+			: __('Form submission failed due to errors', 'event_espresso');
1074 1074
 	}
1075 1075
 
1076 1076
 
@@ -1087,10 +1087,10 @@  discard block
 block discarded – undo
1087 1087
 	/**
1088 1088
 	 * @param string $form_submission_success_message
1089 1089
 	 */
1090
-	public function set_submission_success_message( $form_submission_success_message ) {
1091
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message )
1090
+	public function set_submission_success_message($form_submission_success_message) {
1091
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message)
1092 1092
 			? $form_submission_success_message
1093
-			: __( 'Form submitted successfully', 'event_espresso' );
1093
+			: __('Form submitted successfully', 'event_espresso');
1094 1094
 	}
1095 1095
 
1096 1096
 
@@ -1113,10 +1113,10 @@  discard block
 block discarded – undo
1113 1113
 	 * @return string
1114 1114
 	 * @throws \EE_Error
1115 1115
 	 */
1116
-	public function html_name_prefix(){
1117
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1118
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1119
-		}else{
1116
+	public function html_name_prefix() {
1117
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
1118
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
1119
+		} else {
1120 1120
 			return $this->name();
1121 1121
 		}
1122 1122
 	}
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
 	 * @return string
1132 1132
 	 * @throws \EE_Error
1133 1133
 	 */
1134
-	public function name(){
1134
+	public function name() {
1135 1135
 		$this->ensure_construct_finalized_called();
1136 1136
 		return parent::name();
1137 1137
 	}
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 	 * @return EE_Form_Section_Proper
1143 1143
 	 * @throws \EE_Error
1144 1144
 	 */
1145
-	public function parent_section(){
1145
+	public function parent_section() {
1146 1146
 		$this->ensure_construct_finalized_called();
1147 1147
 		return parent::parent_section();
1148 1148
 	}
@@ -1155,9 +1155,9 @@  discard block
 block discarded – undo
1155 1155
 	 * @return void
1156 1156
 	 * @throws \EE_Error
1157 1157
 	 */
1158
-	public function ensure_construct_finalized_called(){
1159
-		if( ! $this->_construction_finalized ){
1160
-			$this->_construct_finalize($this->_parent_section, $this->_name );
1158
+	public function ensure_construct_finalized_called() {
1159
+		if ( ! $this->_construction_finalized) {
1160
+			$this->_construct_finalize($this->_parent_section, $this->_name);
1161 1161
 		}
1162 1162
 	}
1163 1163
 
@@ -1169,17 +1169,17 @@  discard block
 block discarded – undo
1169 1169
 	 * @param array $req_data
1170 1170
 	 * @return boolean
1171 1171
 	 */
1172
-	public function form_data_present_in( $req_data = NULL ) {
1173
-		if( $req_data === NULL){
1172
+	public function form_data_present_in($req_data = NULL) {
1173
+		if ($req_data === NULL) {
1174 1174
 			$req_data = $_POST;
1175 1175
 		}
1176
-		foreach( $this->subsections() as $subsection ) {
1177
-			if($subsection instanceof EE_Form_Input_Base ) {
1178
-				if( $subsection->form_data_present_in( $req_data ) ) {
1176
+		foreach ($this->subsections() as $subsection) {
1177
+			if ($subsection instanceof EE_Form_Input_Base) {
1178
+				if ($subsection->form_data_present_in($req_data)) {
1179 1179
 					return TRUE;
1180 1180
 				}
1181
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1182
-				if( $subsection->form_data_present_in( $req_data ) ) {
1181
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
1182
+				if ($subsection->form_data_present_in($req_data)) {
1183 1183
 					return TRUE;
1184 1184
 				}
1185 1185
 			}
@@ -1196,14 +1196,14 @@  discard block
 block discarded – undo
1196 1196
 	 */
1197 1197
 	public function get_validation_errors_accumulated() {
1198 1198
 		$validation_errors = $this->get_validation_errors();
1199
-		foreach($this->get_validatable_subsections() as $subsection ) {
1200
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1199
+		foreach ($this->get_validatable_subsections() as $subsection) {
1200
+			if ($subsection instanceof EE_Form_Section_Proper) {
1201 1201
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1202 1202
 			} else {
1203
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1203
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1204 1204
 			}
1205
-			if( $validation_errors_on_this_subsection ){
1206
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1205
+			if ($validation_errors_on_this_subsection) {
1206
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1207 1207
 			}
1208 1208
 		}
1209 1209
 		return $validation_errors;
@@ -1225,24 +1225,24 @@  discard block
 block discarded – undo
1225 1225
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1226 1226
 	 * @return EE_Form_Section_Base
1227 1227
 	 */
1228
-	public function find_section_from_path( $form_section_path ) {
1228
+	public function find_section_from_path($form_section_path) {
1229 1229
 		//check if we can find the input from purely going straight up the tree
1230
-		$input = parent::find_section_from_path( $form_section_path );
1231
-		if( $input instanceof EE_Form_Section_Base ) {
1230
+		$input = parent::find_section_from_path($form_section_path);
1231
+		if ($input instanceof EE_Form_Section_Base) {
1232 1232
 			return $input;
1233 1233
 		}
1234 1234
 
1235
-		$next_slash_pos = strpos( $form_section_path, '/' );
1236
-		if( $next_slash_pos !== false ) {
1237
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1238
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1235
+		$next_slash_pos = strpos($form_section_path, '/');
1236
+		if ($next_slash_pos !== false) {
1237
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1238
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1239 1239
 		} else {
1240 1240
 			$child_section_name = $form_section_path;
1241 1241
 			$subpath = '';
1242 1242
 		}
1243
-		$child_section =  $this->get_subsection( $child_section_name );
1244
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1245
-			return $child_section->find_section_from_path( $subpath );
1243
+		$child_section = $this->get_subsection($child_section_name);
1244
+		if ($child_section instanceof EE_Form_Section_Base) {
1245
+			return $child_section->find_section_from_path($subpath);
1246 1246
 		} else {
1247 1247
 			return null;
1248 1248
 		}
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Form_Input_Base.input.php 1 patch
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage
9 9
  * @author				Mike Nelson
10 10
  */
11
-abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable{
11
+abstract class EE_Form_Input_Base extends EE_Form_Section_Validatable {
12 12
 
13 13
 	/**
14 14
 	 * the input's name attribute
@@ -143,54 +143,54 @@  discard block
 block discarded – undo
143 143
 	 *  @type EE_Validation_Strategy_Base[]  $validation_strategies
144 144
 	 * }
145 145
 	 */
146
-	public function __construct( $input_args = array() ){
147
-		$input_args = (array) apply_filters( 'FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this );
146
+	public function __construct($input_args = array()) {
147
+		$input_args = (array) apply_filters('FHEE__EE_Form_Input_Base___construct__input_args', $input_args, $this);
148 148
 		// the following properties must be cast as arrays
149
-		if ( isset( $input_args['validation_strategies'] ) ) {
150
-			foreach ( (array) $input_args['validation_strategies'] as $validation_strategy ) {
151
-				if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
152
-					$this->_validation_strategies[ get_class( $validation_strategy ) ] = $validation_strategy;
149
+		if (isset($input_args['validation_strategies'])) {
150
+			foreach ((array) $input_args['validation_strategies'] as $validation_strategy) {
151
+				if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
152
+					$this->_validation_strategies[get_class($validation_strategy)] = $validation_strategy;
153 153
 				}
154 154
 			}
155
-			unset( $input_args['validation_strategies'] );
155
+			unset($input_args['validation_strategies']);
156 156
 		}
157 157
 		// loop thru incoming options
158
-		foreach( $input_args as $key => $value ) {
158
+		foreach ($input_args as $key => $value) {
159 159
 			// add underscore to $key to match property names
160
-			$_key = '_' . $key;
161
-			if ( property_exists( $this, $_key )) {
160
+			$_key = '_'.$key;
161
+			if (property_exists($this, $_key)) {
162 162
 				$this->{$_key} = $value;
163 163
 			}
164 164
 		}
165 165
 		// ensure that "required" is set correctly
166 166
 		$this->set_required(
167
-			$this->_required, isset( $input_args[ 'required_validation_error_message' ] )
168
-				? $input_args[ 'required_validation_error_message' ]
167
+			$this->_required, isset($input_args['required_validation_error_message'])
168
+				? $input_args['required_validation_error_message']
169 169
 				: null
170 170
 		);
171 171
 
172 172
 		//$this->_html_name_specified = isset( $input_args['html_name'] ) ? TRUE : FALSE;
173 173
 
174 174
 		$this->_display_strategy->_construct_finalize($this);
175
-		foreach( $this->_validation_strategies as $validation_strategy ){
175
+		foreach ($this->_validation_strategies as $validation_strategy) {
176 176
 			$validation_strategy->_construct_finalize($this);
177 177
 		}
178 178
 
179
-		if( ! $this->_normalization_strategy){
179
+		if ( ! $this->_normalization_strategy) {
180 180
 			$this->_normalization_strategy = new EE_Text_Normalization();
181 181
 		}
182 182
 		$this->_normalization_strategy->_construct_finalize($this);
183 183
 
184 184
 		//at least we can use the normalization strategy to populate the default
185
-		if( isset( $input_args[ 'default' ] ) ) {
186
-			$this->set_default( $input_args[ 'default' ] );
185
+		if (isset($input_args['default'])) {
186
+			$this->set_default($input_args['default']);
187 187
 		}
188 188
 
189
-		if( ! $this->_sensitive_data_removal_strategy){
189
+		if ( ! $this->_sensitive_data_removal_strategy) {
190 190
 			$this->_sensitive_data_removal_strategy = new EE_No_Sensitive_Data_Removal();
191 191
 		}
192 192
 		$this->_sensitive_data_removal_strategy->_construct_finalize($this);
193
-		parent::__construct( $input_args );
193
+		parent::__construct($input_args);
194 194
 	}
195 195
 
196 196
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	 *
202 202
 	 * @throws \EE_Error
203 203
 	 */
204
-	protected function _set_default_html_name_if_empty(){
205
-		if( ! $this->_html_name){
204
+	protected function _set_default_html_name_if_empty() {
205
+		if ( ! $this->_html_name) {
206 206
 			$this->_html_name = $this->name();
207
-			if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper){
208
-				$this->_html_name = $this->_parent_section->html_name_prefix() . "[{$this->name()}]";
207
+			if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) {
208
+				$this->_html_name = $this->_parent_section->html_name_prefix()."[{$this->name()}]";
209 209
 			}
210 210
 		}
211 211
 	}
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
 	public function _construct_finalize($parent_form_section, $name) {
221 221
 		parent::_construct_finalize($parent_form_section, $name);
222 222
 		$this->_set_default_html_name_if_empty();
223
-		if( $this->_html_label === null && $this->_html_label_text === null ){
224
-			$this->_html_label_text = ucwords( str_replace("_"," ",$name));
223
+		if ($this->_html_label === null && $this->_html_label_text === null) {
224
+			$this->_html_label_text = ucwords(str_replace("_", " ", $name));
225 225
 		}
226
-		do_action( 'AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name );
226
+		do_action('AHEE__EE_Form_Input_Base___construct_finalize__end', $this, $parent_form_section, $name);
227 227
 	}
228 228
 
229 229
 	 /**
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	  * @return EE_Display_Strategy_Base
232 232
 	  * @throws EE_Error
233 233
 	  */
234
-	protected function _get_display_strategy(){
235
-		if( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base){
234
+	protected function _get_display_strategy() {
235
+		if ( ! $this->_display_strategy || ! $this->_display_strategy instanceof EE_Display_Strategy_Base) {
236 236
 			throw new EE_Error(
237 237
 				sprintf(
238 238
 					__(
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 					$this->html_id()
244 244
 				)
245 245
 			);
246
-		}else{
246
+		} else {
247 247
 			return $this->_display_strategy;
248 248
 		}
249 249
 	}
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * Sets the display strategy.
252 252
 	 * @param EE_Display_Strategy_Base $strategy
253 253
 	 */
254
-	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy){
254
+	protected function _set_display_strategy(EE_Display_Strategy_Base $strategy) {
255 255
 		$this->_display_strategy = $strategy;
256 256
 	}
257 257
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * Sets the sanitization strategy
260 260
 	 * @param EE_Normalization_Strategy_Base $strategy
261 261
 	 */
262
-	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy){
262
+	protected function _set_normalization_strategy(EE_Normalization_Strategy_Base $strategy) {
263 263
 		$this->_normalization_strategy = $strategy;
264 264
 	}
265 265
 
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 	 * Gets the display strategy for this input
286 286
 	 * @return EE_Display_Strategy_Base
287 287
 	 */
288
-	public function get_display_strategy(){
288
+	public function get_display_strategy() {
289 289
 		return $this->_display_strategy;
290 290
 	}
291 291
 	/**
292 292
 	 * Overwrites the display strategy
293 293
 	 * @param EE_Display_Strategy_Base $display_strategy
294 294
 	 */
295
-	public function set_display_strategy($display_strategy){
295
+	public function set_display_strategy($display_strategy) {
296 296
 		$this->_display_strategy = $display_strategy;
297 297
 		$this->_display_strategy->_construct_finalize($this);
298 298
 	}
@@ -300,14 +300,14 @@  discard block
 block discarded – undo
300 300
 	 * Gets the normalization strategy set on this input
301 301
 	 * @return EE_Normalization_Strategy_Base
302 302
 	 */
303
-	public function get_normalization_strategy(){
303
+	public function get_normalization_strategy() {
304 304
 		return $this->_normalization_strategy;
305 305
 	}
306 306
 	/**
307 307
 	 * Overwrites the normalization strategy
308 308
 	 * @param EE_Normalization_Strategy_Base $normalization_strategy
309 309
 	 */
310
-	public function set_normalization_strategy($normalization_strategy){
310
+	public function set_normalization_strategy($normalization_strategy) {
311 311
 		$this->_normalization_strategy = $normalization_strategy;
312 312
 		$this->_normalization_strategy->_construct_finalize($this);
313 313
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * Returns all teh validation strategies which apply to this field, numerically indexed
317 317
 	 * @return EE_Validation_Strategy_Base[]
318 318
 	 */
319
-	public function get_validation_strategies(){
319
+	public function get_validation_strategies() {
320 320
 		return $this->_validation_strategies;
321 321
 	}
322 322
 
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 	 * @param EE_Validation_Strategy_Base $validation_strategy
328 328
 	 * @return void
329 329
 	 */
330
-	protected function _add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ){
331
-		$validation_strategy->_construct_finalize( $this );
330
+	protected function _add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
331
+		$validation_strategy->_construct_finalize($this);
332 332
 		$this->_validation_strategies[] = $validation_strategy;
333 333
 	}
334 334
 
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
 	 * @param EE_Validation_Strategy_Base $validation_strategy
340 340
 	 * @return void
341 341
 	 */
342
-	public function add_validation_strategy( EE_Validation_Strategy_Base $validation_strategy ) {
343
-		$this->_add_validation_strategy( $validation_strategy );
342
+	public function add_validation_strategy(EE_Validation_Strategy_Base $validation_strategy) {
343
+		$this->_add_validation_strategy($validation_strategy);
344 344
 	}
345 345
 
346 346
 
@@ -350,13 +350,13 @@  discard block
 block discarded – undo
350 350
 	 *
351 351
 	 * @param string $validation_strategy_classname
352 352
 	 */
353
-	public function remove_validation_strategy( $validation_strategy_classname ) {
354
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
355
-			if(
353
+	public function remove_validation_strategy($validation_strategy_classname) {
354
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
355
+			if (
356 356
 				$validation_strategy instanceof $validation_strategy_classname
357
-				|| is_subclass_of( $validation_strategy, $validation_strategy_classname )
357
+				|| is_subclass_of($validation_strategy, $validation_strategy_classname)
358 358
 			) {
359
-				unset( $this->_validation_strategies[ $key ] );
359
+				unset($this->_validation_strategies[$key]);
360 360
 			}
361 361
 		}
362 362
 	}
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 	 * @param array $validation_strategy_classnames
370 370
 	 * @return bool
371 371
 	 */
372
-	public function has_validation_strategy( $validation_strategy_classnames ) {
373
-		$validation_strategy_classnames = is_array( $validation_strategy_classnames )
372
+	public function has_validation_strategy($validation_strategy_classnames) {
373
+		$validation_strategy_classnames = is_array($validation_strategy_classnames)
374 374
 			? $validation_strategy_classnames
375
-			: array( $validation_strategy_classnames );
376
-		foreach( $this->_validation_strategies as $key => $validation_strategy ){
377
-			if( in_array( $key, $validation_strategy_classnames ) ) {
375
+			: array($validation_strategy_classnames);
376
+		foreach ($this->_validation_strategies as $key => $validation_strategy) {
377
+			if (in_array($key, $validation_strategy_classnames)) {
378 378
 				return true;
379 379
 			}
380 380
 		}
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 	 * Gets the HTML
388 388
 	 * @return string
389 389
 	 */
390
-	public function get_html(){
390
+	public function get_html() {
391 391
 		return $this->_parent_section->get_html_for_input($this);
392 392
 	}
393 393
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return string
402 402
 	 * @throws \EE_Error
403 403
 	 */
404
-	public function get_html_for_input(){
404
+	public function get_html_for_input() {
405 405
 		return  $this->_get_display_strategy()->display();
406 406
 	}
407 407
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 	 * @return string
412 412
 	 */
413 413
 	public function html_other_attributes() {
414
-		return ! empty( $this->_html_other_attributes ) ? ' ' . $this->_html_other_attributes : '';
414
+		return ! empty($this->_html_other_attributes) ? ' '.$this->_html_other_attributes : '';
415 415
 	}
416 416
 
417 417
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	/**
420 420
 	 * @param string $html_other_attributes
421 421
 	 */
422
-	public function set_html_other_attributes( $html_other_attributes ) {
422
+	public function set_html_other_attributes($html_other_attributes) {
423 423
 		$this->_html_other_attributes = $html_other_attributes;
424 424
 	}
425 425
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * according to the form section's layout strategy
429 429
 	 * @return string
430 430
 	 */
431
-	public function get_html_for_label(){
431
+	public function get_html_for_label() {
432 432
 		return $this->_parent_section->get_layout_strategy()->display_label($this);
433 433
 	}
434 434
 	/**
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 	 * according to the form section's layout strategy
437 437
 	 * @return string
438 438
 	 */
439
-	public function get_html_for_errors(){
439
+	public function get_html_for_errors() {
440 440
 		return $this->_parent_section->get_layout_strategy()->display_errors($this);
441 441
 	}
442 442
 	/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * according to the form section's layout strategy
445 445
 	 * @return string
446 446
 	 */
447
-	public function get_html_for_help(){
447
+	public function get_html_for_help() {
448 448
 		return $this->_parent_section->get_layout_strategy()->display_help_text($this);
449 449
 	}
450 450
 	/**
@@ -453,18 +453,18 @@  discard block
 block discarded – undo
453 453
 	 * @return boolean
454 454
 	 */
455 455
 	protected function _validate() {
456
-		foreach($this->_validation_strategies as $validation_strategy){
457
-			if ( $validation_strategy instanceof EE_Validation_Strategy_Base ) {
458
-				try{
456
+		foreach ($this->_validation_strategies as $validation_strategy) {
457
+			if ($validation_strategy instanceof EE_Validation_Strategy_Base) {
458
+				try {
459 459
 					$validation_strategy->validate($this->normalized_value());
460
-				}catch(EE_Validation_Error $e){
460
+				} catch (EE_Validation_Error $e) {
461 461
 					$this->add_validation_error($e);
462 462
 				}
463 463
 			}
464 464
 		}
465
-		if( $this->get_validation_errors()){
465
+		if ($this->get_validation_errors()) {
466 466
 			return false;
467
-		}else{
467
+		} else {
468 468
 			return true;
469 469
 		}
470 470
 	}
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
 	 * @param string $value
479 479
 	 * @return null|string
480 480
 	 */
481
-	private function _sanitize( $value ) {
482
-		return $value !== null ? stripslashes( html_entity_decode( trim( $value ) ) ) : null;
481
+	private function _sanitize($value) {
482
+		return $value !== null ? stripslashes(html_entity_decode(trim($value))) : null;
483 483
 	}
484 484
 
485 485
 
@@ -493,25 +493,25 @@  discard block
 block discarded – undo
493 493
 	 * @return boolean whether or not there was an error
494 494
 	 * @throws \EE_Error
495 495
 	 */
496
-	protected function _normalize( $req_data ) {
496
+	protected function _normalize($req_data) {
497 497
 		//any existing validation errors don't apply so clear them
498 498
 		$this->_validation_errors = array();
499 499
 		try {
500
-			$raw_input = $this->find_form_data_for_this_section( $req_data );
500
+			$raw_input = $this->find_form_data_for_this_section($req_data);
501 501
 			//super simple sanitization for now
502
-			if ( is_array( $raw_input )) {
502
+			if (is_array($raw_input)) {
503 503
 				$raw_value = array();
504
-				foreach( $raw_input as $key => $value ) {
505
-					$raw_value[ $key ] = $this->_sanitize( $value );
504
+				foreach ($raw_input as $key => $value) {
505
+					$raw_value[$key] = $this->_sanitize($value);
506 506
 				}
507
-				$this->_set_raw_value( $raw_value );
507
+				$this->_set_raw_value($raw_value);
508 508
 			} else {
509
-				$this->_set_raw_value( $this->_sanitize( $raw_input ) );
509
+				$this->_set_raw_value($this->_sanitize($raw_input));
510 510
 			}
511 511
 			//we want to mostly leave the input alone in case we need to re-display it to the user
512
-			$this->_set_normalized_value( $this->_normalization_strategy->normalize( $this->raw_value() ) );
513
-		} catch ( EE_Validation_Error $e ) {
514
-			$this->add_validation_error( $e );
512
+			$this->_set_normalized_value($this->_normalization_strategy->normalize($this->raw_value()));
513
+		} catch (EE_Validation_Error $e) {
514
+			$this->add_validation_error($e);
515 515
 		}
516 516
 	}
517 517
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	/**
521 521
 	 * @return string
522 522
 	 */
523
-	public function html_name(){
523
+	public function html_name() {
524 524
 		return $this->_html_name;
525 525
 	}
526 526
 
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 	/**
530 530
 	 * @return string
531 531
 	 */
532
-	public function html_label_id(){
533
-		return ! empty( $this->_html_label_id ) ? $this->_html_label_id : $this->_html_id . '-lbl';
532
+	public function html_label_id() {
533
+		return ! empty($this->_html_label_id) ? $this->_html_label_id : $this->_html_id.'-lbl';
534 534
 	}
535 535
 
536 536
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	/**
539 539
 	 * @return string
540 540
 	 */
541
-	public function html_label_class(){
541
+	public function html_label_class() {
542 542
 		return $this->_html_label_class;
543 543
 	}
544 544
 
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	/**
548 548
 	 * @return string
549 549
 	 */
550
-	public function html_label_style(){
550
+	public function html_label_style() {
551 551
 		return $this->_html_label_style;
552 552
 	}
553 553
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	/**
557 557
 	 * @return string
558 558
 	 */
559
-	public function html_label_text(){
559
+	public function html_label_text() {
560 560
 		return $this->_html_label_text;
561 561
 	}
562 562
 
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	/**
566 566
 	 * @return string
567 567
 	 */
568
-	public function html_help_text(){
568
+	public function html_help_text() {
569 569
 		return $this->_html_help_text;
570 570
 	}
571 571
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	/**
575 575
 	 * @return string
576 576
 	 */
577
-	public function html_help_class(){
577
+	public function html_help_class() {
578 578
 		return $this->_html_help_class;
579 579
 	}
580 580
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	/**
584 584
 	 * @return string
585 585
 	 */
586
-	public function html_help_style(){
586
+	public function html_help_style() {
587 587
 		return $this->_html_style;
588 588
 	}
589 589
 	/**
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 	 * in which case, we would have stored the malicious content to our database.
597 597
 	 * @return string
598 598
 	 */
599
-	public function raw_value(){
599
+	public function raw_value() {
600 600
 		return $this->_raw_value;
601 601
 	}
602 602
 	/**
@@ -604,15 +604,15 @@  discard block
 block discarded – undo
604 604
 	 * it escapes all html entities
605 605
 	 * @return string
606 606
 	 */
607
-	public function raw_value_in_form(){
608
-		return htmlentities($this->raw_value(),ENT_QUOTES, 'UTF-8');
607
+	public function raw_value_in_form() {
608
+		return htmlentities($this->raw_value(), ENT_QUOTES, 'UTF-8');
609 609
 	}
610 610
 	/**
611 611
 	 * returns the value after it's been sanitized, and then converted into it's proper type
612 612
 	 * in PHP. Eg, a string, an int, an array,
613 613
 	 * @return mixed
614 614
 	 */
615
-	public function normalized_value(){
615
+	public function normalized_value() {
616 616
 		return $this->_normalized_value;
617 617
 	}
618 618
 
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	 * the best thing to display
623 623
 	 * @return string
624 624
 	 */
625
-	public function pretty_value(){
625
+	public function pretty_value() {
626 626
 		return $this->_normalized_value;
627 627
 	}
628 628
 	/**
@@ -641,19 +641,19 @@  discard block
 block discarded – undo
641 641
 		  }</code>
642 642
 	 * @return array
643 643
 	 */
644
-	public function get_jquery_validation_rules(){
644
+	public function get_jquery_validation_rules() {
645 645
 		$jquery_validation_js = array();
646 646
 		$jquery_validation_rules = array();
647
-		foreach($this->get_validation_strategies() as $validation_strategy){
647
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
648 648
 			$jquery_validation_rules = array_replace_recursive(
649 649
 				$jquery_validation_rules,
650 650
 				$validation_strategy->get_jquery_validation_rule_array()
651 651
 			);
652 652
 		}
653 653
 
654
-		if(! empty($jquery_validation_rules)){
655
-			foreach( $this->get_display_strategy()->get_html_input_ids( true ) as $html_id_with_pound_sign ) {
656
-				$jquery_validation_js[ $html_id_with_pound_sign ] = $jquery_validation_rules;
654
+		if ( ! empty($jquery_validation_rules)) {
655
+			foreach ($this->get_display_strategy()->get_html_input_ids(true) as $html_id_with_pound_sign) {
656
+				$jquery_validation_js[$html_id_with_pound_sign] = $jquery_validation_rules;
657 657
 			}
658 658
 		}
659 659
 		return $jquery_validation_js;
@@ -665,16 +665,16 @@  discard block
 block discarded – undo
665 665
 	 * @param mixed $value
666 666
 	 * @return void
667 667
 	 */
668
-	public function set_default($value){
669
-		$this->_set_normalized_value( $value );
670
-		$this->_set_raw_value( $value );
668
+	public function set_default($value) {
669
+		$this->_set_normalized_value($value);
670
+		$this->_set_raw_value($value);
671 671
 	}
672 672
 	
673 673
 	/**
674 674
 	 * Sets the normalized value on this input
675 675
 	 * @param mixed $value
676 676
 	 */
677
-	protected function _set_normalized_value( $value ) {
677
+	protected function _set_normalized_value($value) {
678 678
 		$this->_normalized_value = $value;
679 679
 	}
680 680
 	
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 	 * Sets the raw value on this input (ie, exactly as the user submitted it)
683 683
 	 * @param mixed $value
684 684
 	 */
685
-	protected function _set_raw_value( $value ) {
686
-		$this->_raw_value = $this->_normalization_strategy->unnormalize( $value );
685
+	protected function _set_raw_value($value) {
686
+		$this->_raw_value = $this->_normalization_strategy->unnormalize($value);
687 687
 	}
688 688
 
689 689
 	/**
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @param string $label
692 692
 	 * @return void
693 693
 	 */
694
-	public function set_html_label_text($label){
694
+	public function set_html_label_text($label) {
695 695
 		$this->_html_label_text = $label;
696 696
 	}
697 697
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	 * @param boolean $required boolean
706 706
 	 * @param null    $required_text
707 707
 	 */
708
-	public function set_required($required = true, $required_text = NULL ){
709
-		$required = filter_var( $required, FILTER_VALIDATE_BOOLEAN  );
708
+	public function set_required($required = true, $required_text = NULL) {
709
+		$required = filter_var($required, FILTER_VALIDATE_BOOLEAN);
710 710
 		//whether $required is a string or a boolean, we want to add a required validation strategy
711
-		if ( $required ) {
712
-			$this->_add_validation_strategy( new EE_Required_Validation_Strategy( $required_text ) );
711
+		if ($required) {
712
+			$this->_add_validation_strategy(new EE_Required_Validation_Strategy($required_text));
713 713
 		} else {
714
-			$this->remove_validation_strategy( 'EE_Required_Validation_Strategy' );
714
+			$this->remove_validation_strategy('EE_Required_Validation_Strategy');
715 715
 		}
716 716
 		$this->_required = $required;
717 717
 	}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	 * Returns whether or not this field is required
720 720
 	 * @return boolean
721 721
 	 */
722
-	public function required(){
722
+	public function required() {
723 723
 		return $this->_required;
724 724
 	}
725 725
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	/**
729 729
 	 * @param string $required_css_class
730 730
 	 */
731
-	public function set_required_css_class( $required_css_class ) {
731
+	public function set_required_css_class($required_css_class) {
732 732
 		$this->_required_css_class = $required_css_class;
733 733
 	}
734 734
 
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 * Sets the help text, in case
748 748
 	 * @param string $text
749 749
 	 */
750
-	public function set_html_help_text($text){
750
+	public function set_html_help_text($text) {
751 751
 		$this->_html_help_text = $text;
752 752
 	}
753 753
 	/**
@@ -759,9 +759,9 @@  discard block
 block discarded – undo
759 759
 	public function clean_sensitive_data() {
760 760
 		//if we do ANY kind of sensitive data removal on this, then just clear out the raw value
761 761
 		//if we need more logic than this we'll make a strategy for it
762
-		if( $this->_sensitive_data_removal_strategy &&
763
-				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal ){
764
-			$this->_set_raw_value( null );
762
+		if ($this->_sensitive_data_removal_strategy &&
763
+				! $this->_sensitive_data_removal_strategy instanceof EE_No_Sensitive_Data_Removal) {
764
+			$this->_set_raw_value(null);
765 765
 		}
766 766
 		//and clean the normalized value according to the appropriate strategy
767 767
 		$this->_set_normalized_value(
@@ -778,10 +778,10 @@  discard block
 block discarded – undo
778 778
 	 * @param string $button_size
779 779
 	 * @param string $other_attributes
780 780
 	 */
781
-	public function set_button_css_attributes( $primary = TRUE, $button_size = '', $other_attributes = '' ) {
781
+	public function set_button_css_attributes($primary = TRUE, $button_size = '', $other_attributes = '') {
782 782
 		$button_css_attributes = 'button';
783 783
 		$button_css_attributes .= $primary === TRUE ? ' button-primary' : ' button-secondary';
784
-		switch ( $button_size ) {
784
+		switch ($button_size) {
785 785
 			case 'xs' :
786 786
 			case 'extra-small' :
787 787
 				$button_css_attributes .= ' button-xs';
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 			default :
803 803
 				$button_css_attributes .= '';
804 804
 		}
805
-		$this->_button_css_attributes .= ! empty( $other_attributes )
806
-			? $button_css_attributes . ' ' . $other_attributes
805
+		$this->_button_css_attributes .= ! empty($other_attributes)
806
+			? $button_css_attributes.' '.$other_attributes
807 807
 			: $button_css_attributes;
808 808
 	}
809 809
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 	 * @return string
814 814
 	 */
815 815
 	public function button_css_attributes() {
816
-		if ( empty( $this->_button_css_attributes )) {
816
+		if (empty($this->_button_css_attributes)) {
817 817
 			$this->set_button_css_attributes();
818 818
 		}
819 819
 		return $this->_button_css_attributes;
@@ -835,26 +835,26 @@  discard block
 block discarded – undo
835 835
 	 * @return mixed whatever the raw value of this form section is in the request data
836 836
 	 * @throws \EE_Error
837 837
 	 */
838
-	public function find_form_data_for_this_section( $req_data ){
838
+	public function find_form_data_for_this_section($req_data) {
839 839
 		// break up the html name by "[]"
840
-		if ( strpos( $this->html_name(), '[' ) !== FALSE ) {
841
-			$before_any_brackets = substr( $this->html_name(), 0, strpos($this->html_name(), '[') );
840
+		if (strpos($this->html_name(), '[') !== FALSE) {
841
+			$before_any_brackets = substr($this->html_name(), 0, strpos($this->html_name(), '['));
842 842
 		} else {
843 843
 			$before_any_brackets = $this->html_name();
844 844
 		}
845 845
 		// grab all of the segments
846
-		preg_match_all('~\[([^]]*)\]~',$this->html_name(), $matches);
847
-		if( isset( $matches[ 1 ] ) && is_array( $matches[ 1 ] ) ){
848
-			$name_parts = $matches[ 1 ];
846
+		preg_match_all('~\[([^]]*)\]~', $this->html_name(), $matches);
847
+		if (isset($matches[1]) && is_array($matches[1])) {
848
+			$name_parts = $matches[1];
849 849
 			array_unshift($name_parts, $before_any_brackets);
850
-		}else{
851
-			$name_parts = array( $before_any_brackets );
850
+		} else {
851
+			$name_parts = array($before_any_brackets);
852 852
 		}
853 853
 		// now get the value for the input
854 854
 		$value = $this->_find_form_data_for_this_section_using_name_parts($name_parts, $req_data);
855 855
 		// check if this thing's name is at the TOP level of the request data
856
-		if( $value === null && isset( $req_data[ $this->name() ] ) ){
857
-			$value = $req_data[ $this->name() ];
856
+		if ($value === null && isset($req_data[$this->name()])) {
857
+			$value = $req_data[$this->name()];
858 858
 		}
859 859
 		return $value;
860 860
 	}
@@ -867,18 +867,18 @@  discard block
 block discarded – undo
867 867
 	 * @param array $req_data
868 868
 	 * @return array | NULL
869 869
 	 */
870
-	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data){
871
-		$first_part_to_consider = array_shift( $html_name_parts );
872
-		if( isset( $req_data[ $first_part_to_consider ] ) ){
873
-			if( empty($html_name_parts ) ){
874
-				return $req_data[ $first_part_to_consider ];
875
-			}else{
870
+	public function _find_form_data_for_this_section_using_name_parts($html_name_parts, $req_data) {
871
+		$first_part_to_consider = array_shift($html_name_parts);
872
+		if (isset($req_data[$first_part_to_consider])) {
873
+			if (empty($html_name_parts)) {
874
+				return $req_data[$first_part_to_consider];
875
+			} else {
876 876
 				return $this->_find_form_data_for_this_section_using_name_parts(
877 877
 					$html_name_parts,
878
-					$req_data[ $first_part_to_consider ]
878
+					$req_data[$first_part_to_consider]
879 879
 				);
880 880
 			}
881
-		}else{
881
+		} else {
882 882
 			return NULL;
883 883
 		}
884 884
 	}
@@ -892,14 +892,14 @@  discard block
 block discarded – undo
892 892
 	 * @return boolean
893 893
 	 * @throws \EE_Error
894 894
 	 */
895
-	public function form_data_present_in($req_data = NULL){
896
-		if( $req_data === NULL ){
895
+	public function form_data_present_in($req_data = NULL) {
896
+		if ($req_data === NULL) {
897 897
 			$req_data = $_POST;
898 898
 		}
899
-		$checked_value = $this->find_form_data_for_this_section( $req_data );
900
-		if( $checked_value !== null ){
899
+		$checked_value = $this->find_form_data_for_this_section($req_data);
900
+		if ($checked_value !== null) {
901 901
 			return TRUE;
902
-		}else{
902
+		} else {
903 903
 			return FALSE;
904 904
 		}
905 905
 	}
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 	 * @param array $form_other_js_data
911 911
 	 * @return array
912 912
 	 */
913
-	public function get_other_js_data( $form_other_js_data = array() ) {
914
-		$form_other_js_data = $this->get_other_js_data_from_strategies( $form_other_js_data );
913
+	public function get_other_js_data($form_other_js_data = array()) {
914
+		$form_other_js_data = $this->get_other_js_data_from_strategies($form_other_js_data);
915 915
 		return $form_other_js_data;
916 916
 	}
917 917
 
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
 	 * @param array $form_other_js_data
925 925
 	 * @return array
926 926
 	 */
927
-	public function get_other_js_data_from_strategies( $form_other_js_data = array() ) {
928
-		$form_other_js_data = $this->get_display_strategy()->get_other_js_data( $form_other_js_data );
929
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
930
-			$form_other_js_data = $validation_strategy->get_other_js_data( $form_other_js_data );
927
+	public function get_other_js_data_from_strategies($form_other_js_data = array()) {
928
+		$form_other_js_data = $this->get_display_strategy()->get_other_js_data($form_other_js_data);
929
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
930
+			$form_other_js_data = $validation_strategy->get_other_js_data($form_other_js_data);
931 931
 		}
932 932
 		return $form_other_js_data;
933 933
 	}
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 * Override parent because we want to give our strategies an opportunity to enqueue some js and css
937 937
 	 * @return void
938 938
 	 */
939
-	public function enqueue_js(){
939
+	public function enqueue_js() {
940 940
 		//ask our display strategy and validation strategies if they have js to enqueue
941 941
 		$this->enqueue_js_from_strategies();
942 942
 	}
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 	 */
948 948
 	public function enqueue_js_from_strategies() {
949 949
 		$this->get_display_strategy()->enqueue_js();
950
-		foreach( $this->get_validation_strategies() as $validation_strategy ) {
950
+		foreach ($this->get_validation_strategies() as $validation_strategy) {
951 951
 			$validation_strategy->enqueue_js();
952 952
 		}
953 953
 	}
Please login to merge, or discard this patch.
admin_pages/messages/EE_Message_List_Table.class.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') ){
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4 4
 }
5 5
 /**
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 	protected function _setup_data() {
29
-		$this->_data = $this->_get_messages( $this->_per_page, $this->_view );
30
-		$this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true );
29
+		$this->_data = $this->_get_messages($this->_per_page, $this->_view);
30
+		$this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
31 31
 	}
32 32
 
33 33
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 
36 36
 	protected function _set_properties() {
37 37
 		$this->_wp_list_args = array(
38
-			'singular' => __( 'Message', 'event_espresso' ),
39
-			'plural' => __( 'Messages', 'event_espresso' ),
38
+			'singular' => __('Message', 'event_espresso'),
39
+			'plural' => __('Messages', 'event_espresso'),
40 40
 			'ajax' => true,
41 41
 			'screen' => $this->get_admin_page()->get_current_screen()->id
42 42
 		);
43 43
 
44 44
 		$this->_columns = array(
45 45
 			'cb' => '<input type="checkbox" />',
46
-			'to' => __( 'To', 'event_espresso' ),
47
-			'from' => __( 'From', 'event_espresso' ),
48
-			'messenger' => __( 'Messenger', 'event_espresso' ),
49
-			'message_type' => __( 'Message Type', 'event_espresso' ),
50
-			'context' => __( 'Context', 'event_espresso' ),
51
-			'modified' => __( 'Modified', 'event_espresso' ),
52
-			'action' => __( 'Actions', 'event_espresso' ),
53
-			'msg_id' => __( 'ID', 'event_espresso' ),
46
+			'to' => __('To', 'event_espresso'),
47
+			'from' => __('From', 'event_espresso'),
48
+			'messenger' => __('Messenger', 'event_espresso'),
49
+			'message_type' => __('Message Type', 'event_espresso'),
50
+			'context' => __('Context', 'event_espresso'),
51
+			'modified' => __('Modified', 'event_espresso'),
52
+			'action' => __('Actions', 'event_espresso'),
53
+			'msg_id' => __('ID', 'event_espresso'),
54 54
 		);
55 55
 
56 56
 		$this->_sortable_columns = array(
57
-			'modified' => array( 'MSG_modified' => true ),
58
-			'message_type' => array( 'MSG_message_type' => false ),
59
-			'messenger' => array( 'MSG_messenger' => false ),
60
-			'to' => array( 'MSG_to' => false ),
61
-			'from' => array( 'MSG_from' => false ),
62
-			'context' => array( 'MSG_context' => false ),
63
-			'msg_id' => array( 'MSG_ID', false ),
57
+			'modified' => array('MSG_modified' => true),
58
+			'message_type' => array('MSG_message_type' => false),
59
+			'messenger' => array('MSG_messenger' => false),
60
+			'to' => array('MSG_to' => false),
61
+			'from' => array('MSG_from' => false),
62
+			'context' => array('MSG_context' => false),
63
+			'msg_id' => array('MSG_ID', false),
64 64
 		);
65 65
 
66 66
 		$this->_primary_column = 'to';
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	 * @param  object $item the current item
79 79
 	 * @return string
80 80
 	 */
81
-	protected function _get_row_class( $item ) {
82
-		$class = parent::_get_row_class( $item );
81
+	protected function _get_row_class($item) {
82
+		$class = parent::_get_row_class($item);
83 83
 		//add status class
84
-		$class .= ' ee-status-strip msg-status-' . $item->STS_ID();
85
-		if ( $this->_has_checkbox_column ) {
84
+		$class .= ' ee-status-strip msg-status-'.$item->STS_ID();
85
+		if ($this->_has_checkbox_column) {
86 86
 			$class .= ' has-checkbox-column';
87 87
 		}
88 88
 		return $class;
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		);
111 111
 
112 112
 		//set filters to select inputs if they aren't empty
113
-		foreach ( $select_inputs as $select_input ) {
114
-			if ( $select_input ) {
113
+		foreach ($select_inputs as $select_input) {
114
+			if ($select_input) {
115 115
 				$filters[] = $select_input;
116 116
 			}
117 117
 		}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	protected function _add_view_counts() {
124
-		foreach ( $this->_views as $view => $args ) {
125
-			$this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true );
124
+		foreach ($this->_views as $view => $args) {
125
+			$this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
126 126
 		}
127 127
 	}
128 128
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @return string   checkbox
134 134
 	 * @throws \EE_Error
135 135
 	 */
136
-	public function column_cb( $message ) {
137
-		return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() );
136
+	public function column_cb($message) {
137
+		return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
138 138
 	}
139 139
 
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 * @throws \EE_Error
146 146
 	 */
147
-	public function column_msg_id( EE_Message $message ) {
147
+	public function column_msg_id(EE_Message $message) {
148 148
 		return $message->ID();
149 149
 	}
150 150
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @return string    The recipient of the message
156 156
 	 * @throws \EE_Error
157 157
 	 */
158
-	public function column_to( EE_Message $message ) {
159
-		EE_Registry::instance()->load_helper( 'URL' );
158
+	public function column_to(EE_Message $message) {
159
+		EE_Registry::instance()->load_helper('URL');
160 160
 		$actions = array();
161 161
 		$actions['delete'] = '<a href="'
162 162
 			. EEH_URL::add_query_args_and_nonce(
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 					'action' => 'delete_ee_message',
166 166
 					'MSG_ID' => $message->ID()
167 167
 				),
168
-				admin_url( 'admin.php' )
168
+				admin_url('admin.php')
169 169
 			)
170
-			. '">' . __( 'Delete', 'event_espresso' ) . '</a>';
171
-		return esc_html( $message->to() ) . $this->row_actions( $actions );
170
+			. '">'.__('Delete', 'event_espresso').'</a>';
171
+		return esc_html($message->to()).$this->row_actions($actions);
172 172
 	}
173 173
 
174 174
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	 * @param EE_Message $message
177 177
 	 * @return string   The sender of the message
178 178
 	 */
179
-	public function column_from( EE_Message $message ) {
180
-		return esc_html( $message->from() );
179
+	public function column_from(EE_Message $message) {
180
+		return esc_html($message->from());
181 181
 	}
182 182
 
183 183
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param EE_Message $message
187 187
 	 * @return string  The messenger used to send the message.
188 188
 	 */
189
-	public function column_messenger( EE_Message $message ) {
190
-		return ucwords( $message->messenger_label() );
189
+	public function column_messenger(EE_Message $message) {
190
+		return ucwords($message->messenger_label());
191 191
 	}
192 192
 
193 193
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 * @param EE_Message $message
196 196
 	 * @return string  The message type used to generate the message.
197 197
 	 */
198
-	public function column_message_type( EE_Message $message ) {
199
-		return ucwords( $message->message_type_label() );
198
+	public function column_message_type(EE_Message $message) {
199
+		return ucwords($message->message_type_label());
200 200
 	}
201 201
 
202 202
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param EE_Message $message
205 205
 	 * @return string  The context the message was generated for.
206 206
 	 */
207
-	public function column_context( EE_Message $message ) {
207
+	public function column_context(EE_Message $message) {
208 208
 		return $message->context_label();
209 209
 	}
210 210
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param EE_Message $message
214 214
 	 * @return string    The timestamp when this message was last modified.
215 215
 	 */
216
-	public function column_modified( EE_Message $message ) {
216
+	public function column_modified(EE_Message $message) {
217 217
 		return $message->modified();
218 218
 	}
219 219
 
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 	 * @param EE_Message $message
223 223
 	 * @return string   Actions that can be done on the current message.
224 224
 	 */
225
-	public function column_action( EE_Message $message ) {
226
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
225
+	public function column_action(EE_Message $message) {
226
+		EE_Registry::instance()->load_helper('MSG_Template');
227 227
 		$action_links = array(
228
-			'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ),
229
-			'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ),
230
-			'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ),
231
-			'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ),
232
-			'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ),
233
-			'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ),
228
+			'view' => EEH_MSG_Template::get_message_action_link('view', $message),
229
+			'error' => EEH_MSG_Template::get_message_action_link('error', $message),
230
+			'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message),
231
+			'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message),
232
+			'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
233
+			'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
234 234
 		);
235 235
 		$content = '';
236
-		switch ( $message->STS_ID() ) {
236
+		switch ($message->STS_ID()) {
237 237
 			case EEM_Message::status_sent :
238
-				$content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
238
+				$content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction'];
239 239
 				break;
240 240
 			case EEM_Message::status_resend :
241
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
241
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
242 242
 				break;
243 243
 			case EEM_Message::status_retry :
244
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
244
+				$content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction'];
245 245
 				break;
246 246
 			case EEM_Message::status_failed :
247 247
 			case EEM_Message::status_debug_only :
248
-				$content = $action_links['error'] . $action_links['view_transaction'];
248
+				$content = $action_links['error'].$action_links['view_transaction'];
249 249
 				break;
250 250
 			case EEM_Message::status_idle :
251
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
251
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
252 252
 				break;
253 253
 			case EEM_Message::status_incomplete;
254
-				$content = $action_links['generate_now'] . $action_links['view_transaction'];
254
+				$content = $action_links['generate_now'].$action_links['view_transaction'];
255 255
 				break;
256 256
 		}
257 257
 		return $content;
@@ -269,54 +269,54 @@  discard block
 block discarded – undo
269 269
 	 * @return int | EE_Message[]
270 270
 	 * @throws \EE_Error
271 271
 	 */
272
-	protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) {
272
+	protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) {
273 273
 
274
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
274
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
275 275
 			? $this->_req_data['paged']
276 276
 			: 1;
277 277
 
278
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
278
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
279 279
 			? $this->_req_data['perpage']
280 280
 			: $perpage;
281 281
 
282
-		$offset = ( $current_page - 1 ) * $per_page;
283
-		$limit = $all || $count ? null : array( $offset, $per_page );
282
+		$offset = ($current_page - 1) * $per_page;
283
+		$limit = $all || $count ? null : array($offset, $per_page);
284 284
 		$query_params = array(
285
-			'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ],
286
-			'order'    => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ],
285
+			'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
286
+			'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
287 287
 			'limit'    => $limit,
288 288
 		);
289 289
 
290 290
 		/**
291 291
 		 * Any filters coming in from other routes?
292 292
 		 */
293
-		if ( isset( $this->_req_data['filterby'] ) ) {
294
-			$query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() );
295
-			if ( ! $count ) {
293
+		if (isset($this->_req_data['filterby'])) {
294
+			$query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
295
+			if ( ! $count) {
296 296
 				$query_params['group_by'] = 'MSG_ID';
297 297
 			}
298 298
 		}
299 299
 
300 300
 		//view conditionals
301
-		if ( $view !== 'all' && $count && $all ) {
301
+		if ($view !== 'all' && $count && $all) {
302 302
 			$query_params[0]['AND*view_conditional'] = array(
303
-				'STS_ID' => strtoupper( $view ),
303
+				'STS_ID' => strtoupper($view),
304 304
 			);
305 305
 		}
306 306
 
307
-		if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) {
307
+		if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') {
308 308
 			$query_params[0]['AND*view_conditional'] = array(
309
-				'STS_ID' => strtoupper( $this->_req_data['status'] ),
309
+				'STS_ID' => strtoupper($this->_req_data['status']),
310 310
 			);
311 311
 		}
312 312
 
313
-		if ( ! $all && ! empty( $this->_req_data['s'] ) ) {
314
-			$search_string = '%' . $this->_req_data['s'] . '%';
313
+		if ( ! $all && ! empty($this->_req_data['s'])) {
314
+			$search_string = '%'.$this->_req_data['s'].'%';
315 315
 			$query_params[0]['OR'] = array(
316
-				'MSG_to' => array( 'LIKE', $search_string ),
317
-				'MSG_from' => array( 'LIKE', $search_string ),
318
-				'MSG_subject' => array( 'LIKE', $search_string ),
319
-				'MSG_content' => array( 'LIKE', $search_string ),
316
+				'MSG_to' => array('LIKE', $search_string),
317
+				'MSG_from' => array('LIKE', $search_string),
318
+				'MSG_subject' => array('LIKE', $search_string),
319
+				'MSG_content' => array('LIKE', $search_string),
320 320
 			);
321 321
 		}
322 322
 
@@ -324,16 +324,16 @@  discard block
 block discarded – undo
324 324
 		//the messages system is in debug mode.
325 325
 		//Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only
326 326
 		//messages in the database.
327
-		if ( ! EEM_Message::debug() ) {
327
+		if ( ! EEM_Message::debug()) {
328 328
 			$query_params[0]['AND*debug_only_conditional'] = array(
329
-				'STS_ID' => array( '!=', EEM_Message::status_debug_only )
329
+				'STS_ID' => array('!=', EEM_Message::status_debug_only)
330 330
 			);
331 331
 		}
332 332
 
333 333
 		//account for filters
334 334
 		if (
335 335
 			! $all
336
-			&& isset( $this->_req_data['ee_messenger_filter_by'] )
336
+			&& isset($this->_req_data['ee_messenger_filter_by'])
337 337
 			&& $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
338 338
 		) {
339 339
 			$query_params[0]['AND*messenger_filter'] = array(
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		if (
344 344
 			! $all
345
-			&& ! empty( $this->_req_data['ee_message_type_filter_by'] )
345
+			&& ! empty($this->_req_data['ee_message_type_filter_by'])
346 346
 			&& $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
347 347
 		) {
348 348
 			$query_params[0]['AND*message_type_filter'] = array(
@@ -352,17 +352,17 @@  discard block
 block discarded – undo
352 352
 
353 353
 		if (
354 354
 			! $all
355
-			&& ! empty( $this->_req_data['ee_context_filter_by'] )
355
+			&& ! empty($this->_req_data['ee_context_filter_by'])
356 356
 			&& $this->_req_data['ee_context_filter_by'] !== 'none_selected'
357 357
 		) {
358 358
 			$query_params[0]['AND*context_filter'] = array(
359
-				'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) )
359
+				'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by']))
360 360
 			);
361 361
 		}
362 362
 
363 363
 		return $count
364
-			? EEM_Message::instance()->count( $query_params, null, true )
365
-			: EEM_Message::instance()->get_all( $query_params );
364
+			? EEM_Message::instance()->count($query_params, null, true)
365
+			: EEM_Message::instance()->get_all($query_params);
366 366
 	}
367 367
 
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	protected function _get_messengers_dropdown_filter() {
374 374
 		$messenger_options = array();
375
-		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) );
375
+		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
376 376
 
377 377
 		//setup array of messenger options
378
-		foreach ( $active_messages_grouped_by_messenger as $active_message ) {
379
-			if ( $active_message instanceof EE_Message ) {
380
-				$messenger_options[ $active_message->messenger() ] = ucwords( $active_message->messenger_label() );
378
+		foreach ($active_messages_grouped_by_messenger as $active_message) {
379
+			if ($active_message instanceof EE_Message) {
380
+				$messenger_options[$active_message->messenger()] = ucwords($active_message->messenger_label());
381 381
 			}
382 382
 		}
383
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
383
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
384 384
 	}
385 385
 
386 386
 
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	protected function _get_message_types_dropdown_filter() {
393 393
 		$message_type_options = array();
394
-		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) );
394
+		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type'));
395 395
 
396 396
 		//setup array of message type options
397
-		foreach ( $active_messages_grouped_by_message_type as $active_message ) {
398
-			if ( $active_message instanceof EE_Message ) {
399
-				$message_type_options[ $active_message->message_type() ] = ucwords( $active_message->message_type_label() );
397
+		foreach ($active_messages_grouped_by_message_type as $active_message) {
398
+			if ($active_message instanceof EE_Message) {
399
+				$message_type_options[$active_message->message_type()] = ucwords($active_message->message_type_label());
400 400
 			}
401 401
 		}
402
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
402
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
403 403
 	}
404 404
 
405 405
 
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	protected function _get_contexts_for_message_types_dropdown_filter() {
411 411
 		$context_options = array();
412
-		$active_messages_grouped_by_context = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) );
412
+		$active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
413 413
 
414 414
 		//setup array of context options
415
-		foreach ( $active_messages_grouped_by_context as $active_message ) {
416
-			if ( $active_message instanceof EE_Message ) {
415
+		foreach ($active_messages_grouped_by_context as $active_message) {
416
+			if ($active_message instanceof EE_Message) {
417 417
 				$message_type = $active_message->message_type_object();
418
-				if ( $message_type instanceof EE_message_type ) {
419
-					foreach ( $message_type->get_contexts() as $context => $context_details ) {
420
-						if ( isset( $context_details['label'] ) ) {
421
-							$context_options[ $context ] = $context_details['label'];
418
+				if ($message_type instanceof EE_message_type) {
419
+					foreach ($message_type->get_contexts() as $context => $context_details) {
420
+						if (isset($context_details['label'])) {
421
+							$context_options[$context] = $context_details['label'];
422 422
 						}
423 423
 					}
424 424
 				}
425 425
 			}
426 426
 		}
427
-		return $this->get_admin_page()->get_contexts_for_message_types_select_input( $context_options );
427
+		return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options);
428 428
 	}
429 429
 } //end EE_Message_List_Table class
430 430
\ No newline at end of file
Please login to merge, or discard this patch.