Completed
Branch BUG-10375-migrations-not-repor... (1e9646)
by
unknown
62:53 queued 49:42
created
modules/events_archive/EventsArchiveIframe.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\libraries\iframe_display\Iframe;
5 5
 
6 6
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-    exit( 'No direct script access allowed' );
7
+	exit( 'No direct script access allowed' );
8 8
 }
9 9
 
10 10
 
@@ -21,56 +21,56 @@  discard block
 block discarded – undo
21 21
 
22 22
 
23 23
 
24
-    /**
25
-     * EventsArchiveIframe constructor.
26
-     *
27
-     * @param \EED_Events_Archive $EED_Events_Archive
28
-     * @throws \DomainException
29
-     */
30
-    public function __construct( $EED_Events_Archive )
31
-    {
32
-        \EE_Registry::instance()->REQ->set_espresso_page( true );
33
-        add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
34
-        $EED_Events_Archive->event_list();
35
-        $event_list = new \EES_Espresso_Events();
36
-        parent::__construct(
37
-            esc_html__( 'Event List', 'event_espresso' ),
38
-            $event_list->process_shortcode()
39
-        );
40
-        $this->addStylesheets(
41
-            apply_filters(
42
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
43
-                array(
44
-                    'espresso_default'           => is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )
45
-                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
46
-                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
47
-                ),
48
-                $this
49
-            )
50
-        );
51
-        $this->addScripts(
52
-            apply_filters(
53
-                'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
54
-                array(
55
-                    'gmap_api' => sprintf(
56
-                        'https://maps.googleapis.com/maps/api/js?key=%s',
57
-                        apply_filters(
58
-                            'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
59
-                            \EE_Registry::instance()->CFG->map_settings->google_map_api_key
60
-                        )
61
-                    ),
62
-                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
63
-                ),
64
-                $this
65
-            )
66
-        );
67
-        $this->addLocalizedVars(
68
-            array(
69
-                'ee_gmap' => \EEH_Maps::$gmap_vars,
70
-            ),
71
-            'ee_gmap_vars'
72
-        );
73
-    }
24
+	/**
25
+	 * EventsArchiveIframe constructor.
26
+	 *
27
+	 * @param \EED_Events_Archive $EED_Events_Archive
28
+	 * @throws \DomainException
29
+	 */
30
+	public function __construct( $EED_Events_Archive )
31
+	{
32
+		\EE_Registry::instance()->REQ->set_espresso_page( true );
33
+		add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
34
+		$EED_Events_Archive->event_list();
35
+		$event_list = new \EES_Espresso_Events();
36
+		parent::__construct(
37
+			esc_html__( 'Event List', 'event_espresso' ),
38
+			$event_list->process_shortcode()
39
+		);
40
+		$this->addStylesheets(
41
+			apply_filters(
42
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
43
+				array(
44
+					'espresso_default'           => is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )
45
+						? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
46
+						: EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
47
+				),
48
+				$this
49
+			)
50
+		);
51
+		$this->addScripts(
52
+			apply_filters(
53
+				'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
54
+				array(
55
+					'gmap_api' => sprintf(
56
+						'https://maps.googleapis.com/maps/api/js?key=%s',
57
+						apply_filters(
58
+							'FHEE__EEH_Maps__espresso_google_maps_js__api_key',
59
+							\EE_Registry::instance()->CFG->map_settings->google_map_api_key
60
+						)
61
+					),
62
+					'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
63
+				),
64
+				$this
65
+			)
66
+		);
67
+		$this->addLocalizedVars(
68
+			array(
69
+				'ee_gmap' => \EEH_Maps::$gmap_vars,
70
+			),
71
+			'ee_gmap_vars'
72
+		);
73
+	}
74 74
 
75 75
 
76 76
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\iframe_display\Iframe;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-    exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+    exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -27,23 +27,23 @@  discard block
 block discarded – undo
27 27
      * @param \EED_Events_Archive $EED_Events_Archive
28 28
      * @throws \DomainException
29 29
      */
30
-    public function __construct( $EED_Events_Archive )
30
+    public function __construct($EED_Events_Archive)
31 31
     {
32
-        \EE_Registry::instance()->REQ->set_espresso_page( true );
32
+        \EE_Registry::instance()->REQ->set_espresso_page(true);
33 33
         add_filter('FHEE__EED_Events_Archive__event_list_iframe', '__return_true');
34 34
         $EED_Events_Archive->event_list();
35 35
         $event_list = new \EES_Espresso_Events();
36 36
         parent::__construct(
37
-            esc_html__( 'Event List', 'event_espresso' ),
37
+            esc_html__('Event List', 'event_espresso'),
38 38
             $event_list->process_shortcode()
39 39
         );
40 40
         $this->addStylesheets(
41 41
             apply_filters(
42 42
                 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
43 43
                 array(
44
-                    'espresso_default'           => is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )
45
-                        ? EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
46
-                        : EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
44
+                    'espresso_default'           => is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')
45
+                        ? EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
46
+                        : EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
47 47
                 ),
48 48
                 $this
49 49
             )
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                             \EE_Registry::instance()->CFG->map_settings->google_map_api_key
60 60
                         )
61 61
                     ),
62
-                    'ee_gmap'  => EE_HELPERS_ASSETS . 'ee_gmap.js?ver=1.0',
62
+                    'ee_gmap'  => EE_HELPERS_ASSETS.'ee_gmap.js?ver=1.0',
63 63
                 ),
64 64
                 $this
65 65
             )
Please login to merge, or discard this patch.
core/libraries/iframe_display/Iframe.php 2 patches
Indentation   +306 added lines, -306 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\libraries\iframe_display;
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
 
@@ -18,338 +18,338 @@  discard block
 block discarded – undo
18 18
 class Iframe
19 19
 {
20 20
 
21
-    /*
21
+	/*
22 22
     * HTML for notices and ajax gif
23 23
     * @var string $title
24 24
     */
25
-    protected $title = '';
25
+	protected $title = '';
26 26
 
27
-    /*
27
+	/*
28 28
     * HTML for the content being displayed
29 29
     * @var string $content
30 30
     */
31
-    protected $content = '';
31
+	protected $content = '';
32 32
 
33
-    /*
33
+	/*
34 34
     * whether or not to call wp_head() and wp_footer()
35 35
     * @var boolean $enqueue_wp_assets
36 36
     */
37
-    protected $enqueue_wp_assets = false;
37
+	protected $enqueue_wp_assets = false;
38 38
 
39
-    /*
39
+	/*
40 40
     * an array of CSS URLs
41 41
     * @var array $css
42 42
     */
43
-    protected $css = array();
43
+	protected $css = array();
44 44
 
45
-    /*
45
+	/*
46 46
     * an array of JS URLs to be set in the HTML header.
47 47
     * @var array $header_js
48 48
     */
49
-    protected $header_js = array();
49
+	protected $header_js = array();
50 50
 
51
-    /*
51
+	/*
52 52
     * an array of JS URLs to be displayed before the HTML </body> tag
53 53
     * @var array $footer_js
54 54
     */
55
-    protected $footer_js = array();
55
+	protected $footer_js = array();
56 56
 
57
-    /*
57
+	/*
58 58
     * an array of JSON vars to be set in the HTML header.
59 59
     * @var array $localized_vars
60 60
     */
61
-    protected $localized_vars = array();
62
-
63
-
64
-
65
-    /**
66
-     * Iframe constructor
67
-     *
68
-     * @param string $title
69
-     * @param string $content
70
-     * @throws \DomainException
71
-     */
72
-    public function __construct( $title, $content )
73
-    {
74
-        global $wp_version;
75
-        if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
-            define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
77
-        }
78
-        $this->setContent( $content );
79
-        $this->setTitle( $title );
80
-        $this->addStylesheets(
81
-            apply_filters(
82
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83
-                array(
84
-                    'site_theme'       => get_stylesheet_directory_uri() . DS
85
-                                          . 'style.css?ver=' . EVENT_ESPRESSO_VERSION,
86
-                    'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
87
-                    'espresso_default' => EE_GLOBAL_ASSETS_URL
88
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
89
-                ),
90
-                $this
91
-            )
92
-        );
93
-        $this->addScripts(
94
-            apply_filters(
95
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
96
-                array(
97
-                    'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
98
-                    'espresso_core' => EE_GLOBAL_ASSETS_URL
99
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
100
-                ),
101
-                $this
102
-            )
103
-        );
104
-        if (
105
-            apply_filters(
106
-                'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__load_default_theme_stylesheet',
107
-                false
108
-            )
109
-        ) {
110
-            $this->addStylesheets(
111
-                apply_filters(
112
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_theme_stylesheet',
113
-                    array('default_theme_stylesheet' => get_stylesheet_uri()),
114
-                    $this
115
-                )
116
-            );
117
-        }
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * @param string $title
124
-     * @throws \DomainException
125
-     */
126
-    public function setTitle( $title )
127
-    {
128
-        if ( empty( $title ) ) {
129
-            throw new \DomainException(
130
-                esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
131
-            );
132
-        }
133
-        $this->title = $title;
134
-    }
135
-
136
-
137
-
138
-    /**
139
-     * @param string $content
140
-     * @throws \DomainException
141
-     */
142
-    public function setContent( $content )
143
-    {
144
-        if ( empty( $content ) ) {
145
-            throw new \DomainException(
146
-                esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
147
-            );
148
-        }
149
-        $this->content = $content;
150
-    }
151
-
152
-
153
-
154
-    /**
155
-     * @param boolean $enqueue_wp_assets
156
-     */
157
-    public function setEnqueueWpAssets( $enqueue_wp_assets )
158
-    {
159
-        $this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
160
-    }
161
-
162
-
163
-
164
-    /**
165
-     * @param array $stylesheets
166
-     * @throws \DomainException
167
-     */
168
-    public function addStylesheets( array $stylesheets )
169
-    {
170
-        if ( empty( $stylesheets ) ) {
171
-            throw new \DomainException(
172
-                esc_html__(
173
-                    'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
174
-                    'event_espresso'
175
-                )
176
-            );
177
-        }
178
-        foreach ( $stylesheets as $handle => $stylesheet ) {
179
-            $this->css[ $handle ] = $stylesheet;
180
-        }
181
-    }
182
-
183
-
184
-
185
-    /**
186
-     * @param array $scripts
187
-     * @param bool  $add_to_header
188
-     * @throws \DomainException
189
-     */
190
-    public function addScripts( array $scripts, $add_to_header = false )
191
-    {
192
-        if ( empty( $scripts ) ) {
193
-            throw new \DomainException(
194
-                esc_html__(
195
-                    'A non-empty array of URLs, is required to add Javascript to an iframe.',
196
-                    'event_espresso'
197
-                )
198
-            );
199
-        }
200
-        foreach ( $scripts as $handle => $script ) {
201
-            if ( $add_to_header ) {
202
-                $this->header_js[ $handle ] = $script;
203
-            } else {
204
-                $this->footer_js[ $handle ] = $script;
205
-            }
206
-        }
207
-    }
208
-
209
-
210
-
211
-    /**
212
-     * @param array  $vars
213
-     * @param string $var_name
214
-     * @throws \DomainException
215
-     */
216
-    public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
217
-    {
218
-        if ( empty( $vars ) ) {
219
-            throw new \DomainException(
220
-                esc_html__(
221
-                    'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
222
-                    'event_espresso'
223
-                )
224
-            );
225
-        }
226
-        foreach ( $vars as $handle => $var ) {
227
-            if ( $var_name === 'eei18n' ) {
228
-                \EE_Registry::$i18n_js_strings[ $handle ] = $var;
229
-            } else {
230
-                if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
231
-                    $this->localized_vars[ $var_name ] = array();
232
-                }
233
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
234
-            }
235
-        }
236
-    }
237
-
238
-
239
-
240
-    /**
241
-     * @param string $utm_content
242
-     * @throws \DomainException
243
-     */
244
-    public function display($utm_content = '')
245
-    {
246
-        $this->content .= \EEH_Template::powered_by_event_espresso(
247
-            '',
248
-            '',
249
-            ! empty($utm_content) ? array('utm_content' => $utm_content) : array()
250
-        );
251
-        \EE_System::do_not_cache();
252
-        echo $this->getTemplate();
253
-        exit;
254
-    }
255
-
256
-
257
-
258
-    /**
259
-     * @return string
260
-     * @throws \DomainException
261
-     */
262
-    public function getTemplate()
263
-    {
264
-        return \EEH_Template::display_template(
265
-            __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
266
-            array(
267
-                'title'             => apply_filters(
268
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
269
-                    $this->title,
270
-                    $this
271
-                ),
272
-                'content'           => apply_filters(
273
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
274
-                    $this->content,
275
-                    $this
276
-                ),
277
-                'enqueue_wp_assets' => apply_filters(
278
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
279
-                    $this->enqueue_wp_assets,
280
-                    $this
281
-                ),
282
-                'css'               => (array)apply_filters(
283
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
284
-                    $this->css,
285
-                    $this
286
-                ),
287
-                'header_js'         => (array)apply_filters(
288
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
289
-                    $this->header_js,
290
-                    $this
291
-                ),
292
-                'footer_js'         => (array)apply_filters(
293
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
294
-                    $this->footer_js,
295
-                    $this
296
-                ),
297
-                'eei18n'            => apply_filters(
298
-                    'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
299
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
300
-                    $this
301
-                ),
302
-                'notices'           => \EEH_Template::display_template(
303
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
304
-                    array(),
305
-                    true
306
-                ),
307
-            ),
308
-            true,
309
-            true
310
-        );
311
-    }
312
-
313
-
314
-
315
-    /**
316
-     * localizeJsonVars
317
-     *
318
-     * @return string
319
-     */
320
-    public function localizeJsonVars()
321
-    {
322
-        $JSON = '';
323
-        foreach ( (array)$this->localized_vars as $var_name => $vars ) {
324
-            foreach ( (array)$vars as $key => $value ) {
325
-                $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
326
-            }
327
-            $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
328
-            $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
329
-            $JSON .= '; /* ]]> */';
330
-        }
331
-        return $JSON;
332
-    }
333
-
334
-
335
-
336
-    /**
337
-     * @param bool|int|float|string|array $var
338
-     * @return array
339
-     */
340
-    public function encodeJsonVars( $var )
341
-    {
342
-        if ( is_array( $var ) ) {
343
-            $localized_vars = array();
344
-            foreach ( (array)$var as $key => $value ) {
345
-                $localized_vars[ $key ] = $this->encodeJsonVars( $value );
346
-            }
347
-            return $localized_vars;
348
-        } else if ( is_scalar( $var ) ) {
349
-            return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
350
-        }
351
-        return null;
352
-    }
61
+	protected $localized_vars = array();
62
+
63
+
64
+
65
+	/**
66
+	 * Iframe constructor
67
+	 *
68
+	 * @param string $title
69
+	 * @param string $content
70
+	 * @throws \DomainException
71
+	 */
72
+	public function __construct( $title, $content )
73
+	{
74
+		global $wp_version;
75
+		if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
+			define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
77
+		}
78
+		$this->setContent( $content );
79
+		$this->setTitle( $title );
80
+		$this->addStylesheets(
81
+			apply_filters(
82
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83
+				array(
84
+					'site_theme'       => get_stylesheet_directory_uri() . DS
85
+										  . 'style.css?ver=' . EVENT_ESPRESSO_VERSION,
86
+					'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
87
+					'espresso_default' => EE_GLOBAL_ASSETS_URL
88
+										  . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
89
+				),
90
+				$this
91
+			)
92
+		);
93
+		$this->addScripts(
94
+			apply_filters(
95
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
96
+				array(
97
+					'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
98
+					'espresso_core' => EE_GLOBAL_ASSETS_URL
99
+									   . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
100
+				),
101
+				$this
102
+			)
103
+		);
104
+		if (
105
+			apply_filters(
106
+				'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__load_default_theme_stylesheet',
107
+				false
108
+			)
109
+		) {
110
+			$this->addStylesheets(
111
+				apply_filters(
112
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_theme_stylesheet',
113
+					array('default_theme_stylesheet' => get_stylesheet_uri()),
114
+					$this
115
+				)
116
+			);
117
+		}
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * @param string $title
124
+	 * @throws \DomainException
125
+	 */
126
+	public function setTitle( $title )
127
+	{
128
+		if ( empty( $title ) ) {
129
+			throw new \DomainException(
130
+				esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
131
+			);
132
+		}
133
+		$this->title = $title;
134
+	}
135
+
136
+
137
+
138
+	/**
139
+	 * @param string $content
140
+	 * @throws \DomainException
141
+	 */
142
+	public function setContent( $content )
143
+	{
144
+		if ( empty( $content ) ) {
145
+			throw new \DomainException(
146
+				esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
147
+			);
148
+		}
149
+		$this->content = $content;
150
+	}
151
+
152
+
153
+
154
+	/**
155
+	 * @param boolean $enqueue_wp_assets
156
+	 */
157
+	public function setEnqueueWpAssets( $enqueue_wp_assets )
158
+	{
159
+		$this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
160
+	}
161
+
162
+
163
+
164
+	/**
165
+	 * @param array $stylesheets
166
+	 * @throws \DomainException
167
+	 */
168
+	public function addStylesheets( array $stylesheets )
169
+	{
170
+		if ( empty( $stylesheets ) ) {
171
+			throw new \DomainException(
172
+				esc_html__(
173
+					'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
174
+					'event_espresso'
175
+				)
176
+			);
177
+		}
178
+		foreach ( $stylesheets as $handle => $stylesheet ) {
179
+			$this->css[ $handle ] = $stylesheet;
180
+		}
181
+	}
182
+
183
+
184
+
185
+	/**
186
+	 * @param array $scripts
187
+	 * @param bool  $add_to_header
188
+	 * @throws \DomainException
189
+	 */
190
+	public function addScripts( array $scripts, $add_to_header = false )
191
+	{
192
+		if ( empty( $scripts ) ) {
193
+			throw new \DomainException(
194
+				esc_html__(
195
+					'A non-empty array of URLs, is required to add Javascript to an iframe.',
196
+					'event_espresso'
197
+				)
198
+			);
199
+		}
200
+		foreach ( $scripts as $handle => $script ) {
201
+			if ( $add_to_header ) {
202
+				$this->header_js[ $handle ] = $script;
203
+			} else {
204
+				$this->footer_js[ $handle ] = $script;
205
+			}
206
+		}
207
+	}
208
+
209
+
210
+
211
+	/**
212
+	 * @param array  $vars
213
+	 * @param string $var_name
214
+	 * @throws \DomainException
215
+	 */
216
+	public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
217
+	{
218
+		if ( empty( $vars ) ) {
219
+			throw new \DomainException(
220
+				esc_html__(
221
+					'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
222
+					'event_espresso'
223
+				)
224
+			);
225
+		}
226
+		foreach ( $vars as $handle => $var ) {
227
+			if ( $var_name === 'eei18n' ) {
228
+				\EE_Registry::$i18n_js_strings[ $handle ] = $var;
229
+			} else {
230
+				if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
231
+					$this->localized_vars[ $var_name ] = array();
232
+				}
233
+				$this->localized_vars[ $var_name ][ $handle ] = $var;
234
+			}
235
+		}
236
+	}
237
+
238
+
239
+
240
+	/**
241
+	 * @param string $utm_content
242
+	 * @throws \DomainException
243
+	 */
244
+	public function display($utm_content = '')
245
+	{
246
+		$this->content .= \EEH_Template::powered_by_event_espresso(
247
+			'',
248
+			'',
249
+			! empty($utm_content) ? array('utm_content' => $utm_content) : array()
250
+		);
251
+		\EE_System::do_not_cache();
252
+		echo $this->getTemplate();
253
+		exit;
254
+	}
255
+
256
+
257
+
258
+	/**
259
+	 * @return string
260
+	 * @throws \DomainException
261
+	 */
262
+	public function getTemplate()
263
+	{
264
+		return \EEH_Template::display_template(
265
+			__DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
266
+			array(
267
+				'title'             => apply_filters(
268
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
269
+					$this->title,
270
+					$this
271
+				),
272
+				'content'           => apply_filters(
273
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content',
274
+					$this->content,
275
+					$this
276
+				),
277
+				'enqueue_wp_assets' => apply_filters(
278
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets',
279
+					$this->enqueue_wp_assets,
280
+					$this
281
+				),
282
+				'css'               => (array)apply_filters(
283
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
284
+					$this->css,
285
+					$this
286
+				),
287
+				'header_js'         => (array)apply_filters(
288
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
289
+					$this->header_js,
290
+					$this
291
+				),
292
+				'footer_js'         => (array)apply_filters(
293
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
294
+					$this->footer_js,
295
+					$this
296
+				),
297
+				'eei18n'            => apply_filters(
298
+					'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
299
+					\EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
300
+					$this
301
+				),
302
+				'notices'           => \EEH_Template::display_template(
303
+					EE_TEMPLATES . 'espresso-ajax-notices.template.php',
304
+					array(),
305
+					true
306
+				),
307
+			),
308
+			true,
309
+			true
310
+		);
311
+	}
312
+
313
+
314
+
315
+	/**
316
+	 * localizeJsonVars
317
+	 *
318
+	 * @return string
319
+	 */
320
+	public function localizeJsonVars()
321
+	{
322
+		$JSON = '';
323
+		foreach ( (array)$this->localized_vars as $var_name => $vars ) {
324
+			foreach ( (array)$vars as $key => $value ) {
325
+				$this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
326
+			}
327
+			$JSON .= "/* <![CDATA[ */ var {$var_name} = ";
328
+			$JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
329
+			$JSON .= '; /* ]]> */';
330
+		}
331
+		return $JSON;
332
+	}
333
+
334
+
335
+
336
+	/**
337
+	 * @param bool|int|float|string|array $var
338
+	 * @return array
339
+	 */
340
+	public function encodeJsonVars( $var )
341
+	{
342
+		if ( is_array( $var ) ) {
343
+			$localized_vars = array();
344
+			foreach ( (array)$var as $key => $value ) {
345
+				$localized_vars[ $key ] = $this->encodeJsonVars( $value );
346
+			}
347
+			return $localized_vars;
348
+		} else if ( is_scalar( $var ) ) {
349
+			return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
350
+		}
351
+		return null;
352
+	}
353 353
 
354 354
 
355 355
 
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 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\libraries\iframe_display;
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
 
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
      * @param string $content
70 70
      * @throws \DomainException
71 71
      */
72
-    public function __construct( $title, $content )
72
+    public function __construct($title, $content)
73 73
     {
74 74
         global $wp_version;
75
-        if ( ! defined( 'EE_IFRAME_DIR_URL' ) ) {
76
-            define( 'EE_IFRAME_DIR_URL', plugin_dir_url( __FILE__ ) );
75
+        if ( ! defined('EE_IFRAME_DIR_URL')) {
76
+            define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__));
77 77
         }
78
-        $this->setContent( $content );
79
-        $this->setTitle( $title );
78
+        $this->setContent($content);
79
+        $this->setTitle($title);
80 80
         $this->addStylesheets(
81 81
             apply_filters(
82 82
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css',
83 83
                 array(
84
-                    'site_theme'       => get_stylesheet_directory_uri() . DS
85
-                                          . 'style.css?ver=' . EVENT_ESPRESSO_VERSION,
86
-                    'dashicons'        => includes_url( 'css/dashicons.min.css?ver=' . $wp_version ),
84
+                    'site_theme'       => get_stylesheet_directory_uri().DS
85
+                                          . 'style.css?ver='.EVENT_ESPRESSO_VERSION,
86
+                    'dashicons'        => includes_url('css/dashicons.min.css?ver='.$wp_version),
87 87
                     'espresso_default' => EE_GLOBAL_ASSETS_URL
88
-                                          . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION,
88
+                                          . 'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION,
89 89
                 ),
90 90
                 $this
91 91
             )
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
             apply_filters(
95 95
                 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js',
96 96
                 array(
97
-                    'jquery'        => includes_url( 'js/jquery/jquery.js?ver=' . $wp_version ),
97
+                    'jquery'        => includes_url('js/jquery/jquery.js?ver='.$wp_version),
98 98
                     'espresso_core' => EE_GLOBAL_ASSETS_URL
99
-                                       . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
99
+                                       . 'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
100 100
                 ),
101 101
                 $this
102 102
             )
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
      * @param string $title
124 124
      * @throws \DomainException
125 125
      */
126
-    public function setTitle( $title )
126
+    public function setTitle($title)
127 127
     {
128
-        if ( empty( $title ) ) {
128
+        if (empty($title)) {
129 129
             throw new \DomainException(
130
-                esc_html__( 'You must provide a page title in order to create an iframe.', 'event_espresso' )
130
+                esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso')
131 131
             );
132 132
         }
133 133
         $this->title = $title;
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
      * @param string $content
140 140
      * @throws \DomainException
141 141
      */
142
-    public function setContent( $content )
142
+    public function setContent($content)
143 143
     {
144
-        if ( empty( $content ) ) {
144
+        if (empty($content)) {
145 145
             throw new \DomainException(
146
-                esc_html__( 'You must provide content in order to create an iframe.', 'event_espresso' )
146
+                esc_html__('You must provide content in order to create an iframe.', 'event_espresso')
147 147
             );
148 148
         }
149 149
         $this->content = $content;
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
     /**
155 155
      * @param boolean $enqueue_wp_assets
156 156
      */
157
-    public function setEnqueueWpAssets( $enqueue_wp_assets )
157
+    public function setEnqueueWpAssets($enqueue_wp_assets)
158 158
     {
159
-        $this->enqueue_wp_assets = filter_var( $enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN );
159
+        $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN);
160 160
     }
161 161
 
162 162
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
      * @param array $stylesheets
166 166
      * @throws \DomainException
167 167
      */
168
-    public function addStylesheets( array $stylesheets )
168
+    public function addStylesheets(array $stylesheets)
169 169
     {
170
-        if ( empty( $stylesheets ) ) {
170
+        if (empty($stylesheets)) {
171 171
             throw new \DomainException(
172 172
                 esc_html__(
173 173
                     'A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.',
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
                 )
176 176
             );
177 177
         }
178
-        foreach ( $stylesheets as $handle => $stylesheet ) {
179
-            $this->css[ $handle ] = $stylesheet;
178
+        foreach ($stylesheets as $handle => $stylesheet) {
179
+            $this->css[$handle] = $stylesheet;
180 180
         }
181 181
     }
182 182
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
      * @param bool  $add_to_header
188 188
      * @throws \DomainException
189 189
      */
190
-    public function addScripts( array $scripts, $add_to_header = false )
190
+    public function addScripts(array $scripts, $add_to_header = false)
191 191
     {
192
-        if ( empty( $scripts ) ) {
192
+        if (empty($scripts)) {
193 193
             throw new \DomainException(
194 194
                 esc_html__(
195 195
                     'A non-empty array of URLs, is required to add Javascript to an iframe.',
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
                 )
198 198
             );
199 199
         }
200
-        foreach ( $scripts as $handle => $script ) {
201
-            if ( $add_to_header ) {
202
-                $this->header_js[ $handle ] = $script;
200
+        foreach ($scripts as $handle => $script) {
201
+            if ($add_to_header) {
202
+                $this->header_js[$handle] = $script;
203 203
             } else {
204
-                $this->footer_js[ $handle ] = $script;
204
+                $this->footer_js[$handle] = $script;
205 205
             }
206 206
         }
207 207
     }
@@ -213,9 +213,9 @@  discard block
 block discarded – undo
213 213
      * @param string $var_name
214 214
      * @throws \DomainException
215 215
      */
216
-    public function addLocalizedVars( array $vars, $var_name = 'eei18n' )
216
+    public function addLocalizedVars(array $vars, $var_name = 'eei18n')
217 217
     {
218
-        if ( empty( $vars ) ) {
218
+        if (empty($vars)) {
219 219
             throw new \DomainException(
220 220
                 esc_html__(
221 221
                     'A non-empty array of vars, is required to add localized Javascript vars to an iframe.',
@@ -223,14 +223,14 @@  discard block
 block discarded – undo
223 223
                 )
224 224
             );
225 225
         }
226
-        foreach ( $vars as $handle => $var ) {
227
-            if ( $var_name === 'eei18n' ) {
228
-                \EE_Registry::$i18n_js_strings[ $handle ] = $var;
226
+        foreach ($vars as $handle => $var) {
227
+            if ($var_name === 'eei18n') {
228
+                \EE_Registry::$i18n_js_strings[$handle] = $var;
229 229
             } else {
230
-                if ( ! isset( $this->localized_vars[ $var_name ] ) ) {
231
-                    $this->localized_vars[ $var_name ] = array();
230
+                if ( ! isset($this->localized_vars[$var_name])) {
231
+                    $this->localized_vars[$var_name] = array();
232 232
                 }
233
-                $this->localized_vars[ $var_name ][ $handle ] = $var;
233
+                $this->localized_vars[$var_name][$handle] = $var;
234 234
             }
235 235
         }
236 236
     }
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
     public function getTemplate()
263 263
     {
264 264
         return \EEH_Template::display_template(
265
-            __DIR__ . DIRECTORY_SEPARATOR . 'iframe_wrapper.template.php',
265
+            __DIR__.DIRECTORY_SEPARATOR.'iframe_wrapper.template.php',
266 266
             array(
267 267
                 'title'             => apply_filters(
268 268
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title',
@@ -279,28 +279,28 @@  discard block
 block discarded – undo
279 279
                     $this->enqueue_wp_assets,
280 280
                     $this
281 281
                 ),
282
-                'css'               => (array)apply_filters(
282
+                'css'               => (array) apply_filters(
283 283
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls',
284 284
                     $this->css,
285 285
                     $this
286 286
                 ),
287
-                'header_js'         => (array)apply_filters(
287
+                'header_js'         => (array) apply_filters(
288 288
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls',
289 289
                     $this->header_js,
290 290
                     $this
291 291
                 ),
292
-                'footer_js'         => (array)apply_filters(
292
+                'footer_js'         => (array) apply_filters(
293 293
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls',
294 294
                     $this->footer_js,
295 295
                     $this
296 296
                 ),
297 297
                 'eei18n'            => apply_filters(
298 298
                     'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings',
299
-                    \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars(),
299
+                    \EE_Registry::localize_i18n_js_strings().$this->localizeJsonVars(),
300 300
                     $this
301 301
                 ),
302 302
                 'notices'           => \EEH_Template::display_template(
303
-                    EE_TEMPLATES . 'espresso-ajax-notices.template.php',
303
+                    EE_TEMPLATES.'espresso-ajax-notices.template.php',
304 304
                     array(),
305 305
                     true
306 306
                 ),
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
     public function localizeJsonVars()
321 321
     {
322 322
         $JSON = '';
323
-        foreach ( (array)$this->localized_vars as $var_name => $vars ) {
324
-            foreach ( (array)$vars as $key => $value ) {
325
-                $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value );
323
+        foreach ((array) $this->localized_vars as $var_name => $vars) {
324
+            foreach ((array) $vars as $key => $value) {
325
+                $this->localized_vars[$var_name] = $this->encodeJsonVars($value);
326 326
             }
327 327
             $JSON .= "/* <![CDATA[ */ var {$var_name} = ";
328
-            $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] );
328
+            $JSON .= wp_json_encode($this->localized_vars[$var_name]);
329 329
             $JSON .= '; /* ]]> */';
330 330
         }
331 331
         return $JSON;
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
      * @param bool|int|float|string|array $var
338 338
      * @return array
339 339
      */
340
-    public function encodeJsonVars( $var )
340
+    public function encodeJsonVars($var)
341 341
     {
342
-        if ( is_array( $var ) ) {
342
+        if (is_array($var)) {
343 343
             $localized_vars = array();
344
-            foreach ( (array)$var as $key => $value ) {
345
-                $localized_vars[ $key ] = $this->encodeJsonVars( $value );
344
+            foreach ((array) $var as $key => $value) {
345
+                $localized_vars[$key] = $this->encodeJsonVars($value);
346 346
             }
347 347
             return $localized_vars;
348
-        } else if ( is_scalar( $var ) ) {
349
-            return html_entity_decode( (string)$var, ENT_QUOTES, 'UTF-8' );
348
+        } else if (is_scalar($var)) {
349
+            return html_entity_decode((string) $var, ENT_QUOTES, 'UTF-8');
350 350
         }
351 351
         return null;
352 352
     }
Please login to merge, or discard this patch.
form_sections/inputs/EE_Checkbox_Dropdown_Selector_Input.input.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -17,65 +17,65 @@  discard block
 block discarded – undo
17 17
 class EE_Checkbox_Dropdown_Selector_Input extends EE_Form_Input_With_Options_Base
18 18
 {
19 19
 
20
-    /**
21
-     * @var string text to display on the select button itself
22
-     */
23
-    protected $_select_button_text;
20
+	/**
21
+	 * @var string text to display on the select button itself
22
+	 */
23
+	protected $_select_button_text;
24 24
 
25
-    /**
26
-     * @param array $answer_options
27
-     * @param array $input_settings
28
-     */
29
-    public function __construct($answer_options, $input_settings = array())
30
-    {
31
-        $this->_select_button_text = EEH_Array::is_set( $input_settings, 'select_button_text',
32
-            esc_html__('Select', 'event_espresso'));
33
-        $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy();
34
-        $this->_set_display_strategy($display_strategy);
35
-        $this->load_iframe_assets($display_strategy);
36
-        $this->_add_validation_strategy(
37
-            new EE_Many_Valued_Validation_Strategy(
38
-                array(
39
-                    new EE_Enum_Validation_Strategy(
40
-                        isset($input_settings['validation_error_message'])
41
-                            ? $input_settings['validation_error_message']
42
-                            : null
43
-                    ),
44
-                )
45
-            )
46
-        );
47
-        $this->_multiple_selections = true;
48
-        parent::__construct($answer_options, $input_settings);
49
-    }
25
+	/**
26
+	 * @param array $answer_options
27
+	 * @param array $input_settings
28
+	 */
29
+	public function __construct($answer_options, $input_settings = array())
30
+	{
31
+		$this->_select_button_text = EEH_Array::is_set( $input_settings, 'select_button_text',
32
+			esc_html__('Select', 'event_espresso'));
33
+		$display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy();
34
+		$this->_set_display_strategy($display_strategy);
35
+		$this->load_iframe_assets($display_strategy);
36
+		$this->_add_validation_strategy(
37
+			new EE_Many_Valued_Validation_Strategy(
38
+				array(
39
+					new EE_Enum_Validation_Strategy(
40
+						isset($input_settings['validation_error_message'])
41
+							? $input_settings['validation_error_message']
42
+							: null
43
+					),
44
+				)
45
+			)
46
+		);
47
+		$this->_multiple_selections = true;
48
+		parent::__construct($answer_options, $input_settings);
49
+	}
50 50
 
51
-    /*
51
+	/*
52 52
      * Returns the text to display in the select button
53 53
      */
54
-    public function select_button_text(){
55
-        return $this->_select_button_text;
56
-    }
54
+	public function select_button_text(){
55
+		return $this->_select_button_text;
56
+	}
57 57
 
58
-    /*
58
+	/*
59 59
      * add css and js for iframes
60 60
      */
61
-    protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy){
62
-        add_filter(
63
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
64
-            array($display_strategy, 'iframe_css')
65
-        );
66
-        add_filter(
67
-            'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
68
-            array($display_strategy, 'iframe_js')
69
-        );
70
-        add_filter(
71
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
72
-            array($display_strategy, 'iframe_css')
73
-        );
74
-        add_filter(
75
-            'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
76
-            array($display_strategy, 'iframe_js')
77
-        );
78
-    }
61
+	protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy){
62
+		add_filter(
63
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
64
+			array($display_strategy, 'iframe_css')
65
+		);
66
+		add_filter(
67
+			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
68
+			array($display_strategy, 'iframe_js')
69
+		);
70
+		add_filter(
71
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
72
+			array($display_strategy, 'iframe_css')
73
+		);
74
+		add_filter(
75
+			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
76
+			array($display_strategy, 'iframe_js')
77
+		);
78
+	}
79 79
 
80 80
 
81 81
 }
82 82
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function __construct($answer_options, $input_settings = array())
30 30
     {
31
-        $this->_select_button_text = EEH_Array::is_set( $input_settings, 'select_button_text',
31
+        $this->_select_button_text = EEH_Array::is_set($input_settings, 'select_button_text',
32 32
             esc_html__('Select', 'event_espresso'));
33 33
         $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy();
34 34
         $this->_set_display_strategy($display_strategy);
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
     /*
52 52
      * Returns the text to display in the select button
53 53
      */
54
-    public function select_button_text(){
54
+    public function select_button_text() {
55 55
         return $this->_select_button_text;
56 56
     }
57 57
 
58 58
     /*
59 59
      * add css and js for iframes
60 60
      */
61
-    protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy){
61
+    protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) {
62 62
         add_filter(
63 63
             'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
64 64
             array($display_strategy, 'iframe_css')
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 2 patches
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		$this->_columns = array_merge( $columns, $this->_columns );
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89 89
 		if ( ! empty( $evt_id )
90
-		     && EE_Registry::instance()->CAP->current_user_can(
90
+			 && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
93 93
 				$evt_id
@@ -104,44 +104,44 @@  discard block
 block discarded – undo
104 104
 				),
105 105
 			);
106 106
 		}
107
-        $this->_bottom_buttons['report_filtered'] = array(
108
-            'route'         => 'registrations_checkin_report',
109
-            'extra_request' => array(
110
-                'use_filters' => true,
111
-                'filters'     => array_merge(
112
-                    array(
113
-                        'EVT_ID' => $evt_id,
114
-                    ),
115
-                    array_diff_key(
116
-                        $this->_req_data,
117
-                        array_flip(
118
-                            array(
119
-                                'page',
120
-                                'action',
121
-                                'default_nonce',
122
-                            )
123
-                        )
124
-                    )
125
-                ),
126
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
127
-            ),
128
-        );
107
+		$this->_bottom_buttons['report_filtered'] = array(
108
+			'route'         => 'registrations_checkin_report',
109
+			'extra_request' => array(
110
+				'use_filters' => true,
111
+				'filters'     => array_merge(
112
+					array(
113
+						'EVT_ID' => $evt_id,
114
+					),
115
+					array_diff_key(
116
+						$this->_req_data,
117
+						array_flip(
118
+							array(
119
+								'page',
120
+								'action',
121
+								'default_nonce',
122
+							)
123
+						)
124
+					)
125
+				),
126
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
127
+			),
128
+		);
129 129
 		$this->_sortable_columns = array(
130
-            /**
131
-             * Allows users to change the default sort if they wish.
132
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
133
-             *
134
-             * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
135
-             * change the sorts on any list table involving registration contacts.  If you want to only change the filter
136
-             * for a specific list table you can use the provided reference to this object instance.
137
-             */
130
+			/**
131
+			 * Allows users to change the default sort if they wish.
132
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
133
+			 *
134
+			 * Note: usual naming conventions for filters aren't followed here so that just one filter can be used to
135
+			 * change the sorts on any list table involving registration contacts.  If you want to only change the filter
136
+			 * for a specific list table you can use the provided reference to this object instance.
137
+			 */
138 138
 			'ATT_name' => array(
139
-                    'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
140
-                    true,
141
-                    $this
142
-                )
143
-                ? array( 'ATT_lname' => true )
144
-                : array( 'ATT_fname' => true ),
139
+					'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
140
+					true,
141
+					$this
142
+				)
143
+				? array( 'ATT_lname' => true )
144
+				: array( 'ATT_fname' => true ),
145 145
 			'Event'    => array( 'Event.EVT.Name' => false ),
146 146
 		);
147 147
 		$this->_hidden_columns = array();
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 			if ( count( $this->_dtts_for_event ) > 1 ) {
225 225
 				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
226 226
 				foreach ( $this->_dtts_for_event as $dtt ) {
227
-                    $datetime_string = $dtt->name();
228
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
227
+					$datetime_string = $dtt->name();
228
+					$datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
229 229
 					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
230 230
 					$dtts[ $dtt->ID() ] = $datetime_string;
231 231
 				}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
320 320
 		$nonce = wp_create_nonce( 'checkin_nonce' );
321 321
 		$toggle_active = ! empty ( $this->_cur_dtt_id )
322
-		                 && EE_Registry::instance()->CAP->current_user_can(
322
+						 && EE_Registry::instance()->CAP->current_user_can(
323 323
 			'ee_edit_checkin',
324 324
 			'espresso_registrations_toggle_checkin_status',
325 325
 			$item->ID()
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 			: '';
329 329
 		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
330 330
 		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
331
-		       . ' data-_regid="' . $item->ID() . '"'
332
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
333
-		       . ' data-nonce="' . $nonce . '">'
334
-		       . '</span>'
335
-		       . $mobile_view_content;
331
+			   . ' data-_regid="' . $item->ID() . '"'
332
+			   . ' data-dttid="' . $this->_cur_dtt_id . '"'
333
+			   . ' data-nonce="' . $nonce . '">'
334
+			   . '</span>'
335
+			   . $mobile_view_content;
336 336
 	}
337 337
 
338 338
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 			'espresso_registrations_edit_attendee'
358 358
 		)
359 359
 			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
360
-			    . $item->attendee()->full_name()
361
-			    . '</a>'
360
+				. $item->attendee()->full_name()
361
+				. '</a>'
362 362
 			: $item->attendee()->full_name();
363 363
 		$name_link .= $item->count() === 1
364 364
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 			? $latest_related_datetime->ID()
394 394
 			: $DTT_ID;
395 395
 		if ( ! empty( $DTT_ID )
396
-		     && EE_Registry::instance()->CAP->current_user_can(
396
+			 && EE_Registry::instance()->CAP->current_user_can(
397 397
 				'ee_read_checkins',
398 398
 				'espresso_registrations_registration_checkins'
399 399
 			)
@@ -493,15 +493,15 @@  discard block
 block discarded – undo
493 493
 				) ? '
494 494
 				<span class="reg-pad-rght">
495 495
 					<a class="status-'
496
-				    . $item->transaction()->status_ID()
497
-				    . '" href="'
498
-				    . $view_txn_lnk_url
499
-				    . '"  title="'
500
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
501
-				    . '">
496
+					. $item->transaction()->status_ID()
497
+					. '" href="'
498
+					. $view_txn_lnk_url
499
+					. '"  title="'
500
+					. esc_attr__( 'View Transaction', 'event_espresso' )
501
+					. '">
502 502
 						'
503
-				    . $item->transaction()->pretty_paid()
504
-				    . '
503
+					. $item->transaction()->pretty_paid()
504
+					. '
505 505
 					</a>
506 506
 				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
507 507
 			}
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
 				'ee_read_transaction',
535 535
 				'espresso_transactions_view_transaction'
536 536
 			) ? '<a href="'
537
-			    . $view_txn_url
538
-			    . '" title="'
539
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
540
-			    . '"><span class="reg-pad-rght">'
541
-			    . $txn_total
542
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
537
+				. $view_txn_url
538
+				. '" title="'
539
+				. esc_attr__( 'View Transaction', 'event_espresso' )
540
+				. '"><span class="reg-pad-rght">'
541
+				. $txn_total
542
+				. '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
543 543
 		} else {
544 544
 			return '<span class="reg-pad-rght"></span>';
545 545
 		}
Please login to merge, or discard this patch.
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -42,51 +42,51 @@  discard block
 block discarded – undo
42 42
 	 *
43 43
 	 * @param \Registrations_Admin_Page $admin_page
44 44
 	 */
45
-	public function __construct( $admin_page ) {
46
-		parent::__construct( $admin_page );
45
+	public function __construct($admin_page) {
46
+		parent::__construct($admin_page);
47 47
 		$this->_status = $this->_admin_page->get_registration_status_array();
48 48
 	}
49 49
 
50 50
 
51 51
 
52 52
 	protected function _setup_data() {
53
-		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page )
54
-			: $this->_admin_page->get_event_attendees( $this->_per_page, false, true );
53
+		$this->_data = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page)
54
+			: $this->_admin_page->get_event_attendees($this->_per_page, false, true);
55 55
 		$this->_all_data_count = $this->_view !== 'trash' ? $this->_admin_page->get_event_attendees(
56 56
 			$this->_per_page,
57 57
 			true
58
-		) : $this->_admin_page->get_event_attendees( $this->_per_page, true, true );
58
+		) : $this->_admin_page->get_event_attendees($this->_per_page, true, true);
59 59
 	}
60 60
 
61 61
 
62 62
 
63 63
 	protected function _set_properties() {
64
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : null;
64
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
65 65
 		$this->_wp_list_args = array(
66
-			'singular' => __( 'registrant', 'event_espresso' ),
67
-			'plural'   => __( 'registrants', 'event_espresso' ),
66
+			'singular' => __('registrant', 'event_espresso'),
67
+			'plural'   => __('registrants', 'event_espresso'),
68 68
 			'ajax'     => true,
69 69
 			'screen'   => $this->_admin_page->get_current_screen()->id,
70 70
 		);
71 71
 		$columns = array();
72 72
 		//$columns['_Reg_Status'] = '';
73
-		if ( ! empty( $evt_id ) ) {
73
+		if ( ! empty($evt_id)) {
74 74
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
75 75
 			$this->_has_checkbox_column = true;
76 76
 		}
77 77
 		$this->_columns = array(
78 78
 			'_REG_att_checked_in' => '<span class="dashicons dashicons-yes ee-icon-size-18"></span>',
79
-			'ATT_name'            => __( 'Registrant', 'event_espresso' ),
80
-			'ATT_email'           => __( 'Email Address', 'event_espresso' ),
81
-			'Event'               => __( 'Event', 'event_espresso' ),
82
-			'PRC_name'            => __( 'TKT Option', 'event_espresso' ),
83
-			'_REG_final_price'    => __( 'Price', 'event_espresso' ),
84
-			'TXN_paid'            => __( 'Paid', 'event_espresso' ),
85
-			'TXN_total'           => __( 'Total', 'event_espresso' ),
79
+			'ATT_name'            => __('Registrant', 'event_espresso'),
80
+			'ATT_email'           => __('Email Address', 'event_espresso'),
81
+			'Event'               => __('Event', 'event_espresso'),
82
+			'PRC_name'            => __('TKT Option', 'event_espresso'),
83
+			'_REG_final_price'    => __('Price', 'event_espresso'),
84
+			'TXN_paid'            => __('Paid', 'event_espresso'),
85
+			'TXN_total'           => __('Total', 'event_espresso'),
86 86
 		);
87
-		$this->_columns = array_merge( $columns, $this->_columns );
87
+		$this->_columns = array_merge($columns, $this->_columns);
88 88
 		$this->_primary_column = '_REG_att_checked_in';
89
-		if ( ! empty( $evt_id )
89
+		if ( ! empty($evt_id)
90 90
 		     && EE_Registry::instance()->CAP->current_user_can(
91 91
 				'ee_read_registrations',
92 92
 				'espresso_registrations_registrations_reports',
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 					'extra_request' =>
100 100
 						array(
101 101
 							'EVT_ID'     => $evt_id,
102
-							'return_url' => urlencode( "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}" ),
102
+							'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
103 103
 						),
104 104
 				),
105 105
 			);
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
                     true,
141 141
                     $this
142 142
                 )
143
-                ? array( 'ATT_lname' => true )
144
-                : array( 'ATT_fname' => true ),
145
-			'Event'    => array( 'Event.EVT.Name' => false ),
143
+                ? array('ATT_lname' => true)
144
+                : array('ATT_fname' => true),
145
+			'Event'    => array('Event.EVT.Name' => false),
146 146
 		);
147 147
 		$this->_hidden_columns = array();
148
-		$this->_evt = EEM_Event::instance()->get_one_by_ID( $evt_id );
148
+		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
149 149
 		$this->_dtts_for_event = $this->_evt instanceof EE_Event ? $this->_evt->datetimes_ordered() : array();
150 150
 	}
151 151
 
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @param \EE_Registration $item
156 156
 	 * @return string
157 157
 	 */
158
-	protected function _get_row_class( $item ) {
159
-		$class = parent::_get_row_class( $item );
158
+	protected function _get_row_class($item) {
159
+		$class = parent::_get_row_class($item);
160 160
 		//add status class
161
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
162
-		if ( $this->_has_checkbox_column ) {
161
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
162
+		if ($this->_has_checkbox_column) {
163 163
 			$class .= ' has-checkbox-column';
164 164
 		}
165 165
 		return $class;
@@ -173,61 +173,61 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function _get_table_filters() {
175 175
 		$filters = $where = array();
176
-		$current_EVT_ID = isset( $this->_req_data['event_id'] ) ? (int) $this->_req_data['event_id'] : 0;
177
-		if ( empty( $this->_dtts_for_event ) || count( $this->_dtts_for_event ) === 1 ) {
176
+		$current_EVT_ID = isset($this->_req_data['event_id']) ? (int) $this->_req_data['event_id'] : 0;
177
+		if (empty($this->_dtts_for_event) || count($this->_dtts_for_event) === 1) {
178 178
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
179 179
 			//note possible capability restrictions
180
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
181
-				$where['status**'] = array( '!=', 'private' );
180
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
181
+				$where['status**'] = array('!=', 'private');
182 182
 			}
183
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
183
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
184 184
 				$where['EVT_wp_user'] = get_current_user_id();
185 185
 			}
186 186
 			$events = EEM_Event::instance()->get_all(
187 187
 				array(
188 188
 					$where,
189
-					'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ),
189
+					'order_by' => array('Datetime.DTT_EVT_start' => 'DESC'),
190 190
 				)
191 191
 			);
192 192
 			$evts[] = array(
193 193
 				'id'   => 0,
194
-				'text' => __( 'To toggle Check-in status, select an event', 'event_espresso' ),
194
+				'text' => __('To toggle Check-in status, select an event', 'event_espresso'),
195 195
 			);
196 196
 			$checked = 'checked';
197 197
 			/** @var EE_Event $evt */
198
-			foreach ( $events as $evt ) {
198
+			foreach ($events as $evt) {
199 199
 				//any registrations for this event?
200
-				if ( ! $evt->get_count_of_all_registrations() ) {
200
+				if ( ! $evt->get_count_of_all_registrations()) {
201 201
 					continue;
202 202
 				}
203 203
 				$evts[] = array(
204 204
 					'id'    => $evt->ID(),
205
-					'text'  => $evt->get( 'EVT_name' ),
205
+					'text'  => $evt->get('EVT_name'),
206 206
 					'class' => $evt->is_expired() ? 'ee-expired-event' : '',
207 207
 				);
208
-				if ( $evt->ID() === $current_EVT_ID && $evt->is_expired() ) {
208
+				if ($evt->ID() === $current_EVT_ID && $evt->is_expired()) {
209 209
 					$checked = '';
210 210
 				}
211 211
 			}
212 212
 			$event_filter = '<div class="ee-event-filter">';
213
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts, $current_EVT_ID );
213
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts, $current_EVT_ID);
214 214
 			$event_filter .= '<span class="ee-event-filter-toggle">';
215
-			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" ' . $checked . '> ';
216
-			$event_filter .= __( 'Hide Expired Events', 'event_espresso' );
215
+			$event_filter .= '<input type="checkbox" id="js-ee-hide-expired-events" '.$checked.'> ';
216
+			$event_filter .= __('Hide Expired Events', 'event_espresso');
217 217
 			$event_filter .= '</span>';
218 218
 			$event_filter .= '</div>';
219 219
 			$filters[] = $event_filter;
220 220
 		}
221
-		if ( ! empty( $this->_dtts_for_event ) ) {
221
+		if ( ! empty($this->_dtts_for_event)) {
222 222
 			//DTT datetimes filter
223
-			$this->_cur_dtt_id = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
224
-			if ( count( $this->_dtts_for_event ) > 1 ) {
225
-				$dtts[0] = __( 'To toggle check-in status, select a datetime.', 'event_espresso' );
226
-				foreach ( $this->_dtts_for_event as $dtt ) {
223
+			$this->_cur_dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
224
+			if (count($this->_dtts_for_event) > 1) {
225
+				$dtts[0] = __('To toggle check-in status, select a datetime.', 'event_espresso');
226
+				foreach ($this->_dtts_for_event as $dtt) {
227 227
                     $datetime_string = $dtt->name();
228
-                    $datetime_string = ! empty($datetime_string ) ? ' (' . $datetime_string . ')' : '';
229
-					$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time() . $datetime_string;
230
-					$dtts[ $dtt->ID() ] = $datetime_string;
228
+                    $datetime_string = ! empty($datetime_string) ? ' ('.$datetime_string.')' : '';
229
+					$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time().$datetime_string;
230
+					$dtts[$dtt->ID()] = $datetime_string;
231 231
 				}
232 232
 				$input = new EE_Select_Input(
233 233
 					$dtts,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 					)
239 239
 				);
240 240
 				$filters[] = $input->get_html_for_input();
241
-				$filters[] = '<input type="hidden" name="event_id" value="' . $current_EVT_ID . '">';
241
+				$filters[] = '<input type="hidden" name="event_id" value="'.$current_EVT_ID.'">';
242 242
 			}
243 243
 		}
244 244
 		return $filters;
@@ -257,22 +257,22 @@  discard block
 block discarded – undo
257 257
 	 * @throws \EE_Error
258 258
 	 */
259 259
 	protected function _get_total_event_attendees() {
260
-		$EVT_ID = isset( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : false;
260
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
261 261
 		$DTT_ID = $this->_cur_dtt_id;
262 262
 		$query_params = array();
263
-		if ( $EVT_ID ) {
263
+		if ($EVT_ID) {
264 264
 			$query_params[0]['EVT_ID'] = $EVT_ID;
265 265
 		}
266 266
 		//if DTT is included we only show for that datetime.  Otherwise we're showing for all datetimes (the event).
267
-		if ( $DTT_ID ) {
267
+		if ($DTT_ID) {
268 268
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
269 269
 		}
270 270
 		$status_ids_array = apply_filters(
271 271
 			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
272
-			array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved )
272
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
273 273
 		);
274
-		$query_params[0]['STS_ID'] = array( 'IN', $status_ids_array );
275
-		return EEM_Registration::instance()->count( $query_params );
274
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
275
+		return EEM_Registration::instance()->count($query_params);
276 276
 	}
277 277
 
278 278
 
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 	 * @param \EE_Registration $item
282 282
 	 * @return string
283 283
 	 */
284
-	public function column__Reg_Status( EE_Registration $item ) {
285
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
284
+	public function column__Reg_Status(EE_Registration $item) {
285
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
286 286
 	}
287 287
 
288 288
 
@@ -292,8 +292,8 @@  discard block
 block discarded – undo
292 292
 	 * @return string
293 293
 	 * @throws \EE_Error
294 294
 	 */
295
-	public function column_cb( $item ) {
296
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
295
+	public function column_cb($item) {
296
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
297 297
 	}
298 298
 
299 299
 
@@ -305,20 +305,20 @@  discard block
 block discarded – undo
305 305
 	 * @return string
306 306
 	 * @throws \EE_Error
307 307
 	 */
308
-	public function column__REG_att_checked_in( EE_Registration $item ) {
308
+	public function column__REG_att_checked_in(EE_Registration $item) {
309 309
 		$attendee = $item->attendee();
310 310
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
311 311
 
312
-		if ( $this->_cur_dtt_id === 0 && count( $this->_dtts_for_event ) === 1 ) {
312
+		if ($this->_cur_dtt_id === 0 && count($this->_dtts_for_event) === 1) {
313 313
 			$latest_related_datetime = $item->get_latest_related_datetime();
314
-			if ( $latest_related_datetime instanceof EE_Datetime ) {
314
+			if ($latest_related_datetime instanceof EE_Datetime) {
315 315
 				$this->_cur_dtt_id = $latest_related_datetime->ID();
316 316
 			}
317 317
 		}
318 318
 
319
-		$checkinstatus = $item->check_in_status_for_datetime( $this->_cur_dtt_id );
320
-		$nonce = wp_create_nonce( 'checkin_nonce' );
321
-		$toggle_active = ! empty ( $this->_cur_dtt_id )
319
+		$checkinstatus = $item->check_in_status_for_datetime($this->_cur_dtt_id);
320
+		$nonce = wp_create_nonce('checkin_nonce');
321
+		$toggle_active = ! empty ($this->_cur_dtt_id)
322 322
 		                 && EE_Registry::instance()->CAP->current_user_can(
323 323
 			'ee_edit_checkin',
324 324
 			'espresso_registrations_toggle_checkin_status',
@@ -326,11 +326,11 @@  discard block
 block discarded – undo
326 326
 		)
327 327
 			? ' clickable trigger-checkin'
328 328
 			: '';
329
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
330
-		return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '"'
331
-		       . ' data-_regid="' . $item->ID() . '"'
332
-		       . ' data-dttid="' . $this->_cur_dtt_id . '"'
333
-		       . ' data-nonce="' . $nonce . '">'
329
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
330
+		return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'"'
331
+		       . ' data-_regid="'.$item->ID().'"'
332
+		       . ' data-dttid="'.$this->_cur_dtt_id.'"'
333
+		       . ' data-nonce="'.$nonce.'">'
334 334
 		       . '</span>'
335 335
 		       . $mobile_view_content;
336 336
 	}
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	 * @return mixed|string|void
343 343
 	 * @throws \EE_Error
344 344
 	 */
345
-	public function column_ATT_name( EE_Registration $item ) {
345
+	public function column_ATT_name(EE_Registration $item) {
346 346
 		$attendee = $item->attendee();
347
-		if ( ! $attendee instanceof EE_Attendee ) {
348
-			return __( 'No contact record for this registration.', 'event_espresso' );
347
+		if ( ! $attendee instanceof EE_Attendee) {
348
+			return __('No contact record for this registration.', 'event_espresso');
349 349
 		}
350 350
 		// edit attendee link
351 351
 		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
352
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
352
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
353 353
 			REG_ADMIN_URL
354 354
 		);
355 355
 		$name_link = EE_Registry::instance()->CAP->current_user_can(
356 356
 			'ee_edit_contacts',
357 357
 			'espresso_registrations_edit_attendee'
358 358
 		)
359
-			? '<a href="' . $edit_lnk_url . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
359
+			? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
360 360
 			    . $item->attendee()->full_name()
361 361
 			    . '</a>'
362 362
 			: $item->attendee()->full_name();
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	'
365 365
 			: '';
366 366
 		//add group details
367
-		$name_link .= '&nbsp;' . sprintf( __( '(%s of %s)', 'event_espresso' ), $item->count(), $item->group_size() );
367
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
368 368
 		//add regcode
369 369
 		$link = EE_Admin_Page::add_query_args_and_nonce(
370
-			array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ),
370
+			array('action' => 'view_registration', '_REG_ID' => $item->ID()),
371 371
 			REG_ADMIN_URL
372 372
 		);
373 373
 		$name_link .= '<br>';
@@ -376,37 +376,37 @@  discard block
 block discarded – undo
376 376
 			'view_registration',
377 377
 			$item->ID()
378 378
 		)
379
-			? '<a href="' . $link . '" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">'
379
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'
380 380
 			  . $item->reg_code()
381 381
 			  . '</a>'
382 382
 			: $item->reg_code();
383 383
 		//status
384 384
 		$name_link .= '<br><span class="ee-status-text-small">';
385
-		$name_link .= EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' );
385
+		$name_link .= EEH_Template::pretty_status($item->status_ID(), false, 'sentence');
386 386
 		$name_link .= '</span>';
387 387
 		$actions = array();
388 388
 		$DTT_ID = $this->_cur_dtt_id;
389
-		$latest_related_datetime = empty( $DTT_ID ) && ! empty( $this->_req_data['event_id'] ) && $item instanceof EE_Registration
389
+		$latest_related_datetime = empty($DTT_ID) && ! empty($this->_req_data['event_id']) && $item instanceof EE_Registration
390 390
 			? $item->get_latest_related_datetime()
391 391
 			: null;
392 392
 		$DTT_ID = $latest_related_datetime instanceof EE_Datetime
393 393
 			? $latest_related_datetime->ID()
394 394
 			: $DTT_ID;
395
-		if ( ! empty( $DTT_ID )
395
+		if ( ! empty($DTT_ID)
396 396
 		     && EE_Registry::instance()->CAP->current_user_can(
397 397
 				'ee_read_checkins',
398 398
 				'espresso_registrations_registration_checkins'
399 399
 			)
400 400
 		) {
401 401
 			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(
402
-				array( 'action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID )
402
+				array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID)
403 403
 			);
404
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__(
404
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__(
405 405
 					'View all the check-ins/checkouts for this registrant',
406 406
 					'event_espresso'
407
-				) . '">' . __( 'View', 'event_espresso' ) . '</a>';
407
+				).'">'.__('View', 'event_espresso').'</a>';
408 408
 		}
409
-		return ! empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions( $actions ) ) : $name_link;
409
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
410 410
 	}
411 411
 
412 412
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 * @param \EE_Registration $item
416 416
 	 * @return string
417 417
 	 */
418
-	public function column_ATT_email( EE_Registration $item ) {
418
+	public function column_ATT_email(EE_Registration $item) {
419 419
 		$attendee = $item->attendee();
420 420
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
421 421
 	}
@@ -427,22 +427,22 @@  discard block
 block discarded – undo
427 427
 	 * @return bool|string
428 428
 	 * @throws \EE_Error
429 429
 	 */
430
-	public function column_Event( EE_Registration $item ) {
430
+	public function column_Event(EE_Registration $item) {
431 431
 		try {
432 432
 			$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
433 433
 			$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
434
-				array( 'action' => 'event_registrations', 'event_id' => $event->ID() ),
434
+				array('action' => 'event_registrations', 'event_id' => $event->ID()),
435 435
 				REG_ADMIN_URL
436 436
 			);
437 437
 			$event_label = EE_Registry::instance()->CAP->current_user_can(
438 438
 				'ee_read_checkins',
439 439
 				'espresso_registrations_registration_checkins'
440
-			) ? '<a href="' . $chkin_lnk_url . '" title="' . esc_attr__(
440
+			) ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__(
441 441
 					'View Checkins for this Event',
442 442
 					'event_espresso'
443
-				) . '">' . $event->name() . '</a>' : $event->name();
444
-		} catch ( \EventEspresso\core\exceptions\EntityNotFoundException $e ) {
445
-			$event_label = esc_html__( 'Unknown', 'event_espresso' );
443
+				).'">'.$event->name().'</a>' : $event->name();
444
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
445
+			$event_label = esc_html__('Unknown', 'event_espresso');
446 446
 		}
447 447
 		return $event_label;
448 448
 	}
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	 * @param \EE_Registration $item
454 454
 	 * @return mixed|string|void
455 455
 	 */
456
-	public function column_PRC_name( EE_Registration $item ) {
457
-		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __( "Unknown", "event_espresso" );
456
+	public function column_PRC_name(EE_Registration $item) {
457
+		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
458 458
 	}
459 459
 
460 460
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
 	 * @param \EE_Registration $item
466 466
 	 * @return string
467 467
 	 */
468
-	public function column__REG_final_price( EE_Registration $item ) {
469
-		return '<span class="reg-pad-rght">' . ' ' . $item->pretty_final_price() . '</span>';
468
+	public function column__REG_final_price(EE_Registration $item) {
469
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
470 470
 	}
471 471
 
472 472
 
@@ -478,13 +478,13 @@  discard block
 block discarded – undo
478 478
 	 * @return string
479 479
 	 * @throws \EE_Error
480 480
 	 */
481
-	public function column_TXN_paid( EE_Registration $item ) {
482
-		if ( $item->count() === 1 ) {
483
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
481
+	public function column_TXN_paid(EE_Registration $item) {
482
+		if ($item->count() === 1) {
483
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
484 484
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
485 485
 			} else {
486 486
 				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(
487
-					array( 'action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID() ),
487
+					array('action' => 'view_transaction', 'TXN_ID' => $item->transaction_ID()),
488 488
 					TXN_ADMIN_URL
489 489
 				);
490 490
 				return EE_Registry::instance()->CAP->current_user_can(
@@ -497,13 +497,13 @@  discard block
 block discarded – undo
497 497
 				    . '" href="'
498 498
 				    . $view_txn_lnk_url
499 499
 				    . '"  title="'
500
-				    . esc_attr__( 'View Transaction', 'event_espresso' )
500
+				    . esc_attr__('View Transaction', 'event_espresso')
501 501
 				    . '">
502 502
 						'
503 503
 				    . $item->transaction()->pretty_paid()
504 504
 				    . '
505 505
 					</a>
506
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
506
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
507 507
 			}
508 508
 		} else {
509 509
 			return '<span class="reg-pad-rght"></span>';
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 	 * @return string
520 520
 	 * @throws \EE_Error
521 521
 	 */
522
-	public function column_TXN_total( EE_Registration $item ) {
522
+	public function column_TXN_total(EE_Registration $item) {
523 523
 		$txn = $item->transaction();
524
-		$view_txn_url = add_query_arg( array( 'action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
525
-		if ( $item->get( 'REG_count' ) === 1 ) {
524
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
525
+		if ($item->get('REG_count') === 1) {
526 526
 			$line_total_obj = $txn->total_line_item();
527 527
 			$txn_total = $line_total_obj instanceof EE_Line_Item
528
-				? $line_total_obj->get_pretty( 'LIN_total' )
528
+				? $line_total_obj->get_pretty('LIN_total')
529 529
 				: __(
530 530
 					'View Transaction',
531 531
 					'event_espresso'
@@ -536,10 +536,10 @@  discard block
 block discarded – undo
536 536
 			) ? '<a href="'
537 537
 			    . $view_txn_url
538 538
 			    . '" title="'
539
-			    . esc_attr__( 'View Transaction', 'event_espresso' )
539
+			    . esc_attr__('View Transaction', 'event_espresso')
540 540
 			    . '"><span class="reg-pad-rght">'
541 541
 			    . $txn_total
542
-			    . '</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
542
+			    . '</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
543 543
 		} else {
544 544
 			return '<span class="reg-pad-rght"></span>';
545 545
 		}
Please login to merge, or discard this patch.
admin/extend/registrations/Extend_Registrations_Admin_Page.core.php 2 patches
Indentation   +1141 added lines, -1141 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -17,1145 +17,1145 @@  discard block
 block discarded – undo
17 17
 {
18 18
 
19 19
 
20
-    /**
21
-     * This is used to hold the reports template data which is setup early in the request.
22
-     *
23
-     * @type array
24
-     */
25
-    protected $_reports_template_data = array();
26
-
27
-
28
-
29
-    /**
30
-     * Extend_Registrations_Admin_Page constructor.
31
-     *
32
-     * @param bool $routing
33
-     */
34
-    public function __construct($routing = true)
35
-    {
36
-        parent::__construct($routing);
37
-        if ( ! defined('REG_CAF_TEMPLATE_PATH')) {
38
-            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
39
-            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
40
-            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
41
-        }
42
-    }
43
-
44
-
45
-
46
-    protected function _extend_page_config()
47
-    {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
-        $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
-            ? $this->_req_data['_REG_ID']
51
-            : 0;
52
-        // $att_id = ! empty( $this->_req_data['ATT_ID'] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
53
-        // $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] )
54
-        // 	? $this->_req_data['post'] : $att_id;
55
-        $new_page_routes = array(
56
-            'reports'                  => array(
57
-                'func'       => '_registration_reports',
58
-                'capability' => 'ee_read_registrations',
59
-            ),
60
-            'registration_checkins'    => array(
61
-                'func'       => '_registration_checkin_list_table',
62
-                'capability' => 'ee_read_checkins',
63
-            ),
64
-            'newsletter_selected_send' => array(
65
-                'func'       => '_newsletter_selected_send',
66
-                'noheader'   => true,
67
-                'capability' => 'ee_send_message',
68
-            ),
69
-            'delete_checkin_rows'      => array(
70
-                'func'       => '_delete_checkin_rows',
71
-                'noheader'   => true,
72
-                'capability' => 'ee_delete_checkins',
73
-            ),
74
-            'delete_checkin_row'       => array(
75
-                'func'       => '_delete_checkin_row',
76
-                'noheader'   => true,
77
-                'capability' => 'ee_delete_checkin',
78
-                'obj_id'     => $reg_id,
79
-            ),
80
-            'toggle_checkin_status'    => array(
81
-                'func'       => '_toggle_checkin_status',
82
-                'noheader'   => true,
83
-                'capability' => 'ee_edit_checkin',
84
-                'obj_id'     => $reg_id,
85
-            ),
86
-            'event_registrations'      => array(
87
-                'func'       => '_event_registrations_list_table',
88
-                'capability' => 'ee_read_checkins',
89
-            ),
90
-            'registrations_checkin_report' => array(
91
-                'func'       => '_registrations_checkin_report',
92
-                'noheader'   => true,
93
-                'capability' => 'ee_read_registrations',
94
-            ),
95
-        );
96
-        $this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
97
-        $new_page_config = array(
98
-            'reports'               => array(
99
-                'nav'           => array(
100
-                    'label' => __('Reports', 'event_espresso'),
101
-                    'order' => 30,
102
-                ),
103
-                'help_tabs'     => array(
104
-                    'registrations_reports_help_tab' => array(
105
-                        'title'    => __('Registration Reports', 'event_espresso'),
106
-                        'filename' => 'registrations_reports',
107
-                    ),
108
-                ),
109
-                /*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
110
-                'require_nonce' => false,
111
-            ),
112
-            'event_registrations'   => array(
113
-                'nav'           => array(
114
-                    'label'      => __('Event Check-In', 'event_espresso'),
115
-                    'order'      => 10,
116
-                    'persistent' => true,
117
-                ),
118
-                'help_tabs'     => array(
119
-                    'registrations_event_checkin_help_tab'                       => array(
120
-                        'title'    => __('Registrations Event Check-In', 'event_espresso'),
121
-                        'filename' => 'registrations_event_checkin',
122
-                    ),
123
-                    'registrations_event_checkin_table_column_headings_help_tab' => array(
124
-                        'title'    => __('Event Check-In Table Column Headings', 'event_espresso'),
125
-                        'filename' => 'registrations_event_checkin_table_column_headings',
126
-                    ),
127
-                    'registrations_event_checkin_filters_help_tab'               => array(
128
-                        'title'    => __('Event Check-In Filters', 'event_espresso'),
129
-                        'filename' => 'registrations_event_checkin_filters',
130
-                    ),
131
-                    'registrations_event_checkin_views_help_tab'                 => array(
132
-                        'title'    => __('Event Check-In Views', 'event_espresso'),
133
-                        'filename' => 'registrations_event_checkin_views',
134
-                    ),
135
-                    'registrations_event_checkin_other_help_tab'                 => array(
136
-                        'title'    => __('Event Check-In Other', 'event_espresso'),
137
-                        'filename' => 'registrations_event_checkin_other',
138
-                    ),
139
-                ),
140
-                'help_tour'     => array('Event_Checkin_Help_Tour'),
141
-                'qtips'         => array('Registration_List_Table_Tips'),
142
-                'list_table'    => 'EE_Event_Registrations_List_Table',
143
-                'metaboxes'     => array(),
144
-                'require_nonce' => false,
145
-            ),
146
-            'registration_checkins' => array(
147
-                'nav'           => array(
148
-                    'label'      => __('Check-In Records', 'event_espresso'),
149
-                    'order'      => 15,
150
-                    'persistent' => false,
151
-                ),
152
-                'list_table'    => 'EE_Registration_CheckIn_List_Table',
153
-                //'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
154
-                'metaboxes'     => array(),
155
-                'require_nonce' => false,
156
-            ),
157
-        );
158
-        $this->_page_config = array_merge($this->_page_config, $new_page_config);
159
-        $this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
160
-        $this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
161
-    }
162
-
163
-
164
-
165
-    protected function _ajax_hooks()
166
-    {
167
-        parent::_ajax_hooks();
168
-        add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
169
-    }
170
-
171
-
172
-
173
-    public function load_scripts_styles()
174
-    {
175
-        parent::load_scripts_styles();
176
-        //if newsletter message type is active then let's add filter and load js for it.
177
-        if (EEH_MSG_Template::is_mt_active('newsletter')) {
178
-            //enqueue newsletter js
179
-            wp_enqueue_script(
180
-                'ee-newsletter-trigger',
181
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
182
-                array('ee-dialog'),
183
-                EVENT_ESPRESSO_VERSION,
184
-                true
185
-            );
186
-            wp_enqueue_style(
187
-                'ee-newsletter-trigger-css',
188
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
189
-                array(),
190
-                EVENT_ESPRESSO_VERSION
191
-            );
192
-            //hook in buttons for newsletter message type trigger.
193
-            add_action(
194
-                'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
195
-                array($this, 'add_newsletter_action_buttons'),
196
-                10
197
-            );
198
-        }
199
-    }
200
-
201
-
202
-
203
-    public function load_scripts_styles_reports()
204
-    {
205
-        wp_register_script(
206
-            'ee-reg-reports-js',
207
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
208
-            array('google-charts'),
209
-            EVENT_ESPRESSO_VERSION,
210
-            true
211
-        );
212
-        wp_enqueue_script('ee-reg-reports-js');
213
-        $this->_registration_reports_js_setup();
214
-    }
215
-
216
-
217
-
218
-    protected function _add_screen_options_event_registrations()
219
-    {
220
-        $this->_per_page_screen_option();
221
-    }
222
-
223
-
224
-
225
-    protected function _add_screen_options_registration_checkins()
226
-    {
227
-        $page_title = $this->_admin_page_title;
228
-        $this->_admin_page_title = __('Check-In Records', 'event_espresso');
229
-        $this->_per_page_screen_option();
230
-        $this->_admin_page_title = $page_title;
231
-    }
232
-
233
-
234
-
235
-    protected function _set_list_table_views_event_registrations()
236
-    {
237
-        $this->_views = array(
238
-            'all' => array(
239
-                'slug'        => 'all',
240
-                'label'       => __('All', 'event_espresso'),
241
-                'count'       => 0,
242
-                'bulk_action' => ! isset($this->_req_data['event_id'])
243
-                    ? array()
244
-                    : array(
245
-                        'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
246
-                        //'trash_registrations' => __('Trash Registrations', 'event_espresso')
247
-                    ),
248
-            ),
249
-        );
250
-    }
251
-
252
-
253
-
254
-    protected function _set_list_table_views_registration_checkins()
255
-    {
256
-        $this->_views = array(
257
-            'all' => array(
258
-                'slug'        => 'all',
259
-                'label'       => __('All', 'event_espresso'),
260
-                'count'       => 0,
261
-                'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')),
262
-            ),
263
-        );
264
-    }
265
-
266
-
267
-
268
-    /**
269
-     * callback for ajax action.
270
-     *
271
-     * @since 4.3.0
272
-     * @return void (JSON)
273
-     * @throws \EE_Error
274
-     */
275
-    public function get_newsletter_form_content()
276
-    {
277
-        //do a nonce check cause we're not coming in from an normal route here.
278
-        $nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
279
-            $this->_req_data['get_newsletter_form_content_nonce']
280
-        ) : '';
281
-        $nonce_ref = 'get_newsletter_form_content_nonce';
282
-        $this->_verify_nonce($nonce, $nonce_ref);
283
-        //let's get the mtp for the incoming MTP_ ID
284
-        if ( ! isset($this->_req_data['GRP_ID'])) {
285
-            EE_Error::add_error(
286
-                __(
287
-                    'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
288
-                    'event_espresso'
289
-                ),
290
-                __FILE__,
291
-                __FUNCTION__,
292
-                __LINE__
293
-            );
294
-            $this->_template_args['success'] = false;
295
-            $this->_template_args['error'] = true;
296
-            $this->_return_json();
297
-        }
298
-        $MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
299
-        if ( ! $MTPG instanceof EE_Message_Template_Group) {
300
-            EE_Error::add_error(
301
-                sprintf(
302
-                    __(
303
-                        'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
304
-                        'event_espresso'
305
-                    ),
306
-                    $this->_req_data['GRP_ID']
307
-                ),
308
-                __FILE__,
309
-                __FUNCTION__,
310
-                __LINE__
311
-            );
312
-            $this->_template_args['success'] = false;
313
-            $this->_template_args['error'] = true;
314
-            $this->_return_json();
315
-        }
316
-        $MTPs = $MTPG->context_templates();
317
-        $MTPs = $MTPs['attendee'];
318
-        $template_fields = array();
319
-        /** @var EE_Message_Template $MTP */
320
-        foreach ($MTPs as $MTP) {
321
-            $field = $MTP->get('MTP_template_field');
322
-            if ($field === 'content') {
323
-                $content = $MTP->get('MTP_content');
324
-                if ( ! empty($content['newsletter_content'])) {
325
-                    $template_fields['newsletter_content'] = $content['newsletter_content'];
326
-                }
327
-                continue;
328
-            }
329
-            $template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content');
330
-        }
331
-        $this->_template_args['success'] = true;
332
-        $this->_template_args['error'] = false;
333
-        $this->_template_args['data'] = array(
334
-            'batch_message_from'    => isset($template_fields['from'])
335
-                ? $template_fields['from']
336
-                : '',
337
-            'batch_message_subject' => isset($template_fields['subject'])
338
-                ? $template_fields['subject']
339
-                : '',
340
-            'batch_message_content' => isset($template_fields['newsletter_content'])
341
-                ? $template_fields['newsletter_content']
342
-                : '',
343
-        );
344
-        $this->_return_json();
345
-    }
346
-
347
-
348
-
349
-    /**
350
-     * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
351
-     *
352
-     * @since 4.3.0
353
-     * @param EE_Admin_List_Table $list_table
354
-     * @return void
355
-     */
356
-    public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
357
-    {
358
-        if ( ! EE_Registry::instance()->CAP->current_user_can(
359
-            'ee_send_message',
360
-            'espresso_registrations_newsletter_selected_send'
361
-        )
362
-        ) {
363
-            return;
364
-        }
365
-        $routes_to_add_to = array(
366
-            'contact_list',
367
-            'event_registrations',
368
-            'default',
369
-        );
370
-        if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
371
-            if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
372
-                || (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
373
-            ) {
374
-                echo '';
375
-            } else {
376
-                $button_text = sprintf(
377
-                    __('Send Batch Message (%s selected)', 'event_espresso'),
378
-                    '<span class="send-selected-newsletter-count">0</span>'
379
-                );
380
-                echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'
381
-                     . $button_text
382
-                     . '</button>';
383
-                add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
384
-            }
385
-        }
386
-    }
387
-
388
-
389
-
390
-    public function newsletter_send_form_skeleton()
391
-    {
392
-        $list_table = $this->_list_table_object;
393
-        $codes = array();
394
-        //need to templates for the newsletter message type for the template selector.
395
-        $values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
396
-        $mtps = EEM_Message_Template_Group::instance()->get_all(
397
-            array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
398
-        );
399
-        foreach ($mtps as $mtp) {
400
-            $name = $mtp->name();
401
-            $values[] = array(
402
-                'text' => empty($name) ? __('Global', 'event_espresso') : $name,
403
-                'id'   => $mtp->ID(),
404
-            );
405
-        }
406
-        //need to get a list of shortcodes that are available for the newsletter message type.
407
-        $shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', false);
408
-        foreach ($shortcodes as $field => $shortcode_array) {
409
-            $codes[$field] = implode(', ', array_keys($shortcode_array));
410
-        }
411
-        $shortcodes = $codes;
412
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
413
-        $form_template_args = array(
414
-            'form_action'       => admin_url('admin.php?page=espresso_registrations'),
415
-            'form_route'        => 'newsletter_selected_send',
416
-            'form_nonce_name'   => 'newsletter_selected_send_nonce',
417
-            'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
418
-            'redirect_back_to'  => $this->_req_action,
419
-            'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
420
-            'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
421
-            'shortcodes'        => $shortcodes,
422
-            'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
423
-        );
424
-        EEH_Template::display_template($form_template, $form_template_args);
425
-    }
426
-
427
-
428
-
429
-    /**
430
-     * Handles sending selected registrations/contacts a newsletter.
431
-     *
432
-     * @since  4.3.0
433
-     * @return void
434
-     * @throws \EE_Error
435
-     */
436
-    protected function _newsletter_selected_send()
437
-    {
438
-        $success = true;
439
-        //first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
440
-        if (empty($this->_req_data['newsletter_mtp_selected'])) {
441
-            EE_Error::add_error(
442
-                __(
443
-                    'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
444
-                    'event_espresso'
445
-                ),
446
-                __FILE__,
447
-                __FUNCTION__,
448
-                __LINE__
449
-            );
450
-            $success = false;
451
-        }
452
-        if ($success) {
453
-            //update Message template in case there are any changes
454
-            $Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
455
-                $this->_req_data['newsletter_mtp_selected']
456
-            );
457
-            $Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
458
-                ? $Message_Template_Group->context_templates()
459
-                : array();
460
-            if (empty($Message_Templates)) {
461
-                EE_Error::add_error(
462
-                    __(
463
-                        'Unable to retrieve message template fields from the db. Messages not sent.',
464
-                        'event_espresso'
465
-                    ),
466
-                    __FILE__,
467
-                    __FUNCTION__,
468
-                    __LINE__
469
-                );
470
-            }
471
-            //let's just update the specific fields
472
-            foreach ($Message_Templates['attendee'] as $Message_Template) {
473
-                if ($Message_Template instanceof EE_Message_Template) {
474
-                    $field = $Message_Template->get('MTP_template_field');
475
-                    $content = $Message_Template->get('MTP_content');
476
-                    $new_content = $content;
477
-                    switch ($field) {
478
-                        case 'from' :
479
-                            $new_content = ! empty($this->_req_data['batch_message']['from'])
480
-                                ? $this->_req_data['batch_message']['from']
481
-                                : $content;
482
-                            break;
483
-                        case 'subject' :
484
-                            $new_content = ! empty($this->_req_data['batch_message']['subject'])
485
-                                ? $this->_req_data['batch_message']['subject']
486
-                                : $content;
487
-                            break;
488
-                        case 'content' :
489
-                            $new_content = $content;
490
-                            $new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
491
-                                ? $this->_req_data['batch_message']['content']
492
-                                : $content['newsletter_content'];
493
-                            break;
494
-                        default :
495
-                            //continue the foreach loop, we don't want to set $new_content nor save.
496
-                            continue 2;
497
-                    }
498
-                    $Message_Template->set('MTP_content', $new_content);
499
-                    $Message_Template->save();
500
-                }
501
-            }
502
-            //great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
503
-            $id_type = ! empty($this->_req_data['batch_message']['id_type'])
504
-                ? $this->_req_data['batch_message']['id_type']
505
-                : 'registration';
506
-            //id_type will affect how we assemble the ids.
507
-            $ids = ! empty($this->_req_data['batch_message']['ids'])
508
-                ? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
509
-                : array();
510
-            $registrations_used_for_contact_data = array();
511
-            //using switch because eventually we'll have other contexts that will be used for generating messages.
512
-            switch ($id_type) {
513
-                case 'registration' :
514
-                    $registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
515
-                        array(
516
-                            array(
517
-                                'REG_ID' => array('IN', $ids),
518
-                            ),
519
-                        )
520
-                    );
521
-                    break;
522
-                case 'contact' :
523
-                    $registrations_used_for_contact_data = EEM_Registration::instance()
524
-                                                                           ->get_latest_registration_for_each_of_given_contacts($ids);
525
-                    break;
526
-            }
527
-            do_action(
528
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
529
-                $registrations_used_for_contact_data,
530
-                $Message_Template_Group->ID()
531
-            );
532
-            //kept for backward compat, internally we no longer use this action.
533
-            //@deprecated 4.8.36.rc.002
534
-            $contacts = $id_type === 'registration'
535
-                ? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
536
-                : EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
537
-            do_action(
538
-                'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
539
-                $contacts,
540
-                $Message_Template_Group->ID()
541
-            );
542
-        }
543
-        $query_args = array(
544
-            'action' => ! empty($this->_req_data['redirect_back_to'])
545
-                ? $this->_req_data['redirect_back_to']
546
-                : 'default',
547
-        );
548
-        $this->_redirect_after_action(false, '', '', $query_args, true);
549
-    }
550
-
551
-
552
-
553
-    /**
554
-     * This is called when javascript is being enqueued to setup the various data needed for the reports js.
555
-     * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
556
-     */
557
-    protected function _registration_reports_js_setup()
558
-    {
559
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
560
-        $this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
561
-    }
562
-
563
-
564
-
565
-    /**
566
-     *        generates Business Reports regarding Registrations
567
-     *
568
-     * @access protected
569
-     * @return void
570
-     */
571
-    protected function _registration_reports()
572
-    {
573
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
574
-        $this->_template_args['admin_page_content'] = EEH_Template::display_template(
575
-            $template_path,
576
-            $this->_reports_template_data,
577
-            true
578
-        );
579
-        // the final template wrapper
580
-        $this->display_admin_page_with_no_sidebar();
581
-    }
582
-
583
-
584
-
585
-    /**
586
-     * Generates Business Report showing total registrations per day.
587
-     *
588
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
589
-     * @return string
590
-     */
591
-    private function _registrations_per_day_report($period = '-1 month')
592
-    {
593
-        $report_ID = 'reg-admin-registrations-per-day-report-dv';
594
-        $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
595
-        $results = (array)$results;
596
-        $regs = array();
597
-        $subtitle = '';
598
-        if ($results) {
599
-            $column_titles = array();
600
-            $tracker = 0;
601
-            foreach ($results as $result) {
602
-                $report_column_values = array();
603
-                foreach ($result as $property_name => $property_value) {
604
-                    $property_value = $property_name === 'Registration_REG_date' ? $property_value
605
-                        : (int)$property_value;
606
-                    $report_column_values[] = $property_value;
607
-                    if ($tracker === 0) {
608
-                        if ($property_name === 'Registration_REG_date') {
609
-                            $column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso');
610
-                        } else {
611
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
612
-                        }
613
-                    }
614
-                }
615
-                $tracker++;
616
-                $regs[] = $report_column_values;
617
-            }
618
-            //make sure the column_titles is pushed to the beginning of the array
619
-            array_unshift($regs, $column_titles);
620
-            //setup the date range.
621
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
622
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
623
-            $ending_date = new DateTime("now", $DateTimeZone);
624
-            $subtitle = sprintf(
625
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
626
-                $beginning_date->format('Y-m-d'),
627
-                $ending_date->format('Y-m-d')
628
-            );
629
-        }
630
-        $report_title = __('Total Registrations per Day', 'event_espresso');
631
-        $report_params = array(
632
-            'title'     => $report_title,
633
-            'subtitle'  => $subtitle,
634
-            'id'        => $report_ID,
635
-            'regs'      => $regs,
636
-            'noResults' => empty($regs),
637
-            'noRegsMsg' => sprintf(
638
-                __(
639
-                    '%sThere are currently no registration records in the last month for this report.%s',
640
-                    'event_espresso'
641
-                ),
642
-                '<h2>' . $report_title . '</h2><p>',
643
-                '</p>'
644
-            ),
645
-        );
646
-        wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
647
-        return $report_ID;
648
-    }
649
-
650
-
651
-
652
-    /**
653
-     * Generates Business Report showing total registrations per event.
654
-     *
655
-     * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
656
-     * @return string
657
-     */
658
-    private function _registrations_per_event_report($period = '-1 month')
659
-    {
660
-        $report_ID = 'reg-admin-registrations-per-event-report-dv';
661
-        $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
662
-        $results = (array)$results;
663
-        $regs = array();
664
-        $subtitle = '';
665
-        if ($results) {
666
-            $column_titles = array();
667
-            $tracker = 0;
668
-            foreach ($results as $result) {
669
-                $report_column_values = array();
670
-                foreach ($result as $property_name => $property_value) {
671
-                    $property_value = $property_name === 'Registration_Event' ? wp_trim_words(
672
-                        $property_value,
673
-                        4,
674
-                        '...'
675
-                    ) : (int)$property_value;
676
-                    $report_column_values[] = $property_value;
677
-                    if ($tracker === 0) {
678
-                        if ($property_name === 'Registration_Event') {
679
-                            $column_titles[] = __('Event', 'event_espresso');
680
-                        } else {
681
-                            $column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
682
-                        }
683
-                    }
684
-                }
685
-                $tracker++;
686
-                $regs[] = $report_column_values;
687
-            }
688
-            //make sure the column_titles is pushed to the beginning of the array
689
-            array_unshift($regs, $column_titles);
690
-            //setup the date range.
691
-            $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
692
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
693
-            $ending_date = new DateTime("now", $DateTimeZone);
694
-            $subtitle = sprintf(
695
-                _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
696
-                $beginning_date->format('Y-m-d'),
697
-                $ending_date->format('Y-m-d')
698
-            );
699
-        }
700
-        $report_title = __('Total Registrations per Event', 'event_espresso');
701
-        $report_params = array(
702
-            'title'     => $report_title,
703
-            'subtitle'  => $subtitle,
704
-            'id'        => $report_ID,
705
-            'regs'      => $regs,
706
-            'noResults' => empty($regs),
707
-            'noRegsMsg' => sprintf(
708
-                __(
709
-                    '%sThere are currently no registration records in the last month for this report.%s',
710
-                    'event_espresso'
711
-                ),
712
-                '<h2>' . $report_title . '</h2><p>',
713
-                '</p>'
714
-            ),
715
-        );
716
-        wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
717
-        return $report_ID;
718
-    }
719
-
720
-
721
-
722
-    /**
723
-     * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
724
-     *
725
-     * @access protected
726
-     * @return void
727
-     * @throws \EE_Error
728
-     */
729
-    protected function _registration_checkin_list_table()
730
-    {
731
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
732
-        $reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
733
-        /** @var EE_Registration $reg */
734
-        $reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
735
-        $this->_admin_page_title .= $this->get_action_link_or_button(
736
-            'new_registration',
737
-            'add-registrant',
738
-            array('event_id' => $reg->event_ID()),
739
-            'add-new-h2'
740
-        );
741
-        $legend_items = array(
742
-            'checkin'  => array(
743
-                'class' => 'ee-icon ee-icon-check-in',
744
-                'desc'  => __('This indicates the attendee has been checked in', 'event_espresso'),
745
-            ),
746
-            'checkout' => array(
747
-                'class' => 'ee-icon ee-icon-check-out',
748
-                'desc'  => __('This indicates the attendee has been checked out', 'event_espresso'),
749
-            ),
750
-        );
751
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
752
-        $dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
753
-        $go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(
754
-            array(
755
-                'action'   => 'event_registrations',
756
-                'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(),
757
-                'DTT_ID'   => $dtt_id,
758
-            ),
759
-            $this->_admin_base_url
760
-        ) : '';
761
-        $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
762
-            ? '<h2>' . sprintf(
763
-                __("%s's check in records for %s at the event, %s", 'event_espresso'),
764
-                '<span id="checkin-attendee-name">'
765
-                . EEM_Registration::instance()
766
-                                  ->get_one_by_ID($reg_id)
767
-                                  ->get_first_related('Attendee')
768
-                                  ->full_name() . '</span>',
769
-                '<span id="checkin-dtt"><a href="' . $go_back_url . '">'
770
-                . EEM_Datetime::instance()
771
-                              ->get_one_by_ID($dtt_id)
772
-                              ->start_date_and_time() . ' - '
773
-                . EEM_Datetime::instance()
774
-                              ->get_one_by_ID($dtt_id)
775
-                              ->end_date_and_time() . '</a></span>',
776
-                '<span id="checkin-event-name">'
777
-                . EEM_Datetime::instance()
778
-                              ->get_one_by_ID($dtt_id)
779
-                              ->get_first_related('Event')
780
-                              ->get('EVT_name') . '</span>'
781
-            ) . '</h2>'
782
-            : '';
783
-        $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
784
-            ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
785
-        $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
786
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
787
-        $this->display_admin_list_table_page_with_no_sidebar();
788
-    }
789
-
790
-
791
-
792
-    /**
793
-     * toggle the Check-in status for the given registration (coming from ajax)
794
-     *
795
-     * @return void (JSON)
796
-     */
797
-    public function toggle_checkin_status()
798
-    {
799
-        //first make sure we have the necessary data
800
-        if ( ! isset($this->_req_data['_regid'])) {
801
-            EE_Error::add_error(
802
-                __(
803
-                    'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
804
-                    'event_espresso'
805
-                ),
806
-                __FILE__,
807
-                __FUNCTION__,
808
-                __LINE__
809
-            );
810
-            $this->_template_args['success'] = false;
811
-            $this->_template_args['error'] = true;
812
-            $this->_return_json();
813
-        };
814
-        //do a nonce check cause we're not coming in from an normal route here.
815
-        $nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
816
-            : '';
817
-        $nonce_ref = 'checkin_nonce';
818
-        $this->_verify_nonce($nonce, $nonce_ref);
819
-        //beautiful! Made it this far so let's get the status.
820
-        $new_status = $this->_toggle_checkin_status();
821
-        //setup new class to return via ajax
822
-        $this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'
823
-                                                      . $new_status;
824
-        $this->_template_args['success'] = true;
825
-        $this->_return_json();
826
-    }
827
-
828
-
829
-
830
-    /**
831
-     * handles toggling the checkin status for the registration,
832
-     *
833
-     * @access protected
834
-     * @return int|void
835
-     */
836
-    protected function _toggle_checkin_status()
837
-    {
838
-        //first let's get the query args out of the way for the redirect
839
-        $query_args = array(
840
-            'action'   => 'event_registrations',
841
-            'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
842
-            'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
843
-        );
844
-        $new_status = false;
845
-        // bulk action check in toggle
846
-        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
847
-            // cycle thru checkboxes
848
-            while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
849
-                $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
850
-                $new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
851
-            }
852
-        } elseif (isset($this->_req_data['_regid'])) {
853
-            //coming from ajax request
854
-            $DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
855
-            $query_args['DTT_ID'] = $DTT_ID;
856
-            $new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
857
-        } else {
858
-            EE_Error::add_error(
859
-                __('Missing some required data to toggle the Check-in', 'event_espresso'),
860
-                __FILE__,
861
-                __FUNCTION__,
862
-                __LINE__
863
-            );
864
-        }
865
-        if (defined('DOING_AJAX')) {
866
-            return $new_status;
867
-        }
868
-        $this->_redirect_after_action(false, '', '', $query_args, true);
869
-    }
870
-
871
-
872
-
873
-    /**
874
-     * This is toggles a single Check-in for the given registration and datetime.
875
-     *
876
-     * @param  int $REG_ID The registration we're toggling
877
-     * @param  int $DTT_ID The datetime we're toggling
878
-     * @return int            The new status toggled to.
879
-     * @throws \EE_Error
880
-     */
881
-    private function _toggle_checkin($REG_ID, $DTT_ID)
882
-    {
883
-        /** @var EE_Registration $REG */
884
-        $REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
885
-        $new_status = $REG->toggle_checkin_status($DTT_ID);
886
-        if ($new_status !== false) {
887
-            EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
888
-        } else {
889
-            EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
890
-            $new_status = false;
891
-        }
892
-        return $new_status;
893
-    }
894
-
895
-
896
-
897
-    /**
898
-     * Takes care of deleting multiple EE_Checkin table rows
899
-     *
900
-     * @access protected
901
-     * @return void
902
-     * @throws \EE_Error
903
-     */
904
-    protected function _delete_checkin_rows()
905
-    {
906
-        $query_args = array(
907
-            'action' => 'registration_checkins',
908
-            'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
909
-            '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0,
910
-        );
911
-        $errors = 0;
912
-        if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
913
-            while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
914
-                if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
915
-                    $errors++;
916
-                }
917
-            }
918
-        } else {
919
-            EE_Error::add_error(
920
-                __(
921
-                    'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
922
-                    'event_espresso'
923
-                ),
924
-                __FILE__,
925
-                __FUNCTION__,
926
-                __LINE__
927
-            );
928
-            $this->_redirect_after_action(false, '', '', $query_args, true);
929
-        }
930
-        if ($errors > 0) {
931
-            EE_Error::add_error(
932
-                sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
933
-                __FILE__,
934
-                __FUNCTION__,
935
-                __LINE__
936
-            );
937
-        } else {
938
-            EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
939
-        }
940
-        $this->_redirect_after_action(false, '', '', $query_args, true);
941
-    }
942
-
943
-
944
-
945
-    /**
946
-     * Deletes a single EE_Checkin row
947
-     *
948
-     * @return void
949
-     * @throws \EE_Error
950
-     */
951
-    protected function _delete_checkin_row()
952
-    {
953
-        $query_args = array(
954
-            'action' => 'registration_checkins',
955
-            'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
956
-            '_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0,
957
-        );
958
-        if ( ! empty($this->_req_data['CHK_ID'])) {
959
-            if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
960
-                EE_Error::add_error(
961
-                    __('Something went wrong and this check-in record was not deleted', 'event_espresso'),
962
-                    __FILE__,
963
-                    __FUNCTION__,
964
-                    __LINE__
965
-                );
966
-            } else {
967
-                EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
968
-            }
969
-        } else {
970
-            EE_Error::add_error(
971
-                __(
972
-                    'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
973
-                    'event_espresso'
974
-                ),
975
-                __FILE__,
976
-                __FUNCTION__,
977
-                __LINE__
978
-            );
979
-        }
980
-        $this->_redirect_after_action(false, '', '', $query_args, true);
981
-    }
982
-
983
-
984
-
985
-    /**
986
-     *        generates HTML for the Event Registrations List Table
987
-     *
988
-     * @access protected
989
-     * @return void
990
-     * @throws \EE_Error
991
-     */
992
-    protected function _event_registrations_list_table()
993
-    {
994
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
995
-        $this->_admin_page_title .= isset($this->_req_data['event_id'])
996
-            ? $this->get_action_link_or_button(
997
-                'new_registration',
998
-                'add-registrant',
999
-                array('event_id' => $this->_req_data['event_id']),
1000
-                'add-new-h2',
1001
-                '',
1002
-                false
1003
-            )
1004
-            : '';
1005
-        $legend_items = array(
1006
-            'star-icon'        => array(
1007
-                'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1008
-                'desc'  => __('This Registrant is the Primary Registrant', 'event_espresso'),
1009
-            ),
1010
-            'checkin'          => array(
1011
-                'class' => 'ee-icon ee-icon-check-in',
1012
-                'desc'  => __('This Registrant has been Checked In', 'event_espresso'),
1013
-            ),
1014
-            'checkout'         => array(
1015
-                'class' => 'ee-icon ee-icon-check-out',
1016
-                'desc'  => __('This Registrant has been Checked Out', 'event_espresso'),
1017
-            ),
1018
-            'nocheckinrecord'  => array(
1019
-                'class' => 'dashicons dashicons-no',
1020
-                'desc'  => __('No Check-in Record has been Created for this Registrant', 'event_espresso'),
1021
-            ),
1022
-            'view_details'     => array(
1023
-                'class' => 'dashicons dashicons-search',
1024
-                'desc'  => __('View All Check-in Records for this Registrant', 'event_espresso'),
1025
-            ),
1026
-            'approved_status'  => array(
1027
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1028
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1029
-            ),
1030
-            'cancelled_status' => array(
1031
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1032
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1033
-            ),
1034
-            'declined_status'  => array(
1035
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1036
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1037
-            ),
1038
-            'not_approved'     => array(
1039
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1040
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1041
-            ),
1042
-            'pending_status'   => array(
1043
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1044
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1045
-            ),
1046
-            'wait_list'        => array(
1047
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1048
-                'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1049
-            ),
1050
-        );
1051
-        $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1052
-        $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1053
-        $this->_template_args['before_list_table'] = ! empty($event_id)
1054
-            ? '<h2>' . sprintf(
1055
-                __('Viewing Registrations for Event: %s', 'event_espresso'),
1056
-                EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1057
-            ) . '</h2>'
1058
-            : '';
1059
-        //need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on the event.
1060
-        /** @var EE_Event $event */
1061
-        $event = EEM_Event::instance()->get_one_by_ID($event_id);
1062
-        $DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1063
-        $datetime = null;
1064
-        if ($event instanceof EE_Event) {
1065
-            $datetimes_on_event = $event->datetimes();
1066
-            if (count($datetimes_on_event) === 1) {
1067
-                $datetime = reset($datetimes_on_event);
1068
-            }
1069
-        }
1070
-        $datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1071
-        if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1072
-            $this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1073
-            $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1074
-            $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1075
-            $this->_template_args['before_list_table'] .= $datetime->name();
1076
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1077
-            $this->_template_args['before_list_table'] .= '</span></h2>';
1078
-        }
1079
-        //if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status column
1080
-        //represents
1081
-        if ( ! $datetime instanceof EE_Datetime) {
1082
-            $this->_template_args['before_list_table'] .= '<br><p class="description">'
1083
-                                                          . __('In this view, the check-in status represents the latest check-in record for the registration in that row.',
1084
-                    'event_espresso')
1085
-                                                          . '</p>';
1086
-        }
1087
-        $this->display_admin_list_table_page_with_no_sidebar();
1088
-    }
1089
-
1090
-    /**
1091
-     * Download the registrations check-in report (same as the normal registration report, but with different where
1092
-     * conditions)
1093
-     *
1094
-     * @return void ends the request by a redirect or download
1095
-     */
1096
-    public function _registrations_checkin_report()
1097
-    {
1098
-        $this->_registrations_report_base('_get_checkin_query_params_from_request');
1099
-    }
1100
-
1101
-    /**
1102
-     * Gets the query params from the request, plus adds a where condition for the registration status,
1103
-     * because on the checkin page we only ever want to see approved and pending-approval registrations
1104
-     *
1105
-     * @param array     $request
1106
-     * @param int  $per_page
1107
-     * @param bool $count
1108
-     * @return array
1109
-     */
1110
-    protected function _get_checkin_query_params_from_request(
1111
-        $request,
1112
-        $per_page = 10,
1113
-        $count = false
1114
-    ) {
1115
-        $query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1116
-        //unlike the regular registrations list table,
1117
-        $status_ids_array = apply_filters(
1118
-            'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1119
-            array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1120
-        );
1121
-        $query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1122
-        return $query_params;
1123
-    }
1124
-
1125
-
1126
-
1127
-
1128
-    /**
1129
-     * Gets registrations for an event
1130
-     *
1131
-     * @param int    $per_page
1132
-     * @param bool   $count whether to return count or data.
1133
-     * @param bool   $trash
1134
-     * @param string $orderby
1135
-     * @return EE_Registration[]|int
1136
-     * @throws \EE_Error
1137
-     */
1138
-    public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1139
-    {
1140
-        //normalize some request params that get setup by the parent `get_registrations` method.
1141
-        $request = $this->_req_data;
1142
-        $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1143
-        $request['order'] =  ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1144
-        if($trash){
1145
-            $request['status'] = 'trash';
1146
-        }
1147
-        $query_params = $this->_get_checkin_query_params_from_request( $request, $per_page, $count );
1148
-        /**
1149
-         * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1150
-         * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1151
-         * @see EEM_Base::get_all()
1152
-         */
1153
-        $query_params['group_by'] = '';
1154
-
1155
-        return $count
1156
-            ? EEM_Registration::instance()->count($query_params)
1157
-            /** @type EE_Registration[] */
1158
-            : EEM_Registration::instance()->get_all($query_params);
1159
-    }
20
+	/**
21
+	 * This is used to hold the reports template data which is setup early in the request.
22
+	 *
23
+	 * @type array
24
+	 */
25
+	protected $_reports_template_data = array();
26
+
27
+
28
+
29
+	/**
30
+	 * Extend_Registrations_Admin_Page constructor.
31
+	 *
32
+	 * @param bool $routing
33
+	 */
34
+	public function __construct($routing = true)
35
+	{
36
+		parent::__construct($routing);
37
+		if ( ! defined('REG_CAF_TEMPLATE_PATH')) {
38
+			define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
39
+			define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
40
+			define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
41
+		}
42
+	}
43
+
44
+
45
+
46
+	protected function _extend_page_config()
47
+	{
48
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
49
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50
+			? $this->_req_data['_REG_ID']
51
+			: 0;
52
+		// $att_id = ! empty( $this->_req_data['ATT_ID'] ) ? ! is_array( $this->_req_data['ATT_ID'] ) : 0;
53
+		// $att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] )
54
+		// 	? $this->_req_data['post'] : $att_id;
55
+		$new_page_routes = array(
56
+			'reports'                  => array(
57
+				'func'       => '_registration_reports',
58
+				'capability' => 'ee_read_registrations',
59
+			),
60
+			'registration_checkins'    => array(
61
+				'func'       => '_registration_checkin_list_table',
62
+				'capability' => 'ee_read_checkins',
63
+			),
64
+			'newsletter_selected_send' => array(
65
+				'func'       => '_newsletter_selected_send',
66
+				'noheader'   => true,
67
+				'capability' => 'ee_send_message',
68
+			),
69
+			'delete_checkin_rows'      => array(
70
+				'func'       => '_delete_checkin_rows',
71
+				'noheader'   => true,
72
+				'capability' => 'ee_delete_checkins',
73
+			),
74
+			'delete_checkin_row'       => array(
75
+				'func'       => '_delete_checkin_row',
76
+				'noheader'   => true,
77
+				'capability' => 'ee_delete_checkin',
78
+				'obj_id'     => $reg_id,
79
+			),
80
+			'toggle_checkin_status'    => array(
81
+				'func'       => '_toggle_checkin_status',
82
+				'noheader'   => true,
83
+				'capability' => 'ee_edit_checkin',
84
+				'obj_id'     => $reg_id,
85
+			),
86
+			'event_registrations'      => array(
87
+				'func'       => '_event_registrations_list_table',
88
+				'capability' => 'ee_read_checkins',
89
+			),
90
+			'registrations_checkin_report' => array(
91
+				'func'       => '_registrations_checkin_report',
92
+				'noheader'   => true,
93
+				'capability' => 'ee_read_registrations',
94
+			),
95
+		);
96
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
97
+		$new_page_config = array(
98
+			'reports'               => array(
99
+				'nav'           => array(
100
+					'label' => __('Reports', 'event_espresso'),
101
+					'order' => 30,
102
+				),
103
+				'help_tabs'     => array(
104
+					'registrations_reports_help_tab' => array(
105
+						'title'    => __('Registration Reports', 'event_espresso'),
106
+						'filename' => 'registrations_reports',
107
+					),
108
+				),
109
+				/*'help_tour' => array( 'Registration_Reports_Help_Tour' ),*/
110
+				'require_nonce' => false,
111
+			),
112
+			'event_registrations'   => array(
113
+				'nav'           => array(
114
+					'label'      => __('Event Check-In', 'event_espresso'),
115
+					'order'      => 10,
116
+					'persistent' => true,
117
+				),
118
+				'help_tabs'     => array(
119
+					'registrations_event_checkin_help_tab'                       => array(
120
+						'title'    => __('Registrations Event Check-In', 'event_espresso'),
121
+						'filename' => 'registrations_event_checkin',
122
+					),
123
+					'registrations_event_checkin_table_column_headings_help_tab' => array(
124
+						'title'    => __('Event Check-In Table Column Headings', 'event_espresso'),
125
+						'filename' => 'registrations_event_checkin_table_column_headings',
126
+					),
127
+					'registrations_event_checkin_filters_help_tab'               => array(
128
+						'title'    => __('Event Check-In Filters', 'event_espresso'),
129
+						'filename' => 'registrations_event_checkin_filters',
130
+					),
131
+					'registrations_event_checkin_views_help_tab'                 => array(
132
+						'title'    => __('Event Check-In Views', 'event_espresso'),
133
+						'filename' => 'registrations_event_checkin_views',
134
+					),
135
+					'registrations_event_checkin_other_help_tab'                 => array(
136
+						'title'    => __('Event Check-In Other', 'event_espresso'),
137
+						'filename' => 'registrations_event_checkin_other',
138
+					),
139
+				),
140
+				'help_tour'     => array('Event_Checkin_Help_Tour'),
141
+				'qtips'         => array('Registration_List_Table_Tips'),
142
+				'list_table'    => 'EE_Event_Registrations_List_Table',
143
+				'metaboxes'     => array(),
144
+				'require_nonce' => false,
145
+			),
146
+			'registration_checkins' => array(
147
+				'nav'           => array(
148
+					'label'      => __('Check-In Records', 'event_espresso'),
149
+					'order'      => 15,
150
+					'persistent' => false,
151
+				),
152
+				'list_table'    => 'EE_Registration_CheckIn_List_Table',
153
+				//'help_tour' => array( 'Checkin_Toggle_View_Help_Tour' ),
154
+				'metaboxes'     => array(),
155
+				'require_nonce' => false,
156
+			),
157
+		);
158
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
159
+		$this->_page_config['contact_list']['list_table'] = 'Extend_EE_Attendee_Contact_List_Table';
160
+		$this->_page_config['default']['list_table'] = 'Extend_EE_Registrations_List_Table';
161
+	}
162
+
163
+
164
+
165
+	protected function _ajax_hooks()
166
+	{
167
+		parent::_ajax_hooks();
168
+		add_action('wp_ajax_get_newsletter_form_content', array($this, 'get_newsletter_form_content'));
169
+	}
170
+
171
+
172
+
173
+	public function load_scripts_styles()
174
+	{
175
+		parent::load_scripts_styles();
176
+		//if newsletter message type is active then let's add filter and load js for it.
177
+		if (EEH_MSG_Template::is_mt_active('newsletter')) {
178
+			//enqueue newsletter js
179
+			wp_enqueue_script(
180
+				'ee-newsletter-trigger',
181
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
182
+				array('ee-dialog'),
183
+				EVENT_ESPRESSO_VERSION,
184
+				true
185
+			);
186
+			wp_enqueue_style(
187
+				'ee-newsletter-trigger-css',
188
+				REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
189
+				array(),
190
+				EVENT_ESPRESSO_VERSION
191
+			);
192
+			//hook in buttons for newsletter message type trigger.
193
+			add_action(
194
+				'AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',
195
+				array($this, 'add_newsletter_action_buttons'),
196
+				10
197
+			);
198
+		}
199
+	}
200
+
201
+
202
+
203
+	public function load_scripts_styles_reports()
204
+	{
205
+		wp_register_script(
206
+			'ee-reg-reports-js',
207
+			REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
208
+			array('google-charts'),
209
+			EVENT_ESPRESSO_VERSION,
210
+			true
211
+		);
212
+		wp_enqueue_script('ee-reg-reports-js');
213
+		$this->_registration_reports_js_setup();
214
+	}
215
+
216
+
217
+
218
+	protected function _add_screen_options_event_registrations()
219
+	{
220
+		$this->_per_page_screen_option();
221
+	}
222
+
223
+
224
+
225
+	protected function _add_screen_options_registration_checkins()
226
+	{
227
+		$page_title = $this->_admin_page_title;
228
+		$this->_admin_page_title = __('Check-In Records', 'event_espresso');
229
+		$this->_per_page_screen_option();
230
+		$this->_admin_page_title = $page_title;
231
+	}
232
+
233
+
234
+
235
+	protected function _set_list_table_views_event_registrations()
236
+	{
237
+		$this->_views = array(
238
+			'all' => array(
239
+				'slug'        => 'all',
240
+				'label'       => __('All', 'event_espresso'),
241
+				'count'       => 0,
242
+				'bulk_action' => ! isset($this->_req_data['event_id'])
243
+					? array()
244
+					: array(
245
+						'toggle_checkin_status' => __('Toggle Check-In', 'event_espresso'),
246
+						//'trash_registrations' => __('Trash Registrations', 'event_espresso')
247
+					),
248
+			),
249
+		);
250
+	}
251
+
252
+
253
+
254
+	protected function _set_list_table_views_registration_checkins()
255
+	{
256
+		$this->_views = array(
257
+			'all' => array(
258
+				'slug'        => 'all',
259
+				'label'       => __('All', 'event_espresso'),
260
+				'count'       => 0,
261
+				'bulk_action' => array('delete_checkin_rows' => __('Delete Check-In Rows', 'event_espresso')),
262
+			),
263
+		);
264
+	}
265
+
266
+
267
+
268
+	/**
269
+	 * callback for ajax action.
270
+	 *
271
+	 * @since 4.3.0
272
+	 * @return void (JSON)
273
+	 * @throws \EE_Error
274
+	 */
275
+	public function get_newsletter_form_content()
276
+	{
277
+		//do a nonce check cause we're not coming in from an normal route here.
278
+		$nonce = isset($this->_req_data['get_newsletter_form_content_nonce']) ? sanitize_text_field(
279
+			$this->_req_data['get_newsletter_form_content_nonce']
280
+		) : '';
281
+		$nonce_ref = 'get_newsletter_form_content_nonce';
282
+		$this->_verify_nonce($nonce, $nonce_ref);
283
+		//let's get the mtp for the incoming MTP_ ID
284
+		if ( ! isset($this->_req_data['GRP_ID'])) {
285
+			EE_Error::add_error(
286
+				__(
287
+					'There must be something broken with the js or html structure because the required data for getting a message template group is not present (need an GRP_ID).',
288
+					'event_espresso'
289
+				),
290
+				__FILE__,
291
+				__FUNCTION__,
292
+				__LINE__
293
+			);
294
+			$this->_template_args['success'] = false;
295
+			$this->_template_args['error'] = true;
296
+			$this->_return_json();
297
+		}
298
+		$MTPG = EEM_Message_Template_Group::instance()->get_one_by_ID($this->_req_data['GRP_ID']);
299
+		if ( ! $MTPG instanceof EE_Message_Template_Group) {
300
+			EE_Error::add_error(
301
+				sprintf(
302
+					__(
303
+						'The GRP_ID given (%d) does not appear to have a corresponding row in the database.',
304
+						'event_espresso'
305
+					),
306
+					$this->_req_data['GRP_ID']
307
+				),
308
+				__FILE__,
309
+				__FUNCTION__,
310
+				__LINE__
311
+			);
312
+			$this->_template_args['success'] = false;
313
+			$this->_template_args['error'] = true;
314
+			$this->_return_json();
315
+		}
316
+		$MTPs = $MTPG->context_templates();
317
+		$MTPs = $MTPs['attendee'];
318
+		$template_fields = array();
319
+		/** @var EE_Message_Template $MTP */
320
+		foreach ($MTPs as $MTP) {
321
+			$field = $MTP->get('MTP_template_field');
322
+			if ($field === 'content') {
323
+				$content = $MTP->get('MTP_content');
324
+				if ( ! empty($content['newsletter_content'])) {
325
+					$template_fields['newsletter_content'] = $content['newsletter_content'];
326
+				}
327
+				continue;
328
+			}
329
+			$template_fields[$MTP->get('MTP_template_field')] = $MTP->get('MTP_content');
330
+		}
331
+		$this->_template_args['success'] = true;
332
+		$this->_template_args['error'] = false;
333
+		$this->_template_args['data'] = array(
334
+			'batch_message_from'    => isset($template_fields['from'])
335
+				? $template_fields['from']
336
+				: '',
337
+			'batch_message_subject' => isset($template_fields['subject'])
338
+				? $template_fields['subject']
339
+				: '',
340
+			'batch_message_content' => isset($template_fields['newsletter_content'])
341
+				? $template_fields['newsletter_content']
342
+				: '',
343
+		);
344
+		$this->_return_json();
345
+	}
346
+
347
+
348
+
349
+	/**
350
+	 * callback for AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons action
351
+	 *
352
+	 * @since 4.3.0
353
+	 * @param EE_Admin_List_Table $list_table
354
+	 * @return void
355
+	 */
356
+	public function add_newsletter_action_buttons(EE_Admin_List_Table $list_table)
357
+	{
358
+		if ( ! EE_Registry::instance()->CAP->current_user_can(
359
+			'ee_send_message',
360
+			'espresso_registrations_newsletter_selected_send'
361
+		)
362
+		) {
363
+			return;
364
+		}
365
+		$routes_to_add_to = array(
366
+			'contact_list',
367
+			'event_registrations',
368
+			'default',
369
+		);
370
+		if ($this->_current_page === 'espresso_registrations' && in_array($this->_req_action, $routes_to_add_to)) {
371
+			if (($this->_req_action === 'event_registrations' && empty($this->_req_data['event_id']))
372
+				|| (isset($this->_req_data['status']) && $this->_req_data['status'] === 'trash')
373
+			) {
374
+				echo '';
375
+			} else {
376
+				$button_text = sprintf(
377
+					__('Send Batch Message (%s selected)', 'event_espresso'),
378
+					'<span class="send-selected-newsletter-count">0</span>'
379
+				);
380
+				echo '<button id="selected-batch-send-trigger" class="button secondary-button"><span class="dashicons dashicons-email "></span>'
381
+					 . $button_text
382
+					 . '</button>';
383
+				add_action('admin_footer', array($this, 'newsletter_send_form_skeleton'));
384
+			}
385
+		}
386
+	}
387
+
388
+
389
+
390
+	public function newsletter_send_form_skeleton()
391
+	{
392
+		$list_table = $this->_list_table_object;
393
+		$codes = array();
394
+		//need to templates for the newsletter message type for the template selector.
395
+		$values[] = array('text' => __('Select Template to Use', 'event_espresso'), 'id' => 0);
396
+		$mtps = EEM_Message_Template_Group::instance()->get_all(
397
+			array(array('MTP_message_type' => 'newsletter', 'MTP_messenger' => 'email'))
398
+		);
399
+		foreach ($mtps as $mtp) {
400
+			$name = $mtp->name();
401
+			$values[] = array(
402
+				'text' => empty($name) ? __('Global', 'event_espresso') : $name,
403
+				'id'   => $mtp->ID(),
404
+			);
405
+		}
406
+		//need to get a list of shortcodes that are available for the newsletter message type.
407
+		$shortcodes = EEH_MSG_Template::get_shortcodes('newsletter', 'email', array(), 'attendee', false);
408
+		foreach ($shortcodes as $field => $shortcode_array) {
409
+			$codes[$field] = implode(', ', array_keys($shortcode_array));
410
+		}
411
+		$shortcodes = $codes;
412
+		$form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
413
+		$form_template_args = array(
414
+			'form_action'       => admin_url('admin.php?page=espresso_registrations'),
415
+			'form_route'        => 'newsletter_selected_send',
416
+			'form_nonce_name'   => 'newsletter_selected_send_nonce',
417
+			'form_nonce'        => wp_create_nonce('newsletter_selected_send_nonce'),
418
+			'redirect_back_to'  => $this->_req_action,
419
+			'ajax_nonce'        => wp_create_nonce('get_newsletter_form_content_nonce'),
420
+			'template_selector' => EEH_Form_Fields::select_input('newsletter_mtp_selected', $values),
421
+			'shortcodes'        => $shortcodes,
422
+			'id_type'           => $list_table instanceof EE_Attendee_Contact_List_Table ? 'contact' : 'registration',
423
+		);
424
+		EEH_Template::display_template($form_template, $form_template_args);
425
+	}
426
+
427
+
428
+
429
+	/**
430
+	 * Handles sending selected registrations/contacts a newsletter.
431
+	 *
432
+	 * @since  4.3.0
433
+	 * @return void
434
+	 * @throws \EE_Error
435
+	 */
436
+	protected function _newsletter_selected_send()
437
+	{
438
+		$success = true;
439
+		//first we need to make sure we have a GRP_ID so we know what template we're sending and updating!
440
+		if (empty($this->_req_data['newsletter_mtp_selected'])) {
441
+			EE_Error::add_error(
442
+				__(
443
+					'In order to send a message, a Message Template GRP_ID is needed. It was not provided so messages were not sent.',
444
+					'event_espresso'
445
+				),
446
+				__FILE__,
447
+				__FUNCTION__,
448
+				__LINE__
449
+			);
450
+			$success = false;
451
+		}
452
+		if ($success) {
453
+			//update Message template in case there are any changes
454
+			$Message_Template_Group = EEM_Message_Template_Group::instance()->get_one_by_ID(
455
+				$this->_req_data['newsletter_mtp_selected']
456
+			);
457
+			$Message_Templates = $Message_Template_Group instanceof EE_Message_Template_Group
458
+				? $Message_Template_Group->context_templates()
459
+				: array();
460
+			if (empty($Message_Templates)) {
461
+				EE_Error::add_error(
462
+					__(
463
+						'Unable to retrieve message template fields from the db. Messages not sent.',
464
+						'event_espresso'
465
+					),
466
+					__FILE__,
467
+					__FUNCTION__,
468
+					__LINE__
469
+				);
470
+			}
471
+			//let's just update the specific fields
472
+			foreach ($Message_Templates['attendee'] as $Message_Template) {
473
+				if ($Message_Template instanceof EE_Message_Template) {
474
+					$field = $Message_Template->get('MTP_template_field');
475
+					$content = $Message_Template->get('MTP_content');
476
+					$new_content = $content;
477
+					switch ($field) {
478
+						case 'from' :
479
+							$new_content = ! empty($this->_req_data['batch_message']['from'])
480
+								? $this->_req_data['batch_message']['from']
481
+								: $content;
482
+							break;
483
+						case 'subject' :
484
+							$new_content = ! empty($this->_req_data['batch_message']['subject'])
485
+								? $this->_req_data['batch_message']['subject']
486
+								: $content;
487
+							break;
488
+						case 'content' :
489
+							$new_content = $content;
490
+							$new_content['newsletter_content'] = ! empty($this->_req_data['batch_message']['content'])
491
+								? $this->_req_data['batch_message']['content']
492
+								: $content['newsletter_content'];
493
+							break;
494
+						default :
495
+							//continue the foreach loop, we don't want to set $new_content nor save.
496
+							continue 2;
497
+					}
498
+					$Message_Template->set('MTP_content', $new_content);
499
+					$Message_Template->save();
500
+				}
501
+			}
502
+			//great fields are updated!  now let's make sure we just have contact objects (EE_Attendee).
503
+			$id_type = ! empty($this->_req_data['batch_message']['id_type'])
504
+				? $this->_req_data['batch_message']['id_type']
505
+				: 'registration';
506
+			//id_type will affect how we assemble the ids.
507
+			$ids = ! empty($this->_req_data['batch_message']['ids'])
508
+				? json_decode(stripslashes($this->_req_data['batch_message']['ids']))
509
+				: array();
510
+			$registrations_used_for_contact_data = array();
511
+			//using switch because eventually we'll have other contexts that will be used for generating messages.
512
+			switch ($id_type) {
513
+				case 'registration' :
514
+					$registrations_used_for_contact_data = EEM_Registration::instance()->get_all(
515
+						array(
516
+							array(
517
+								'REG_ID' => array('IN', $ids),
518
+							),
519
+						)
520
+					);
521
+					break;
522
+				case 'contact' :
523
+					$registrations_used_for_contact_data = EEM_Registration::instance()
524
+																		   ->get_latest_registration_for_each_of_given_contacts($ids);
525
+					break;
526
+			}
527
+			do_action(
528
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations',
529
+				$registrations_used_for_contact_data,
530
+				$Message_Template_Group->ID()
531
+			);
532
+			//kept for backward compat, internally we no longer use this action.
533
+			//@deprecated 4.8.36.rc.002
534
+			$contacts = $id_type === 'registration'
535
+				? EEM_Attendee::instance()->get_array_of_contacts_from_reg_ids($ids)
536
+				: EEM_Attendee::instance()->get_all(array(array('ATT_ID' => array('in', $ids))));
537
+			do_action(
538
+				'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send',
539
+				$contacts,
540
+				$Message_Template_Group->ID()
541
+			);
542
+		}
543
+		$query_args = array(
544
+			'action' => ! empty($this->_req_data['redirect_back_to'])
545
+				? $this->_req_data['redirect_back_to']
546
+				: 'default',
547
+		);
548
+		$this->_redirect_after_action(false, '', '', $query_args, true);
549
+	}
550
+
551
+
552
+
553
+	/**
554
+	 * This is called when javascript is being enqueued to setup the various data needed for the reports js.
555
+	 * Also $this->{$_reports_template_data} property is set for later usage by the _registration_reports method.
556
+	 */
557
+	protected function _registration_reports_js_setup()
558
+	{
559
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_day_report();
560
+		$this->_reports_template_data['admin_reports'][] = $this->_registrations_per_event_report();
561
+	}
562
+
563
+
564
+
565
+	/**
566
+	 *        generates Business Reports regarding Registrations
567
+	 *
568
+	 * @access protected
569
+	 * @return void
570
+	 */
571
+	protected function _registration_reports()
572
+	{
573
+		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
574
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
575
+			$template_path,
576
+			$this->_reports_template_data,
577
+			true
578
+		);
579
+		// the final template wrapper
580
+		$this->display_admin_page_with_no_sidebar();
581
+	}
582
+
583
+
584
+
585
+	/**
586
+	 * Generates Business Report showing total registrations per day.
587
+	 *
588
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
589
+	 * @return string
590
+	 */
591
+	private function _registrations_per_day_report($period = '-1 month')
592
+	{
593
+		$report_ID = 'reg-admin-registrations-per-day-report-dv';
594
+		$results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
595
+		$results = (array)$results;
596
+		$regs = array();
597
+		$subtitle = '';
598
+		if ($results) {
599
+			$column_titles = array();
600
+			$tracker = 0;
601
+			foreach ($results as $result) {
602
+				$report_column_values = array();
603
+				foreach ($result as $property_name => $property_value) {
604
+					$property_value = $property_name === 'Registration_REG_date' ? $property_value
605
+						: (int)$property_value;
606
+					$report_column_values[] = $property_value;
607
+					if ($tracker === 0) {
608
+						if ($property_name === 'Registration_REG_date') {
609
+							$column_titles[] = __('Date (only days with registrations are shown)', 'event_espresso');
610
+						} else {
611
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
612
+						}
613
+					}
614
+				}
615
+				$tracker++;
616
+				$regs[] = $report_column_values;
617
+			}
618
+			//make sure the column_titles is pushed to the beginning of the array
619
+			array_unshift($regs, $column_titles);
620
+			//setup the date range.
621
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
622
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
623
+			$ending_date = new DateTime("now", $DateTimeZone);
624
+			$subtitle = sprintf(
625
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
626
+				$beginning_date->format('Y-m-d'),
627
+				$ending_date->format('Y-m-d')
628
+			);
629
+		}
630
+		$report_title = __('Total Registrations per Day', 'event_espresso');
631
+		$report_params = array(
632
+			'title'     => $report_title,
633
+			'subtitle'  => $subtitle,
634
+			'id'        => $report_ID,
635
+			'regs'      => $regs,
636
+			'noResults' => empty($regs),
637
+			'noRegsMsg' => sprintf(
638
+				__(
639
+					'%sThere are currently no registration records in the last month for this report.%s',
640
+					'event_espresso'
641
+				),
642
+				'<h2>' . $report_title . '</h2><p>',
643
+				'</p>'
644
+			),
645
+		);
646
+		wp_localize_script('ee-reg-reports-js', 'regPerDay', $report_params);
647
+		return $report_ID;
648
+	}
649
+
650
+
651
+
652
+	/**
653
+	 * Generates Business Report showing total registrations per event.
654
+	 *
655
+	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
656
+	 * @return string
657
+	 */
658
+	private function _registrations_per_event_report($period = '-1 month')
659
+	{
660
+		$report_ID = 'reg-admin-registrations-per-event-report-dv';
661
+		$results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
662
+		$results = (array)$results;
663
+		$regs = array();
664
+		$subtitle = '';
665
+		if ($results) {
666
+			$column_titles = array();
667
+			$tracker = 0;
668
+			foreach ($results as $result) {
669
+				$report_column_values = array();
670
+				foreach ($result as $property_name => $property_value) {
671
+					$property_value = $property_name === 'Registration_Event' ? wp_trim_words(
672
+						$property_value,
673
+						4,
674
+						'...'
675
+					) : (int)$property_value;
676
+					$report_column_values[] = $property_value;
677
+					if ($tracker === 0) {
678
+						if ($property_name === 'Registration_Event') {
679
+							$column_titles[] = __('Event', 'event_espresso');
680
+						} else {
681
+							$column_titles[] = EEH_Template::pretty_status($property_name, false, 'sentence');
682
+						}
683
+					}
684
+				}
685
+				$tracker++;
686
+				$regs[] = $report_column_values;
687
+			}
688
+			//make sure the column_titles is pushed to the beginning of the array
689
+			array_unshift($regs, $column_titles);
690
+			//setup the date range.
691
+			$DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
692
+			$beginning_date = new DateTime("now " . $period, $DateTimeZone);
693
+			$ending_date = new DateTime("now", $DateTimeZone);
694
+			$subtitle = sprintf(
695
+				_x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
696
+				$beginning_date->format('Y-m-d'),
697
+				$ending_date->format('Y-m-d')
698
+			);
699
+		}
700
+		$report_title = __('Total Registrations per Event', 'event_espresso');
701
+		$report_params = array(
702
+			'title'     => $report_title,
703
+			'subtitle'  => $subtitle,
704
+			'id'        => $report_ID,
705
+			'regs'      => $regs,
706
+			'noResults' => empty($regs),
707
+			'noRegsMsg' => sprintf(
708
+				__(
709
+					'%sThere are currently no registration records in the last month for this report.%s',
710
+					'event_espresso'
711
+				),
712
+				'<h2>' . $report_title . '</h2><p>',
713
+				'</p>'
714
+			),
715
+		);
716
+		wp_localize_script('ee-reg-reports-js', 'regPerEvent', $report_params);
717
+		return $report_ID;
718
+	}
719
+
720
+
721
+
722
+	/**
723
+	 * generates HTML for the Registration Check-in list table (showing all Check-ins for a specific registration)
724
+	 *
725
+	 * @access protected
726
+	 * @return void
727
+	 * @throws \EE_Error
728
+	 */
729
+	protected function _registration_checkin_list_table()
730
+	{
731
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
732
+		$reg_id = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : null;
733
+		/** @var EE_Registration $reg */
734
+		$reg = EEM_Registration::instance()->get_one_by_ID($reg_id);
735
+		$this->_admin_page_title .= $this->get_action_link_or_button(
736
+			'new_registration',
737
+			'add-registrant',
738
+			array('event_id' => $reg->event_ID()),
739
+			'add-new-h2'
740
+		);
741
+		$legend_items = array(
742
+			'checkin'  => array(
743
+				'class' => 'ee-icon ee-icon-check-in',
744
+				'desc'  => __('This indicates the attendee has been checked in', 'event_espresso'),
745
+			),
746
+			'checkout' => array(
747
+				'class' => 'ee-icon ee-icon-check-out',
748
+				'desc'  => __('This indicates the attendee has been checked out', 'event_espresso'),
749
+			),
750
+		);
751
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
752
+		$dtt_id = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
753
+		$go_back_url = ! empty($reg_id) ? EE_Admin_Page::add_query_args_and_nonce(
754
+			array(
755
+				'action'   => 'event_registrations',
756
+				'event_id' => EEM_Registration::instance()->get_one_by_ID($reg_id)->get_first_related('Event')->ID(),
757
+				'DTT_ID'   => $dtt_id,
758
+			),
759
+			$this->_admin_base_url
760
+		) : '';
761
+		$this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
762
+			? '<h2>' . sprintf(
763
+				__("%s's check in records for %s at the event, %s", 'event_espresso'),
764
+				'<span id="checkin-attendee-name">'
765
+				. EEM_Registration::instance()
766
+								  ->get_one_by_ID($reg_id)
767
+								  ->get_first_related('Attendee')
768
+								  ->full_name() . '</span>',
769
+				'<span id="checkin-dtt"><a href="' . $go_back_url . '">'
770
+				. EEM_Datetime::instance()
771
+							  ->get_one_by_ID($dtt_id)
772
+							  ->start_date_and_time() . ' - '
773
+				. EEM_Datetime::instance()
774
+							  ->get_one_by_ID($dtt_id)
775
+							  ->end_date_and_time() . '</a></span>',
776
+				'<span id="checkin-event-name">'
777
+				. EEM_Datetime::instance()
778
+							  ->get_one_by_ID($dtt_id)
779
+							  ->get_first_related('Event')
780
+							  ->get('EVT_name') . '</span>'
781
+			) . '</h2>'
782
+			: '';
783
+		$this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
784
+			? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
785
+		$this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
786
+			? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
787
+		$this->display_admin_list_table_page_with_no_sidebar();
788
+	}
789
+
790
+
791
+
792
+	/**
793
+	 * toggle the Check-in status for the given registration (coming from ajax)
794
+	 *
795
+	 * @return void (JSON)
796
+	 */
797
+	public function toggle_checkin_status()
798
+	{
799
+		//first make sure we have the necessary data
800
+		if ( ! isset($this->_req_data['_regid'])) {
801
+			EE_Error::add_error(
802
+				__(
803
+					'There must be something broken with the html structure because the required data for toggling the Check-in status is not being sent via ajax',
804
+					'event_espresso'
805
+				),
806
+				__FILE__,
807
+				__FUNCTION__,
808
+				__LINE__
809
+			);
810
+			$this->_template_args['success'] = false;
811
+			$this->_template_args['error'] = true;
812
+			$this->_return_json();
813
+		};
814
+		//do a nonce check cause we're not coming in from an normal route here.
815
+		$nonce = isset($this->_req_data['checkinnonce']) ? sanitize_text_field($this->_req_data['checkinnonce'])
816
+			: '';
817
+		$nonce_ref = 'checkin_nonce';
818
+		$this->_verify_nonce($nonce, $nonce_ref);
819
+		//beautiful! Made it this far so let's get the status.
820
+		$new_status = $this->_toggle_checkin_status();
821
+		//setup new class to return via ajax
822
+		$this->_template_args['admin_page_content'] = 'clickable trigger-checkin checkin-icons checkedin-status-'
823
+													  . $new_status;
824
+		$this->_template_args['success'] = true;
825
+		$this->_return_json();
826
+	}
827
+
828
+
829
+
830
+	/**
831
+	 * handles toggling the checkin status for the registration,
832
+	 *
833
+	 * @access protected
834
+	 * @return int|void
835
+	 */
836
+	protected function _toggle_checkin_status()
837
+	{
838
+		//first let's get the query args out of the way for the redirect
839
+		$query_args = array(
840
+			'action'   => 'event_registrations',
841
+			'event_id' => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
842
+			'DTT_ID'   => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null,
843
+		);
844
+		$new_status = false;
845
+		// bulk action check in toggle
846
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
847
+			// cycle thru checkboxes
848
+			while (list($REG_ID, $value) = each($this->_req_data['checkbox'])) {
849
+				$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : null;
850
+				$new_status = $this->_toggle_checkin($REG_ID, $DTT_ID);
851
+			}
852
+		} elseif (isset($this->_req_data['_regid'])) {
853
+			//coming from ajax request
854
+			$DTT_ID = isset($this->_req_data['dttid']) ? $this->_req_data['dttid'] : null;
855
+			$query_args['DTT_ID'] = $DTT_ID;
856
+			$new_status = $this->_toggle_checkin($this->_req_data['_regid'], $DTT_ID);
857
+		} else {
858
+			EE_Error::add_error(
859
+				__('Missing some required data to toggle the Check-in', 'event_espresso'),
860
+				__FILE__,
861
+				__FUNCTION__,
862
+				__LINE__
863
+			);
864
+		}
865
+		if (defined('DOING_AJAX')) {
866
+			return $new_status;
867
+		}
868
+		$this->_redirect_after_action(false, '', '', $query_args, true);
869
+	}
870
+
871
+
872
+
873
+	/**
874
+	 * This is toggles a single Check-in for the given registration and datetime.
875
+	 *
876
+	 * @param  int $REG_ID The registration we're toggling
877
+	 * @param  int $DTT_ID The datetime we're toggling
878
+	 * @return int            The new status toggled to.
879
+	 * @throws \EE_Error
880
+	 */
881
+	private function _toggle_checkin($REG_ID, $DTT_ID)
882
+	{
883
+		/** @var EE_Registration $REG */
884
+		$REG = EEM_Registration::instance()->get_one_by_ID($REG_ID);
885
+		$new_status = $REG->toggle_checkin_status($DTT_ID);
886
+		if ($new_status !== false) {
887
+			EE_Error::add_success($REG->get_checkin_msg($DTT_ID));
888
+		} else {
889
+			EE_Error::add_error($REG->get_checkin_msg($DTT_ID, true), __FILE__, __FUNCTION__, __LINE__);
890
+			$new_status = false;
891
+		}
892
+		return $new_status;
893
+	}
894
+
895
+
896
+
897
+	/**
898
+	 * Takes care of deleting multiple EE_Checkin table rows
899
+	 *
900
+	 * @access protected
901
+	 * @return void
902
+	 * @throws \EE_Error
903
+	 */
904
+	protected function _delete_checkin_rows()
905
+	{
906
+		$query_args = array(
907
+			'action' => 'registration_checkins',
908
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
909
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0,
910
+		);
911
+		$errors = 0;
912
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
913
+			while (list($CHK_ID, $value) = each($this->_req_data['checkbox'])) {
914
+				if ( ! EEM_Checkin::instance()->delete_by_ID($CHK_ID)) {
915
+					$errors++;
916
+				}
917
+			}
918
+		} else {
919
+			EE_Error::add_error(
920
+				__(
921
+					'So, something went wrong with the bulk delete because there was no data received for instructions on WHAT to delete!',
922
+					'event_espresso'
923
+				),
924
+				__FILE__,
925
+				__FUNCTION__,
926
+				__LINE__
927
+			);
928
+			$this->_redirect_after_action(false, '', '', $query_args, true);
929
+		}
930
+		if ($errors > 0) {
931
+			EE_Error::add_error(
932
+				sprintf(__('There were %d records that did not delete successfully', 'event_espresso'), $errors),
933
+				__FILE__,
934
+				__FUNCTION__,
935
+				__LINE__
936
+			);
937
+		} else {
938
+			EE_Error::add_success(__('Records were successfully deleted', 'event_espresso'));
939
+		}
940
+		$this->_redirect_after_action(false, '', '', $query_args, true);
941
+	}
942
+
943
+
944
+
945
+	/**
946
+	 * Deletes a single EE_Checkin row
947
+	 *
948
+	 * @return void
949
+	 * @throws \EE_Error
950
+	 */
951
+	protected function _delete_checkin_row()
952
+	{
953
+		$query_args = array(
954
+			'action' => 'registration_checkins',
955
+			'DTT_ID' => isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0,
956
+			'_REGID' => isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : 0,
957
+		);
958
+		if ( ! empty($this->_req_data['CHK_ID'])) {
959
+			if ( ! EEM_Checkin::instance()->delete_by_ID($this->_req_data['CHK_ID'])) {
960
+				EE_Error::add_error(
961
+					__('Something went wrong and this check-in record was not deleted', 'event_espresso'),
962
+					__FILE__,
963
+					__FUNCTION__,
964
+					__LINE__
965
+				);
966
+			} else {
967
+				EE_Error::add_success(__('Check-In record successfully deleted', 'event_espresso'));
968
+			}
969
+		} else {
970
+			EE_Error::add_error(
971
+				__(
972
+					'In order to delete a Check-in record, there must be a Check-In ID available. There is not. It is not your fault, there is just a gremlin living in the code',
973
+					'event_espresso'
974
+				),
975
+				__FILE__,
976
+				__FUNCTION__,
977
+				__LINE__
978
+			);
979
+		}
980
+		$this->_redirect_after_action(false, '', '', $query_args, true);
981
+	}
982
+
983
+
984
+
985
+	/**
986
+	 *        generates HTML for the Event Registrations List Table
987
+	 *
988
+	 * @access protected
989
+	 * @return void
990
+	 * @throws \EE_Error
991
+	 */
992
+	protected function _event_registrations_list_table()
993
+	{
994
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
995
+		$this->_admin_page_title .= isset($this->_req_data['event_id'])
996
+			? $this->get_action_link_or_button(
997
+				'new_registration',
998
+				'add-registrant',
999
+				array('event_id' => $this->_req_data['event_id']),
1000
+				'add-new-h2',
1001
+				'',
1002
+				false
1003
+			)
1004
+			: '';
1005
+		$legend_items = array(
1006
+			'star-icon'        => array(
1007
+				'class' => 'dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8',
1008
+				'desc'  => __('This Registrant is the Primary Registrant', 'event_espresso'),
1009
+			),
1010
+			'checkin'          => array(
1011
+				'class' => 'ee-icon ee-icon-check-in',
1012
+				'desc'  => __('This Registrant has been Checked In', 'event_espresso'),
1013
+			),
1014
+			'checkout'         => array(
1015
+				'class' => 'ee-icon ee-icon-check-out',
1016
+				'desc'  => __('This Registrant has been Checked Out', 'event_espresso'),
1017
+			),
1018
+			'nocheckinrecord'  => array(
1019
+				'class' => 'dashicons dashicons-no',
1020
+				'desc'  => __('No Check-in Record has been Created for this Registrant', 'event_espresso'),
1021
+			),
1022
+			'view_details'     => array(
1023
+				'class' => 'dashicons dashicons-search',
1024
+				'desc'  => __('View All Check-in Records for this Registrant', 'event_espresso'),
1025
+			),
1026
+			'approved_status'  => array(
1027
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1028
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1029
+			),
1030
+			'cancelled_status' => array(
1031
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1032
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1033
+			),
1034
+			'declined_status'  => array(
1035
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1036
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1037
+			),
1038
+			'not_approved'     => array(
1039
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1040
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1041
+			),
1042
+			'pending_status'   => array(
1043
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1044
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1045
+			),
1046
+			'wait_list'        => array(
1047
+				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1048
+				'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1049
+			),
1050
+		);
1051
+		$this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1052
+		$event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1053
+		$this->_template_args['before_list_table'] = ! empty($event_id)
1054
+			? '<h2>' . sprintf(
1055
+				__('Viewing Registrations for Event: %s', 'event_espresso'),
1056
+				EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1057
+			) . '</h2>'
1058
+			: '';
1059
+		//need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on the event.
1060
+		/** @var EE_Event $event */
1061
+		$event = EEM_Event::instance()->get_one_by_ID($event_id);
1062
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? absint($this->_req_data['DTT_ID']) : 0;
1063
+		$datetime = null;
1064
+		if ($event instanceof EE_Event) {
1065
+			$datetimes_on_event = $event->datetimes();
1066
+			if (count($datetimes_on_event) === 1) {
1067
+				$datetime = reset($datetimes_on_event);
1068
+			}
1069
+		}
1070
+		$datetime = $datetime instanceof EE_Datetime ? $datetime : EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
1071
+		if ($datetime instanceof EE_Datetime && $this->_template_args['before_list_table'] !== '') {
1072
+			$this->_template_args['before_list_table'] = substr($this->_template_args['before_list_table'], 0, -5);
1073
+			$this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1074
+			$this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1075
+			$this->_template_args['before_list_table'] .= $datetime->name();
1076
+			$this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1077
+			$this->_template_args['before_list_table'] .= '</span></h2>';
1078
+		}
1079
+		//if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status column
1080
+		//represents
1081
+		if ( ! $datetime instanceof EE_Datetime) {
1082
+			$this->_template_args['before_list_table'] .= '<br><p class="description">'
1083
+														  . __('In this view, the check-in status represents the latest check-in record for the registration in that row.',
1084
+					'event_espresso')
1085
+														  . '</p>';
1086
+		}
1087
+		$this->display_admin_list_table_page_with_no_sidebar();
1088
+	}
1089
+
1090
+	/**
1091
+	 * Download the registrations check-in report (same as the normal registration report, but with different where
1092
+	 * conditions)
1093
+	 *
1094
+	 * @return void ends the request by a redirect or download
1095
+	 */
1096
+	public function _registrations_checkin_report()
1097
+	{
1098
+		$this->_registrations_report_base('_get_checkin_query_params_from_request');
1099
+	}
1100
+
1101
+	/**
1102
+	 * Gets the query params from the request, plus adds a where condition for the registration status,
1103
+	 * because on the checkin page we only ever want to see approved and pending-approval registrations
1104
+	 *
1105
+	 * @param array     $request
1106
+	 * @param int  $per_page
1107
+	 * @param bool $count
1108
+	 * @return array
1109
+	 */
1110
+	protected function _get_checkin_query_params_from_request(
1111
+		$request,
1112
+		$per_page = 10,
1113
+		$count = false
1114
+	) {
1115
+		$query_params = $this->_get_registration_query_parameters($request, $per_page, $count);
1116
+		//unlike the regular registrations list table,
1117
+		$status_ids_array = apply_filters(
1118
+			'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array',
1119
+			array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved)
1120
+		);
1121
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
1122
+		return $query_params;
1123
+	}
1124
+
1125
+
1126
+
1127
+
1128
+	/**
1129
+	 * Gets registrations for an event
1130
+	 *
1131
+	 * @param int    $per_page
1132
+	 * @param bool   $count whether to return count or data.
1133
+	 * @param bool   $trash
1134
+	 * @param string $orderby
1135
+	 * @return EE_Registration[]|int
1136
+	 * @throws \EE_Error
1137
+	 */
1138
+	public function get_event_attendees($per_page = 10, $count = false, $trash = false, $orderby = 'ATT_fname')
1139
+	{
1140
+		//normalize some request params that get setup by the parent `get_registrations` method.
1141
+		$request = $this->_req_data;
1142
+		$request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1143
+		$request['order'] =  ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1144
+		if($trash){
1145
+			$request['status'] = 'trash';
1146
+		}
1147
+		$query_params = $this->_get_checkin_query_params_from_request( $request, $per_page, $count );
1148
+		/**
1149
+		 * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1150
+		 * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
1151
+		 * @see EEM_Base::get_all()
1152
+		 */
1153
+		$query_params['group_by'] = '';
1154
+
1155
+		return $count
1156
+			? EEM_Registration::instance()->count($query_params)
1157
+			/** @type EE_Registration[] */
1158
+			: EEM_Registration::instance()->get_all($query_params);
1159
+	}
1160 1160
 
1161 1161
 } //end class Registrations Admin Page
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     {
36 36
         parent::__construct($routing);
37 37
         if ( ! defined('REG_CAF_TEMPLATE_PATH')) {
38
-            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/templates/');
39
-            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'registrations/assets/');
40
-            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registrations/assets/');
38
+            define('REG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'registrations/templates/');
39
+            define('REG_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'registrations/assets/');
40
+            define('REG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registrations/assets/');
41 41
         }
42 42
     }
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     protected function _extend_page_config()
47 47
     {
48
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'registrations';
48
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'registrations';
49 49
         $reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID'])
50 50
             ? $this->_req_data['_REG_ID']
51 51
             : 0;
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
             //enqueue newsletter js
179 179
             wp_enqueue_script(
180 180
                 'ee-newsletter-trigger',
181
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.js',
181
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.js',
182 182
                 array('ee-dialog'),
183 183
                 EVENT_ESPRESSO_VERSION,
184 184
                 true
185 185
             );
186 186
             wp_enqueue_style(
187 187
                 'ee-newsletter-trigger-css',
188
-                REG_CAF_ASSETS_URL . 'ee-newsletter-trigger.css',
188
+                REG_CAF_ASSETS_URL.'ee-newsletter-trigger.css',
189 189
                 array(),
190 190
                 EVENT_ESPRESSO_VERSION
191 191
             );
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
     {
205 205
         wp_register_script(
206 206
             'ee-reg-reports-js',
207
-            REG_CAF_ASSETS_URL . 'ee-registration-admin-reports.js',
207
+            REG_CAF_ASSETS_URL.'ee-registration-admin-reports.js',
208 208
             array('google-charts'),
209 209
             EVENT_ESPRESSO_VERSION,
210 210
             true
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
             $codes[$field] = implode(', ', array_keys($shortcode_array));
410 410
         }
411 411
         $shortcodes = $codes;
412
-        $form_template = REG_CAF_TEMPLATE_PATH . 'newsletter-send-form.template.php';
412
+        $form_template = REG_CAF_TEMPLATE_PATH.'newsletter-send-form.template.php';
413 413
         $form_template_args = array(
414 414
             'form_action'       => admin_url('admin.php?page=espresso_registrations'),
415 415
             'form_route'        => 'newsletter_selected_send',
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      */
571 571
     protected function _registration_reports()
572 572
     {
573
-        $template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
573
+        $template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
574 574
         $this->_template_args['admin_page_content'] = EEH_Template::display_template(
575 575
             $template_path,
576 576
             $this->_reports_template_data,
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
     {
593 593
         $report_ID = 'reg-admin-registrations-per-day-report-dv';
594 594
         $results = EEM_Registration::instance()->get_registrations_per_day_and_per_status_report($period);
595
-        $results = (array)$results;
595
+        $results = (array) $results;
596 596
         $regs = array();
597 597
         $subtitle = '';
598 598
         if ($results) {
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
                 $report_column_values = array();
603 603
                 foreach ($result as $property_name => $property_value) {
604 604
                     $property_value = $property_name === 'Registration_REG_date' ? $property_value
605
-                        : (int)$property_value;
605
+                        : (int) $property_value;
606 606
                     $report_column_values[] = $property_value;
607 607
                     if ($tracker === 0) {
608 608
                         if ($property_name === 'Registration_REG_date') {
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
             array_unshift($regs, $column_titles);
620 620
             //setup the date range.
621 621
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
622
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
622
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
623 623
             $ending_date = new DateTime("now", $DateTimeZone);
624 624
             $subtitle = sprintf(
625 625
                 _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
                     '%sThere are currently no registration records in the last month for this report.%s',
640 640
                     'event_espresso'
641 641
                 ),
642
-                '<h2>' . $report_title . '</h2><p>',
642
+                '<h2>'.$report_title.'</h2><p>',
643 643
                 '</p>'
644 644
             ),
645 645
         );
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
     {
660 660
         $report_ID = 'reg-admin-registrations-per-event-report-dv';
661 661
         $results = EEM_Registration::instance()->get_registrations_per_event_and_per_status_report($period);
662
-        $results = (array)$results;
662
+        $results = (array) $results;
663 663
         $regs = array();
664 664
         $subtitle = '';
665 665
         if ($results) {
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
                         $property_value,
673 673
                         4,
674 674
                         '...'
675
-                    ) : (int)$property_value;
675
+                    ) : (int) $property_value;
676 676
                     $report_column_values[] = $property_value;
677 677
                     if ($tracker === 0) {
678 678
                         if ($property_name === 'Registration_Event') {
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
             array_unshift($regs, $column_titles);
690 690
             //setup the date range.
691 691
             $DateTimeZone = new DateTimeZone(EEH_DTT_Helper::get_timezone());
692
-            $beginning_date = new DateTime("now " . $period, $DateTimeZone);
692
+            $beginning_date = new DateTime("now ".$period, $DateTimeZone);
693 693
             $ending_date = new DateTime("now", $DateTimeZone);
694 694
             $subtitle = sprintf(
695 695
                 _x('For the period: %1$s to %2$s', 'Used to give date range', 'event_espresso'),
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
                     '%sThere are currently no registration records in the last month for this report.%s',
710 710
                     'event_espresso'
711 711
                 ),
712
-                '<h2>' . $report_title . '</h2><p>',
712
+                '<h2>'.$report_title.'</h2><p>',
713 713
                 '</p>'
714 714
             ),
715 715
         );
@@ -759,31 +759,31 @@  discard block
 block discarded – undo
759 759
             $this->_admin_base_url
760 760
         ) : '';
761 761
         $this->_template_args['before_list_table'] = ! empty($reg_id) && ! empty($dtt_id)
762
-            ? '<h2>' . sprintf(
762
+            ? '<h2>'.sprintf(
763 763
                 __("%s's check in records for %s at the event, %s", 'event_espresso'),
764 764
                 '<span id="checkin-attendee-name">'
765 765
                 . EEM_Registration::instance()
766 766
                                   ->get_one_by_ID($reg_id)
767 767
                                   ->get_first_related('Attendee')
768
-                                  ->full_name() . '</span>',
769
-                '<span id="checkin-dtt"><a href="' . $go_back_url . '">'
768
+                                  ->full_name().'</span>',
769
+                '<span id="checkin-dtt"><a href="'.$go_back_url.'">'
770 770
                 . EEM_Datetime::instance()
771 771
                               ->get_one_by_ID($dtt_id)
772
-                              ->start_date_and_time() . ' - '
772
+                              ->start_date_and_time().' - '
773 773
                 . EEM_Datetime::instance()
774 774
                               ->get_one_by_ID($dtt_id)
775
-                              ->end_date_and_time() . '</a></span>',
775
+                              ->end_date_and_time().'</a></span>',
776 776
                 '<span id="checkin-event-name">'
777 777
                 . EEM_Datetime::instance()
778 778
                               ->get_one_by_ID($dtt_id)
779 779
                               ->get_first_related('Event')
780
-                              ->get('EVT_name') . '</span>'
781
-            ) . '</h2>'
780
+                              ->get('EVT_name').'</span>'
781
+            ).'</h2>'
782 782
             : '';
783 783
         $this->_template_args['list_table_hidden_fields'] = ! empty($reg_id)
784
-            ? '<input type="hidden" name="_REGID" value="' . $reg_id . '">' : '';
784
+            ? '<input type="hidden" name="_REGID" value="'.$reg_id.'">' : '';
785 785
         $this->_template_args['list_table_hidden_fields'] .= ! empty($dtt_id)
786
-            ? '<input type="hidden" name="DTT_ID" value="' . $dtt_id . '">' : '';
786
+            ? '<input type="hidden" name="DTT_ID" value="'.$dtt_id.'">' : '';
787 787
         $this->display_admin_list_table_page_with_no_sidebar();
788 788
     }
789 789
 
@@ -1024,37 +1024,37 @@  discard block
 block discarded – undo
1024 1024
                 'desc'  => __('View All Check-in Records for this Registrant', 'event_espresso'),
1025 1025
             ),
1026 1026
             'approved_status'  => array(
1027
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
1027
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
1028 1028
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence'),
1029 1029
             ),
1030 1030
             'cancelled_status' => array(
1031
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
1031
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
1032 1032
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence'),
1033 1033
             ),
1034 1034
             'declined_status'  => array(
1035
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
1035
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
1036 1036
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence'),
1037 1037
             ),
1038 1038
             'not_approved'     => array(
1039
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
1039
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
1040 1040
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence'),
1041 1041
             ),
1042 1042
             'pending_status'   => array(
1043
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
1043
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
1044 1044
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence'),
1045 1045
             ),
1046 1046
             'wait_list'        => array(
1047
-                'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_wait_list,
1047
+                'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_wait_list,
1048 1048
                 'desc'  => EEH_Template::pretty_status(EEM_Registration::status_id_wait_list, false, 'sentence'),
1049 1049
             ),
1050 1050
         );
1051 1051
         $this->_template_args['after_list_table'] = $this->_display_legend($legend_items);
1052 1052
         $event_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null;
1053 1053
         $this->_template_args['before_list_table'] = ! empty($event_id)
1054
-            ? '<h2>' . sprintf(
1054
+            ? '<h2>'.sprintf(
1055 1055
                 __('Viewing Registrations for Event: %s', 'event_espresso'),
1056 1056
                 EEM_Event::instance()->get_one_by_ID($event_id)->get('EVT_name')
1057
-            ) . '</h2>'
1057
+            ).'</h2>'
1058 1058
             : '';
1059 1059
         //need to get the number of datetimes on the event and set default datetime_id if there is only one datetime on the event.
1060 1060
         /** @var EE_Event $event */
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
             $this->_template_args['before_list_table'] .= ' &nbsp;<span class="drk-grey-text">';
1074 1074
             $this->_template_args['before_list_table'] .= '<span class="dashicons dashicons-calendar"></span>';
1075 1075
             $this->_template_args['before_list_table'] .= $datetime->name();
1076
-            $this->_template_args['before_list_table'] .= ' ( ' . $datetime->date_and_time_range() . ' )';
1076
+            $this->_template_args['before_list_table'] .= ' ( '.$datetime->date_and_time_range().' )';
1077 1077
             $this->_template_args['before_list_table'] .= '</span></h2>';
1078 1078
         }
1079 1079
         //if no datetime, then we're on the initial view, so let's give some helpful instructions on what the status column
@@ -1140,11 +1140,11 @@  discard block
 block discarded – undo
1140 1140
         //normalize some request params that get setup by the parent `get_registrations` method.
1141 1141
         $request = $this->_req_data;
1142 1142
         $request['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : $orderby;
1143
-        $request['order'] =  ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1144
-        if($trash){
1143
+        $request['order'] = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC';
1144
+        if ($trash) {
1145 1145
             $request['status'] = 'trash';
1146 1146
         }
1147
-        $query_params = $this->_get_checkin_query_params_from_request( $request, $per_page, $count );
1147
+        $query_params = $this->_get_checkin_query_params_from_request($request, $per_page, $count);
1148 1148
         /**
1149 1149
          * Override the default groupby added by EEM_Base so that sorts with multiple order bys work as expected
1150 1150
          * @link https://events.codebasehq.com/projects/event-espresso/tickets/10093
Please login to merge, or discard this patch.
admin_pages/registrations/EE_Registrations_List_Table.class.php 2 patches
Indentation   +840 added lines, -840 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -26,869 +26,869 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 
29
-    private $_status;
30
-
31
-
32
-
33
-    /**
34
-     * An array of transaction details for the related transaction to the registration being processed.
35
-     * This is set via the _set_related_details method.
36
-     *
37
-     * @var array
38
-     */
39
-    protected $_transaction_details = array();
40
-
41
-
42
-
43
-    /**
44
-     * An array of event details for the related event to the registration being processed.
45
-     * This is set via the _set_related_details method.
46
-     *
47
-     * @var array
48
-     */
49
-    protected $_event_details = array();
50
-
51
-
52
-
53
-    /**
54
-     * @param \Registrations_Admin_Page $admin_page
55
-     */
56
-    public function __construct(Registrations_Admin_Page $admin_page)
57
-    {
58
-        if ( ! empty($_GET['event_id'])) {
59
-            $extra_query_args = array();
60
-            foreach ($admin_page->get_views() as $key => $view_details) {
61
-                $extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
62
-            }
63
-            $this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64
-        }
65
-        parent::__construct($admin_page);
66
-        $this->_status = $this->_admin_page->get_registration_status_array();
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     *    _setup_data
73
-     *
74
-     * @access protected
75
-     * @return void
76
-     */
77
-    protected function _setup_data()
78
-    {
79
-        $this->_data = $this->_admin_page->get_registrations($this->_per_page);
80
-        $this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     *    _set_properties
87
-     *
88
-     * @access protected
89
-     * @return void
90
-     */
91
-    protected function _set_properties()
92
-    {
93
-        $this->_wp_list_args = array(
94
-            'singular' => __('registration', 'event_espresso'),
95
-            'plural'   => __('registrations', 'event_espresso'),
96
-            'ajax'     => true,
97
-            'screen'   => $this->_admin_page->get_current_screen()->id,
98
-        );
99
-        $ID_column_name = __('ID', 'event_espresso');
100
-        $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
-        $ID_column_name .= __('Registrant Name', 'event_espresso');
102
-        $ID_column_name .= '</span> ';
103
-        if (isset($_GET['event_id'])) {
104
-            $this->_columns = array(
105
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
-                '_REG_ID'          => $ID_column_name,
107
-                'ATT_fname'        => __('Name', 'event_espresso'),
108
-                'ATT_email'        => __('Email', 'event_espresso'),
109
-                '_REG_date'        => __('Reg Date', 'event_espresso'),
110
-                'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
-                '_REG_final_price' => __('Final Price', 'event_espresso'),
112
-                'TXN_total'        => __('Total Txn', 'event_espresso'),
113
-                'TXN_paid'         => __('Paid', 'event_espresso'),
114
-                'actions'          => __('Actions', 'event_espresso'),
115
-            );
116
-            $this->_bottom_buttons = array(
117
-                'report' => array(
118
-                    'route'         => 'registrations_report',
119
-                    'extra_request' => array(
120
-                        'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
-                    ),
123
-                ),
124
-            );
125
-        } else {
126
-            $this->_columns = array(
127
-                'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
-                '_REG_ID'          => $ID_column_name,
129
-                'ATT_fname'        => __('Name', 'event_espresso'),
130
-                '_REG_date'        => __('TXN Date', 'event_espresso'),
131
-                'event_name'       => __('Event', 'event_espresso'),
132
-                'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
-                '_REG_final_price' => __('Price', 'event_espresso'),
134
-                '_REG_paid'        => __('Paid', 'event_espresso'),
135
-                'actions'          => __('Actions', 'event_espresso'),
136
-            );
137
-            $this->_bottom_buttons = array(
138
-                'report_all' => array(
139
-                    'route'         => 'registrations_report',
140
-                    'extra_request' => array(
141
-                        'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
-                    ),
143
-                ),
144
-            );
145
-        }
146
-        $this->_bottom_buttons['report_filtered'] = array(
147
-            'route'         => 'registrations_report',
148
-            'extra_request' => array(
149
-                'use_filters' => true,
150
-                'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
-                            'page',
152
-                            'action',
153
-                            'default_nonce',
154
-                        ))),
155
-                'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
-            ),
157
-        );
158
-        $this->_primary_column = '_REG_ID';
159
-        $this->_sortable_columns = array(
160
-            '_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
-            /**
162
-             * Allows users to change the default sort if they wish.
163
-             * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
164
-             */
165
-            'ATT_fname'     => array(
166
-                    'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
167
-                    true,
168
-                    $this
169
-                )
170
-                ? array('ATT_lname' => false)
171
-                : array('ATT_fname' => false),
172
-            'event_name'    => array('event_name' => false),
173
-            'DTT_EVT_start' => array('DTT_EVT_start' => false),
174
-            '_REG_ID'       => array('_REG_ID' => false),
175
-        );
176
-        $this->_hidden_columns = array();
177
-    }
178
-
179
-
180
-
181
-    /**
182
-     * This simply sets up the row class for the table rows.
183
-     * Allows for easier overriding of child methods for setting up sorting.
184
-     *
185
-     * @param  EE_Registration $item the current item
186
-     * @return string
187
-     */
188
-    protected function _get_row_class($item)
189
-    {
190
-        $class = parent::_get_row_class($item);
191
-        //add status class
192
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
193
-        if ($this->_has_checkbox_column) {
194
-            $class .= ' has-checkbox-column';
195
-        }
196
-        return $class;
197
-    }
198
-
199
-
200
-
201
-    /**
202
-     * Set the $_transaction_details property if not set yet.
203
-     *
204
-     * @param EE_Registration $registration
205
-     * @throws \EE_Error
206
-     */
207
-    protected function _set_related_details(EE_Registration $registration)
208
-    {
209
-        $transaction = $registration->get_first_related('Transaction');
210
-        $status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
211
-            : EEM_Transaction::failed_status_code;
212
-        $this->_transaction_details = array(
213
-            'transaction' => $transaction,
214
-            'status'      => $status,
215
-            'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
216
-            'title_attr'  => sprintf(__('View Transaction Details (%s)', 'event_espresso'),
217
-                EEH_Template::pretty_status($status, false, 'sentence')),
218
-        );
219
-        try {
220
-            $event = $registration->event();
221
-        } catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
222
-            $event = null;
223
-        }
224
-        $status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
225
-        $this->_event_details = array(
226
-            'event'      => $event,
227
-            'status'     => $status,
228
-            'id'         => $event instanceof EE_Event ? $event->ID() : 0,
229
-            'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'),
230
-                EEH_Template::pretty_status($status, false, 'sentence')),
231
-        );
232
-    }
233
-
234
-
235
-
236
-    /**
237
-     *    _get_table_filters
238
-     *
239
-     * @access protected
240
-     * @return array
241
-     */
242
-    protected function _get_table_filters()
243
-    {
244
-        $filters = array();
245
-        //todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
246
-        $cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
247
-        $cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
248
-        $reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
249
-        $filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
250
-        $filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
251
-        $status = array();
252
-        $status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
253
-        foreach ($this->_status as $key => $value) {
254
-            $status[] = array('id' => $key, 'text' => $value);
255
-        }
256
-        if ($this->_view !== 'incomplete') {
257
-            $filters[] = EEH_Form_Fields::select_input('_reg_status', $status,
258
-                isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
259
-                    : '');
260
-        }
261
-        if (isset($this->_req_data['event_id'])) {
262
-            $filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
263
-        }
264
-        return $filters;
265
-    }
266
-
267
-
268
-
269
-    /**
270
-     *    _add_view_counts
271
-     *
272
-     * @access protected
273
-     * @return void
274
-     * @throws \EE_Error
275
-     */
276
-    protected function _add_view_counts()
277
-    {
278
-        $this->_views['all']['count'] = $this->_total_registrations();
279
-        $this->_views['month']['count'] = $this->_total_registrations_this_month();
280
-        $this->_views['today']['count'] = $this->_total_registrations_today();
281
-        if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations',
282
-            'espresso_registrations_trash_registrations')
283
-        ) {
284
-            $this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
285
-            $this->_views['trash']['count'] = $this->_total_registrations('trash');
286
-        }
287
-    }
288
-
289
-
290
-
291
-    /**
292
-     * _total_registrations
293
-     *
294
-     * @access protected
295
-     * @param string $view
296
-     * @return int
297
-     * @throws \EE_Error
298
-     */
299
-    protected function _total_registrations($view = '')
300
-    {
301
-        $_where = array();
302
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
303
-        if ($EVT_ID) {
304
-            $_where['EVT_ID'] = $EVT_ID;
305
-        }
306
-        switch ($view) {
307
-            case 'trash' :
308
-                return EEM_Registration::instance()->count_deleted(array($_where));
309
-                break;
310
-            case 'incomplete' :
311
-                $_where['STS_ID'] = EEM_Registration::status_id_incomplete;
312
-                break;
313
-            default :
314
-                $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
315
-        }
316
-        return EEM_Registration::instance()->count(array($_where));
317
-    }
318
-
319
-
320
-
321
-    /**
322
-     * _total_registrations_this_month
323
-     *
324
-     * @access protected
325
-     * @return int
326
-     * @throws \EE_Error
327
-     */
328
-    protected function _total_registrations_this_month()
329
-    {
330
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
331
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
332
-        $this_year_r = date('Y', current_time('timestamp'));
333
-        $time_start = ' 00:00:00';
334
-        $time_end = ' 23:59:59';
335
-        $this_month_r = date('m', current_time('timestamp'));
336
-        $days_this_month = date('t', current_time('timestamp'));
337
-        //setup date query.
338
-        $beginning_string = EEM_Registration::instance()
339
-                                            ->convert_datetime_for_query('REG_date',
340
-                                                $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
341
-                                                'Y-m-d H:i:s');
342
-        $end_string = EEM_Registration::instance()
343
-                                      ->convert_datetime_for_query('REG_date',
344
-                                          $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
345
-                                          'Y-m-d H:i:s');
346
-        $_where['REG_date'] = array(
347
-            'BETWEEN',
348
-            array(
349
-                $beginning_string,
350
-                $end_string,
351
-            ),
352
-        );
353
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
354
-        return EEM_Registration::instance()->count(array($_where));
355
-    }
356
-
357
-
358
-
359
-    /**
360
-     * _total_registrations_today
361
-     *
362
-     * @access protected
363
-     * @return int
364
-     * @throws \EE_Error
365
-     */
366
-    protected function _total_registrations_today()
367
-    {
368
-        $EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
369
-        $_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
370
-        $current_date = date('Y-m-d', current_time('timestamp'));
371
-        $time_start = ' 00:00:00';
372
-        $time_end = ' 23:59:59';
373
-        $_where['REG_date'] = array(
374
-            'BETWEEN',
375
-            array(
376
-                EEM_Registration::instance()
377
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_start, 'Y-m-d H:i:s'),
378
-                EEM_Registration::instance()
379
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_end, 'Y-m-d H:i:s'),
380
-            ),
381
-        );
382
-        $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
383
-        return EEM_Registration::instance()->count(array($_where));
384
-    }
385
-
386
-
387
-
388
-    /**
389
-     * column_cb
390
-     *
391
-     * @access public
392
-     * @param \EE_Registration $item
393
-     * @return string
394
-     * @throws \EE_Error
395
-     */
396
-    public function column_cb($item)
397
-    {
398
-        /** checkbox/lock **/
399
-        $transaction = $item->get_first_related('Transaction');
400
-        $payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
401
-        return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
402
-                                    . '<span class="ee-lock-icon"></span>'
403
-            : sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
404
-    }
405
-
406
-
407
-
408
-    /**
409
-     * column__REG_ID
410
-     *
411
-     * @access public
412
-     * @param \EE_Registration $item
413
-     * @return string
414
-     * @throws \EE_Error
415
-     */
416
-    public function column__REG_ID(EE_Registration $item)
417
-    {
418
-        $attendee = $item->attendee();
419
-        $content = $item->ID();
420
-        $content .= '<div class="show-on-mobile-view-only">';
421
-        $content .= '<br>';
422
-        $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
423
-        $content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
424
-        $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
425
-        $content .= '</div>';
426
-        return $content;
427
-    }
428
-
429
-
430
-
431
-    /**
432
-     * column__REG_date
433
-     *
434
-     * @access public
435
-     * @param \EE_Registration $item
436
-     * @return string
437
-     * @throws \EE_Error
438
-     */
439
-    public function column__REG_date(EE_Registration $item)
440
-    {
441
-        $this->_set_related_details($item);
442
-        //Build row actions
443
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
444
-            'action' => 'view_transaction',
445
-            'TXN_ID' => $this->_transaction_details['id'],
446
-        ), TXN_ADMIN_URL);
447
-        $view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
448
-            'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'
449
-                                                        . $this->_transaction_details['status']
450
-                                                        . '" href="'
451
-                                                        . $view_lnk_url
452
-                                                        . '" title="'
453
-                                                        . esc_attr($this->_transaction_details['title_attr'])
454
-                                                        . '">'
455
-                                                        . $item->get_i18n_datetime('REG_date')
456
-                                                        . '</a>' : $item->get_i18n_datetime('REG_date');
457
-        $view_link .= '<br><span class="ee-status-text-small">'
458
-                      . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
459
-                      . '</span>';
460
-        return $view_link;
461
-    }
462
-
463
-
464
-
465
-    /**
466
-     * column_event_name
467
-     *
468
-     * @access public
469
-     * @param \EE_Registration $item
470
-     * @return string
471
-     * @throws \EE_Error
472
-     */
473
-    public function column_event_name(EE_Registration $item)
474
-    {
475
-        $this->_set_related_details($item);
476
-        // page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
477
-        $EVT_ID = $item->event_ID();
478
-        $event_name = $item->event_name();
479
-        $event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
480
-        $event_name = wp_trim_words($event_name, 30, '...');
481
-        if ($EVT_ID) {
482
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
483
-                EVENTS_ADMIN_URL);
484
-            $edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
485
-                ? '<a class="ee-status-color-'
486
-                  . $this->_event_details['status']
487
-                  . '" href="'
488
-                  . $edit_event_url
489
-                  . '" title="'
490
-                  . esc_attr($this->_event_details['title_attr'])
491
-                  . '">'
492
-                  . $event_name
493
-                  . '</a>' : $event_name;
494
-            $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
495
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
496
-            $actions['event_filter'] .= sprintf(esc_attr__('Filter this list to only show registrations for %s',
497
-                'event_espresso'), $event_name);
498
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
499
-        } else {
500
-            $edit_event = $event_name;
501
-            $actions['event_filter'] = '';
502
-        }
503
-        return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
504
-    }
505
-
506
-
507
-
508
-    /**
509
-     * column_DTT_EVT_start
510
-     *
511
-     * @access public
512
-     * @param \EE_Registration $item
513
-     * @return string
514
-     * @throws \EE_Error
515
-     */
516
-    public function column_DTT_EVT_start(EE_Registration $item)
517
-    {
518
-        $datetime_strings = array();
519
-        $ticket = $item->ticket(true);
520
-        if ($ticket instanceof EE_Ticket) {
521
-            $remove_defaults = array('default_where_conditions' => 'none');
522
-            $datetimes = $ticket->datetimes($remove_defaults);
523
-            foreach ($datetimes as $datetime) {
524
-                $datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
525
-            }
526
-            return implode("<br />", $datetime_strings);
527
-        } else {
528
-            return __('There is no ticket on this registration', 'event_espresso');
529
-        }
530
-    }
531
-
532
-
533
-
534
-    /**
535
-     * column_ATT_fname
536
-     *
537
-     * @access public
538
-     * @param \EE_Registration $item
539
-     * @return string
540
-     * @throws \EE_Error
541
-     */
542
-    public function column_ATT_fname(EE_Registration $item)
543
-    {
544
-        $attendee = $item->attendee();
545
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
546
-            'action'  => 'view_registration',
547
-            '_REG_ID' => $item->ID(),
548
-        ), REG_ADMIN_URL);
549
-        $attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
550
-        $link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
551
-            'espresso_registrations_view_registration', $item->ID()) ? '<a href="'
552
-                                                                       . $edit_lnk_url
553
-                                                                       . '" title="'
554
-                                                                       . esc_attr__('View Registration Details',
555
-                'event_espresso')
556
-                                                                       . '">'
557
-                                                                       . $attendee_name
558
-                                                                       . '</a>' : $attendee_name;
559
-        $link .= $item->count() === 1
560
-            ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
561
-        $t = $item->get_first_related('Transaction');
562
-        $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
563
-        //append group count to name
564
-        $link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
565
-        //append reg_code
566
-        $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
567
-        //reg status text for accessibility
568
-        $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
569
-                'sentence') . '</span>';
570
-        //trash/restore/delete actions
571
-        $actions = array();
572
-        if ($this->_view !== 'trash'
573
-            && $payment_count === 0
574
-            && EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
575
-                'espresso_registrations_trash_registrations', $item->ID())
576
-        ) {
577
-            $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
578
-                'action'  => 'trash_registrations',
579
-                '_REG_ID' => $item->ID(),
580
-            ), REG_ADMIN_URL);
581
-            $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration',
582
-                    'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
583
-        } elseif ($this->_view === 'trash') {
584
-            // restore registration link
585
-            if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
586
-                'espresso_registrations_restore_registrations', $item->ID())
587
-            ) {
588
-                $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
589
-                    'action'  => 'restore_registrations',
590
-                    '_REG_ID' => $item->ID(),
591
-                ), REG_ADMIN_URL);
592
-                $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration',
593
-                        'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
594
-            }
595
-            if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
596
-                'espresso_registrations_ee_delete_registrations', $item->ID())
597
-            ) {
598
-                $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
599
-                    'action'  => 'delete_registrations',
600
-                    '_REG_ID' => $item->ID(),
601
-                ), REG_ADMIN_URL);
602
-                $actions['delete'] = '<a href="'
603
-                                     . $delete_lnk_url
604
-                                     . '" title="'
605
-                                     . esc_attr__('Delete Registration Permanently', 'event_espresso')
606
-                                     . '">'
607
-                                     . __('Delete', 'event_espresso')
608
-                                     . '</a>';
609
-            }
610
-        }
611
-        return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
612
-    }
613
-
614
-
615
-
616
-    /**
617
-     * column_ATT_email
618
-     *
619
-     * @access public
620
-     * @param \EE_Registration $item
621
-     * @return string
622
-     * @throws \EE_Error
623
-     */
624
-    public function column_ATT_email(EE_Registration $item)
625
-    {
626
-        $attendee = $item->get_first_related('Attendee');
627
-        return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
628
-            : $attendee->email();
629
-    }
630
-
631
-
632
-
633
-    /**
634
-     * column__REG_count
635
-     *
636
-     * @access public
637
-     * @param \EE_Registration $item
638
-     * @return string
639
-     */
640
-    public function column__REG_count(EE_Registration $item)
641
-    {
642
-        return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
643
-    }
644
-
645
-
646
-
647
-    /**
648
-     * column_PRC_amount
649
-     *
650
-     * @access public
651
-     * @param \EE_Registration $item
652
-     * @return string
653
-     */
654
-    public function column_PRC_amount(EE_Registration $item)
655
-    {
656
-        $ticket = $item->ticket();
657
-        $content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
658
-                                                                              . $ticket->name()
659
-                                                                              . '</span><br />' : '';
660
-        if ($item->final_price() > 0) {
661
-            $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
662
-        } else {
663
-            // free event
664
-            $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
665
-                        . __('free', 'event_espresso')
666
-                        . '</span>';
667
-        }
668
-        return $content;
669
-    }
670
-
671
-
672
-
673
-    /**
674
-     * column__REG_final_price
675
-     *
676
-     * @access public
677
-     * @param \EE_Registration $item
678
-     * @return string
679
-     */
680
-    public function column__REG_final_price(EE_Registration $item)
681
-    {
682
-        $ticket = $item->ticket();
683
-        $content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
684
-            ? ''
685
-            : '<span class="TKT_name">'
686
-              . $ticket->name()
687
-              . '</span><br />';
688
-        $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
689
-        return $content;
690
-    }
691
-
692
-
693
-
694
-    /**
695
-     * column__REG_paid
696
-     *
697
-     * @access public
698
-     * @param \EE_Registration $item
699
-     * @return string
700
-     */
701
-    public function column__REG_paid(EE_Registration $item)
702
-    {
703
-        $payment_method = $item->payment_method();
704
-        $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
705
-            : __('Unknown', 'event_espresso');
706
-        $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
707
-        if ($item->paid() > 0) {
708
-            $content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
709
-                    $payment_method_name) . '</span>';
710
-        }
711
-        return $content;
712
-    }
713
-
714
-
715
-
716
-    /**
717
-     * column_TXN_total
718
-     *
719
-     * @access public
720
-     * @param \EE_Registration $item
721
-     * @return string
722
-     * @throws \EE_Error
723
-     */
724
-    public function column_TXN_total(EE_Registration $item)
725
-    {
726
-        if ($item->transaction()) {
727
-            $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
728
-                'action' => 'view_transaction',
729
-                'TXN_ID' => $item->transaction_ID(),
730
-            ), TXN_ADMIN_URL);
731
-            return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
732
-                'espresso_transactions_view_transaction', $item->transaction_ID())
733
-                ? '<span class="reg-pad-rght"><a class="status-'
734
-                  . $item->transaction()->status_ID()
735
-                  . '" href="'
736
-                  . $view_txn_lnk_url
737
-                  . '"  title="'
738
-                  . esc_attr__('View Transaction', 'event_espresso')
739
-                  . '">'
740
-                  . $item->transaction()->pretty_total()
741
-                  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
742
-        } else {
743
-            return __("None", "event_espresso");
744
-        }
745
-    }
746
-
747
-
748
-
749
-    /**
750
-     * column_TXN_paid
751
-     *
752
-     * @access public
753
-     * @param \EE_Registration $item
754
-     * @return string
755
-     * @throws \EE_Error
756
-     */
757
-    public function column_TXN_paid(EE_Registration $item)
758
-    {
759
-        if ($item->count() === 1) {
760
-            $transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
761
-            if ($transaction->paid() >= $transaction->total()) {
762
-                return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
763
-            } else {
764
-                $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
765
-                    'action' => 'view_transaction',
766
-                    'TXN_ID' => $item->transaction_ID(),
767
-                ), TXN_ADMIN_URL);
768
-                return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
769
-                    'espresso_transactions_view_transaction', $item->transaction_ID())
770
-                    ? '<span class="reg-pad-rght"><a class="status-'
771
-                      . $transaction->status_ID()
772
-                      . '" href="'
773
-                      . $view_txn_lnk_url
774
-                      . '"  title="'
775
-                      . esc_attr__('View Transaction', 'event_espresso')
776
-                      . '">'
777
-                      . $item->transaction()->pretty_paid()
778
-                      . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
779
-            }
780
-        }
781
-        return '&nbsp;';
782
-    }
783
-
784
-
785
-
786
-    /**
787
-     * column_actions
788
-     *
789
-     * @access public
790
-     * @param \EE_Registration $item
791
-     * @return string
792
-     * @throws \EE_Error
793
-     */
794
-    public function column_actions(EE_Registration $item)
795
-    {
796
-        $actions = array();
797
-        $attendee = $item->attendee();
798
-        $this->_set_related_details($item);
799
-        //Build row actions
800
-        $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
801
-            'action'  => 'view_registration',
802
-            '_REG_ID' => $item->ID(),
803
-        ), REG_ADMIN_URL);
804
-        $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
805
-            'action' => 'edit_attendee',
806
-            'post'   => $item->attendee_ID(),
807
-        ), REG_ADMIN_URL);
808
-        // page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
809
-        //$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
810
-        $resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
811
-            'action'  => 'resend_registration',
812
-            '_REG_ID' => $item->ID(),
813
-        ), REG_ADMIN_URL, true);
814
-        //Build row actions
815
-        $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
816
-            'espresso_registrations_view_registration', $item->ID()) ? '
29
+	private $_status;
30
+
31
+
32
+
33
+	/**
34
+	 * An array of transaction details for the related transaction to the registration being processed.
35
+	 * This is set via the _set_related_details method.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $_transaction_details = array();
40
+
41
+
42
+
43
+	/**
44
+	 * An array of event details for the related event to the registration being processed.
45
+	 * This is set via the _set_related_details method.
46
+	 *
47
+	 * @var array
48
+	 */
49
+	protected $_event_details = array();
50
+
51
+
52
+
53
+	/**
54
+	 * @param \Registrations_Admin_Page $admin_page
55
+	 */
56
+	public function __construct(Registrations_Admin_Page $admin_page)
57
+	{
58
+		if ( ! empty($_GET['event_id'])) {
59
+			$extra_query_args = array();
60
+			foreach ($admin_page->get_views() as $key => $view_details) {
61
+				$extra_query_args[$view_details['slug']] = array('event_id' => $_GET['event_id']);
62
+			}
63
+			$this->_views = $admin_page->get_list_table_view_RLs($extra_query_args);
64
+		}
65
+		parent::__construct($admin_page);
66
+		$this->_status = $this->_admin_page->get_registration_status_array();
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 *    _setup_data
73
+	 *
74
+	 * @access protected
75
+	 * @return void
76
+	 */
77
+	protected function _setup_data()
78
+	{
79
+		$this->_data = $this->_admin_page->get_registrations($this->_per_page);
80
+		$this->_all_data_count = $this->_admin_page->get_registrations($this->_per_page, true, false, false);
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 *    _set_properties
87
+	 *
88
+	 * @access protected
89
+	 * @return void
90
+	 */
91
+	protected function _set_properties()
92
+	{
93
+		$this->_wp_list_args = array(
94
+			'singular' => __('registration', 'event_espresso'),
95
+			'plural'   => __('registrations', 'event_espresso'),
96
+			'ajax'     => true,
97
+			'screen'   => $this->_admin_page->get_current_screen()->id,
98
+		);
99
+		$ID_column_name = __('ID', 'event_espresso');
100
+		$ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">';
101
+		$ID_column_name .= __('Registrant Name', 'event_espresso');
102
+		$ID_column_name .= '</span> ';
103
+		if (isset($_GET['event_id'])) {
104
+			$this->_columns = array(
105
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
106
+				'_REG_ID'          => $ID_column_name,
107
+				'ATT_fname'        => __('Name', 'event_espresso'),
108
+				'ATT_email'        => __('Email', 'event_espresso'),
109
+				'_REG_date'        => __('Reg Date', 'event_espresso'),
110
+				'PRC_amount'       => __('TKT Price', 'event_espresso'),
111
+				'_REG_final_price' => __('Final Price', 'event_espresso'),
112
+				'TXN_total'        => __('Total Txn', 'event_espresso'),
113
+				'TXN_paid'         => __('Paid', 'event_espresso'),
114
+				'actions'          => __('Actions', 'event_espresso'),
115
+			);
116
+			$this->_bottom_buttons = array(
117
+				'report' => array(
118
+					'route'         => 'registrations_report',
119
+					'extra_request' => array(
120
+						'EVT_ID'     => isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : null,
121
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
122
+					),
123
+				),
124
+			);
125
+		} else {
126
+			$this->_columns = array(
127
+				'cb'               => '<input type="checkbox" />', //Render a checkbox instead of text
128
+				'_REG_ID'          => $ID_column_name,
129
+				'ATT_fname'        => __('Name', 'event_espresso'),
130
+				'_REG_date'        => __('TXN Date', 'event_espresso'),
131
+				'event_name'       => __('Event', 'event_espresso'),
132
+				'DTT_EVT_start'    => __('Event Date', 'event_espresso'),
133
+				'_REG_final_price' => __('Price', 'event_espresso'),
134
+				'_REG_paid'        => __('Paid', 'event_espresso'),
135
+				'actions'          => __('Actions', 'event_espresso'),
136
+			);
137
+			$this->_bottom_buttons = array(
138
+				'report_all' => array(
139
+					'route'         => 'registrations_report',
140
+					'extra_request' => array(
141
+						'return_url' => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
142
+					),
143
+				),
144
+			);
145
+		}
146
+		$this->_bottom_buttons['report_filtered'] = array(
147
+			'route'         => 'registrations_report',
148
+			'extra_request' => array(
149
+				'use_filters' => true,
150
+				'filters'     => array_diff_key($this->_req_data, array_flip(array(
151
+							'page',
152
+							'action',
153
+							'default_nonce',
154
+						))),
155
+				'return_url'  => urlencode("//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"),
156
+			),
157
+		);
158
+		$this->_primary_column = '_REG_ID';
159
+		$this->_sortable_columns = array(
160
+			'_REG_date'     => array('_REG_date' => true),   //true means its already sorted
161
+			/**
162
+			 * Allows users to change the default sort if they wish.
163
+			 * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
164
+			 */
165
+			'ATT_fname'     => array(
166
+					'FHEE__EE_Registrations_List_Table___set_properties__default_sort_by_registration_last_name',
167
+					true,
168
+					$this
169
+				)
170
+				? array('ATT_lname' => false)
171
+				: array('ATT_fname' => false),
172
+			'event_name'    => array('event_name' => false),
173
+			'DTT_EVT_start' => array('DTT_EVT_start' => false),
174
+			'_REG_ID'       => array('_REG_ID' => false),
175
+		);
176
+		$this->_hidden_columns = array();
177
+	}
178
+
179
+
180
+
181
+	/**
182
+	 * This simply sets up the row class for the table rows.
183
+	 * Allows for easier overriding of child methods for setting up sorting.
184
+	 *
185
+	 * @param  EE_Registration $item the current item
186
+	 * @return string
187
+	 */
188
+	protected function _get_row_class($item)
189
+	{
190
+		$class = parent::_get_row_class($item);
191
+		//add status class
192
+		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
193
+		if ($this->_has_checkbox_column) {
194
+			$class .= ' has-checkbox-column';
195
+		}
196
+		return $class;
197
+	}
198
+
199
+
200
+
201
+	/**
202
+	 * Set the $_transaction_details property if not set yet.
203
+	 *
204
+	 * @param EE_Registration $registration
205
+	 * @throws \EE_Error
206
+	 */
207
+	protected function _set_related_details(EE_Registration $registration)
208
+	{
209
+		$transaction = $registration->get_first_related('Transaction');
210
+		$status = $transaction instanceof EE_Transaction ? $transaction->status_ID()
211
+			: EEM_Transaction::failed_status_code;
212
+		$this->_transaction_details = array(
213
+			'transaction' => $transaction,
214
+			'status'      => $status,
215
+			'id'          => $transaction instanceof EE_Transaction ? $transaction->ID() : 0,
216
+			'title_attr'  => sprintf(__('View Transaction Details (%s)', 'event_espresso'),
217
+				EEH_Template::pretty_status($status, false, 'sentence')),
218
+		);
219
+		try {
220
+			$event = $registration->event();
221
+		} catch (\EventEspresso\core\exceptions\EntityNotFoundException $e) {
222
+			$event = null;
223
+		}
224
+		$status = $event instanceof EE_Event ? $event->get_active_status() : EE_Datetime::inactive;
225
+		$this->_event_details = array(
226
+			'event'      => $event,
227
+			'status'     => $status,
228
+			'id'         => $event instanceof EE_Event ? $event->ID() : 0,
229
+			'title_attr' => sprintf(__('Edit Event (%s)', 'event_espresso'),
230
+				EEH_Template::pretty_status($status, false, 'sentence')),
231
+		);
232
+	}
233
+
234
+
235
+
236
+	/**
237
+	 *    _get_table_filters
238
+	 *
239
+	 * @access protected
240
+	 * @return array
241
+	 */
242
+	protected function _get_table_filters()
243
+	{
244
+		$filters = array();
245
+		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
246
+		$cur_date = isset($this->_req_data['month_range']) ? $this->_req_data['month_range'] : '';
247
+		$cur_category = isset($this->_req_data['EVT_CAT']) ? $this->_req_data['EVT_CAT'] : -1;
248
+		$reg_status = isset($this->_req_data['_reg_status']) ? $this->_req_data['_reg_status'] : '';
249
+		$filters[] = EEH_Form_Fields::generate_registration_months_dropdown($cur_date, $reg_status, $cur_category);
250
+		$filters[] = EEH_Form_Fields::generate_event_category_dropdown($cur_category);
251
+		$status = array();
252
+		$status[] = array('id' => 0, 'text' => __('Select Status', 'event_espresso'));
253
+		foreach ($this->_status as $key => $value) {
254
+			$status[] = array('id' => $key, 'text' => $value);
255
+		}
256
+		if ($this->_view !== 'incomplete') {
257
+			$filters[] = EEH_Form_Fields::select_input('_reg_status', $status,
258
+				isset($this->_req_data['_reg_status']) ? strtoupper(sanitize_key($this->_req_data['_reg_status']))
259
+					: '');
260
+		}
261
+		if (isset($this->_req_data['event_id'])) {
262
+			$filters[] = EEH_Form_Fields::hidden_input('event_id', $this->_req_data['event_id'], 'reg_event_id');
263
+		}
264
+		return $filters;
265
+	}
266
+
267
+
268
+
269
+	/**
270
+	 *    _add_view_counts
271
+	 *
272
+	 * @access protected
273
+	 * @return void
274
+	 * @throws \EE_Error
275
+	 */
276
+	protected function _add_view_counts()
277
+	{
278
+		$this->_views['all']['count'] = $this->_total_registrations();
279
+		$this->_views['month']['count'] = $this->_total_registrations_this_month();
280
+		$this->_views['today']['count'] = $this->_total_registrations_today();
281
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations',
282
+			'espresso_registrations_trash_registrations')
283
+		) {
284
+			$this->_views['incomplete']['count'] = $this->_total_registrations('incomplete');
285
+			$this->_views['trash']['count'] = $this->_total_registrations('trash');
286
+		}
287
+	}
288
+
289
+
290
+
291
+	/**
292
+	 * _total_registrations
293
+	 *
294
+	 * @access protected
295
+	 * @param string $view
296
+	 * @return int
297
+	 * @throws \EE_Error
298
+	 */
299
+	protected function _total_registrations($view = '')
300
+	{
301
+		$_where = array();
302
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
303
+		if ($EVT_ID) {
304
+			$_where['EVT_ID'] = $EVT_ID;
305
+		}
306
+		switch ($view) {
307
+			case 'trash' :
308
+				return EEM_Registration::instance()->count_deleted(array($_where));
309
+				break;
310
+			case 'incomplete' :
311
+				$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
312
+				break;
313
+			default :
314
+				$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
315
+		}
316
+		return EEM_Registration::instance()->count(array($_where));
317
+	}
318
+
319
+
320
+
321
+	/**
322
+	 * _total_registrations_this_month
323
+	 *
324
+	 * @access protected
325
+	 * @return int
326
+	 * @throws \EE_Error
327
+	 */
328
+	protected function _total_registrations_this_month()
329
+	{
330
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
331
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
332
+		$this_year_r = date('Y', current_time('timestamp'));
333
+		$time_start = ' 00:00:00';
334
+		$time_end = ' 23:59:59';
335
+		$this_month_r = date('m', current_time('timestamp'));
336
+		$days_this_month = date('t', current_time('timestamp'));
337
+		//setup date query.
338
+		$beginning_string = EEM_Registration::instance()
339
+											->convert_datetime_for_query('REG_date',
340
+												$this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
341
+												'Y-m-d H:i:s');
342
+		$end_string = EEM_Registration::instance()
343
+									  ->convert_datetime_for_query('REG_date',
344
+										  $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
345
+										  'Y-m-d H:i:s');
346
+		$_where['REG_date'] = array(
347
+			'BETWEEN',
348
+			array(
349
+				$beginning_string,
350
+				$end_string,
351
+			),
352
+		);
353
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
354
+		return EEM_Registration::instance()->count(array($_where));
355
+	}
356
+
357
+
358
+
359
+	/**
360
+	 * _total_registrations_today
361
+	 *
362
+	 * @access protected
363
+	 * @return int
364
+	 * @throws \EE_Error
365
+	 */
366
+	protected function _total_registrations_today()
367
+	{
368
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : false;
369
+		$_where = $EVT_ID ? array('EVT_ID' => $EVT_ID) : array();
370
+		$current_date = date('Y-m-d', current_time('timestamp'));
371
+		$time_start = ' 00:00:00';
372
+		$time_end = ' 23:59:59';
373
+		$_where['REG_date'] = array(
374
+			'BETWEEN',
375
+			array(
376
+				EEM_Registration::instance()
377
+								->convert_datetime_for_query('REG_date', $current_date . $time_start, 'Y-m-d H:i:s'),
378
+				EEM_Registration::instance()
379
+								->convert_datetime_for_query('REG_date', $current_date . $time_end, 'Y-m-d H:i:s'),
380
+			),
381
+		);
382
+		$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
383
+		return EEM_Registration::instance()->count(array($_where));
384
+	}
385
+
386
+
387
+
388
+	/**
389
+	 * column_cb
390
+	 *
391
+	 * @access public
392
+	 * @param \EE_Registration $item
393
+	 * @return string
394
+	 * @throws \EE_Error
395
+	 */
396
+	public function column_cb($item)
397
+	{
398
+		/** checkbox/lock **/
399
+		$transaction = $item->get_first_related('Transaction');
400
+		$payment_count = $transaction instanceof EE_Transaction ? $transaction->count_related('Payment') : 0;
401
+		return $payment_count > 0 ? sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID())
402
+									. '<span class="ee-lock-icon"></span>'
403
+			: sprintf('<input type="checkbox" name="_REG_ID[]" value="%1$s" />', $item->ID());
404
+	}
405
+
406
+
407
+
408
+	/**
409
+	 * column__REG_ID
410
+	 *
411
+	 * @access public
412
+	 * @param \EE_Registration $item
413
+	 * @return string
414
+	 * @throws \EE_Error
415
+	 */
416
+	public function column__REG_ID(EE_Registration $item)
417
+	{
418
+		$attendee = $item->attendee();
419
+		$content = $item->ID();
420
+		$content .= '<div class="show-on-mobile-view-only">';
421
+		$content .= '<br>';
422
+		$content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
423
+		$content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
424
+		$content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
425
+		$content .= '</div>';
426
+		return $content;
427
+	}
428
+
429
+
430
+
431
+	/**
432
+	 * column__REG_date
433
+	 *
434
+	 * @access public
435
+	 * @param \EE_Registration $item
436
+	 * @return string
437
+	 * @throws \EE_Error
438
+	 */
439
+	public function column__REG_date(EE_Registration $item)
440
+	{
441
+		$this->_set_related_details($item);
442
+		//Build row actions
443
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
444
+			'action' => 'view_transaction',
445
+			'TXN_ID' => $this->_transaction_details['id'],
446
+		), TXN_ADMIN_URL);
447
+		$view_link = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
448
+			'espresso_transactions_view_transaction') ? '<a class="ee-status-color-'
449
+														. $this->_transaction_details['status']
450
+														. '" href="'
451
+														. $view_lnk_url
452
+														. '" title="'
453
+														. esc_attr($this->_transaction_details['title_attr'])
454
+														. '">'
455
+														. $item->get_i18n_datetime('REG_date')
456
+														. '</a>' : $item->get_i18n_datetime('REG_date');
457
+		$view_link .= '<br><span class="ee-status-text-small">'
458
+					  . EEH_Template::pretty_status($this->_transaction_details['status'], false, 'sentence')
459
+					  . '</span>';
460
+		return $view_link;
461
+	}
462
+
463
+
464
+
465
+	/**
466
+	 * column_event_name
467
+	 *
468
+	 * @access public
469
+	 * @param \EE_Registration $item
470
+	 * @return string
471
+	 * @throws \EE_Error
472
+	 */
473
+	public function column_event_name(EE_Registration $item)
474
+	{
475
+		$this->_set_related_details($item);
476
+		// page=espresso_events&action=edit_event&EVT_ID=2&edit_event_nonce=cf3a7e5b62
477
+		$EVT_ID = $item->event_ID();
478
+		$event_name = $item->event_name();
479
+		$event_name = $event_name ? $event_name : __("No Associated Event", 'event_espresso');
480
+		$event_name = wp_trim_words($event_name, 30, '...');
481
+		if ($EVT_ID) {
482
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $EVT_ID),
483
+				EVENTS_ADMIN_URL);
484
+			$edit_event = EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'edit_event', $EVT_ID)
485
+				? '<a class="ee-status-color-'
486
+				  . $this->_event_details['status']
487
+				  . '" href="'
488
+				  . $edit_event_url
489
+				  . '" title="'
490
+				  . esc_attr($this->_event_details['title_attr'])
491
+				  . '">'
492
+				  . $event_name
493
+				  . '</a>' : $event_name;
494
+			$edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
495
+			$actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
496
+			$actions['event_filter'] .= sprintf(esc_attr__('Filter this list to only show registrations for %s',
497
+				'event_espresso'), $event_name);
498
+			$actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
499
+		} else {
500
+			$edit_event = $event_name;
501
+			$actions['event_filter'] = '';
502
+		}
503
+		return sprintf('%1$s %2$s', $edit_event, $this->row_actions($actions));
504
+	}
505
+
506
+
507
+
508
+	/**
509
+	 * column_DTT_EVT_start
510
+	 *
511
+	 * @access public
512
+	 * @param \EE_Registration $item
513
+	 * @return string
514
+	 * @throws \EE_Error
515
+	 */
516
+	public function column_DTT_EVT_start(EE_Registration $item)
517
+	{
518
+		$datetime_strings = array();
519
+		$ticket = $item->ticket(true);
520
+		if ($ticket instanceof EE_Ticket) {
521
+			$remove_defaults = array('default_where_conditions' => 'none');
522
+			$datetimes = $ticket->datetimes($remove_defaults);
523
+			foreach ($datetimes as $datetime) {
524
+				$datetime_strings[] = $datetime->get_i18n_datetime('DTT_EVT_start');
525
+			}
526
+			return implode("<br />", $datetime_strings);
527
+		} else {
528
+			return __('There is no ticket on this registration', 'event_espresso');
529
+		}
530
+	}
531
+
532
+
533
+
534
+	/**
535
+	 * column_ATT_fname
536
+	 *
537
+	 * @access public
538
+	 * @param \EE_Registration $item
539
+	 * @return string
540
+	 * @throws \EE_Error
541
+	 */
542
+	public function column_ATT_fname(EE_Registration $item)
543
+	{
544
+		$attendee = $item->attendee();
545
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
546
+			'action'  => 'view_registration',
547
+			'_REG_ID' => $item->ID(),
548
+		), REG_ADMIN_URL);
549
+		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
550
+		$link = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
551
+			'espresso_registrations_view_registration', $item->ID()) ? '<a href="'
552
+																	   . $edit_lnk_url
553
+																	   . '" title="'
554
+																	   . esc_attr__('View Registration Details',
555
+				'event_espresso')
556
+																	   . '">'
557
+																	   . $attendee_name
558
+																	   . '</a>' : $attendee_name;
559
+		$link .= $item->count() === 1
560
+			? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>' : '';
561
+		$t = $item->get_first_related('Transaction');
562
+		$payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
563
+		//append group count to name
564
+		$link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
565
+		//append reg_code
566
+		$link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
567
+		//reg status text for accessibility
568
+		$link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
569
+				'sentence') . '</span>';
570
+		//trash/restore/delete actions
571
+		$actions = array();
572
+		if ($this->_view !== 'trash'
573
+			&& $payment_count === 0
574
+			&& EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
575
+				'espresso_registrations_trash_registrations', $item->ID())
576
+		) {
577
+			$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
578
+				'action'  => 'trash_registrations',
579
+				'_REG_ID' => $item->ID(),
580
+			), REG_ADMIN_URL);
581
+			$actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration',
582
+					'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
583
+		} elseif ($this->_view === 'trash') {
584
+			// restore registration link
585
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
586
+				'espresso_registrations_restore_registrations', $item->ID())
587
+			) {
588
+				$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
589
+					'action'  => 'restore_registrations',
590
+					'_REG_ID' => $item->ID(),
591
+				), REG_ADMIN_URL);
592
+				$actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration',
593
+						'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
594
+			}
595
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
596
+				'espresso_registrations_ee_delete_registrations', $item->ID())
597
+			) {
598
+				$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
599
+					'action'  => 'delete_registrations',
600
+					'_REG_ID' => $item->ID(),
601
+				), REG_ADMIN_URL);
602
+				$actions['delete'] = '<a href="'
603
+									 . $delete_lnk_url
604
+									 . '" title="'
605
+									 . esc_attr__('Delete Registration Permanently', 'event_espresso')
606
+									 . '">'
607
+									 . __('Delete', 'event_espresso')
608
+									 . '</a>';
609
+			}
610
+		}
611
+		return sprintf('%1$s %2$s', $link, $this->row_actions($actions));
612
+	}
613
+
614
+
615
+
616
+	/**
617
+	 * column_ATT_email
618
+	 *
619
+	 * @access public
620
+	 * @param \EE_Registration $item
621
+	 * @return string
622
+	 * @throws \EE_Error
623
+	 */
624
+	public function column_ATT_email(EE_Registration $item)
625
+	{
626
+		$attendee = $item->get_first_related('Attendee');
627
+		return ! $attendee instanceof EE_Attendee ? __('No attached contact record.', 'event_espresso')
628
+			: $attendee->email();
629
+	}
630
+
631
+
632
+
633
+	/**
634
+	 * column__REG_count
635
+	 *
636
+	 * @access public
637
+	 * @param \EE_Registration $item
638
+	 * @return string
639
+	 */
640
+	public function column__REG_count(EE_Registration $item)
641
+	{
642
+		return sprintf(__('%1$s / %2$s', 'event_espresso'), $item->count(), $item->group_size());
643
+	}
644
+
645
+
646
+
647
+	/**
648
+	 * column_PRC_amount
649
+	 *
650
+	 * @access public
651
+	 * @param \EE_Registration $item
652
+	 * @return string
653
+	 */
654
+	public function column_PRC_amount(EE_Registration $item)
655
+	{
656
+		$ticket = $item->ticket();
657
+		$content = isset($_GET['event_id']) && $ticket instanceof EE_Ticket ? '<span class="TKT_name">'
658
+																			  . $ticket->name()
659
+																			  . '</span><br />' : '';
660
+		if ($item->final_price() > 0) {
661
+			$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
662
+		} else {
663
+			// free event
664
+			$content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
665
+						. __('free', 'event_espresso')
666
+						. '</span>';
667
+		}
668
+		return $content;
669
+	}
670
+
671
+
672
+
673
+	/**
674
+	 * column__REG_final_price
675
+	 *
676
+	 * @access public
677
+	 * @param \EE_Registration $item
678
+	 * @return string
679
+	 */
680
+	public function column__REG_final_price(EE_Registration $item)
681
+	{
682
+		$ticket = $item->ticket();
683
+		$content = isset($_GET['event_id']) || ! $ticket instanceof EE_Ticket
684
+			? ''
685
+			: '<span class="TKT_name">'
686
+			  . $ticket->name()
687
+			  . '</span><br />';
688
+		$content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
689
+		return $content;
690
+	}
691
+
692
+
693
+
694
+	/**
695
+	 * column__REG_paid
696
+	 *
697
+	 * @access public
698
+	 * @param \EE_Registration $item
699
+	 * @return string
700
+	 */
701
+	public function column__REG_paid(EE_Registration $item)
702
+	{
703
+		$payment_method = $item->payment_method();
704
+		$payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
705
+			: __('Unknown', 'event_espresso');
706
+		$content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
707
+		if ($item->paid() > 0) {
708
+			$content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
709
+					$payment_method_name) . '</span>';
710
+		}
711
+		return $content;
712
+	}
713
+
714
+
715
+
716
+	/**
717
+	 * column_TXN_total
718
+	 *
719
+	 * @access public
720
+	 * @param \EE_Registration $item
721
+	 * @return string
722
+	 * @throws \EE_Error
723
+	 */
724
+	public function column_TXN_total(EE_Registration $item)
725
+	{
726
+		if ($item->transaction()) {
727
+			$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
728
+				'action' => 'view_transaction',
729
+				'TXN_ID' => $item->transaction_ID(),
730
+			), TXN_ADMIN_URL);
731
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
732
+				'espresso_transactions_view_transaction', $item->transaction_ID())
733
+				? '<span class="reg-pad-rght"><a class="status-'
734
+				  . $item->transaction()->status_ID()
735
+				  . '" href="'
736
+				  . $view_txn_lnk_url
737
+				  . '"  title="'
738
+				  . esc_attr__('View Transaction', 'event_espresso')
739
+				  . '">'
740
+				  . $item->transaction()->pretty_total()
741
+				  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
742
+		} else {
743
+			return __("None", "event_espresso");
744
+		}
745
+	}
746
+
747
+
748
+
749
+	/**
750
+	 * column_TXN_paid
751
+	 *
752
+	 * @access public
753
+	 * @param \EE_Registration $item
754
+	 * @return string
755
+	 * @throws \EE_Error
756
+	 */
757
+	public function column_TXN_paid(EE_Registration $item)
758
+	{
759
+		if ($item->count() === 1) {
760
+			$transaction = $item->transaction() ? $item->transaction() : EE_Transaction::new_instance();
761
+			if ($transaction->paid() >= $transaction->total()) {
762
+				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
763
+			} else {
764
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
765
+					'action' => 'view_transaction',
766
+					'TXN_ID' => $item->transaction_ID(),
767
+				), TXN_ADMIN_URL);
768
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
769
+					'espresso_transactions_view_transaction', $item->transaction_ID())
770
+					? '<span class="reg-pad-rght"><a class="status-'
771
+					  . $transaction->status_ID()
772
+					  . '" href="'
773
+					  . $view_txn_lnk_url
774
+					  . '"  title="'
775
+					  . esc_attr__('View Transaction', 'event_espresso')
776
+					  . '">'
777
+					  . $item->transaction()->pretty_paid()
778
+					  . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
779
+			}
780
+		}
781
+		return '&nbsp;';
782
+	}
783
+
784
+
785
+
786
+	/**
787
+	 * column_actions
788
+	 *
789
+	 * @access public
790
+	 * @param \EE_Registration $item
791
+	 * @return string
792
+	 * @throws \EE_Error
793
+	 */
794
+	public function column_actions(EE_Registration $item)
795
+	{
796
+		$actions = array();
797
+		$attendee = $item->attendee();
798
+		$this->_set_related_details($item);
799
+		//Build row actions
800
+		$view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
801
+			'action'  => 'view_registration',
802
+			'_REG_ID' => $item->ID(),
803
+		), REG_ADMIN_URL);
804
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
805
+			'action' => 'edit_attendee',
806
+			'post'   => $item->attendee_ID(),
807
+		), REG_ADMIN_URL);
808
+		// page=attendees&event_admin_reports=resend_email&registration_id=43653465634&event_id=2&form_action=resend_email
809
+		//$resend_reg_lnk_url_params = array( 'action'=>'resend_registration', '_REG_ID'=>$item->REG_ID );
810
+		$resend_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
811
+			'action'  => 'resend_registration',
812
+			'_REG_ID' => $item->ID(),
813
+		), REG_ADMIN_URL, true);
814
+		//Build row actions
815
+		$actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
816
+			'espresso_registrations_view_registration', $item->ID()) ? '
817 817
 			<li>
818 818
 			<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '" class="tiny-text">
819 819
 				<div class="dashicons dashicons-clipboard"></div>
820 820
 			</a>
821 821
 			</li>' : '';
822
-        $actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts',
823
-            'espresso_registrations_edit_attendee')
824
-                               && $attendee instanceof EE_Attendee ? '
822
+		$actions['edit_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts',
823
+			'espresso_registrations_edit_attendee')
824
+							   && $attendee instanceof EE_Attendee ? '
825 825
 			<li>
826 826
 			<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
827 827
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
828 828
 			</a>
829 829
 			</li>' : '';
830
-        $actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
831
-                                     && EE_Registry::instance()->CAP->current_user_can('ee_send_message',
832
-            'espresso_registrations_resend_registration', $item->ID()) ? '
830
+		$actions['resend_reg_lnk'] = $attendee instanceof EE_Attendee
831
+									 && EE_Registry::instance()->CAP->current_user_can('ee_send_message',
832
+			'espresso_registrations_resend_registration', $item->ID()) ? '
833 833
 			<li>
834 834
 			<a href="'
835
-                                                                         . $resend_reg_lnk_url
836
-                                                                         . '" title="'
837
-                                                                         . esc_attr__('Resend Registration Details',
838
-                'event_espresso')
839
-                                                                         . '" class="tiny-text">
835
+																		 . $resend_reg_lnk_url
836
+																		 . '" title="'
837
+																		 . esc_attr__('Resend Registration Details',
838
+				'event_espresso')
839
+																		 . '" class="tiny-text">
840 840
 				<div class="dashicons dashicons-email-alt"></div>
841 841
 			</a>
842 842
 			</li>' : '';
843
-        // page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
844
-        $view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
845
-            'action' => 'view_transaction',
846
-            'TXN_ID' => $this->_transaction_details['id'],
847
-        ), TXN_ADMIN_URL);
848
-        $actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
849
-            'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
843
+		// page=transactions&action=view_transaction&txn=256&_wpnonce=6414da4dbb
844
+		$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
845
+			'action' => 'view_transaction',
846
+			'TXN_ID' => $this->_transaction_details['id'],
847
+		), TXN_ADMIN_URL);
848
+		$actions['view_txn_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_transaction',
849
+			'espresso_transactions_view_transaction', $this->_transaction_details['id']) ? '
850 850
 			<li>
851 851
 			<a class="ee-status-color-'
852
-                                                                                           . $this->_transaction_details['status']
853
-                                                                                           . ' tiny-text" href="'
854
-                                                                                           . $view_txn_lnk_url
855
-                                                                                           . '"  title="'
856
-                                                                                           . $this->_transaction_details['title_attr']
857
-                                                                                           . '">
852
+																						   . $this->_transaction_details['status']
853
+																						   . ' tiny-text" href="'
854
+																						   . $view_txn_lnk_url
855
+																						   . '"  title="'
856
+																						   . $this->_transaction_details['title_attr']
857
+																						   . '">
858 858
 				<div class="dashicons dashicons-cart"></div>
859 859
 			</a>
860 860
 			</li>' : '';
861
-        //invoice link
862
-        $actions['dl_invoice_lnk'] = '';
863
-        $dl_invoice_lnk_url = $item->invoice_url();
864
-        //only show invoice link if message type is active.
865
-        if ($attendee instanceof EE_Attendee
866
-            && $item->is_primary_registrant()
867
-            && EEH_MSG_Template::is_mt_active('invoice')
868
-        ) {
869
-            $actions['dl_invoice_lnk'] = '
861
+		//invoice link
862
+		$actions['dl_invoice_lnk'] = '';
863
+		$dl_invoice_lnk_url = $item->invoice_url();
864
+		//only show invoice link if message type is active.
865
+		if ($attendee instanceof EE_Attendee
866
+			&& $item->is_primary_registrant()
867
+			&& EEH_MSG_Template::is_mt_active('invoice')
868
+		) {
869
+			$actions['dl_invoice_lnk'] = '
870 870
 		<li>
871 871
 			<a title="'
872
-                                         . esc_attr__('View Transaction Invoice', 'event_espresso')
873
-                                         . '" target="_blank" href="'
874
-                                         . $dl_invoice_lnk_url
875
-                                         . '" class="tiny-text">
872
+										 . esc_attr__('View Transaction Invoice', 'event_espresso')
873
+										 . '" target="_blank" href="'
874
+										 . $dl_invoice_lnk_url
875
+										 . '" class="tiny-text">
876 876
 				<span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span>
877 877
 			</a>
878 878
 		</li>';
879
-        }
880
-        $actions['filtered_messages_link'] = '';
881
-        //message list table link (filtered by REG_ID
882
-        if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
883
-            $actions['filtered_messages_link'] = '<li>'
884
-                                                 . EEH_MSG_Template::get_message_action_link('see_notifications_for',
885
-                    null, array(
886
-                        '_REG_ID' => $item->ID(),
887
-                    ))
888
-                                                 . '</li>';
889
-        }
890
-        $actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
891
-        return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
892
-    }
879
+		}
880
+		$actions['filtered_messages_link'] = '';
881
+		//message list table link (filtered by REG_ID
882
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
883
+			$actions['filtered_messages_link'] = '<li>'
884
+												 . EEH_MSG_Template::get_message_action_link('see_notifications_for',
885
+					null, array(
886
+						'_REG_ID' => $item->ID(),
887
+					))
888
+												 . '</li>';
889
+		}
890
+		$actions = apply_filters('FHEE__EE_Registrations_List_Table__column_actions__actions', $actions, $item, $this);
891
+		return $this->_action_string(implode('', $actions), $item, 'ul', 'reg-overview-actions-ul');
892
+	}
893 893
 
894 894
 }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         );
158 158
         $this->_primary_column = '_REG_ID';
159 159
         $this->_sortable_columns = array(
160
-            '_REG_date'     => array('_REG_date' => true),   //true means its already sorted
160
+            '_REG_date'     => array('_REG_date' => true), //true means its already sorted
161 161
             /**
162 162
              * Allows users to change the default sort if they wish.
163 163
              * Returning a falsey on this filter will result in the default sort to be by firstname rather than last name.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     {
190 190
         $class = parent::_get_row_class($item);
191 191
         //add status class
192
-        $class .= ' ee-status-strip reg-status-' . $item->status_ID();
192
+        $class .= ' ee-status-strip reg-status-'.$item->status_ID();
193 193
         if ($this->_has_checkbox_column) {
194 194
             $class .= ' has-checkbox-column';
195 195
         }
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
         //setup date query.
338 338
         $beginning_string = EEM_Registration::instance()
339 339
                                             ->convert_datetime_for_query('REG_date',
340
-                                                $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start,
340
+                                                $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start,
341 341
                                                 'Y-m-d H:i:s');
342 342
         $end_string = EEM_Registration::instance()
343 343
                                       ->convert_datetime_for_query('REG_date',
344
-                                          $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end,
344
+                                          $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end,
345 345
                                           'Y-m-d H:i:s');
346 346
         $_where['REG_date'] = array(
347 347
             'BETWEEN',
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
             'BETWEEN',
375 375
             array(
376 376
                 EEM_Registration::instance()
377
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_start, 'Y-m-d H:i:s'),
377
+                                ->convert_datetime_for_query('REG_date', $current_date.$time_start, 'Y-m-d H:i:s'),
378 378
                 EEM_Registration::instance()
379
-                                ->convert_datetime_for_query('REG_date', $current_date . $time_end, 'Y-m-d H:i:s'),
379
+                                ->convert_datetime_for_query('REG_date', $current_date.$time_end, 'Y-m-d H:i:s'),
380 380
             ),
381 381
         );
382 382
         $_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
         $content .= '<div class="show-on-mobile-view-only">';
421 421
         $content .= '<br>';
422 422
         $content .= $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
423
-        $content .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
424
-        $content .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
423
+        $content .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
424
+        $content .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
425 425
         $content .= '</div>';
426 426
         return $content;
427 427
     }
@@ -492,10 +492,10 @@  discard block
 block discarded – undo
492 492
                   . $event_name
493 493
                   . '</a>' : $event_name;
494 494
             $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('event_id' => $EVT_ID), REG_ADMIN_URL);
495
-            $actions['event_filter'] = '<a href="' . $edit_event_url . '" title="';
495
+            $actions['event_filter'] = '<a href="'.$edit_event_url.'" title="';
496 496
             $actions['event_filter'] .= sprintf(esc_attr__('Filter this list to only show registrations for %s',
497 497
                 'event_espresso'), $event_name);
498
-            $actions['event_filter'] .= '">' . __('View Registrations', 'event_espresso') . '</a>';
498
+            $actions['event_filter'] .= '">'.__('View Registrations', 'event_espresso').'</a>';
499 499
         } else {
500 500
             $edit_event = $event_name;
501 501
             $actions['event_filter'] = '';
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
         $t = $item->get_first_related('Transaction');
562 562
         $payment_count = $t instanceof EE_Transaction ? $t->count_related('Payment') : 0;
563 563
         //append group count to name
564
-        $link .= '&nbsp;' . sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
564
+        $link .= '&nbsp;'.sprintf(__('(%1$s / %2$s)', 'event_espresso'), $item->count(), $item->group_size());
565 565
         //append reg_code
566
-        $link .= '<br>' . sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
566
+        $link .= '<br>'.sprintf(__('Reg Code: %s', 'event_espresso'), $item->get('REG_code'));
567 567
         //reg status text for accessibility
568
-        $link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status($item->status_ID(), false,
569
-                'sentence') . '</span>';
568
+        $link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false,
569
+                'sentence').'</span>';
570 570
         //trash/restore/delete actions
571 571
         $actions = array();
572 572
         if ($this->_view !== 'trash'
@@ -578,8 +578,8 @@  discard block
 block discarded – undo
578 578
                 'action'  => 'trash_registrations',
579 579
                 '_REG_ID' => $item->ID(),
580 580
             ), REG_ADMIN_URL);
581
-            $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Trash Registration',
582
-                    'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
581
+            $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Trash Registration',
582
+                    'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
583 583
         } elseif ($this->_view === 'trash') {
584 584
             // restore registration link
585 585
             if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
                     'action'  => 'restore_registrations',
590 590
                     '_REG_ID' => $item->ID(),
591 591
                 ), REG_ADMIN_URL);
592
-                $actions['restore'] = '<a href="' . $restore_lnk_url . '" title="' . esc_attr__('Restore Registration',
593
-                        'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
592
+                $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Registration',
593
+                        'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
594 594
             }
595 595
             if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registration',
596 596
                 'espresso_registrations_ee_delete_registrations', $item->ID())
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
                                                                               . $ticket->name()
659 659
                                                                               . '</span><br />' : '';
660 660
         if ($item->final_price() > 0) {
661
-            $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
661
+            $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
662 662
         } else {
663 663
             // free event
664 664
             $content .= '<span class="reg-overview-free-event-spn reg-pad-rght">'
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
             : '<span class="TKT_name">'
686 686
               . $ticket->name()
687 687
               . '</span><br />';
688
-        $content .= '<span class="reg-pad-rght">' . $item->pretty_final_price() . '</span>';
688
+        $content .= '<span class="reg-pad-rght">'.$item->pretty_final_price().'</span>';
689 689
         return $content;
690 690
     }
691 691
 
@@ -703,10 +703,10 @@  discard block
 block discarded – undo
703 703
         $payment_method = $item->payment_method();
704 704
         $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name()
705 705
             : __('Unknown', 'event_espresso');
706
-        $content = '<span class="reg-pad-rght">' . $item->pretty_paid() . '</span>';
706
+        $content = '<span class="reg-pad-rght">'.$item->pretty_paid().'</span>';
707 707
         if ($item->paid() > 0) {
708
-            $content .= '<br><span class="ee-status-text-small">' . sprintf(__('...via %s', 'event_espresso'),
709
-                    $payment_method_name) . '</span>';
708
+            $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'),
709
+                    $payment_method_name).'</span>';
710 710
         }
711 711
         return $content;
712 712
     }
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
                   . esc_attr__('View Transaction', 'event_espresso')
739 739
                   . '">'
740 740
                   . $item->transaction()->pretty_total()
741
-                  . '</a></span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_total() . '</span>';
741
+                  . '</a></span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_total().'</span>';
742 742
         } else {
743 743
             return __("None", "event_espresso");
744 744
         }
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
                       . esc_attr__('View Transaction', 'event_espresso')
776 776
                       . '">'
777 777
                       . $item->transaction()->pretty_paid()
778
-                      . '</a><span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
778
+                      . '</a><span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
779 779
             }
780 780
         }
781 781
         return '&nbsp;';
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
         $actions['view_lnk'] = EE_Registry::instance()->CAP->current_user_can('ee_read_registration',
816 816
             'espresso_registrations_view_registration', $item->ID()) ? '
817 817
 			<li>
818
-			<a href="' . $view_lnk_url . '" title="' . esc_attr__('View Registration Details', 'event_espresso') . '" class="tiny-text">
818
+			<a href="' . $view_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text">
819 819
 				<div class="dashicons dashicons-clipboard"></div>
820 820
 			</a>
821 821
 			</li>' : '';
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
             'espresso_registrations_edit_attendee')
824 824
                                && $attendee instanceof EE_Attendee ? '
825 825
 			<li>
826
-			<a href="' . $edit_lnk_url . '" title="' . esc_attr__('Edit Contact Details', 'event_espresso') . '" class="tiny-text">
826
+			<a href="' . $edit_lnk_url.'" title="'.esc_attr__('Edit Contact Details', 'event_espresso').'" class="tiny-text">
827 827
 				<div class="ee-icon ee-icon-user-edit ee-icon-size-16"></div>
828 828
 			</a>
829 829
 			</li>' : '';
Please login to merge, or discard this patch.
core/EE_Config.core.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      * @param    string         $name
492 492
      * @param    string         $config_class
493 493
      * @param    EE_Config_Base $config_obj
494
-     * @param    array          $tests_to_run
494
+     * @param    integer[]          $tests_to_run
495 495
      * @param    bool           $display_errors
496 496
      * @return    bool    TRUE on success, FALSE on fail
497 497
      */
@@ -1794,7 +1794,7 @@  discard block
 block discarded – undo
1794 1794
 
1795 1795
 
1796 1796
     /**
1797
-     * @return array
1797
+     * @return integer[]
1798 1798
      */
1799 1799
     public function get_critical_pages_array()
1800 1800
     {
@@ -1808,7 +1808,7 @@  discard block
 block discarded – undo
1808 1808
 
1809 1809
 
1810 1810
     /**
1811
-     * @return array
1811
+     * @return string[]
1812 1812
      */
1813 1813
     public function get_critical_pages_shortcodes_array()
1814 1814
     {
@@ -3088,7 +3088,7 @@  discard block
 block discarded – undo
3088 3088
      * according to max_input_vars
3089 3089
      *
3090 3090
      * @param int   $input_count the count of input vars.
3091
-     * @return array {
3091
+     * @return string {
3092 3092
      *                           An array that represents whether available space and if no available space the error
3093 3093
      *                           message.
3094 3094
      * @type bool   $has_space   whether more inputs can be added.
Please login to merge, or discard this patch.
Indentation   +3108 added lines, -3108 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -14,2504 +14,2504 @@  discard block
 block discarded – undo
14 14
 final class EE_Config
15 15
 {
16 16
 
17
-    const OPTION_NAME        = 'ee_config';
17
+	const OPTION_NAME        = 'ee_config';
18
+
19
+	const LOG_NAME           = 'ee_config_log';
20
+
21
+	const LOG_LENGTH         = 100;
22
+
23
+	const ADDON_OPTION_NAMES = 'ee_config_option_names';
24
+
25
+
26
+	/**
27
+	 *    instance of the EE_Config object
28
+	 *
29
+	 * @var    EE_Config $_instance
30
+	 * @access    private
31
+	 */
32
+	private static $_instance;
33
+
34
+	/**
35
+	 * @var boolean $_logging_enabled
36
+	 */
37
+	private static $_logging_enabled = false;
38
+
39
+	/**
40
+	 * An StdClass whose property names are addon slugs,
41
+	 * and values are their config classes
42
+	 *
43
+	 * @var StdClass
44
+	 */
45
+	public $addons;
46
+
47
+	/**
48
+	 * @var EE_Admin_Config
49
+	 */
50
+	public $admin;
51
+
52
+	/**
53
+	 * @var EE_Core_Config
54
+	 */
55
+	public $core;
56
+
57
+	/**
58
+	 * @var EE_Currency_Config
59
+	 */
60
+	public $currency;
61
+
62
+	/**
63
+	 * @var EE_Organization_Config
64
+	 */
65
+	public $organization;
66
+
67
+	/**
68
+	 * @var EE_Registration_Config
69
+	 */
70
+	public $registration;
71
+
72
+	/**
73
+	 * @var EE_Template_Config
74
+	 */
75
+	public $template_settings;
76
+
77
+	/**
78
+	 * Holds EE environment values.
79
+	 *
80
+	 * @var EE_Environment_Config
81
+	 */
82
+	public $environment;
83
+
84
+	/**
85
+	 * settings pertaining to Google maps
86
+	 *
87
+	 * @var EE_Map_Config
88
+	 */
89
+	public $map_settings;
90
+
91
+	/**
92
+	 * settings pertaining to Taxes
93
+	 *
94
+	 * @var EE_Tax_Config
95
+	 */
96
+	public $tax_settings;
97
+
98
+	/**
99
+	 * @deprecated
100
+	 * @var EE_Gateway_Config
101
+	 */
102
+	public $gateway;
103
+
104
+	/**
105
+	 * @var    array $_addon_option_names
106
+	 * @access    private
107
+	 */
108
+	private $_addon_option_names = array();
109
+
110
+	/**
111
+	 * @var    array $_module_route_map
112
+	 * @access    private
113
+	 */
114
+	private static $_module_route_map = array();
115
+
116
+	/**
117
+	 * @var    array $_module_forward_map
118
+	 * @access    private
119
+	 */
120
+	private static $_module_forward_map = array();
121
+
122
+	/**
123
+	 * @var    array $_module_view_map
124
+	 * @access    private
125
+	 */
126
+	private static $_module_view_map = array();
127
+
128
+
129
+
130
+	/**
131
+	 * @singleton method used to instantiate class object
132
+	 * @access    public
133
+	 * @return EE_Config instance
134
+	 */
135
+	public static function instance()
136
+	{
137
+		// check if class object is instantiated, and instantiated properly
138
+		if ( ! self::$_instance instanceof EE_Config) {
139
+			self::$_instance = new self();
140
+		}
141
+		return self::$_instance;
142
+	}
143
+
144
+
145
+
146
+	/**
147
+	 * Resets the config
148
+	 *
149
+	 * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
150
+	 *                               (default) leaves the database alone, and merely resets the EE_Config object to
151
+	 *                               reflect its state in the database
152
+	 * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
153
+	 *                               $_instance as NULL. Useful in case you want to forget about the old instance on
154
+	 *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
155
+	 *                               site was put into maintenance mode)
156
+	 * @return EE_Config
157
+	 */
158
+	public static function reset($hard_reset = false, $reinstantiate = true)
159
+	{
160
+		if (self::$_instance instanceof EE_Config) {
161
+			if ($hard_reset) {
162
+				self::$_instance->_addon_option_names = array();
163
+				self::$_instance->_initialize_config();
164
+				self::$_instance->update_espresso_config();
165
+			}
166
+			self::$_instance->update_addon_option_names();
167
+		}
168
+		self::$_instance = null;
169
+		//we don't need to reset the static properties imo because those should
170
+		//only change when a module is added or removed. Currently we don't
171
+		//support removing a module during a request when it previously existed
172
+		if ($reinstantiate) {
173
+			return self::instance();
174
+		} else {
175
+			return null;
176
+		}
177
+	}
178
+
179
+
180
+
181
+	/**
182
+	 *    class constructor
183
+	 *
184
+	 * @access    private
185
+	 */
186
+	private function __construct()
187
+	{
188
+		do_action('AHEE__EE_Config__construct__begin', $this);
189
+		EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
190
+		// setup empty config classes
191
+		$this->_initialize_config();
192
+		// load existing EE site settings
193
+		$this->_load_core_config();
194
+		// confirm everything loaded correctly and set filtered defaults if not
195
+		$this->_verify_config();
196
+		//  register shortcodes and modules
197
+		add_action(
198
+			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
199
+			array($this, 'register_shortcodes_and_modules'),
200
+			999
201
+		);
202
+		//  initialize shortcodes and modules
203
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
204
+		// register widgets
205
+		add_action('widgets_init', array($this, 'widgets_init'), 10);
206
+		// shutdown
207
+		add_action('shutdown', array($this, 'shutdown'), 10);
208
+		// construct__end hook
209
+		do_action('AHEE__EE_Config__construct__end', $this);
210
+		// hardcoded hack
211
+		$this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
212
+	}
213
+
214
+
215
+
216
+	/**
217
+	 * @return boolean
218
+	 */
219
+	public static function logging_enabled()
220
+	{
221
+		return self::$_logging_enabled;
222
+	}
223
+
224
+
225
+
226
+	/**
227
+	 * use to get the current theme if needed from static context
228
+	 *
229
+	 * @return string current theme set.
230
+	 */
231
+	public static function get_current_theme()
232
+	{
233
+		return isset(self::$_instance->template_settings->current_espresso_theme)
234
+			? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
235
+	}
236
+
237
+
238
+
239
+	/**
240
+	 *        _initialize_config
241
+	 *
242
+	 * @access private
243
+	 * @return void
244
+	 */
245
+	private function _initialize_config()
246
+	{
247
+		EE_Config::trim_log();
248
+		//set defaults
249
+		$this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
250
+		$this->addons = new stdClass();
251
+		// set _module_route_map
252
+		EE_Config::$_module_route_map = array();
253
+		// set _module_forward_map
254
+		EE_Config::$_module_forward_map = array();
255
+		// set _module_view_map
256
+		EE_Config::$_module_view_map = array();
257
+	}
258
+
259
+
260
+
261
+	/**
262
+	 *        load core plugin configuration
263
+	 *
264
+	 * @access private
265
+	 * @return void
266
+	 */
267
+	private function _load_core_config()
268
+	{
269
+		// load_core_config__start hook
270
+		do_action('AHEE__EE_Config___load_core_config__start', $this);
271
+		$espresso_config = $this->get_espresso_config();
272
+		foreach ($espresso_config as $config => $settings) {
273
+			// load_core_config__start hook
274
+			$settings = apply_filters(
275
+				'FHEE__EE_Config___load_core_config__config_settings',
276
+				$settings,
277
+				$config,
278
+				$this
279
+			);
280
+			if (is_object($settings) && property_exists($this, $config)) {
281
+				$this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
282
+				//call configs populate method to ensure any defaults are set for empty values.
283
+				if (method_exists($settings, 'populate')) {
284
+					$this->{$config}->populate();
285
+				}
286
+				if (method_exists($settings, 'do_hooks')) {
287
+					$this->{$config}->do_hooks();
288
+				}
289
+			}
290
+		}
291
+		if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
292
+			$this->update_espresso_config();
293
+		}
294
+		// load_core_config__end hook
295
+		do_action('AHEE__EE_Config___load_core_config__end', $this);
296
+	}
297
+
298
+
299
+
300
+	/**
301
+	 *    _verify_config
302
+	 *
303
+	 * @access    protected
304
+	 * @return    void
305
+	 */
306
+	protected function _verify_config()
307
+	{
308
+		$this->core = $this->core instanceof EE_Core_Config
309
+			? $this->core
310
+			: new EE_Core_Config();
311
+		$this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
312
+		$this->organization = $this->organization instanceof EE_Organization_Config
313
+			? $this->organization
314
+			: new EE_Organization_Config();
315
+		$this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization',
316
+			$this->organization);
317
+		$this->currency = $this->currency instanceof EE_Currency_Config
318
+			? $this->currency
319
+			: new EE_Currency_Config();
320
+		$this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
321
+		$this->registration = $this->registration instanceof EE_Registration_Config
322
+			? $this->registration
323
+			: new EE_Registration_Config();
324
+		$this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration',
325
+			$this->registration);
326
+		$this->admin = $this->admin instanceof EE_Admin_Config
327
+			? $this->admin
328
+			: new EE_Admin_Config();
329
+		$this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
330
+		$this->template_settings = $this->template_settings instanceof EE_Template_Config
331
+			? $this->template_settings
332
+			: new EE_Template_Config();
333
+		$this->template_settings = apply_filters(
334
+			'FHEE__EE_Config___initialize_config__template_settings',
335
+			$this->template_settings
336
+		);
337
+		$this->map_settings = $this->map_settings instanceof EE_Map_Config
338
+			? $this->map_settings
339
+			: new EE_Map_Config();
340
+		$this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings',
341
+			$this->map_settings);
342
+		$this->environment = $this->environment instanceof EE_Environment_Config
343
+			? $this->environment
344
+			: new EE_Environment_Config();
345
+		$this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment',
346
+			$this->environment);
347
+		$this->tax_settings = $this->tax_settings instanceof EE_Tax_Config
348
+			? $this->tax_settings
349
+			: new EE_Tax_Config();
350
+		$this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings',
351
+			$this->tax_settings);
352
+		$this->gateway = $this->gateway instanceof EE_Gateway_Config
353
+			? $this->gateway
354
+			: new EE_Gateway_Config();
355
+		$this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
356
+	}
357
+
358
+
359
+
360
+	/**
361
+	 *    get_espresso_config
362
+	 *
363
+	 * @access    public
364
+	 * @return    array of espresso config stuff
365
+	 */
366
+	public function get_espresso_config()
367
+	{
368
+		// grab espresso configuration
369
+		return apply_filters(
370
+			'FHEE__EE_Config__get_espresso_config__CFG',
371
+			get_option(EE_Config::OPTION_NAME, array())
372
+		);
373
+	}
374
+
375
+
376
+
377
+	/**
378
+	 *    double_check_config_comparison
379
+	 *
380
+	 * @access    public
381
+	 * @param string $option
382
+	 * @param        $old_value
383
+	 * @param        $value
384
+	 */
385
+	public function double_check_config_comparison($option = '', $old_value, $value)
386
+	{
387
+		// make sure we're checking the ee config
388
+		if ($option === EE_Config::OPTION_NAME) {
389
+			// run a loose comparison of the old value against the new value for type and properties,
390
+			// but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
391
+			if ($value != $old_value) {
392
+				// if they are NOT the same, then remove the hook,
393
+				// which means the subsequent update results will be based solely on the update query results
394
+				// the reason we do this is because, as stated above,
395
+				// WP update_option performs an exact instance comparison (===) on any update values passed to it
396
+				// this happens PRIOR to serialization and any subsequent update.
397
+				// If values are found to match their previous old value,
398
+				// then WP bails before performing any update.
399
+				// Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version
400
+				// it just pulled from the db, with the one being passed to it (which will not match).
401
+				// HOWEVER, once the object is serialized and passed off to MySQL to update,
402
+				// MySQL MAY ALSO NOT perform the update because
403
+				// the string it sees in the db looks the same as the new one it has been passed!!!
404
+				// This results in the query returning an "affected rows" value of ZERO,
405
+				// which gets returned immediately by WP update_option and looks like an error.
406
+				remove_action('update_option', array($this, 'check_config_updated'));
407
+			}
408
+		}
409
+	}
410
+
411
+
412
+
413
+	/**
414
+	 *    update_espresso_config
415
+	 *
416
+	 * @access   public
417
+	 */
418
+	protected function _reset_espresso_addon_config()
419
+	{
420
+		$this->_addon_option_names = array();
421
+		foreach ($this->addons as $addon_name => $addon_config_obj) {
422
+			$addon_config_obj = maybe_unserialize($addon_config_obj);
423
+			$config_class = get_class($addon_config_obj);
424
+			if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
425
+				$this->update_config('addons', $addon_name, $addon_config_obj, false);
426
+			}
427
+			$this->addons->{$addon_name} = null;
428
+		}
429
+	}
430
+
431
+
432
+
433
+	/**
434
+	 *    update_espresso_config
435
+	 *
436
+	 * @access   public
437
+	 * @param   bool $add_success
438
+	 * @param   bool $add_error
439
+	 * @return   bool
440
+	 */
441
+	public function update_espresso_config($add_success = false, $add_error = true)
442
+	{
443
+		// don't allow config updates during WP heartbeats
444
+		if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
445
+			return false;
446
+		}
447
+		// commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
448
+		//$clone = clone( self::$_instance );
449
+		//self::$_instance = NULL;
450
+		do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
451
+		$this->_reset_espresso_addon_config();
452
+		// hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
453
+		// but BEFORE the actual update occurs
454
+		add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
455
+		// now update "ee_config"
456
+		$saved = update_option(EE_Config::OPTION_NAME, $this);
457
+		EE_Config::log(EE_Config::OPTION_NAME);
458
+		// if not saved... check if the hook we just added still exists;
459
+		// if it does, it means one of two things:
460
+		// 		that update_option bailed at the ( $value === $old_value ) conditional,
461
+		//		 or...
462
+		// 		the db update query returned 0 rows affected
463
+		// 		(probably because the data  value was the same from it's perspective)
464
+		// so the existence of the hook means that a negative result from update_option is NOT an error,
465
+		// but just means no update occurred, so don't display an error to the user.
466
+		// BUT... if update_option returns FALSE, AND the hook is missing,
467
+		// then it means that something truly went wrong
468
+		$saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
469
+		// remove our action since we don't want it in the system anymore
470
+		remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
471
+		do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
472
+		//self::$_instance = $clone;
473
+		//unset( $clone );
474
+		// if config remains the same or was updated successfully
475
+		if ($saved) {
476
+			if ($add_success) {
477
+				EE_Error::add_success(
478
+					__('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
479
+					__FILE__,
480
+					__FUNCTION__,
481
+					__LINE__
482
+				);
483
+			}
484
+			return true;
485
+		} else {
486
+			if ($add_error) {
487
+				EE_Error::add_error(
488
+					__('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
489
+					__FILE__,
490
+					__FUNCTION__,
491
+					__LINE__
492
+				);
493
+			}
494
+			return false;
495
+		}
496
+	}
497
+
498
+
499
+
500
+	/**
501
+	 *    _verify_config_params
502
+	 *
503
+	 * @access    private
504
+	 * @param    string         $section
505
+	 * @param    string         $name
506
+	 * @param    string         $config_class
507
+	 * @param    EE_Config_Base $config_obj
508
+	 * @param    array          $tests_to_run
509
+	 * @param    bool           $display_errors
510
+	 * @return    bool    TRUE on success, FALSE on fail
511
+	 */
512
+	private function _verify_config_params(
513
+		$section = '',
514
+		$name = '',
515
+		$config_class = '',
516
+		$config_obj = null,
517
+		$tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
518
+		$display_errors = true
519
+	) {
520
+		try {
521
+			foreach ($tests_to_run as $test) {
522
+				switch ($test) {
523
+					// TEST #1 : check that section was set
524
+					case 1 :
525
+						if (empty($section)) {
526
+							if ($display_errors) {
527
+								throw new EE_Error(
528
+									sprintf(
529
+										__(
530
+											'No configuration section has been provided while attempting to save "%s".',
531
+											'event_espresso'
532
+										),
533
+										$config_class
534
+									)
535
+								);
536
+							}
537
+							return false;
538
+						}
539
+						break;
540
+					// TEST #2 : check that settings section exists
541
+					case 2 :
542
+						if ( ! isset($this->{$section})) {
543
+							if ($display_errors) {
544
+								throw new EE_Error(
545
+									sprintf(
546
+										__('The "%s" configuration section does not exist.', 'event_espresso'),
547
+										$section
548
+									)
549
+								);
550
+							}
551
+							return false;
552
+						}
553
+						break;
554
+					// TEST #3 : check that section is the proper format
555
+					case 3 :
556
+						if (
557
+						! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
558
+						) {
559
+							if ($display_errors) {
560
+								throw new EE_Error(
561
+									sprintf(
562
+										__(
563
+											'The "%s" configuration settings have not been formatted correctly.',
564
+											'event_espresso'
565
+										),
566
+										$section
567
+									)
568
+								);
569
+							}
570
+							return false;
571
+						}
572
+						break;
573
+					// TEST #4 : check that config section name has been set
574
+					case 4 :
575
+						if (empty($name)) {
576
+							if ($display_errors) {
577
+								throw new EE_Error(
578
+									__(
579
+										'No name has been provided for the specific configuration section.',
580
+										'event_espresso'
581
+									)
582
+								);
583
+							}
584
+							return false;
585
+						}
586
+						break;
587
+					// TEST #5 : check that a config class name has been set
588
+					case 5 :
589
+						if (empty($config_class)) {
590
+							if ($display_errors) {
591
+								throw new EE_Error(
592
+									__(
593
+										'No class name has been provided for the specific configuration section.',
594
+										'event_espresso'
595
+									)
596
+								);
597
+							}
598
+							return false;
599
+						}
600
+						break;
601
+					// TEST #6 : verify config class is accessible
602
+					case 6 :
603
+						if ( ! class_exists($config_class)) {
604
+							if ($display_errors) {
605
+								throw new EE_Error(
606
+									sprintf(
607
+										__(
608
+											'The "%s" class does not exist. Please ensure that an autoloader has been set for it.',
609
+											'event_espresso'
610
+										),
611
+										$config_class
612
+									)
613
+								);
614
+							}
615
+							return false;
616
+						}
617
+						break;
618
+					// TEST #7 : check that config has even been set
619
+					case 7 :
620
+						if ( ! isset($this->{$section}->{$name})) {
621
+							if ($display_errors) {
622
+								throw new EE_Error(
623
+									sprintf(
624
+										__('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
625
+										$section,
626
+										$name
627
+									)
628
+								);
629
+							}
630
+							return false;
631
+						} else {
632
+							// and make sure it's not serialized
633
+							$this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name});
634
+						}
635
+						break;
636
+					// TEST #8 : check that config is the requested type
637
+					case 8 :
638
+						if ( ! $this->{$section}->{$name} instanceof $config_class) {
639
+							if ($display_errors) {
640
+								throw new EE_Error(
641
+									sprintf(
642
+										__(
643
+											'The configuration for "%1$s->%2$s" is not of the "%3$s" class.',
644
+											'event_espresso'
645
+										),
646
+										$section,
647
+										$name,
648
+										$config_class
649
+									)
650
+								);
651
+							}
652
+							return false;
653
+						}
654
+						break;
655
+					// TEST #9 : verify config object
656
+					case 9 :
657
+						if ( ! $config_obj instanceof EE_Config_Base) {
658
+							if ($display_errors) {
659
+								throw new EE_Error(
660
+									sprintf(
661
+										__('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
662
+										print_r($config_obj, true)
663
+									)
664
+								);
665
+							}
666
+							return false;
667
+						}
668
+						break;
669
+				}
670
+			}
671
+		} catch (EE_Error $e) {
672
+			$e->get_error();
673
+		}
674
+		// you have successfully run the gauntlet
675
+		return true;
676
+	}
677
+
678
+
679
+
680
+	/**
681
+	 *    _generate_config_option_name
682
+	 *
683
+	 * @access        protected
684
+	 * @param        string $section
685
+	 * @param        string $name
686
+	 * @return        string
687
+	 */
688
+	private function _generate_config_option_name($section = '', $name = '')
689
+	{
690
+		return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
691
+	}
692
+
693
+
694
+
695
+	/**
696
+	 *    _set_config_class
697
+	 * ensures that a config class is set, either from a passed config class or one generated from the config name
698
+	 *
699
+	 * @access    private
700
+	 * @param    string $config_class
701
+	 * @param    string $name
702
+	 * @return    string
703
+	 */
704
+	private function _set_config_class($config_class = '', $name = '')
705
+	{
706
+		return ! empty($config_class)
707
+			? $config_class
708
+			: str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
709
+	}
710
+
711
+
712
+
713
+	/**
714
+	 *    set_config
715
+	 *
716
+	 * @access    protected
717
+	 * @param    string         $section
718
+	 * @param    string         $name
719
+	 * @param    string         $config_class
720
+	 * @param    EE_Config_Base $config_obj
721
+	 * @return    EE_Config_Base
722
+	 */
723
+	public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null)
724
+	{
725
+		// ensure config class is set to something
726
+		$config_class = $this->_set_config_class($config_class, $name);
727
+		// run tests 1-4, 6, and 7 to verify all config params are set and valid
728
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
729
+			return null;
730
+		}
731
+		$config_option_name = $this->_generate_config_option_name($section, $name);
732
+		// if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
733
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
734
+			$this->_addon_option_names[$config_option_name] = $config_class;
735
+			$this->update_addon_option_names();
736
+		}
737
+		// verify the incoming config object but suppress errors
738
+		if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
739
+			$config_obj = new $config_class();
740
+		}
741
+		if (get_option($config_option_name)) {
742
+			EE_Config::log($config_option_name);
743
+			update_option($config_option_name, $config_obj);
744
+			$this->{$section}->{$name} = $config_obj;
745
+			return $this->{$section}->{$name};
746
+		} else {
747
+			// create a wp-option for this config
748
+			if (add_option($config_option_name, $config_obj, '', 'no')) {
749
+				$this->{$section}->{$name} = maybe_unserialize($config_obj);
750
+				return $this->{$section}->{$name};
751
+			} else {
752
+				EE_Error::add_error(
753
+					sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
754
+					__FILE__,
755
+					__FUNCTION__,
756
+					__LINE__
757
+				);
758
+				return null;
759
+			}
760
+		}
761
+	}
762
+
763
+
764
+
765
+	/**
766
+	 *    update_config
767
+	 * Important: the config object must ALREADY be set, otherwise this will produce an error.
768
+	 *
769
+	 * @access    public
770
+	 * @param    string                $section
771
+	 * @param    string                $name
772
+	 * @param    EE_Config_Base|string $config_obj
773
+	 * @param    bool                  $throw_errors
774
+	 * @return    bool
775
+	 */
776
+	public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true)
777
+	{
778
+		// don't allow config updates during WP heartbeats
779
+		if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
780
+			return false;
781
+		}
782
+		$config_obj = maybe_unserialize($config_obj);
783
+		// get class name of the incoming object
784
+		$config_class = get_class($config_obj);
785
+		// run tests 1-5 and 9 to verify config
786
+		if ( ! $this->_verify_config_params(
787
+			$section,
788
+			$name,
789
+			$config_class,
790
+			$config_obj,
791
+			array(1, 2, 3, 4, 7, 9)
792
+		)
793
+		) {
794
+			return false;
795
+		}
796
+		$config_option_name = $this->_generate_config_option_name($section, $name);
797
+		// check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
798
+		if ( ! isset($this->_addon_option_names[$config_option_name])) {
799
+			// save new config to db
800
+			if ($this->set_config($section, $name, $config_class, $config_obj)) {
801
+				return true;
802
+			}
803
+		} else {
804
+			// first check if the record already exists
805
+			$existing_config = get_option($config_option_name);
806
+			$config_obj = serialize($config_obj);
807
+			// just return if db record is already up to date (NOT type safe comparison)
808
+			if ($existing_config == $config_obj) {
809
+				$this->{$section}->{$name} = $config_obj;
810
+				return true;
811
+			} else if (update_option($config_option_name, $config_obj)) {
812
+				EE_Config::log($config_option_name);
813
+				// update wp-option for this config class
814
+				$this->{$section}->{$name} = $config_obj;
815
+				return true;
816
+			} elseif ($throw_errors) {
817
+				EE_Error::add_error(
818
+					sprintf(
819
+						__(
820
+							'The "%1$s" object stored at"%2$s" was not successfully updated in the database.',
821
+							'event_espresso'
822
+						),
823
+						$config_class,
824
+						'EE_Config->' . $section . '->' . $name
825
+					),
826
+					__FILE__,
827
+					__FUNCTION__,
828
+					__LINE__
829
+				);
830
+			}
831
+		}
832
+		return false;
833
+	}
834
+
835
+
836
+
837
+	/**
838
+	 *    get_config
839
+	 *
840
+	 * @access    public
841
+	 * @param    string $section
842
+	 * @param    string $name
843
+	 * @param    string $config_class
844
+	 * @return    mixed EE_Config_Base | NULL
845
+	 */
846
+	public function get_config($section = '', $name = '', $config_class = '')
847
+	{
848
+		// ensure config class is set to something
849
+		$config_class = $this->_set_config_class($config_class, $name);
850
+		// run tests 1-4, 6 and 7 to verify that all params have been set
851
+		if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
852
+			return null;
853
+		}
854
+		// now test if the requested config object exists, but suppress errors
855
+		if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
856
+			// config already exists, so pass it back
857
+			return $this->{$section}->{$name};
858
+		}
859
+		// load config option from db if it exists
860
+		$config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
861
+		// verify the newly retrieved config object, but suppress errors
862
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
863
+			// config is good, so set it and pass it back
864
+			$this->{$section}->{$name} = $config_obj;
865
+			return $this->{$section}->{$name};
866
+		}
867
+		// oops! $config_obj is not already set and does not exist in the db, so create a new one
868
+		$config_obj = $this->set_config($section, $name, $config_class);
869
+		// verify the newly created config object
870
+		if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
871
+			return $this->{$section}->{$name};
872
+		} else {
873
+			EE_Error::add_error(
874
+				sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
875
+				__FILE__,
876
+				__FUNCTION__,
877
+				__LINE__
878
+			);
879
+		}
880
+		return null;
881
+	}
882
+
883
+
884
+
885
+	/**
886
+	 *    get_config_option
887
+	 *
888
+	 * @access    public
889
+	 * @param    string $config_option_name
890
+	 * @return    mixed EE_Config_Base | FALSE
891
+	 */
892
+	public function get_config_option($config_option_name = '')
893
+	{
894
+		// retrieve the wp-option for this config class.
895
+		$config_option = maybe_unserialize(get_option($config_option_name, array()));
896
+		if (empty($config_option)) {
897
+			EE_Config::log($config_option_name . '-NOT-FOUND');
898
+		}
899
+		return $config_option;
900
+	}
901
+
902
+
903
+
904
+	/**
905
+	 * log
906
+	 *
907
+	 * @param string $config_option_name
908
+	 */
909
+	public static function log($config_option_name = '')
910
+	{
911
+		if (EE_Config::logging_enabled() && ! empty($config_option_name)) {
912
+			$config_log = get_option(EE_Config::LOG_NAME, array());
913
+			//copy incoming $_REQUEST and sanitize it so we can save it
914
+			$_request = $_REQUEST;
915
+			array_walk_recursive($_request, 'sanitize_text_field');
916
+			$config_log[(string)microtime(true)] = array(
917
+				'config_name' => $config_option_name,
918
+				'request'     => $_request,
919
+			);
920
+			update_option(EE_Config::LOG_NAME, $config_log);
921
+		}
922
+	}
923
+
924
+
925
+
926
+	/**
927
+	 * trim_log
928
+	 * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
929
+	 */
930
+	public static function trim_log()
931
+	{
932
+		if ( ! EE_Config::logging_enabled()) {
933
+			return;
934
+		}
935
+		$config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
936
+		$log_length = count($config_log);
937
+		if ($log_length > EE_Config::LOG_LENGTH) {
938
+			ksort($config_log);
939
+			$config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
940
+			update_option(EE_Config::LOG_NAME, $config_log);
941
+		}
942
+	}
943
+
944
+
945
+
946
+	/**
947
+	 *    get_page_for_posts
948
+	 *    if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the
949
+	 *    wp-option "page_for_posts", or "posts" if no page is selected
950
+	 *
951
+	 * @access    public
952
+	 * @return    string
953
+	 */
954
+	public static function get_page_for_posts()
955
+	{
956
+		$page_for_posts = get_option('page_for_posts');
957
+		if ( ! $page_for_posts) {
958
+			return 'posts';
959
+		}
960
+		/** @type WPDB $wpdb */
961
+		global $wpdb;
962
+		$SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
963
+		return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
964
+	}
965
+
966
+
967
+
968
+	/**
969
+	 *    register_shortcodes_and_modules.
970
+	 *    At this point, it's too early to tell if we're maintenance mode or not.
971
+	 *    In fact, this is where we give modules a chance to let core know they exist
972
+	 *    so they can help trigger maintenance mode if it's needed
973
+	 *
974
+	 * @access    public
975
+	 * @return    void
976
+	 */
977
+	public function register_shortcodes_and_modules()
978
+	{
979
+		// allow shortcodes to register with WP and to set hooks for the rest of the system
980
+		EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
981
+		// allow modules to set hooks for the rest of the system
982
+		EE_Registry::instance()->modules = $this->_register_modules();
983
+	}
984
+
985
+
986
+
987
+	/**
988
+	 *    initialize_shortcodes_and_modules
989
+	 *    meaning they can start adding their hooks to get stuff done
990
+	 *
991
+	 * @access    public
992
+	 * @return    void
993
+	 */
994
+	public function initialize_shortcodes_and_modules()
995
+	{
996
+		// allow shortcodes to set hooks for the rest of the system
997
+		$this->_initialize_shortcodes();
998
+		// allow modules to set hooks for the rest of the system
999
+		$this->_initialize_modules();
1000
+	}
1001
+
1002
+
1003
+
1004
+	/**
1005
+	 *    widgets_init
1006
+	 *
1007
+	 * @access private
1008
+	 * @return void
1009
+	 */
1010
+	public function widgets_init()
1011
+	{
1012
+		//only init widgets on admin pages when not in complete maintenance, and
1013
+		//on frontend when not in any maintenance mode
1014
+		if (
1015
+			! EE_Maintenance_Mode::instance()->level()
1016
+			|| (
1017
+				is_admin()
1018
+				&& EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
1019
+			)
1020
+		) {
1021
+			// grab list of installed widgets
1022
+			$widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1023
+			// filter list of modules to register
1024
+			$widgets_to_register = apply_filters(
1025
+				'FHEE__EE_Config__register_widgets__widgets_to_register',
1026
+				$widgets_to_register
1027
+			);
1028
+			if ( ! empty($widgets_to_register)) {
1029
+				// cycle thru widget folders
1030
+				foreach ($widgets_to_register as $widget_path) {
1031
+					// add to list of installed widget modules
1032
+					EE_Config::register_ee_widget($widget_path);
1033
+				}
1034
+			}
1035
+			// filter list of installed modules
1036
+			EE_Registry::instance()->widgets = apply_filters(
1037
+				'FHEE__EE_Config__register_widgets__installed_widgets',
1038
+				EE_Registry::instance()->widgets
1039
+			);
1040
+		}
1041
+	}
1042
+
1043
+
1044
+
1045
+	/**
1046
+	 *    register_ee_widget - makes core aware of this widget
1047
+	 *
1048
+	 * @access    public
1049
+	 * @param    string $widget_path - full path up to and including widget folder
1050
+	 * @return    void
1051
+	 */
1052
+	public static function register_ee_widget($widget_path = null)
1053
+	{
1054
+		do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
1055
+		$widget_ext = '.widget.php';
1056
+		// make all separators match
1057
+		$widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
1058
+		// does the file path INCLUDE the actual file name as part of the path ?
1059
+		if (strpos($widget_path, $widget_ext) !== false) {
1060
+			// grab and shortcode file name from directory name and break apart at dots
1061
+			$file_name = explode('.', basename($widget_path));
1062
+			// take first segment from file name pieces and remove class prefix if it exists
1063
+			$widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
1064
+			// sanitize shortcode directory name
1065
+			$widget = sanitize_key($widget);
1066
+			// now we need to rebuild the shortcode path
1067
+			$widget_path = explode(DS, $widget_path);
1068
+			// remove last segment
1069
+			array_pop($widget_path);
1070
+			// glue it back together
1071
+			$widget_path = implode(DS, $widget_path);
1072
+		} else {
1073
+			// grab and sanitize widget directory name
1074
+			$widget = sanitize_key(basename($widget_path));
1075
+		}
1076
+		// create classname from widget directory name
1077
+		$widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1078
+		// add class prefix
1079
+		$widget_class = 'EEW_' . $widget;
1080
+		// does the widget exist ?
1081
+		if ( ! is_readable($widget_path . DS . $widget_class . $widget_ext)) {
1082
+			$msg = sprintf(
1083
+				__(
1084
+					'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1085
+					'event_espresso'
1086
+				),
1087
+				$widget_class,
1088
+				$widget_path . DS . $widget_class . $widget_ext
1089
+			);
1090
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1091
+			return;
1092
+		}
1093
+		// load the widget class file
1094
+		require_once($widget_path . DS . $widget_class . $widget_ext);
1095
+		// verify that class exists
1096
+		if ( ! class_exists($widget_class)) {
1097
+			$msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1098
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1099
+			return;
1100
+		}
1101
+		register_widget($widget_class);
1102
+		// add to array of registered widgets
1103
+		EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
1104
+	}
1105
+
1106
+
1107
+
1108
+	/**
1109
+	 *        _register_shortcodes
1110
+	 *
1111
+	 * @access private
1112
+	 * @return array
1113
+	 */
1114
+	private function _register_shortcodes()
1115
+	{
1116
+		// grab list of installed shortcodes
1117
+		$shortcodes_to_register = glob(EE_SHORTCODES . '*', GLOB_ONLYDIR);
1118
+		// filter list of modules to register
1119
+		$shortcodes_to_register = apply_filters(
1120
+			'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
1121
+			$shortcodes_to_register
1122
+		);
1123
+		if ( ! empty($shortcodes_to_register)) {
1124
+			// cycle thru shortcode folders
1125
+			foreach ($shortcodes_to_register as $shortcode_path) {
1126
+				// add to list of installed shortcode modules
1127
+				EE_Config::register_shortcode($shortcode_path);
1128
+			}
1129
+		}
1130
+		// filter list of installed modules
1131
+		return apply_filters(
1132
+			'FHEE__EE_Config___register_shortcodes__installed_shortcodes',
1133
+			EE_Registry::instance()->shortcodes
1134
+		);
1135
+	}
1136
+
1137
+
1138
+
1139
+	/**
1140
+	 *    register_shortcode - makes core aware of this shortcode
1141
+	 *
1142
+	 * @access    public
1143
+	 * @param    string $shortcode_path - full path up to and including shortcode folder
1144
+	 * @return    bool
1145
+	 */
1146
+	public static function register_shortcode($shortcode_path = null)
1147
+	{
1148
+		do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
1149
+		$shortcode_ext = '.shortcode.php';
1150
+		// make all separators match
1151
+		$shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
1152
+		// does the file path INCLUDE the actual file name as part of the path ?
1153
+		if (strpos($shortcode_path, $shortcode_ext) !== false) {
1154
+			// grab shortcode file name from directory name and break apart at dots
1155
+			$shortcode_file = explode('.', basename($shortcode_path));
1156
+			// take first segment from file name pieces and remove class prefix if it exists
1157
+			$shortcode = strpos($shortcode_file[0], 'EES_') === 0
1158
+				? substr($shortcode_file[0], 4)
1159
+				: $shortcode_file[0];
1160
+			// sanitize shortcode directory name
1161
+			$shortcode = sanitize_key($shortcode);
1162
+			// now we need to rebuild the shortcode path
1163
+			$shortcode_path = explode(DS, $shortcode_path);
1164
+			// remove last segment
1165
+			array_pop($shortcode_path);
1166
+			// glue it back together
1167
+			$shortcode_path = implode(DS, $shortcode_path) . DS;
1168
+		} else {
1169
+			// we need to generate the filename based off of the folder name
1170
+			// grab and sanitize shortcode directory name
1171
+			$shortcode = sanitize_key(basename($shortcode_path));
1172
+			$shortcode_path = rtrim($shortcode_path, DS) . DS;
1173
+		}
1174
+		// create classname from shortcode directory or file name
1175
+		$shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1176
+		// add class prefix
1177
+		$shortcode_class = 'EES_' . $shortcode;
1178
+		// does the shortcode exist ?
1179
+		if ( ! is_readable($shortcode_path . DS . $shortcode_class . $shortcode_ext)) {
1180
+			$msg = sprintf(
1181
+				__(
1182
+					'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s',
1183
+					'event_espresso'
1184
+				),
1185
+				$shortcode_class,
1186
+				$shortcode_path . DS . $shortcode_class . $shortcode_ext
1187
+			);
1188
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1189
+			return false;
1190
+		}
1191
+		// load the shortcode class file
1192
+		require_once($shortcode_path . $shortcode_class . $shortcode_ext);
1193
+		// verify that class exists
1194
+		if ( ! class_exists($shortcode_class)) {
1195
+			$msg = sprintf(
1196
+				__('The requested %s shortcode class does not exist.', 'event_espresso'),
1197
+				$shortcode_class
1198
+			);
1199
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1200
+			return false;
1201
+		}
1202
+		$shortcode = strtoupper($shortcode);
1203
+		// add to array of registered shortcodes
1204
+		EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1205
+		return true;
1206
+	}
1207
+
1208
+
1209
+
1210
+	/**
1211
+	 *        _register_modules
1212
+	 *
1213
+	 * @access private
1214
+	 * @return array
1215
+	 */
1216
+	private function _register_modules()
1217
+	{
1218
+		// grab list of installed modules
1219
+		$modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1220
+		// filter list of modules to register
1221
+		$modules_to_register = apply_filters(
1222
+			'FHEE__EE_Config__register_modules__modules_to_register',
1223
+			$modules_to_register
1224
+		);
1225
+		if ( ! empty($modules_to_register)) {
1226
+			// loop through folders
1227
+			foreach ($modules_to_register as $module_path) {
1228
+				/**TEMPORARILY EXCLUDE gateways from modules for time being**/
1229
+				if (
1230
+					$module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1231
+					&& $module_path !== EE_MODULES . 'gateways'
1232
+				) {
1233
+					// add to list of installed modules
1234
+					EE_Config::register_module($module_path);
1235
+				}
1236
+			}
1237
+		}
1238
+		// filter list of installed modules
1239
+		return apply_filters(
1240
+			'FHEE__EE_Config___register_modules__installed_modules',
1241
+			EE_Registry::instance()->modules
1242
+		);
1243
+	}
1244
+
1245
+
1246
+
1247
+	/**
1248
+	 *    register_module - makes core aware of this module
1249
+	 *
1250
+	 * @access    public
1251
+	 * @param    string $module_path - full path up to and including module folder
1252
+	 * @return    bool
1253
+	 */
1254
+	public static function register_module($module_path = null)
1255
+	{
1256
+		do_action('AHEE__EE_Config__register_module__begin', $module_path);
1257
+		$module_ext = '.module.php';
1258
+		// make all separators match
1259
+		$module_path = str_replace(array('\\', '/'), DS, $module_path);
1260
+		// does the file path INCLUDE the actual file name as part of the path ?
1261
+		if (strpos($module_path, $module_ext) !== false) {
1262
+			// grab and shortcode file name from directory name and break apart at dots
1263
+			$module_file = explode('.', basename($module_path));
1264
+			// now we need to rebuild the shortcode path
1265
+			$module_path = explode(DS, $module_path);
1266
+			// remove last segment
1267
+			array_pop($module_path);
1268
+			// glue it back together
1269
+			$module_path = implode(DS, $module_path) . DS;
1270
+			// take first segment from file name pieces and sanitize it
1271
+			$module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1272
+			// ensure class prefix is added
1273
+			$module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1274
+		} else {
1275
+			// we need to generate the filename based off of the folder name
1276
+			// grab and sanitize module name
1277
+			$module = strtolower(basename($module_path));
1278
+			$module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1279
+			// like trailingslashit()
1280
+			$module_path = rtrim($module_path, DS) . DS;
1281
+			// create classname from module directory name
1282
+			$module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1283
+			// add class prefix
1284
+			$module_class = 'EED_' . $module;
1285
+		}
1286
+		// does the module exist ?
1287
+		if ( ! is_readable($module_path . DS . $module_class . $module_ext)) {
1288
+			$msg = sprintf(
1289
+				__(
1290
+					'The requested %s module file could not be found or is not readable due to file permissions.',
1291
+					'event_espresso'
1292
+				),
1293
+				$module
1294
+			);
1295
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1296
+			return false;
1297
+		}
1298
+		// load the module class file
1299
+		require_once($module_path . $module_class . $module_ext);
1300
+		// verify that class exists
1301
+		if ( ! class_exists($module_class)) {
1302
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1303
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1304
+			return false;
1305
+		}
1306
+		// add to array of registered modules
1307
+		EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1308
+		do_action(
1309
+			'AHEE__EE_Config__register_module__complete',
1310
+			$module_class,
1311
+			EE_Registry::instance()->modules->{$module_class}
1312
+		);
1313
+		return true;
1314
+	}
1315
+
1316
+
1317
+
1318
+	/**
1319
+	 *    _initialize_shortcodes
1320
+	 *    allow shortcodes to set hooks for the rest of the system
1321
+	 *
1322
+	 * @access private
1323
+	 * @return void
1324
+	 */
1325
+	private function _initialize_shortcodes()
1326
+	{
1327
+		// cycle thru shortcode folders
1328
+		foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1329
+			// add class prefix
1330
+			$shortcode_class = 'EES_' . $shortcode;
1331
+			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1332
+			// which set hooks ?
1333
+			if (is_admin()) {
1334
+				// fire immediately
1335
+				call_user_func(array($shortcode_class, 'set_hooks_admin'));
1336
+			} else {
1337
+				// delay until other systems are online
1338
+				add_action(
1339
+					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1340
+					array($shortcode_class, 'set_hooks')
1341
+				);
1342
+				// convert classname to UPPERCASE and create WP shortcode.
1343
+				$shortcode_tag = strtoupper($shortcode);
1344
+				// but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1345
+				if ( ! shortcode_exists($shortcode_tag)) {
1346
+					// NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1347
+					add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1348
+				}
1349
+			}
1350
+		}
1351
+	}
1352
+
1353
+
1354
+
1355
+	/**
1356
+	 *    _initialize_modules
1357
+	 *    allow modules to set hooks for the rest of the system
1358
+	 *
1359
+	 * @access private
1360
+	 * @return void
1361
+	 */
1362
+	private function _initialize_modules()
1363
+	{
1364
+		// cycle thru shortcode folders
1365
+		foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1366
+			// fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1367
+			// which set hooks ?
1368
+			if (is_admin()) {
1369
+				// fire immediately
1370
+				call_user_func(array($module_class, 'set_hooks_admin'));
1371
+			} else {
1372
+				// delay until other systems are online
1373
+				add_action(
1374
+					'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1375
+					array($module_class, 'set_hooks')
1376
+				);
1377
+			}
1378
+		}
1379
+	}
1380
+
1381
+
1382
+
1383
+	/**
1384
+	 *    register_route - adds module method routes to route_map
1385
+	 *
1386
+	 * @access    public
1387
+	 * @param    string $route       - "pretty" public alias for module method
1388
+	 * @param    string $module      - module name (classname without EED_ prefix)
1389
+	 * @param    string $method_name - the actual module method to be routed to
1390
+	 * @param    string $key         - url param key indicating a route is being called
1391
+	 * @return    bool
1392
+	 */
1393
+	public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee')
1394
+	{
1395
+		do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1396
+		$module = str_replace('EED_', '', $module);
1397
+		$module_class = 'EED_' . $module;
1398
+		if ( ! isset(EE_Registry::instance()->modules->{$module_class})) {
1399
+			$msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1400
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1401
+			return false;
1402
+		}
1403
+		if (empty($route)) {
1404
+			$msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1405
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1406
+			return false;
1407
+		}
1408
+		if ( ! method_exists('EED_' . $module, $method_name)) {
1409
+			$msg = sprintf(
1410
+				__('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1411
+				$route
1412
+			);
1413
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1414
+			return false;
1415
+		}
1416
+		EE_Config::$_module_route_map[$key][$route] = array('EED_' . $module, $method_name);
1417
+		return true;
1418
+	}
1419
+
1420
+
1421
+
1422
+	/**
1423
+	 *    get_route - get module method route
1424
+	 *
1425
+	 * @access    public
1426
+	 * @param    string $route - "pretty" public alias for module method
1427
+	 * @param    string $key   - url param key indicating a route is being called
1428
+	 * @return    string
1429
+	 */
1430
+	public static function get_route($route = null, $key = 'ee')
1431
+	{
1432
+		do_action('AHEE__EE_Config__get_route__begin', $route);
1433
+		$route = (string)apply_filters('FHEE__EE_Config__get_route', $route);
1434
+		if (isset(EE_Config::$_module_route_map[$key][$route])) {
1435
+			return EE_Config::$_module_route_map[$key][$route];
1436
+		}
1437
+		return null;
1438
+	}
1439
+
1440
+
1441
+
1442
+	/**
1443
+	 *    get_routes - get ALL module method routes
1444
+	 *
1445
+	 * @access    public
1446
+	 * @return    array
1447
+	 */
1448
+	public static function get_routes()
1449
+	{
1450
+		return EE_Config::$_module_route_map;
1451
+	}
1452
+
1453
+
1454
+
1455
+	/**
1456
+	 *    register_forward - allows modules to forward request to another module for further processing
1457
+	 *
1458
+	 * @access    public
1459
+	 * @param    string       $route   - "pretty" public alias for module method
1460
+	 * @param    integer      $status  - integer value corresponding  to status constant strings set in module parent
1461
+	 *                                 class, allows different forwards to be served based on status
1462
+	 * @param    array|string $forward - function name or array( class, method )
1463
+	 * @param    string       $key     - url param key indicating a route is being called
1464
+	 * @return    bool
1465
+	 */
1466
+	public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee')
1467
+	{
1468
+		do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1469
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1470
+			$msg = sprintf(
1471
+				__('The module route %s for this forward has not been registered.', 'event_espresso'),
1472
+				$route
1473
+			);
1474
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1475
+			return false;
1476
+		}
1477
+		if (empty($forward)) {
1478
+			$msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1479
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1480
+			return false;
1481
+		}
1482
+		if (is_array($forward)) {
1483
+			if ( ! isset($forward[1])) {
1484
+				$msg = sprintf(
1485
+					__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1486
+					$route
1487
+				);
1488
+				EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1489
+				return false;
1490
+			}
1491
+			if ( ! method_exists($forward[0], $forward[1])) {
1492
+				$msg = sprintf(
1493
+					__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1494
+					$forward[1],
1495
+					$route
1496
+				);
1497
+				EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1498
+				return false;
1499
+			}
1500
+		} else if ( ! function_exists($forward)) {
1501
+			$msg = sprintf(
1502
+				__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1503
+				$forward,
1504
+				$route
1505
+			);
1506
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1507
+			return false;
1508
+		}
1509
+		EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1510
+		return true;
1511
+	}
1512
+
1513
+
1514
+
1515
+	/**
1516
+	 *    get_forward - get forwarding route
1517
+	 *
1518
+	 * @access    public
1519
+	 * @param    string  $route  - "pretty" public alias for module method
1520
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1521
+	 *                           allows different forwards to be served based on status
1522
+	 * @param    string  $key    - url param key indicating a route is being called
1523
+	 * @return    string
1524
+	 */
1525
+	public static function get_forward($route = null, $status = 0, $key = 'ee')
1526
+	{
1527
+		do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1528
+		if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1529
+			return apply_filters(
1530
+				'FHEE__EE_Config__get_forward',
1531
+				EE_Config::$_module_forward_map[$key][$route][$status],
1532
+				$route,
1533
+				$status
1534
+			);
1535
+		}
1536
+		return null;
1537
+	}
1538
+
1539
+
1540
+
1541
+	/**
1542
+	 *    register_forward - allows modules to specify different view templates for different method routes and status
1543
+	 *    results
1544
+	 *
1545
+	 * @access    public
1546
+	 * @param    string  $route  - "pretty" public alias for module method
1547
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1548
+	 *                           allows different views to be served based on status
1549
+	 * @param    string  $view
1550
+	 * @param    string  $key    - url param key indicating a route is being called
1551
+	 * @return    bool
1552
+	 */
1553
+	public static function register_view($route = null, $status = 0, $view = null, $key = 'ee')
1554
+	{
1555
+		do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1556
+		if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1557
+			$msg = sprintf(
1558
+				__('The module route %s for this view has not been registered.', 'event_espresso'),
1559
+				$route
1560
+			);
1561
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1562
+			return false;
1563
+		}
1564
+		if ( ! is_readable($view)) {
1565
+			$msg = sprintf(
1566
+				__(
1567
+					'The %s view file could not be found or is not readable due to file permissions.',
1568
+					'event_espresso'
1569
+				),
1570
+				$view
1571
+			);
1572
+			EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1573
+			return false;
1574
+		}
1575
+		EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1576
+		return true;
1577
+	}
1578
+
1579
+
1580
+
1581
+	/**
1582
+	 *    get_view - get view for route and status
1583
+	 *
1584
+	 * @access    public
1585
+	 * @param    string  $route  - "pretty" public alias for module method
1586
+	 * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1587
+	 *                           allows different views to be served based on status
1588
+	 * @param    string  $key    - url param key indicating a route is being called
1589
+	 * @return    string
1590
+	 */
1591
+	public static function get_view($route = null, $status = 0, $key = 'ee')
1592
+	{
1593
+		do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1594
+		if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1595
+			return apply_filters(
1596
+				'FHEE__EE_Config__get_view',
1597
+				EE_Config::$_module_view_map[$key][$route][$status],
1598
+				$route,
1599
+				$status
1600
+			);
1601
+		}
1602
+		return null;
1603
+	}
1604
+
1605
+
1606
+
1607
+	public function update_addon_option_names()
1608
+	{
1609
+		update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1610
+	}
1611
+
1612
+
1613
+
1614
+	public function shutdown()
1615
+	{
1616
+		$this->update_addon_option_names();
1617
+	}
18 1618
 
19
-    const LOG_NAME           = 'ee_config_log';
20 1619
 
21
-    const LOG_LENGTH         = 100;
22
-
23
-    const ADDON_OPTION_NAMES = 'ee_config_option_names';
24
-
25
-
26
-    /**
27
-     *    instance of the EE_Config object
28
-     *
29
-     * @var    EE_Config $_instance
30
-     * @access    private
31
-     */
32
-    private static $_instance;
33
-
34
-    /**
35
-     * @var boolean $_logging_enabled
36
-     */
37
-    private static $_logging_enabled = false;
38
-
39
-    /**
40
-     * An StdClass whose property names are addon slugs,
41
-     * and values are their config classes
42
-     *
43
-     * @var StdClass
44
-     */
45
-    public $addons;
46
-
47
-    /**
48
-     * @var EE_Admin_Config
49
-     */
50
-    public $admin;
51
-
52
-    /**
53
-     * @var EE_Core_Config
54
-     */
55
-    public $core;
56
-
57
-    /**
58
-     * @var EE_Currency_Config
59
-     */
60
-    public $currency;
61
-
62
-    /**
63
-     * @var EE_Organization_Config
64
-     */
65
-    public $organization;
66
-
67
-    /**
68
-     * @var EE_Registration_Config
69
-     */
70
-    public $registration;
71
-
72
-    /**
73
-     * @var EE_Template_Config
74
-     */
75
-    public $template_settings;
76
-
77
-    /**
78
-     * Holds EE environment values.
79
-     *
80
-     * @var EE_Environment_Config
81
-     */
82
-    public $environment;
83
-
84
-    /**
85
-     * settings pertaining to Google maps
86
-     *
87
-     * @var EE_Map_Config
88
-     */
89
-    public $map_settings;
90
-
91
-    /**
92
-     * settings pertaining to Taxes
93
-     *
94
-     * @var EE_Tax_Config
95
-     */
96
-    public $tax_settings;
97
-
98
-    /**
99
-     * @deprecated
100
-     * @var EE_Gateway_Config
101
-     */
102
-    public $gateway;
103
-
104
-    /**
105
-     * @var    array $_addon_option_names
106
-     * @access    private
107
-     */
108
-    private $_addon_option_names = array();
109
-
110
-    /**
111
-     * @var    array $_module_route_map
112
-     * @access    private
113
-     */
114
-    private static $_module_route_map = array();
115
-
116
-    /**
117
-     * @var    array $_module_forward_map
118
-     * @access    private
119
-     */
120
-    private static $_module_forward_map = array();
121
-
122
-    /**
123
-     * @var    array $_module_view_map
124
-     * @access    private
125
-     */
126
-    private static $_module_view_map = array();
127
-
128
-
129
-
130
-    /**
131
-     * @singleton method used to instantiate class object
132
-     * @access    public
133
-     * @return EE_Config instance
134
-     */
135
-    public static function instance()
136
-    {
137
-        // check if class object is instantiated, and instantiated properly
138
-        if ( ! self::$_instance instanceof EE_Config) {
139
-            self::$_instance = new self();
140
-        }
141
-        return self::$_instance;
142
-    }
143
-
144
-
145
-
146
-    /**
147
-     * Resets the config
148
-     *
149
-     * @param bool    $hard_reset    if TRUE, sets EE_CONFig back to its original settings in the database. If FALSE
150
-     *                               (default) leaves the database alone, and merely resets the EE_Config object to
151
-     *                               reflect its state in the database
152
-     * @param boolean $reinstantiate if TRUE (default) call instance() and return it. Otherwise, just leave
153
-     *                               $_instance as NULL. Useful in case you want to forget about the old instance on
154
-     *                               EE_Config, but might not be ready to instantiate EE_Config currently (eg if the
155
-     *                               site was put into maintenance mode)
156
-     * @return EE_Config
157
-     */
158
-    public static function reset($hard_reset = false, $reinstantiate = true)
159
-    {
160
-        if (self::$_instance instanceof EE_Config) {
161
-            if ($hard_reset) {
162
-                self::$_instance->_addon_option_names = array();
163
-                self::$_instance->_initialize_config();
164
-                self::$_instance->update_espresso_config();
165
-            }
166
-            self::$_instance->update_addon_option_names();
167
-        }
168
-        self::$_instance = null;
169
-        //we don't need to reset the static properties imo because those should
170
-        //only change when a module is added or removed. Currently we don't
171
-        //support removing a module during a request when it previously existed
172
-        if ($reinstantiate) {
173
-            return self::instance();
174
-        } else {
175
-            return null;
176
-        }
177
-    }
178
-
179
-
180
-
181
-    /**
182
-     *    class constructor
183
-     *
184
-     * @access    private
185
-     */
186
-    private function __construct()
187
-    {
188
-        do_action('AHEE__EE_Config__construct__begin', $this);
189
-        EE_Config::$_logging_enabled = apply_filters('FHEE__EE_Config___construct__logging_enabled', false);
190
-        // setup empty config classes
191
-        $this->_initialize_config();
192
-        // load existing EE site settings
193
-        $this->_load_core_config();
194
-        // confirm everything loaded correctly and set filtered defaults if not
195
-        $this->_verify_config();
196
-        //  register shortcodes and modules
197
-        add_action(
198
-            'AHEE__EE_System__register_shortcodes_modules_and_widgets',
199
-            array($this, 'register_shortcodes_and_modules'),
200
-            999
201
-        );
202
-        //  initialize shortcodes and modules
203
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules'));
204
-        // register widgets
205
-        add_action('widgets_init', array($this, 'widgets_init'), 10);
206
-        // shutdown
207
-        add_action('shutdown', array($this, 'shutdown'), 10);
208
-        // construct__end hook
209
-        do_action('AHEE__EE_Config__construct__end', $this);
210
-        // hardcoded hack
211
-        $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014';
212
-    }
213
-
214
-
215
-
216
-    /**
217
-     * @return boolean
218
-     */
219
-    public static function logging_enabled()
220
-    {
221
-        return self::$_logging_enabled;
222
-    }
223
-
224
-
225
-
226
-    /**
227
-     * use to get the current theme if needed from static context
228
-     *
229
-     * @return string current theme set.
230
-     */
231
-    public static function get_current_theme()
232
-    {
233
-        return isset(self::$_instance->template_settings->current_espresso_theme)
234
-            ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014';
235
-    }
236
-
237
-
238
-
239
-    /**
240
-     *        _initialize_config
241
-     *
242
-     * @access private
243
-     * @return void
244
-     */
245
-    private function _initialize_config()
246
-    {
247
-        EE_Config::trim_log();
248
-        //set defaults
249
-        $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array());
250
-        $this->addons = new stdClass();
251
-        // set _module_route_map
252
-        EE_Config::$_module_route_map = array();
253
-        // set _module_forward_map
254
-        EE_Config::$_module_forward_map = array();
255
-        // set _module_view_map
256
-        EE_Config::$_module_view_map = array();
257
-    }
258
-
259
-
260
-
261
-    /**
262
-     *        load core plugin configuration
263
-     *
264
-     * @access private
265
-     * @return void
266
-     */
267
-    private function _load_core_config()
268
-    {
269
-        // load_core_config__start hook
270
-        do_action('AHEE__EE_Config___load_core_config__start', $this);
271
-        $espresso_config = $this->get_espresso_config();
272
-        foreach ($espresso_config as $config => $settings) {
273
-            // load_core_config__start hook
274
-            $settings = apply_filters(
275
-                'FHEE__EE_Config___load_core_config__config_settings',
276
-                $settings,
277
-                $config,
278
-                $this
279
-            );
280
-            if (is_object($settings) && property_exists($this, $config)) {
281
-                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
282
-                //call configs populate method to ensure any defaults are set for empty values.
283
-                if (method_exists($settings, 'populate')) {
284
-                    $this->{$config}->populate();
285
-                }
286
-                if (method_exists($settings, 'do_hooks')) {
287
-                    $this->{$config}->do_hooks();
288
-                }
289
-            }
290
-        }
291
-        if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) {
292
-            $this->update_espresso_config();
293
-        }
294
-        // load_core_config__end hook
295
-        do_action('AHEE__EE_Config___load_core_config__end', $this);
296
-    }
297
-
298
-
299
-
300
-    /**
301
-     *    _verify_config
302
-     *
303
-     * @access    protected
304
-     * @return    void
305
-     */
306
-    protected function _verify_config()
307
-    {
308
-        $this->core = $this->core instanceof EE_Core_Config
309
-            ? $this->core
310
-            : new EE_Core_Config();
311
-        $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core);
312
-        $this->organization = $this->organization instanceof EE_Organization_Config
313
-            ? $this->organization
314
-            : new EE_Organization_Config();
315
-        $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization',
316
-            $this->organization);
317
-        $this->currency = $this->currency instanceof EE_Currency_Config
318
-            ? $this->currency
319
-            : new EE_Currency_Config();
320
-        $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency);
321
-        $this->registration = $this->registration instanceof EE_Registration_Config
322
-            ? $this->registration
323
-            : new EE_Registration_Config();
324
-        $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration',
325
-            $this->registration);
326
-        $this->admin = $this->admin instanceof EE_Admin_Config
327
-            ? $this->admin
328
-            : new EE_Admin_Config();
329
-        $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin);
330
-        $this->template_settings = $this->template_settings instanceof EE_Template_Config
331
-            ? $this->template_settings
332
-            : new EE_Template_Config();
333
-        $this->template_settings = apply_filters(
334
-            'FHEE__EE_Config___initialize_config__template_settings',
335
-            $this->template_settings
336
-        );
337
-        $this->map_settings = $this->map_settings instanceof EE_Map_Config
338
-            ? $this->map_settings
339
-            : new EE_Map_Config();
340
-        $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings',
341
-            $this->map_settings);
342
-        $this->environment = $this->environment instanceof EE_Environment_Config
343
-            ? $this->environment
344
-            : new EE_Environment_Config();
345
-        $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment',
346
-            $this->environment);
347
-        $this->tax_settings = $this->tax_settings instanceof EE_Tax_Config
348
-            ? $this->tax_settings
349
-            : new EE_Tax_Config();
350
-        $this->tax_settings = apply_filters('FHEE__EE_Config___initialize_config__tax_settings',
351
-            $this->tax_settings);
352
-        $this->gateway = $this->gateway instanceof EE_Gateway_Config
353
-            ? $this->gateway
354
-            : new EE_Gateway_Config();
355
-        $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway);
356
-    }
357
-
358
-
359
-
360
-    /**
361
-     *    get_espresso_config
362
-     *
363
-     * @access    public
364
-     * @return    array of espresso config stuff
365
-     */
366
-    public function get_espresso_config()
367
-    {
368
-        // grab espresso configuration
369
-        return apply_filters(
370
-            'FHEE__EE_Config__get_espresso_config__CFG',
371
-            get_option(EE_Config::OPTION_NAME, array())
372
-        );
373
-    }
374
-
375
-
376
-
377
-    /**
378
-     *    double_check_config_comparison
379
-     *
380
-     * @access    public
381
-     * @param string $option
382
-     * @param        $old_value
383
-     * @param        $value
384
-     */
385
-    public function double_check_config_comparison($option = '', $old_value, $value)
386
-    {
387
-        // make sure we're checking the ee config
388
-        if ($option === EE_Config::OPTION_NAME) {
389
-            // run a loose comparison of the old value against the new value for type and properties,
390
-            // but NOT exact instance like WP update_option does (ie: NOT type safe comparison)
391
-            if ($value != $old_value) {
392
-                // if they are NOT the same, then remove the hook,
393
-                // which means the subsequent update results will be based solely on the update query results
394
-                // the reason we do this is because, as stated above,
395
-                // WP update_option performs an exact instance comparison (===) on any update values passed to it
396
-                // this happens PRIOR to serialization and any subsequent update.
397
-                // If values are found to match their previous old value,
398
-                // then WP bails before performing any update.
399
-                // Since we are passing the EE_Config object, it is comparing the EXACT instance of the saved version
400
-                // it just pulled from the db, with the one being passed to it (which will not match).
401
-                // HOWEVER, once the object is serialized and passed off to MySQL to update,
402
-                // MySQL MAY ALSO NOT perform the update because
403
-                // the string it sees in the db looks the same as the new one it has been passed!!!
404
-                // This results in the query returning an "affected rows" value of ZERO,
405
-                // which gets returned immediately by WP update_option and looks like an error.
406
-                remove_action('update_option', array($this, 'check_config_updated'));
407
-            }
408
-        }
409
-    }
410
-
411
-
412
-
413
-    /**
414
-     *    update_espresso_config
415
-     *
416
-     * @access   public
417
-     */
418
-    protected function _reset_espresso_addon_config()
419
-    {
420
-        $this->_addon_option_names = array();
421
-        foreach ($this->addons as $addon_name => $addon_config_obj) {
422
-            $addon_config_obj = maybe_unserialize($addon_config_obj);
423
-            $config_class = get_class($addon_config_obj);
424
-            if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) {
425
-                $this->update_config('addons', $addon_name, $addon_config_obj, false);
426
-            }
427
-            $this->addons->{$addon_name} = null;
428
-        }
429
-    }
430
-
431
-
432
-
433
-    /**
434
-     *    update_espresso_config
435
-     *
436
-     * @access   public
437
-     * @param   bool $add_success
438
-     * @param   bool $add_error
439
-     * @return   bool
440
-     */
441
-    public function update_espresso_config($add_success = false, $add_error = true)
442
-    {
443
-        // don't allow config updates during WP heartbeats
444
-        if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
445
-            return false;
446
-        }
447
-        // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197
448
-        //$clone = clone( self::$_instance );
449
-        //self::$_instance = NULL;
450
-        do_action('AHEE__EE_Config__update_espresso_config__begin', $this);
451
-        $this->_reset_espresso_addon_config();
452
-        // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional
453
-        // but BEFORE the actual update occurs
454
-        add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3);
455
-        // now update "ee_config"
456
-        $saved = update_option(EE_Config::OPTION_NAME, $this);
457
-        EE_Config::log(EE_Config::OPTION_NAME);
458
-        // if not saved... check if the hook we just added still exists;
459
-        // if it does, it means one of two things:
460
-        // 		that update_option bailed at the ( $value === $old_value ) conditional,
461
-        //		 or...
462
-        // 		the db update query returned 0 rows affected
463
-        // 		(probably because the data  value was the same from it's perspective)
464
-        // so the existence of the hook means that a negative result from update_option is NOT an error,
465
-        // but just means no update occurred, so don't display an error to the user.
466
-        // BUT... if update_option returns FALSE, AND the hook is missing,
467
-        // then it means that something truly went wrong
468
-        $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved;
469
-        // remove our action since we don't want it in the system anymore
470
-        remove_action('update_option', array($this, 'double_check_config_comparison'), 1);
471
-        do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved);
472
-        //self::$_instance = $clone;
473
-        //unset( $clone );
474
-        // if config remains the same or was updated successfully
475
-        if ($saved) {
476
-            if ($add_success) {
477
-                EE_Error::add_success(
478
-                    __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'),
479
-                    __FILE__,
480
-                    __FUNCTION__,
481
-                    __LINE__
482
-                );
483
-            }
484
-            return true;
485
-        } else {
486
-            if ($add_error) {
487
-                EE_Error::add_error(
488
-                    __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'),
489
-                    __FILE__,
490
-                    __FUNCTION__,
491
-                    __LINE__
492
-                );
493
-            }
494
-            return false;
495
-        }
496
-    }
497
-
498
-
499
-
500
-    /**
501
-     *    _verify_config_params
502
-     *
503
-     * @access    private
504
-     * @param    string         $section
505
-     * @param    string         $name
506
-     * @param    string         $config_class
507
-     * @param    EE_Config_Base $config_obj
508
-     * @param    array          $tests_to_run
509
-     * @param    bool           $display_errors
510
-     * @return    bool    TRUE on success, FALSE on fail
511
-     */
512
-    private function _verify_config_params(
513
-        $section = '',
514
-        $name = '',
515
-        $config_class = '',
516
-        $config_obj = null,
517
-        $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8),
518
-        $display_errors = true
519
-    ) {
520
-        try {
521
-            foreach ($tests_to_run as $test) {
522
-                switch ($test) {
523
-                    // TEST #1 : check that section was set
524
-                    case 1 :
525
-                        if (empty($section)) {
526
-                            if ($display_errors) {
527
-                                throw new EE_Error(
528
-                                    sprintf(
529
-                                        __(
530
-                                            'No configuration section has been provided while attempting to save "%s".',
531
-                                            'event_espresso'
532
-                                        ),
533
-                                        $config_class
534
-                                    )
535
-                                );
536
-                            }
537
-                            return false;
538
-                        }
539
-                        break;
540
-                    // TEST #2 : check that settings section exists
541
-                    case 2 :
542
-                        if ( ! isset($this->{$section})) {
543
-                            if ($display_errors) {
544
-                                throw new EE_Error(
545
-                                    sprintf(
546
-                                        __('The "%s" configuration section does not exist.', 'event_espresso'),
547
-                                        $section
548
-                                    )
549
-                                );
550
-                            }
551
-                            return false;
552
-                        }
553
-                        break;
554
-                    // TEST #3 : check that section is the proper format
555
-                    case 3 :
556
-                        if (
557
-                        ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass)
558
-                        ) {
559
-                            if ($display_errors) {
560
-                                throw new EE_Error(
561
-                                    sprintf(
562
-                                        __(
563
-                                            'The "%s" configuration settings have not been formatted correctly.',
564
-                                            'event_espresso'
565
-                                        ),
566
-                                        $section
567
-                                    )
568
-                                );
569
-                            }
570
-                            return false;
571
-                        }
572
-                        break;
573
-                    // TEST #4 : check that config section name has been set
574
-                    case 4 :
575
-                        if (empty($name)) {
576
-                            if ($display_errors) {
577
-                                throw new EE_Error(
578
-                                    __(
579
-                                        'No name has been provided for the specific configuration section.',
580
-                                        'event_espresso'
581
-                                    )
582
-                                );
583
-                            }
584
-                            return false;
585
-                        }
586
-                        break;
587
-                    // TEST #5 : check that a config class name has been set
588
-                    case 5 :
589
-                        if (empty($config_class)) {
590
-                            if ($display_errors) {
591
-                                throw new EE_Error(
592
-                                    __(
593
-                                        'No class name has been provided for the specific configuration section.',
594
-                                        'event_espresso'
595
-                                    )
596
-                                );
597
-                            }
598
-                            return false;
599
-                        }
600
-                        break;
601
-                    // TEST #6 : verify config class is accessible
602
-                    case 6 :
603
-                        if ( ! class_exists($config_class)) {
604
-                            if ($display_errors) {
605
-                                throw new EE_Error(
606
-                                    sprintf(
607
-                                        __(
608
-                                            'The "%s" class does not exist. Please ensure that an autoloader has been set for it.',
609
-                                            'event_espresso'
610
-                                        ),
611
-                                        $config_class
612
-                                    )
613
-                                );
614
-                            }
615
-                            return false;
616
-                        }
617
-                        break;
618
-                    // TEST #7 : check that config has even been set
619
-                    case 7 :
620
-                        if ( ! isset($this->{$section}->{$name})) {
621
-                            if ($display_errors) {
622
-                                throw new EE_Error(
623
-                                    sprintf(
624
-                                        __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'),
625
-                                        $section,
626
-                                        $name
627
-                                    )
628
-                                );
629
-                            }
630
-                            return false;
631
-                        } else {
632
-                            // and make sure it's not serialized
633
-                            $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name});
634
-                        }
635
-                        break;
636
-                    // TEST #8 : check that config is the requested type
637
-                    case 8 :
638
-                        if ( ! $this->{$section}->{$name} instanceof $config_class) {
639
-                            if ($display_errors) {
640
-                                throw new EE_Error(
641
-                                    sprintf(
642
-                                        __(
643
-                                            'The configuration for "%1$s->%2$s" is not of the "%3$s" class.',
644
-                                            'event_espresso'
645
-                                        ),
646
-                                        $section,
647
-                                        $name,
648
-                                        $config_class
649
-                                    )
650
-                                );
651
-                            }
652
-                            return false;
653
-                        }
654
-                        break;
655
-                    // TEST #9 : verify config object
656
-                    case 9 :
657
-                        if ( ! $config_obj instanceof EE_Config_Base) {
658
-                            if ($display_errors) {
659
-                                throw new EE_Error(
660
-                                    sprintf(
661
-                                        __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'),
662
-                                        print_r($config_obj, true)
663
-                                    )
664
-                                );
665
-                            }
666
-                            return false;
667
-                        }
668
-                        break;
669
-                }
670
-            }
671
-        } catch (EE_Error $e) {
672
-            $e->get_error();
673
-        }
674
-        // you have successfully run the gauntlet
675
-        return true;
676
-    }
677
-
678
-
679
-
680
-    /**
681
-     *    _generate_config_option_name
682
-     *
683
-     * @access        protected
684
-     * @param        string $section
685
-     * @param        string $name
686
-     * @return        string
687
-     */
688
-    private function _generate_config_option_name($section = '', $name = '')
689
-    {
690
-        return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
691
-    }
692
-
693
-
694
-
695
-    /**
696
-     *    _set_config_class
697
-     * ensures that a config class is set, either from a passed config class or one generated from the config name
698
-     *
699
-     * @access    private
700
-     * @param    string $config_class
701
-     * @param    string $name
702
-     * @return    string
703
-     */
704
-    private function _set_config_class($config_class = '', $name = '')
705
-    {
706
-        return ! empty($config_class)
707
-            ? $config_class
708
-            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
709
-    }
710
-
711
-
712
-
713
-    /**
714
-     *    set_config
715
-     *
716
-     * @access    protected
717
-     * @param    string         $section
718
-     * @param    string         $name
719
-     * @param    string         $config_class
720
-     * @param    EE_Config_Base $config_obj
721
-     * @return    EE_Config_Base
722
-     */
723
-    public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null)
724
-    {
725
-        // ensure config class is set to something
726
-        $config_class = $this->_set_config_class($config_class, $name);
727
-        // run tests 1-4, 6, and 7 to verify all config params are set and valid
728
-        if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
729
-            return null;
730
-        }
731
-        $config_option_name = $this->_generate_config_option_name($section, $name);
732
-        // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now
733
-        if ( ! isset($this->_addon_option_names[$config_option_name])) {
734
-            $this->_addon_option_names[$config_option_name] = $config_class;
735
-            $this->update_addon_option_names();
736
-        }
737
-        // verify the incoming config object but suppress errors
738
-        if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
739
-            $config_obj = new $config_class();
740
-        }
741
-        if (get_option($config_option_name)) {
742
-            EE_Config::log($config_option_name);
743
-            update_option($config_option_name, $config_obj);
744
-            $this->{$section}->{$name} = $config_obj;
745
-            return $this->{$section}->{$name};
746
-        } else {
747
-            // create a wp-option for this config
748
-            if (add_option($config_option_name, $config_obj, '', 'no')) {
749
-                $this->{$section}->{$name} = maybe_unserialize($config_obj);
750
-                return $this->{$section}->{$name};
751
-            } else {
752
-                EE_Error::add_error(
753
-                    sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class),
754
-                    __FILE__,
755
-                    __FUNCTION__,
756
-                    __LINE__
757
-                );
758
-                return null;
759
-            }
760
-        }
761
-    }
762
-
763
-
764
-
765
-    /**
766
-     *    update_config
767
-     * Important: the config object must ALREADY be set, otherwise this will produce an error.
768
-     *
769
-     * @access    public
770
-     * @param    string                $section
771
-     * @param    string                $name
772
-     * @param    EE_Config_Base|string $config_obj
773
-     * @param    bool                  $throw_errors
774
-     * @return    bool
775
-     */
776
-    public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true)
777
-    {
778
-        // don't allow config updates during WP heartbeats
779
-        if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') {
780
-            return false;
781
-        }
782
-        $config_obj = maybe_unserialize($config_obj);
783
-        // get class name of the incoming object
784
-        $config_class = get_class($config_obj);
785
-        // run tests 1-5 and 9 to verify config
786
-        if ( ! $this->_verify_config_params(
787
-            $section,
788
-            $name,
789
-            $config_class,
790
-            $config_obj,
791
-            array(1, 2, 3, 4, 7, 9)
792
-        )
793
-        ) {
794
-            return false;
795
-        }
796
-        $config_option_name = $this->_generate_config_option_name($section, $name);
797
-        // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array
798
-        if ( ! isset($this->_addon_option_names[$config_option_name])) {
799
-            // save new config to db
800
-            if ($this->set_config($section, $name, $config_class, $config_obj)) {
801
-                return true;
802
-            }
803
-        } else {
804
-            // first check if the record already exists
805
-            $existing_config = get_option($config_option_name);
806
-            $config_obj = serialize($config_obj);
807
-            // just return if db record is already up to date (NOT type safe comparison)
808
-            if ($existing_config == $config_obj) {
809
-                $this->{$section}->{$name} = $config_obj;
810
-                return true;
811
-            } else if (update_option($config_option_name, $config_obj)) {
812
-                EE_Config::log($config_option_name);
813
-                // update wp-option for this config class
814
-                $this->{$section}->{$name} = $config_obj;
815
-                return true;
816
-            } elseif ($throw_errors) {
817
-                EE_Error::add_error(
818
-                    sprintf(
819
-                        __(
820
-                            'The "%1$s" object stored at"%2$s" was not successfully updated in the database.',
821
-                            'event_espresso'
822
-                        ),
823
-                        $config_class,
824
-                        'EE_Config->' . $section . '->' . $name
825
-                    ),
826
-                    __FILE__,
827
-                    __FUNCTION__,
828
-                    __LINE__
829
-                );
830
-            }
831
-        }
832
-        return false;
833
-    }
834
-
835
-
836
-
837
-    /**
838
-     *    get_config
839
-     *
840
-     * @access    public
841
-     * @param    string $section
842
-     * @param    string $name
843
-     * @param    string $config_class
844
-     * @return    mixed EE_Config_Base | NULL
845
-     */
846
-    public function get_config($section = '', $name = '', $config_class = '')
847
-    {
848
-        // ensure config class is set to something
849
-        $config_class = $this->_set_config_class($config_class, $name);
850
-        // run tests 1-4, 6 and 7 to verify that all params have been set
851
-        if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) {
852
-            return null;
853
-        }
854
-        // now test if the requested config object exists, but suppress errors
855
-        if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) {
856
-            // config already exists, so pass it back
857
-            return $this->{$section}->{$name};
858
-        }
859
-        // load config option from db if it exists
860
-        $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name));
861
-        // verify the newly retrieved config object, but suppress errors
862
-        if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) {
863
-            // config is good, so set it and pass it back
864
-            $this->{$section}->{$name} = $config_obj;
865
-            return $this->{$section}->{$name};
866
-        }
867
-        // oops! $config_obj is not already set and does not exist in the db, so create a new one
868
-        $config_obj = $this->set_config($section, $name, $config_class);
869
-        // verify the newly created config object
870
-        if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) {
871
-            return $this->{$section}->{$name};
872
-        } else {
873
-            EE_Error::add_error(
874
-                sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class),
875
-                __FILE__,
876
-                __FUNCTION__,
877
-                __LINE__
878
-            );
879
-        }
880
-        return null;
881
-    }
882
-
883
-
884
-
885
-    /**
886
-     *    get_config_option
887
-     *
888
-     * @access    public
889
-     * @param    string $config_option_name
890
-     * @return    mixed EE_Config_Base | FALSE
891
-     */
892
-    public function get_config_option($config_option_name = '')
893
-    {
894
-        // retrieve the wp-option for this config class.
895
-        $config_option = maybe_unserialize(get_option($config_option_name, array()));
896
-        if (empty($config_option)) {
897
-            EE_Config::log($config_option_name . '-NOT-FOUND');
898
-        }
899
-        return $config_option;
900
-    }
901
-
902
-
903
-
904
-    /**
905
-     * log
906
-     *
907
-     * @param string $config_option_name
908
-     */
909
-    public static function log($config_option_name = '')
910
-    {
911
-        if (EE_Config::logging_enabled() && ! empty($config_option_name)) {
912
-            $config_log = get_option(EE_Config::LOG_NAME, array());
913
-            //copy incoming $_REQUEST and sanitize it so we can save it
914
-            $_request = $_REQUEST;
915
-            array_walk_recursive($_request, 'sanitize_text_field');
916
-            $config_log[(string)microtime(true)] = array(
917
-                'config_name' => $config_option_name,
918
-                'request'     => $_request,
919
-            );
920
-            update_option(EE_Config::LOG_NAME, $config_log);
921
-        }
922
-    }
923
-
924
-
925
-
926
-    /**
927
-     * trim_log
928
-     * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH
929
-     */
930
-    public static function trim_log()
931
-    {
932
-        if ( ! EE_Config::logging_enabled()) {
933
-            return;
934
-        }
935
-        $config_log = maybe_unserialize(get_option(EE_Config::LOG_NAME, array()));
936
-        $log_length = count($config_log);
937
-        if ($log_length > EE_Config::LOG_LENGTH) {
938
-            ksort($config_log);
939
-            $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true);
940
-            update_option(EE_Config::LOG_NAME, $config_log);
941
-        }
942
-    }
943
-
944
-
945
-
946
-    /**
947
-     *    get_page_for_posts
948
-     *    if the wp-option "show_on_front" is set to "page", then this is the post_name for the post set in the
949
-     *    wp-option "page_for_posts", or "posts" if no page is selected
950
-     *
951
-     * @access    public
952
-     * @return    string
953
-     */
954
-    public static function get_page_for_posts()
955
-    {
956
-        $page_for_posts = get_option('page_for_posts');
957
-        if ( ! $page_for_posts) {
958
-            return 'posts';
959
-        }
960
-        /** @type WPDB $wpdb */
961
-        global $wpdb;
962
-        $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
963
-        return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts));
964
-    }
965
-
966
-
967
-
968
-    /**
969
-     *    register_shortcodes_and_modules.
970
-     *    At this point, it's too early to tell if we're maintenance mode or not.
971
-     *    In fact, this is where we give modules a chance to let core know they exist
972
-     *    so they can help trigger maintenance mode if it's needed
973
-     *
974
-     * @access    public
975
-     * @return    void
976
-     */
977
-    public function register_shortcodes_and_modules()
978
-    {
979
-        // allow shortcodes to register with WP and to set hooks for the rest of the system
980
-        EE_Registry::instance()->shortcodes = $this->_register_shortcodes();
981
-        // allow modules to set hooks for the rest of the system
982
-        EE_Registry::instance()->modules = $this->_register_modules();
983
-    }
984
-
985
-
986
-
987
-    /**
988
-     *    initialize_shortcodes_and_modules
989
-     *    meaning they can start adding their hooks to get stuff done
990
-     *
991
-     * @access    public
992
-     * @return    void
993
-     */
994
-    public function initialize_shortcodes_and_modules()
995
-    {
996
-        // allow shortcodes to set hooks for the rest of the system
997
-        $this->_initialize_shortcodes();
998
-        // allow modules to set hooks for the rest of the system
999
-        $this->_initialize_modules();
1000
-    }
1001
-
1002
-
1003
-
1004
-    /**
1005
-     *    widgets_init
1006
-     *
1007
-     * @access private
1008
-     * @return void
1009
-     */
1010
-    public function widgets_init()
1011
-    {
1012
-        //only init widgets on admin pages when not in complete maintenance, and
1013
-        //on frontend when not in any maintenance mode
1014
-        if (
1015
-            ! EE_Maintenance_Mode::instance()->level()
1016
-            || (
1017
-                is_admin()
1018
-                && EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
1019
-            )
1020
-        ) {
1021
-            // grab list of installed widgets
1022
-            $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1023
-            // filter list of modules to register
1024
-            $widgets_to_register = apply_filters(
1025
-                'FHEE__EE_Config__register_widgets__widgets_to_register',
1026
-                $widgets_to_register
1027
-            );
1028
-            if ( ! empty($widgets_to_register)) {
1029
-                // cycle thru widget folders
1030
-                foreach ($widgets_to_register as $widget_path) {
1031
-                    // add to list of installed widget modules
1032
-                    EE_Config::register_ee_widget($widget_path);
1033
-                }
1034
-            }
1035
-            // filter list of installed modules
1036
-            EE_Registry::instance()->widgets = apply_filters(
1037
-                'FHEE__EE_Config__register_widgets__installed_widgets',
1038
-                EE_Registry::instance()->widgets
1039
-            );
1040
-        }
1041
-    }
1042
-
1043
-
1044
-
1045
-    /**
1046
-     *    register_ee_widget - makes core aware of this widget
1047
-     *
1048
-     * @access    public
1049
-     * @param    string $widget_path - full path up to and including widget folder
1050
-     * @return    void
1051
-     */
1052
-    public static function register_ee_widget($widget_path = null)
1053
-    {
1054
-        do_action('AHEE__EE_Config__register_widget__begin', $widget_path);
1055
-        $widget_ext = '.widget.php';
1056
-        // make all separators match
1057
-        $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS);
1058
-        // does the file path INCLUDE the actual file name as part of the path ?
1059
-        if (strpos($widget_path, $widget_ext) !== false) {
1060
-            // grab and shortcode file name from directory name and break apart at dots
1061
-            $file_name = explode('.', basename($widget_path));
1062
-            // take first segment from file name pieces and remove class prefix if it exists
1063
-            $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0];
1064
-            // sanitize shortcode directory name
1065
-            $widget = sanitize_key($widget);
1066
-            // now we need to rebuild the shortcode path
1067
-            $widget_path = explode(DS, $widget_path);
1068
-            // remove last segment
1069
-            array_pop($widget_path);
1070
-            // glue it back together
1071
-            $widget_path = implode(DS, $widget_path);
1072
-        } else {
1073
-            // grab and sanitize widget directory name
1074
-            $widget = sanitize_key(basename($widget_path));
1075
-        }
1076
-        // create classname from widget directory name
1077
-        $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1078
-        // add class prefix
1079
-        $widget_class = 'EEW_' . $widget;
1080
-        // does the widget exist ?
1081
-        if ( ! is_readable($widget_path . DS . $widget_class . $widget_ext)) {
1082
-            $msg = sprintf(
1083
-                __(
1084
-                    'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1085
-                    'event_espresso'
1086
-                ),
1087
-                $widget_class,
1088
-                $widget_path . DS . $widget_class . $widget_ext
1089
-            );
1090
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1091
-            return;
1092
-        }
1093
-        // load the widget class file
1094
-        require_once($widget_path . DS . $widget_class . $widget_ext);
1095
-        // verify that class exists
1096
-        if ( ! class_exists($widget_class)) {
1097
-            $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1098
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1099
-            return;
1100
-        }
1101
-        register_widget($widget_class);
1102
-        // add to array of registered widgets
1103
-        EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
1104
-    }
1105
-
1106
-
1107
-
1108
-    /**
1109
-     *        _register_shortcodes
1110
-     *
1111
-     * @access private
1112
-     * @return array
1113
-     */
1114
-    private function _register_shortcodes()
1115
-    {
1116
-        // grab list of installed shortcodes
1117
-        $shortcodes_to_register = glob(EE_SHORTCODES . '*', GLOB_ONLYDIR);
1118
-        // filter list of modules to register
1119
-        $shortcodes_to_register = apply_filters(
1120
-            'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
1121
-            $shortcodes_to_register
1122
-        );
1123
-        if ( ! empty($shortcodes_to_register)) {
1124
-            // cycle thru shortcode folders
1125
-            foreach ($shortcodes_to_register as $shortcode_path) {
1126
-                // add to list of installed shortcode modules
1127
-                EE_Config::register_shortcode($shortcode_path);
1128
-            }
1129
-        }
1130
-        // filter list of installed modules
1131
-        return apply_filters(
1132
-            'FHEE__EE_Config___register_shortcodes__installed_shortcodes',
1133
-            EE_Registry::instance()->shortcodes
1134
-        );
1135
-    }
1136
-
1137
-
1138
-
1139
-    /**
1140
-     *    register_shortcode - makes core aware of this shortcode
1141
-     *
1142
-     * @access    public
1143
-     * @param    string $shortcode_path - full path up to and including shortcode folder
1144
-     * @return    bool
1145
-     */
1146
-    public static function register_shortcode($shortcode_path = null)
1147
-    {
1148
-        do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path);
1149
-        $shortcode_ext = '.shortcode.php';
1150
-        // make all separators match
1151
-        $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path);
1152
-        // does the file path INCLUDE the actual file name as part of the path ?
1153
-        if (strpos($shortcode_path, $shortcode_ext) !== false) {
1154
-            // grab shortcode file name from directory name and break apart at dots
1155
-            $shortcode_file = explode('.', basename($shortcode_path));
1156
-            // take first segment from file name pieces and remove class prefix if it exists
1157
-            $shortcode = strpos($shortcode_file[0], 'EES_') === 0
1158
-                ? substr($shortcode_file[0], 4)
1159
-                : $shortcode_file[0];
1160
-            // sanitize shortcode directory name
1161
-            $shortcode = sanitize_key($shortcode);
1162
-            // now we need to rebuild the shortcode path
1163
-            $shortcode_path = explode(DS, $shortcode_path);
1164
-            // remove last segment
1165
-            array_pop($shortcode_path);
1166
-            // glue it back together
1167
-            $shortcode_path = implode(DS, $shortcode_path) . DS;
1168
-        } else {
1169
-            // we need to generate the filename based off of the folder name
1170
-            // grab and sanitize shortcode directory name
1171
-            $shortcode = sanitize_key(basename($shortcode_path));
1172
-            $shortcode_path = rtrim($shortcode_path, DS) . DS;
1173
-        }
1174
-        // create classname from shortcode directory or file name
1175
-        $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1176
-        // add class prefix
1177
-        $shortcode_class = 'EES_' . $shortcode;
1178
-        // does the shortcode exist ?
1179
-        if ( ! is_readable($shortcode_path . DS . $shortcode_class . $shortcode_ext)) {
1180
-            $msg = sprintf(
1181
-                __(
1182
-                    'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s',
1183
-                    'event_espresso'
1184
-                ),
1185
-                $shortcode_class,
1186
-                $shortcode_path . DS . $shortcode_class . $shortcode_ext
1187
-            );
1188
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1189
-            return false;
1190
-        }
1191
-        // load the shortcode class file
1192
-        require_once($shortcode_path . $shortcode_class . $shortcode_ext);
1193
-        // verify that class exists
1194
-        if ( ! class_exists($shortcode_class)) {
1195
-            $msg = sprintf(
1196
-                __('The requested %s shortcode class does not exist.', 'event_espresso'),
1197
-                $shortcode_class
1198
-            );
1199
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1200
-            return false;
1201
-        }
1202
-        $shortcode = strtoupper($shortcode);
1203
-        // add to array of registered shortcodes
1204
-        EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1205
-        return true;
1206
-    }
1207
-
1208
-
1209
-
1210
-    /**
1211
-     *        _register_modules
1212
-     *
1213
-     * @access private
1214
-     * @return array
1215
-     */
1216
-    private function _register_modules()
1217
-    {
1218
-        // grab list of installed modules
1219
-        $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1220
-        // filter list of modules to register
1221
-        $modules_to_register = apply_filters(
1222
-            'FHEE__EE_Config__register_modules__modules_to_register',
1223
-            $modules_to_register
1224
-        );
1225
-        if ( ! empty($modules_to_register)) {
1226
-            // loop through folders
1227
-            foreach ($modules_to_register as $module_path) {
1228
-                /**TEMPORARILY EXCLUDE gateways from modules for time being**/
1229
-                if (
1230
-                    $module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1231
-                    && $module_path !== EE_MODULES . 'gateways'
1232
-                ) {
1233
-                    // add to list of installed modules
1234
-                    EE_Config::register_module($module_path);
1235
-                }
1236
-            }
1237
-        }
1238
-        // filter list of installed modules
1239
-        return apply_filters(
1240
-            'FHEE__EE_Config___register_modules__installed_modules',
1241
-            EE_Registry::instance()->modules
1242
-        );
1243
-    }
1244
-
1245
-
1246
-
1247
-    /**
1248
-     *    register_module - makes core aware of this module
1249
-     *
1250
-     * @access    public
1251
-     * @param    string $module_path - full path up to and including module folder
1252
-     * @return    bool
1253
-     */
1254
-    public static function register_module($module_path = null)
1255
-    {
1256
-        do_action('AHEE__EE_Config__register_module__begin', $module_path);
1257
-        $module_ext = '.module.php';
1258
-        // make all separators match
1259
-        $module_path = str_replace(array('\\', '/'), DS, $module_path);
1260
-        // does the file path INCLUDE the actual file name as part of the path ?
1261
-        if (strpos($module_path, $module_ext) !== false) {
1262
-            // grab and shortcode file name from directory name and break apart at dots
1263
-            $module_file = explode('.', basename($module_path));
1264
-            // now we need to rebuild the shortcode path
1265
-            $module_path = explode(DS, $module_path);
1266
-            // remove last segment
1267
-            array_pop($module_path);
1268
-            // glue it back together
1269
-            $module_path = implode(DS, $module_path) . DS;
1270
-            // take first segment from file name pieces and sanitize it
1271
-            $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1272
-            // ensure class prefix is added
1273
-            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1274
-        } else {
1275
-            // we need to generate the filename based off of the folder name
1276
-            // grab and sanitize module name
1277
-            $module = strtolower(basename($module_path));
1278
-            $module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1279
-            // like trailingslashit()
1280
-            $module_path = rtrim($module_path, DS) . DS;
1281
-            // create classname from module directory name
1282
-            $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1283
-            // add class prefix
1284
-            $module_class = 'EED_' . $module;
1285
-        }
1286
-        // does the module exist ?
1287
-        if ( ! is_readable($module_path . DS . $module_class . $module_ext)) {
1288
-            $msg = sprintf(
1289
-                __(
1290
-                    'The requested %s module file could not be found or is not readable due to file permissions.',
1291
-                    'event_espresso'
1292
-                ),
1293
-                $module
1294
-            );
1295
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1296
-            return false;
1297
-        }
1298
-        // load the module class file
1299
-        require_once($module_path . $module_class . $module_ext);
1300
-        // verify that class exists
1301
-        if ( ! class_exists($module_class)) {
1302
-            $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1303
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1304
-            return false;
1305
-        }
1306
-        // add to array of registered modules
1307
-        EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1308
-        do_action(
1309
-            'AHEE__EE_Config__register_module__complete',
1310
-            $module_class,
1311
-            EE_Registry::instance()->modules->{$module_class}
1312
-        );
1313
-        return true;
1314
-    }
1315
-
1316
-
1317
-
1318
-    /**
1319
-     *    _initialize_shortcodes
1320
-     *    allow shortcodes to set hooks for the rest of the system
1321
-     *
1322
-     * @access private
1323
-     * @return void
1324
-     */
1325
-    private function _initialize_shortcodes()
1326
-    {
1327
-        // cycle thru shortcode folders
1328
-        foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1329
-            // add class prefix
1330
-            $shortcode_class = 'EES_' . $shortcode;
1331
-            // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1332
-            // which set hooks ?
1333
-            if (is_admin()) {
1334
-                // fire immediately
1335
-                call_user_func(array($shortcode_class, 'set_hooks_admin'));
1336
-            } else {
1337
-                // delay until other systems are online
1338
-                add_action(
1339
-                    'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1340
-                    array($shortcode_class, 'set_hooks')
1341
-                );
1342
-                // convert classname to UPPERCASE and create WP shortcode.
1343
-                $shortcode_tag = strtoupper($shortcode);
1344
-                // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor'
1345
-                if ( ! shortcode_exists($shortcode_tag)) {
1346
-                    // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes()
1347
-                    add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor'));
1348
-                }
1349
-            }
1350
-        }
1351
-    }
1352
-
1353
-
1354
-
1355
-    /**
1356
-     *    _initialize_modules
1357
-     *    allow modules to set hooks for the rest of the system
1358
-     *
1359
-     * @access private
1360
-     * @return void
1361
-     */
1362
-    private function _initialize_modules()
1363
-    {
1364
-        // cycle thru shortcode folders
1365
-        foreach (EE_Registry::instance()->modules as $module_class => $module_path) {
1366
-            // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1367
-            // which set hooks ?
1368
-            if (is_admin()) {
1369
-                // fire immediately
1370
-                call_user_func(array($module_class, 'set_hooks_admin'));
1371
-            } else {
1372
-                // delay until other systems are online
1373
-                add_action(
1374
-                    'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons',
1375
-                    array($module_class, 'set_hooks')
1376
-                );
1377
-            }
1378
-        }
1379
-    }
1380
-
1381
-
1382
-
1383
-    /**
1384
-     *    register_route - adds module method routes to route_map
1385
-     *
1386
-     * @access    public
1387
-     * @param    string $route       - "pretty" public alias for module method
1388
-     * @param    string $module      - module name (classname without EED_ prefix)
1389
-     * @param    string $method_name - the actual module method to be routed to
1390
-     * @param    string $key         - url param key indicating a route is being called
1391
-     * @return    bool
1392
-     */
1393
-    public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee')
1394
-    {
1395
-        do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1396
-        $module = str_replace('EED_', '', $module);
1397
-        $module_class = 'EED_' . $module;
1398
-        if ( ! isset(EE_Registry::instance()->modules->{$module_class})) {
1399
-            $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1400
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1401
-            return false;
1402
-        }
1403
-        if (empty($route)) {
1404
-            $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1405
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1406
-            return false;
1407
-        }
1408
-        if ( ! method_exists('EED_' . $module, $method_name)) {
1409
-            $msg = sprintf(
1410
-                __('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1411
-                $route
1412
-            );
1413
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1414
-            return false;
1415
-        }
1416
-        EE_Config::$_module_route_map[$key][$route] = array('EED_' . $module, $method_name);
1417
-        return true;
1418
-    }
1419
-
1420
-
1421
-
1422
-    /**
1423
-     *    get_route - get module method route
1424
-     *
1425
-     * @access    public
1426
-     * @param    string $route - "pretty" public alias for module method
1427
-     * @param    string $key   - url param key indicating a route is being called
1428
-     * @return    string
1429
-     */
1430
-    public static function get_route($route = null, $key = 'ee')
1431
-    {
1432
-        do_action('AHEE__EE_Config__get_route__begin', $route);
1433
-        $route = (string)apply_filters('FHEE__EE_Config__get_route', $route);
1434
-        if (isset(EE_Config::$_module_route_map[$key][$route])) {
1435
-            return EE_Config::$_module_route_map[$key][$route];
1436
-        }
1437
-        return null;
1438
-    }
1439
-
1440
-
1441
-
1442
-    /**
1443
-     *    get_routes - get ALL module method routes
1444
-     *
1445
-     * @access    public
1446
-     * @return    array
1447
-     */
1448
-    public static function get_routes()
1449
-    {
1450
-        return EE_Config::$_module_route_map;
1451
-    }
1452
-
1453
-
1454
-
1455
-    /**
1456
-     *    register_forward - allows modules to forward request to another module for further processing
1457
-     *
1458
-     * @access    public
1459
-     * @param    string       $route   - "pretty" public alias for module method
1460
-     * @param    integer      $status  - integer value corresponding  to status constant strings set in module parent
1461
-     *                                 class, allows different forwards to be served based on status
1462
-     * @param    array|string $forward - function name or array( class, method )
1463
-     * @param    string       $key     - url param key indicating a route is being called
1464
-     * @return    bool
1465
-     */
1466
-    public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee')
1467
-    {
1468
-        do_action('AHEE__EE_Config__register_forward', $route, $status, $forward);
1469
-        if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1470
-            $msg = sprintf(
1471
-                __('The module route %s for this forward has not been registered.', 'event_espresso'),
1472
-                $route
1473
-            );
1474
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1475
-            return false;
1476
-        }
1477
-        if (empty($forward)) {
1478
-            $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1479
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1480
-            return false;
1481
-        }
1482
-        if (is_array($forward)) {
1483
-            if ( ! isset($forward[1])) {
1484
-                $msg = sprintf(
1485
-                    __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1486
-                    $route
1487
-                );
1488
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1489
-                return false;
1490
-            }
1491
-            if ( ! method_exists($forward[0], $forward[1])) {
1492
-                $msg = sprintf(
1493
-                    __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'),
1494
-                    $forward[1],
1495
-                    $route
1496
-                );
1497
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1498
-                return false;
1499
-            }
1500
-        } else if ( ! function_exists($forward)) {
1501
-            $msg = sprintf(
1502
-                __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'),
1503
-                $forward,
1504
-                $route
1505
-            );
1506
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1507
-            return false;
1508
-        }
1509
-        EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
1510
-        return true;
1511
-    }
1512
-
1513
-
1514
-
1515
-    /**
1516
-     *    get_forward - get forwarding route
1517
-     *
1518
-     * @access    public
1519
-     * @param    string  $route  - "pretty" public alias for module method
1520
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1521
-     *                           allows different forwards to be served based on status
1522
-     * @param    string  $key    - url param key indicating a route is being called
1523
-     * @return    string
1524
-     */
1525
-    public static function get_forward($route = null, $status = 0, $key = 'ee')
1526
-    {
1527
-        do_action('AHEE__EE_Config__get_forward__begin', $route, $status);
1528
-        if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) {
1529
-            return apply_filters(
1530
-                'FHEE__EE_Config__get_forward',
1531
-                EE_Config::$_module_forward_map[$key][$route][$status],
1532
-                $route,
1533
-                $status
1534
-            );
1535
-        }
1536
-        return null;
1537
-    }
1538
-
1539
-
1540
-
1541
-    /**
1542
-     *    register_forward - allows modules to specify different view templates for different method routes and status
1543
-     *    results
1544
-     *
1545
-     * @access    public
1546
-     * @param    string  $route  - "pretty" public alias for module method
1547
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1548
-     *                           allows different views to be served based on status
1549
-     * @param    string  $view
1550
-     * @param    string  $key    - url param key indicating a route is being called
1551
-     * @return    bool
1552
-     */
1553
-    public static function register_view($route = null, $status = 0, $view = null, $key = 'ee')
1554
-    {
1555
-        do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view);
1556
-        if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) {
1557
-            $msg = sprintf(
1558
-                __('The module route %s for this view has not been registered.', 'event_espresso'),
1559
-                $route
1560
-            );
1561
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1562
-            return false;
1563
-        }
1564
-        if ( ! is_readable($view)) {
1565
-            $msg = sprintf(
1566
-                __(
1567
-                    'The %s view file could not be found or is not readable due to file permissions.',
1568
-                    'event_espresso'
1569
-                ),
1570
-                $view
1571
-            );
1572
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1573
-            return false;
1574
-        }
1575
-        EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
1576
-        return true;
1577
-    }
1578
-
1579
-
1580
-
1581
-    /**
1582
-     *    get_view - get view for route and status
1583
-     *
1584
-     * @access    public
1585
-     * @param    string  $route  - "pretty" public alias for module method
1586
-     * @param    integer $status - integer value corresponding  to status constant strings set in module parent class,
1587
-     *                           allows different views to be served based on status
1588
-     * @param    string  $key    - url param key indicating a route is being called
1589
-     * @return    string
1590
-     */
1591
-    public static function get_view($route = null, $status = 0, $key = 'ee')
1592
-    {
1593
-        do_action('AHEE__EE_Config__get_view__begin', $route, $status);
1594
-        if (isset(EE_Config::$_module_view_map[$key][$route][$status])) {
1595
-            return apply_filters(
1596
-                'FHEE__EE_Config__get_view',
1597
-                EE_Config::$_module_view_map[$key][$route][$status],
1598
-                $route,
1599
-                $status
1600
-            );
1601
-        }
1602
-        return null;
1603
-    }
1604
-
1605
-
1606
-
1607
-    public function update_addon_option_names()
1608
-    {
1609
-        update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names);
1610
-    }
1611
-
1612
-
1613
-
1614
-    public function shutdown()
1615
-    {
1616
-        $this->update_addon_option_names();
1617
-    }
1618
-
1619
-
1620
-}
1621
-
1622
-
1623
-
1624
-/**
1625
- * Base class used for config classes. These classes should generally not have
1626
- * magic functions in use, except we'll allow them to magically set and get stuff...
1627
- * basically, they should just be well-defined stdClasses
1628
- */
1629
-class EE_Config_Base
1630
-{
1631
-
1632
-    /**
1633
-     * Utility function for escaping the value of a property and returning.
1634
-     *
1635
-     * @param string $property property name (checks to see if exists).
1636
-     * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1637
-     * @throws \EE_Error
1638
-     */
1639
-    public function get_pretty($property)
1640
-    {
1641
-        if ( ! property_exists($this, $property)) {
1642
-            throw new EE_Error(
1643
-                sprintf(
1644
-                    __(
1645
-                        '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1646
-                        'event_espresso'
1647
-                    ),
1648
-                    get_class($this),
1649
-                    $property
1650
-                )
1651
-            );
1652
-        }
1653
-        //just handling escaping of strings for now.
1654
-        if (is_string($this->{$property})) {
1655
-            return stripslashes($this->{$property});
1656
-        }
1657
-        return $this->{$property};
1658
-    }
1659
-
1660
-
1661
-
1662
-    public function populate()
1663
-    {
1664
-        //grab defaults via a new instance of this class.
1665
-        $class_name = get_class($this);
1666
-        $defaults = new $class_name;
1667
-        //loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1668
-        //default from our $defaults object.
1669
-        foreach (get_object_vars($defaults) as $property => $value) {
1670
-            if ($this->{$property} === null) {
1671
-                $this->{$property} = $value;
1672
-            }
1673
-        }
1674
-        //cleanup
1675
-        unset($defaults);
1676
-    }
1677
-
1678
-
1679
-    /**
1680
-     *        @ override magic methods
1681
-     *        @ return void
1682
-     */
1683
-    //	public function __get($a) { return apply_filters('FHEE__'.get_class($this).'__get__'.$a,$this->{$a}); }
1684
-    //	public function __set($a,$b) { return apply_filters('FHEE__'.get_class($this).'__set__'.$a, $this->{$a} = $b ); }
1685
-    /**
1686
-     *        __isset
1687
-     *
1688
-     * @param $a
1689
-     * @return bool
1690
-     */
1691
-    public function __isset($a)
1692
-    {
1693
-        return false;
1694
-    }
1695
-
1696
-
1697
-
1698
-    /**
1699
-     *        __unset
1700
-     *
1701
-     * @param $a
1702
-     * @return bool
1703
-     */
1704
-    public function __unset($a)
1705
-    {
1706
-        return false;
1707
-    }
1708
-
1709
-
1710
-
1711
-    /**
1712
-     *        __clone
1713
-     */
1714
-    public function __clone()
1715
-    {
1716
-    }
1717
-
1718
-
1719
-
1720
-    /**
1721
-     *        __wakeup
1722
-     */
1723
-    public function __wakeup()
1724
-    {
1725
-    }
1726
-
1727
-
1728
-
1729
-    /**
1730
-     *        __destruct
1731
-     */
1732
-    public function __destruct()
1733
-    {
1734
-    }
1735
-}
1736
-
1737
-
1738
-
1739
-/**
1740
- * Class for defining what's in the EE_Config relating to registration settings
1741
- */
1742
-class EE_Core_Config extends EE_Config_Base
1743
-{
1744
-
1745
-    public $current_blog_id;
1746
-
1747
-    public $ee_ueip_optin;
1748
-
1749
-    public $ee_ueip_has_notified;
1750
-
1751
-    /**
1752
-     * Not to be confused with the 4 critical page variables (See
1753
-     * get_critical_pages_array()), this is just an array of wp posts that have EE
1754
-     * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode
1755
-     * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array.
1756
-     *
1757
-     * @var array
1758
-     */
1759
-    public $post_shortcodes;
1760
-
1761
-    public $module_route_map;
1762
-
1763
-    public $module_forward_map;
1764
-
1765
-    public $module_view_map;
1766
-
1767
-    /**
1768
-     * The next 4 vars are the IDs of critical EE pages.
1769
-     *
1770
-     * @var int
1771
-     */
1772
-    public $reg_page_id;
1773
-
1774
-    public $txn_page_id;
1775
-
1776
-    public $thank_you_page_id;
1777
-
1778
-    public $cancel_page_id;
1779
-
1780
-    /**
1781
-     * The next 4 vars are the URLs of critical EE pages.
1782
-     *
1783
-     * @var int
1784
-     */
1785
-    public $reg_page_url;
1786
-
1787
-    public $txn_page_url;
1788
-
1789
-    public $thank_you_page_url;
1790
-
1791
-    public $cancel_page_url;
1792
-
1793
-    /**
1794
-     * The next vars relate to the custom slugs for EE CPT routes
1795
-     */
1796
-    public $event_cpt_slug;
1797
-
1798
-
1799
-    /**
1800
-     * This caches the _ee_ueip_option in case this config is reset in the same
1801
-     * request across blog switches in a multisite context.
1802
-     * Avoids extra queries to the db for this option.
1803
-     *
1804
-     * @var bool
1805
-     */
1806
-    public static $ee_ueip_option;
1807
-
1808
-
1809
-
1810
-    /**
1811
-     *    class constructor
1812
-     *
1813
-     * @access    public
1814
-     */
1815
-    public function __construct()
1816
-    {
1817
-        // set default organization settings
1818
-        $this->current_blog_id = get_current_blog_id();
1819
-        $this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id;
1820
-        $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1821
-        $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1822
-        $this->post_shortcodes = array();
1823
-        $this->module_route_map = array();
1824
-        $this->module_forward_map = array();
1825
-        $this->module_view_map = array();
1826
-        // critical EE page IDs
1827
-        $this->reg_page_id = 0;
1828
-        $this->txn_page_id = 0;
1829
-        $this->thank_you_page_id = 0;
1830
-        $this->cancel_page_id = 0;
1831
-        // critical EE page URLs
1832
-        $this->reg_page_url = '';
1833
-        $this->txn_page_url = '';
1834
-        $this->thank_you_page_url = '';
1835
-        $this->cancel_page_url = '';
1836
-        //cpt slugs
1837
-        $this->event_cpt_slug = __('events', 'event_espresso');
1838
-        //ueip constant check
1839
-        if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1840
-            $this->ee_ueip_optin = false;
1841
-            $this->ee_ueip_has_notified = true;
1842
-        }
1843
-    }
1844
-
1845
-
1846
-
1847
-    /**
1848
-     * @return array
1849
-     */
1850
-    public function get_critical_pages_array()
1851
-    {
1852
-        return array(
1853
-            $this->reg_page_id,
1854
-            $this->txn_page_id,
1855
-            $this->thank_you_page_id,
1856
-            $this->cancel_page_id,
1857
-        );
1858
-    }
1859
-
1860
-
1861
-
1862
-    /**
1863
-     * @return array
1864
-     */
1865
-    public function get_critical_pages_shortcodes_array()
1866
-    {
1867
-        return array(
1868
-            $this->reg_page_id       => 'ESPRESSO_CHECKOUT',
1869
-            $this->txn_page_id       => 'ESPRESSO_TXN_PAGE',
1870
-            $this->thank_you_page_id => 'ESPRESSO_THANK_YOU',
1871
-            $this->cancel_page_id    => 'ESPRESSO_CANCELLED',
1872
-        );
1873
-    }
1874
-
1875
-
1876
-
1877
-    /**
1878
-     *  gets/returns URL for EE reg_page
1879
-     *
1880
-     * @access    public
1881
-     * @return    string
1882
-     */
1883
-    public function reg_page_url()
1884
-    {
1885
-        if ( ! $this->reg_page_url) {
1886
-            $this->reg_page_url = add_query_arg(
1887
-                                      array('uts' => time()),
1888
-                                      get_permalink($this->reg_page_id)
1889
-                                  ) . '#checkout';
1890
-        }
1891
-        return $this->reg_page_url;
1892
-    }
1893
-
1894
-
1895
-
1896
-    /**
1897
-     *  gets/returns URL for EE txn_page
1898
-     *
1899
-     * @param array $query_args like what gets passed to
1900
-     *                          add_query_arg() as the first argument
1901
-     * @access    public
1902
-     * @return    string
1903
-     */
1904
-    public function txn_page_url($query_args = array())
1905
-    {
1906
-        if ( ! $this->txn_page_url) {
1907
-            $this->txn_page_url = get_permalink($this->txn_page_id);
1908
-        }
1909
-        if ($query_args) {
1910
-            return add_query_arg($query_args, $this->txn_page_url);
1911
-        } else {
1912
-            return $this->txn_page_url;
1913
-        }
1914
-    }
1915
-
1916
-
1917
-
1918
-    /**
1919
-     *  gets/returns URL for EE thank_you_page
1920
-     *
1921
-     * @param array $query_args like what gets passed to
1922
-     *                          add_query_arg() as the first argument
1923
-     * @access    public
1924
-     * @return    string
1925
-     */
1926
-    public function thank_you_page_url($query_args = array())
1927
-    {
1928
-        if ( ! $this->thank_you_page_url) {
1929
-            $this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1930
-        }
1931
-        if ($query_args) {
1932
-            return add_query_arg($query_args, $this->thank_you_page_url);
1933
-        } else {
1934
-            return $this->thank_you_page_url;
1935
-        }
1936
-    }
1937
-
1938
-
1939
-
1940
-    /**
1941
-     *  gets/returns URL for EE cancel_page
1942
-     *
1943
-     * @access    public
1944
-     * @return    string
1945
-     */
1946
-    public function cancel_page_url()
1947
-    {
1948
-        if ( ! $this->cancel_page_url) {
1949
-            $this->cancel_page_url = get_permalink($this->cancel_page_id);
1950
-        }
1951
-        return $this->cancel_page_url;
1952
-    }
1953
-
1954
-
1955
-
1956
-    /**
1957
-     * Resets all critical page urls to their original state.  Used primarily by the __sleep() magic method currently.
1958
-     *
1959
-     * @since 4.7.5
1960
-     */
1961
-    protected function _reset_urls()
1962
-    {
1963
-        $this->reg_page_url = '';
1964
-        $this->txn_page_url = '';
1965
-        $this->cancel_page_url = '';
1966
-        $this->thank_you_page_url = '';
1967
-    }
1968
-
1969
-
1970
-
1971
-    /**
1972
-     * Used to return what the optin value is set for the EE User Experience Program.
1973
-     * This accounts for multisite and this value being requested for a subsite.  In multisite, the value is set
1974
-     * on the main site only.
1975
-     *
1976
-     * @return mixed|void
1977
-     */
1978
-    protected function _get_main_ee_ueip_optin()
1979
-    {
1980
-        //if this is the main site then we can just bypass our direct query.
1981
-        if (is_main_site()) {
1982
-            return get_option('ee_ueip_optin', false);
1983
-        }
1984
-        //is this already cached for this request?  If so use it.
1985
-        if ( ! empty(EE_Core_Config::$ee_ueip_option)) {
1986
-            return EE_Core_Config::$ee_ueip_option;
1987
-        }
1988
-        global $wpdb;
1989
-        $current_network_main_site = is_multisite() ? get_current_site() : null;
1990
-        $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1991
-        $option = 'ee_ueip_optin';
1992
-        //set correct table for query
1993
-        $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1994
-        //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1995
-        //get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1996
-        //re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1997
-        //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1998
-        //for the purpose of caching.
1999
-        $pre = apply_filters('pre_option_' . $option, false, $option);
2000
-        if (false !== $pre) {
2001
-            EE_Core_Config::$ee_ueip_option = $pre;
2002
-            return EE_Core_Config::$ee_ueip_option;
2003
-        }
2004
-        $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1",
2005
-            $option));
2006
-        if (is_object($row)) {
2007
-            $value = $row->option_value;
2008
-        } else { //option does not exist so use default.
2009
-            return apply_filters('default_option_' . $option, false, $option);
2010
-        }
2011
-        EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
2012
-        return EE_Core_Config::$ee_ueip_option;
2013
-    }
2014
-
2015
-
2016
-
2017
-    /**
2018
-     * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values
2019
-     * on the object.
2020
-     *
2021
-     * @return array
2022
-     */
2023
-    public function __sleep()
2024
-    {
2025
-        //reset all url properties
2026
-        $this->_reset_urls();
2027
-        //return what to save to db
2028
-        return array_keys(get_object_vars($this));
2029
-    }
2030
-
2031
-}
2032
-
2033
-
2034
-
2035
-/**
2036
- * Config class for storing info on the Organization
2037
- */
2038
-class EE_Organization_Config extends EE_Config_Base
2039
-{
2040
-
2041
-    /**
2042
-     * @var string $name
2043
-     * eg EE4.1
2044
-     */
2045
-    public $name;
2046
-
2047
-    /**
2048
-     * @var string $address_1
2049
-     * eg 123 Onna Road
2050
-     */
2051
-    public $address_1;
2052
-
2053
-    /**
2054
-     * @var string $address_2
2055
-     * eg PO Box 123
2056
-     */
2057
-    public $address_2;
2058
-
2059
-    /**
2060
-     * @var string $city
2061
-     * eg Inna City
2062
-     */
2063
-    public $city;
2064
-
2065
-    /**
2066
-     * @var int $STA_ID
2067
-     * eg 4
2068
-     */
2069
-    public $STA_ID;
2070
-
2071
-    /**
2072
-     * @var string $CNT_ISO
2073
-     * eg US
2074
-     */
2075
-    public $CNT_ISO;
2076
-
2077
-    /**
2078
-     * @var string $zip
2079
-     * eg 12345  or V1A 2B3
2080
-     */
2081
-    public $zip;
2082
-
2083
-    /**
2084
-     * @var string $email
2085
-     * eg [email protected]
2086
-     */
2087
-    public $email;
2088
-
2089
-
2090
-    /**
2091
-     * @var string $phone
2092
-     * eg. 111-111-1111
2093
-     */
2094
-    public $phone;
2095
-
2096
-
2097
-    /**
2098
-     * @var string $vat
2099
-     * VAT/Tax Number
2100
-     */
2101
-    public $vat;
2102
-
2103
-    /**
2104
-     * @var string $logo_url
2105
-     * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
2106
-     */
2107
-    public $logo_url;
2108
-
2109
-
2110
-    /**
2111
-     * The below are all various properties for holding links to organization social network profiles
2112
-     *
2113
-     * @var string
2114
-     */
2115
-    /**
2116
-     * facebook (facebook.com/profile.name)
2117
-     *
2118
-     * @var string
2119
-     */
2120
-    public $facebook;
2121
-
2122
-
2123
-    /**
2124
-     * twitter (twitter.com/twitter_handle)
2125
-     *
2126
-     * @var string
2127
-     */
2128
-    public $twitter;
2129
-
2130
-
2131
-    /**
2132
-     * linkedin (linkedin.com/in/profile_name)
2133
-     *
2134
-     * @var string
2135
-     */
2136
-    public $linkedin;
2137
-
2138
-
2139
-    /**
2140
-     * pinterest (www.pinterest.com/profile_name)
2141
-     *
2142
-     * @var string
2143
-     */
2144
-    public $pinterest;
2145
-
2146
-
2147
-    /**
2148
-     * google+ (google.com/+profileName)
2149
-     *
2150
-     * @var string
2151
-     */
2152
-    public $google;
2153
-
2154
-
2155
-    /**
2156
-     * instagram (instagram.com/handle)
2157
-     *
2158
-     * @var string
2159
-     */
2160
-    public $instagram;
2161
-
2162
-
2163
-
2164
-    /**
2165
-     *    class constructor
2166
-     *
2167
-     * @access    public
2168
-     */
2169
-    public function __construct()
2170
-    {
2171
-        // set default organization settings
2172
-        $this->name = get_bloginfo('name');
2173
-        $this->address_1 = '123 Onna Road';
2174
-        $this->address_2 = 'PO Box 123';
2175
-        $this->city = 'Inna City';
2176
-        $this->STA_ID = 4;
2177
-        $this->CNT_ISO = 'US';
2178
-        $this->zip = '12345';
2179
-        $this->email = get_bloginfo('admin_email');
2180
-        $this->phone = '';
2181
-        $this->vat = '123456789';
2182
-        $this->logo_url = '';
2183
-        $this->facebook = '';
2184
-        $this->twitter = '';
2185
-        $this->linkedin = '';
2186
-        $this->pinterest = '';
2187
-        $this->google = '';
2188
-        $this->instagram = '';
2189
-    }
2190
-
2191
-}
2192
-
2193
-
2194
-
2195
-/**
2196
- * Class for defining what's in the EE_Config relating to currency
2197
- */
2198
-class EE_Currency_Config extends EE_Config_Base
2199
-{
2200
-
2201
-    /**
2202
-     * @var string $code
2203
-     * eg 'US'
2204
-     */
2205
-    public $code;
2206
-
2207
-    /**
2208
-     * @var string $name
2209
-     * eg 'Dollar'
2210
-     */
2211
-    public $name;
2212
-
2213
-    /**
2214
-     * plural name
2215
-     *
2216
-     * @var string $plural
2217
-     * eg 'Dollars'
2218
-     */
2219
-    public $plural;
2220
-
2221
-    /**
2222
-     * currency sign
2223
-     *
2224
-     * @var string $sign
2225
-     * eg '$'
2226
-     */
2227
-    public $sign;
2228
-
2229
-    /**
2230
-     * Whether the currency sign should come before the number or not
2231
-     *
2232
-     * @var boolean $sign_b4
2233
-     */
2234
-    public $sign_b4;
2235
-
2236
-    /**
2237
-     * How many digits should come after the decimal place
2238
-     *
2239
-     * @var int $dec_plc
2240
-     */
2241
-    public $dec_plc;
2242
-
2243
-    /**
2244
-     * Symbol to use for decimal mark
2245
-     *
2246
-     * @var string $dec_mrk
2247
-     * eg '.'
2248
-     */
2249
-    public $dec_mrk;
2250
-
2251
-    /**
2252
-     * Symbol to use for thousands
2253
-     *
2254
-     * @var string $thsnds
2255
-     * eg ','
2256
-     */
2257
-    public $thsnds;
2258
-
2259
-
2260
-
2261
-    /**
2262
-     *    class constructor
2263
-     *
2264
-     * @access    public
2265
-     * @param string $CNT_ISO
2266
-     * @throws \EE_Error
2267
-     */
2268
-    public function __construct($CNT_ISO = '')
2269
-    {
2270
-        /** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */
2271
-        $table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
2272
-        // get country code from organization settings or use default
2273
-        $ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2274
-                   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2275
-            ? EE_Registry::instance()->CFG->organization->CNT_ISO
2276
-            : '';
2277
-        // but override if requested
2278
-        $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2279
-        // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
2280
-        if (
2281
-            ! empty($CNT_ISO)
2282
-            && EE_Maintenance_Mode::instance()->models_can_query()
2283
-            && $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())
2284
-        ) {
2285
-            // retrieve the country settings from the db, just in case they have been customized
2286
-            $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2287
-            if ($country instanceof EE_Country) {
2288
-                $this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2289
-                $this->name = $country->currency_name_single();    // Dollar
2290
-                $this->plural = $country->currency_name_plural();    // Dollars
2291
-                $this->sign = $country->currency_sign();            // currency sign: $
2292
-                $this->sign_b4 = $country->currency_sign_before();        // currency sign before or after: $TRUE  or  FALSE$
2293
-                $this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2294
-                $this->dec_mrk = $country->currency_decimal_mark();    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2295
-                $this->thsnds = $country->currency_thousands_separator();    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2296
-            }
2297
-        }
2298
-        // fallback to hardcoded defaults, in case the above failed
2299
-        if (empty($this->code)) {
2300
-            // set default currency settings
2301
-            $this->code = 'USD';    // currency code: USD, CAD, EUR
2302
-            $this->name = __('Dollar', 'event_espresso');    // Dollar
2303
-            $this->plural = __('Dollars', 'event_espresso');    // Dollars
2304
-            $this->sign = '$';    // currency sign: $
2305
-            $this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2306
-            $this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2307
-            $this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2308
-            $this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2309
-        }
2310
-    }
2311 1620
 }
2312 1621
 
2313 1622
 
2314 1623
 
2315 1624
 /**
2316
- * Class for defining what's in the EE_Config relating to registration settings
1625
+ * Base class used for config classes. These classes should generally not have
1626
+ * magic functions in use, except we'll allow them to magically set and get stuff...
1627
+ * basically, they should just be well-defined stdClasses
2317 1628
  */
2318
-class EE_Registration_Config extends EE_Config_Base
1629
+class EE_Config_Base
2319 1630
 {
2320 1631
 
2321
-    /**
2322
-     * Default registration status
2323
-     *
2324
-     * @var string $default_STS_ID
2325
-     * eg 'RPP'
2326
-     */
2327
-    public $default_STS_ID;
2328
-
2329
-    /**
2330
-     * level of validation to apply to email addresses
2331
-     *
2332
-     * @var string $email_validation_level
2333
-     * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2334
-     */
2335
-    public $email_validation_level;
2336
-
2337
-    /**
2338
-     *    whether or not to show alternate payment options during the reg process if payment status is pending
2339
-     *
2340
-     * @var boolean $show_pending_payment_options
2341
-     */
2342
-    public $show_pending_payment_options;
2343
-
2344
-    /**
2345
-     * Whether to skip the registration confirmation page
2346
-     *
2347
-     * @var boolean $skip_reg_confirmation
2348
-     */
2349
-    public $skip_reg_confirmation;
2350
-
2351
-    /**
2352
-     * an array of SPCO reg steps where:
2353
-     *        the keys denotes the reg step order
2354
-     *        each element consists of an array with the following elements:
2355
-     *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2356
-     *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2357
-     *            "slug" => the URL param used to trigger the reg step
2358
-     *
2359
-     * @var array $reg_steps
2360
-     */
2361
-    public $reg_steps;
2362
-
2363
-    /**
2364
-     * Whether registration confirmation should be the last page of SPCO
2365
-     *
2366
-     * @var boolean $reg_confirmation_last
2367
-     */
2368
-    public $reg_confirmation_last;
2369
-
2370
-    /**
2371
-     * Whether or not to enable the EE Bot Trap
2372
-     *
2373
-     * @var boolean $use_bot_trap
2374
-     */
2375
-    public $use_bot_trap;
2376
-
2377
-    /**
2378
-     * Whether or not to encrypt some data sent by the EE Bot Trap
2379
-     *
2380
-     * @var boolean $use_encryption
2381
-     */
2382
-    public $use_encryption;
2383
-
2384
-    /**
2385
-     * Whether or not to use ReCaptcha
2386
-     *
2387
-     * @var boolean $use_captcha
2388
-     */
2389
-    public $use_captcha;
2390
-
2391
-    /**
2392
-     * ReCaptcha Theme
2393
-     *
2394
-     * @var string $recaptcha_theme
2395
-     *    options: 'dark    ', 'light'
2396
-     */
2397
-    public $recaptcha_theme;
1632
+	/**
1633
+	 * Utility function for escaping the value of a property and returning.
1634
+	 *
1635
+	 * @param string $property property name (checks to see if exists).
1636
+	 * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned.
1637
+	 * @throws \EE_Error
1638
+	 */
1639
+	public function get_pretty($property)
1640
+	{
1641
+		if ( ! property_exists($this, $property)) {
1642
+			throw new EE_Error(
1643
+				sprintf(
1644
+					__(
1645
+						'%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.',
1646
+						'event_espresso'
1647
+					),
1648
+					get_class($this),
1649
+					$property
1650
+				)
1651
+			);
1652
+		}
1653
+		//just handling escaping of strings for now.
1654
+		if (is_string($this->{$property})) {
1655
+			return stripslashes($this->{$property});
1656
+		}
1657
+		return $this->{$property};
1658
+	}
1659
+
1660
+
1661
+
1662
+	public function populate()
1663
+	{
1664
+		//grab defaults via a new instance of this class.
1665
+		$class_name = get_class($this);
1666
+		$defaults = new $class_name;
1667
+		//loop through the properties for this class and see if they are set.  If they are NOT, then grab the
1668
+		//default from our $defaults object.
1669
+		foreach (get_object_vars($defaults) as $property => $value) {
1670
+			if ($this->{$property} === null) {
1671
+				$this->{$property} = $value;
1672
+			}
1673
+		}
1674
+		//cleanup
1675
+		unset($defaults);
1676
+	}
1677
+
1678
+
1679
+	/**
1680
+	 *        @ override magic methods
1681
+	 *        @ return void
1682
+	 */
1683
+	//	public function __get($a) { return apply_filters('FHEE__'.get_class($this).'__get__'.$a,$this->{$a}); }
1684
+	//	public function __set($a,$b) { return apply_filters('FHEE__'.get_class($this).'__set__'.$a, $this->{$a} = $b ); }
1685
+	/**
1686
+	 *        __isset
1687
+	 *
1688
+	 * @param $a
1689
+	 * @return bool
1690
+	 */
1691
+	public function __isset($a)
1692
+	{
1693
+		return false;
1694
+	}
1695
+
1696
+
1697
+
1698
+	/**
1699
+	 *        __unset
1700
+	 *
1701
+	 * @param $a
1702
+	 * @return bool
1703
+	 */
1704
+	public function __unset($a)
1705
+	{
1706
+		return false;
1707
+	}
1708
+
1709
+
1710
+
1711
+	/**
1712
+	 *        __clone
1713
+	 */
1714
+	public function __clone()
1715
+	{
1716
+	}
1717
+
1718
+
1719
+
1720
+	/**
1721
+	 *        __wakeup
1722
+	 */
1723
+	public function __wakeup()
1724
+	{
1725
+	}
1726
+
1727
+
1728
+
1729
+	/**
1730
+	 *        __destruct
1731
+	 */
1732
+	public function __destruct()
1733
+	{
1734
+	}
1735
+}
2398 1736
 
2399
-    /**
2400
-     * ReCaptcha Type
2401
-     *
2402
-     * @var string $recaptcha_type
2403
-     *    options: 'audio', 'image'
2404
-     */
2405
-    public $recaptcha_type;
2406 1737
 
2407
-    /**
2408
-     * ReCaptcha language
2409
-     *
2410
-     * @var string $recaptcha_language
2411
-     * eg 'en'
2412
-     */
2413
-    public $recaptcha_language;
2414 1738
 
2415
-    /**
2416
-     * ReCaptcha public key
2417
-     *
2418
-     * @var string $recaptcha_publickey
2419
-     */
2420
-    public $recaptcha_publickey;
1739
+/**
1740
+ * Class for defining what's in the EE_Config relating to registration settings
1741
+ */
1742
+class EE_Core_Config extends EE_Config_Base
1743
+{
2421 1744
 
2422
-    /**
2423
-     * ReCaptcha private key
2424
-     *
2425
-     * @var string $recaptcha_privatekey
2426
-     */
2427
-    public $recaptcha_privatekey;
1745
+	public $current_blog_id;
1746
+
1747
+	public $ee_ueip_optin;
1748
+
1749
+	public $ee_ueip_has_notified;
1750
+
1751
+	/**
1752
+	 * Not to be confused with the 4 critical page variables (See
1753
+	 * get_critical_pages_array()), this is just an array of wp posts that have EE
1754
+	 * shortcodes in them. Keys are slugs, values are arrays with only 1 element: where the key is the shortcode
1755
+	 * in the page, and the value is the page's ID. The key 'posts' is basically a duplicate of this same array.
1756
+	 *
1757
+	 * @var array
1758
+	 */
1759
+	public $post_shortcodes;
1760
+
1761
+	public $module_route_map;
1762
+
1763
+	public $module_forward_map;
1764
+
1765
+	public $module_view_map;
1766
+
1767
+	/**
1768
+	 * The next 4 vars are the IDs of critical EE pages.
1769
+	 *
1770
+	 * @var int
1771
+	 */
1772
+	public $reg_page_id;
1773
+
1774
+	public $txn_page_id;
1775
+
1776
+	public $thank_you_page_id;
1777
+
1778
+	public $cancel_page_id;
1779
+
1780
+	/**
1781
+	 * The next 4 vars are the URLs of critical EE pages.
1782
+	 *
1783
+	 * @var int
1784
+	 */
1785
+	public $reg_page_url;
1786
+
1787
+	public $txn_page_url;
1788
+
1789
+	public $thank_you_page_url;
1790
+
1791
+	public $cancel_page_url;
1792
+
1793
+	/**
1794
+	 * The next vars relate to the custom slugs for EE CPT routes
1795
+	 */
1796
+	public $event_cpt_slug;
1797
+
1798
+
1799
+	/**
1800
+	 * This caches the _ee_ueip_option in case this config is reset in the same
1801
+	 * request across blog switches in a multisite context.
1802
+	 * Avoids extra queries to the db for this option.
1803
+	 *
1804
+	 * @var bool
1805
+	 */
1806
+	public static $ee_ueip_option;
1807
+
1808
+
1809
+
1810
+	/**
1811
+	 *    class constructor
1812
+	 *
1813
+	 * @access    public
1814
+	 */
1815
+	public function __construct()
1816
+	{
1817
+		// set default organization settings
1818
+		$this->current_blog_id = get_current_blog_id();
1819
+		$this->current_blog_id = $this->current_blog_id === null ? 1 : $this->current_blog_id;
1820
+		$this->ee_ueip_optin = $this->_get_main_ee_ueip_optin();
1821
+		$this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true;
1822
+		$this->post_shortcodes = array();
1823
+		$this->module_route_map = array();
1824
+		$this->module_forward_map = array();
1825
+		$this->module_view_map = array();
1826
+		// critical EE page IDs
1827
+		$this->reg_page_id = 0;
1828
+		$this->txn_page_id = 0;
1829
+		$this->thank_you_page_id = 0;
1830
+		$this->cancel_page_id = 0;
1831
+		// critical EE page URLs
1832
+		$this->reg_page_url = '';
1833
+		$this->txn_page_url = '';
1834
+		$this->thank_you_page_url = '';
1835
+		$this->cancel_page_url = '';
1836
+		//cpt slugs
1837
+		$this->event_cpt_slug = __('events', 'event_espresso');
1838
+		//ueip constant check
1839
+		if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) {
1840
+			$this->ee_ueip_optin = false;
1841
+			$this->ee_ueip_has_notified = true;
1842
+		}
1843
+	}
1844
+
1845
+
1846
+
1847
+	/**
1848
+	 * @return array
1849
+	 */
1850
+	public function get_critical_pages_array()
1851
+	{
1852
+		return array(
1853
+			$this->reg_page_id,
1854
+			$this->txn_page_id,
1855
+			$this->thank_you_page_id,
1856
+			$this->cancel_page_id,
1857
+		);
1858
+	}
1859
+
1860
+
1861
+
1862
+	/**
1863
+	 * @return array
1864
+	 */
1865
+	public function get_critical_pages_shortcodes_array()
1866
+	{
1867
+		return array(
1868
+			$this->reg_page_id       => 'ESPRESSO_CHECKOUT',
1869
+			$this->txn_page_id       => 'ESPRESSO_TXN_PAGE',
1870
+			$this->thank_you_page_id => 'ESPRESSO_THANK_YOU',
1871
+			$this->cancel_page_id    => 'ESPRESSO_CANCELLED',
1872
+		);
1873
+	}
1874
+
1875
+
1876
+
1877
+	/**
1878
+	 *  gets/returns URL for EE reg_page
1879
+	 *
1880
+	 * @access    public
1881
+	 * @return    string
1882
+	 */
1883
+	public function reg_page_url()
1884
+	{
1885
+		if ( ! $this->reg_page_url) {
1886
+			$this->reg_page_url = add_query_arg(
1887
+									  array('uts' => time()),
1888
+									  get_permalink($this->reg_page_id)
1889
+								  ) . '#checkout';
1890
+		}
1891
+		return $this->reg_page_url;
1892
+	}
1893
+
1894
+
1895
+
1896
+	/**
1897
+	 *  gets/returns URL for EE txn_page
1898
+	 *
1899
+	 * @param array $query_args like what gets passed to
1900
+	 *                          add_query_arg() as the first argument
1901
+	 * @access    public
1902
+	 * @return    string
1903
+	 */
1904
+	public function txn_page_url($query_args = array())
1905
+	{
1906
+		if ( ! $this->txn_page_url) {
1907
+			$this->txn_page_url = get_permalink($this->txn_page_id);
1908
+		}
1909
+		if ($query_args) {
1910
+			return add_query_arg($query_args, $this->txn_page_url);
1911
+		} else {
1912
+			return $this->txn_page_url;
1913
+		}
1914
+	}
1915
+
1916
+
1917
+
1918
+	/**
1919
+	 *  gets/returns URL for EE thank_you_page
1920
+	 *
1921
+	 * @param array $query_args like what gets passed to
1922
+	 *                          add_query_arg() as the first argument
1923
+	 * @access    public
1924
+	 * @return    string
1925
+	 */
1926
+	public function thank_you_page_url($query_args = array())
1927
+	{
1928
+		if ( ! $this->thank_you_page_url) {
1929
+			$this->thank_you_page_url = get_permalink($this->thank_you_page_id);
1930
+		}
1931
+		if ($query_args) {
1932
+			return add_query_arg($query_args, $this->thank_you_page_url);
1933
+		} else {
1934
+			return $this->thank_you_page_url;
1935
+		}
1936
+	}
1937
+
1938
+
1939
+
1940
+	/**
1941
+	 *  gets/returns URL for EE cancel_page
1942
+	 *
1943
+	 * @access    public
1944
+	 * @return    string
1945
+	 */
1946
+	public function cancel_page_url()
1947
+	{
1948
+		if ( ! $this->cancel_page_url) {
1949
+			$this->cancel_page_url = get_permalink($this->cancel_page_id);
1950
+		}
1951
+		return $this->cancel_page_url;
1952
+	}
1953
+
1954
+
1955
+
1956
+	/**
1957
+	 * Resets all critical page urls to their original state.  Used primarily by the __sleep() magic method currently.
1958
+	 *
1959
+	 * @since 4.7.5
1960
+	 */
1961
+	protected function _reset_urls()
1962
+	{
1963
+		$this->reg_page_url = '';
1964
+		$this->txn_page_url = '';
1965
+		$this->cancel_page_url = '';
1966
+		$this->thank_you_page_url = '';
1967
+	}
1968
+
1969
+
1970
+
1971
+	/**
1972
+	 * Used to return what the optin value is set for the EE User Experience Program.
1973
+	 * This accounts for multisite and this value being requested for a subsite.  In multisite, the value is set
1974
+	 * on the main site only.
1975
+	 *
1976
+	 * @return mixed|void
1977
+	 */
1978
+	protected function _get_main_ee_ueip_optin()
1979
+	{
1980
+		//if this is the main site then we can just bypass our direct query.
1981
+		if (is_main_site()) {
1982
+			return get_option('ee_ueip_optin', false);
1983
+		}
1984
+		//is this already cached for this request?  If so use it.
1985
+		if ( ! empty(EE_Core_Config::$ee_ueip_option)) {
1986
+			return EE_Core_Config::$ee_ueip_option;
1987
+		}
1988
+		global $wpdb;
1989
+		$current_network_main_site = is_multisite() ? get_current_site() : null;
1990
+		$current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1991
+		$option = 'ee_ueip_optin';
1992
+		//set correct table for query
1993
+		$table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1994
+		//rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1995
+		//get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1996
+		//re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1997
+		//this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1998
+		//for the purpose of caching.
1999
+		$pre = apply_filters('pre_option_' . $option, false, $option);
2000
+		if (false !== $pre) {
2001
+			EE_Core_Config::$ee_ueip_option = $pre;
2002
+			return EE_Core_Config::$ee_ueip_option;
2003
+		}
2004
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1",
2005
+			$option));
2006
+		if (is_object($row)) {
2007
+			$value = $row->option_value;
2008
+		} else { //option does not exist so use default.
2009
+			return apply_filters('default_option_' . $option, false, $option);
2010
+		}
2011
+		EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
2012
+		return EE_Core_Config::$ee_ueip_option;
2013
+	}
2014
+
2015
+
2016
+
2017
+	/**
2018
+	 * Currently used to ensure critical page urls have initial values saved to the db instead of any current set values
2019
+	 * on the object.
2020
+	 *
2021
+	 * @return array
2022
+	 */
2023
+	public function __sleep()
2024
+	{
2025
+		//reset all url properties
2026
+		$this->_reset_urls();
2027
+		//return what to save to db
2028
+		return array_keys(get_object_vars($this));
2029
+	}
2428 2030
 
2429
-    /**
2430
-     * ReCaptcha width
2431
-     *
2432
-     * @var int $recaptcha_width
2433
-     * @deprecated
2434
-     */
2435
-    public $recaptcha_width;
2031
+}
2436 2032
 
2437
-    /**
2438
-     * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2439
-     *
2440
-     * @var boolean $track_invalid_checkout_access
2441
-     */
2442
-    protected $track_invalid_checkout_access = true;
2443 2033
 
2444 2034
 
2035
+/**
2036
+ * Config class for storing info on the Organization
2037
+ */
2038
+class EE_Organization_Config extends EE_Config_Base
2039
+{
2445 2040
 
2446
-    /**
2447
-     *    class constructor
2448
-     *
2449
-     * @access    public
2450
-     */
2451
-    public function __construct()
2452
-    {
2453
-        // set default registration settings
2454
-        $this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2455
-        $this->email_validation_level = 'wp_default';
2456
-        $this->show_pending_payment_options = true;
2457
-        $this->skip_reg_confirmation = false;
2458
-        $this->reg_steps = array();
2459
-        $this->reg_confirmation_last = false;
2460
-        $this->use_bot_trap = true;
2461
-        $this->use_encryption = true;
2462
-        $this->use_captcha = false;
2463
-        $this->recaptcha_theme = 'light';
2464
-        $this->recaptcha_type = 'image';
2465
-        $this->recaptcha_language = 'en';
2466
-        $this->recaptcha_publickey = null;
2467
-        $this->recaptcha_privatekey = null;
2468
-        $this->recaptcha_width = 500;
2469
-    }
2470
-
2471
-
2472
-
2473
-    /**
2474
-     * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2475
-     *
2476
-     * @since 4.8.8.rc.019
2477
-     */
2478
-    public function do_hooks()
2479
-    {
2480
-        add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2481
-    }
2041
+	/**
2042
+	 * @var string $name
2043
+	 * eg EE4.1
2044
+	 */
2045
+	public $name;
2046
+
2047
+	/**
2048
+	 * @var string $address_1
2049
+	 * eg 123 Onna Road
2050
+	 */
2051
+	public $address_1;
2052
+
2053
+	/**
2054
+	 * @var string $address_2
2055
+	 * eg PO Box 123
2056
+	 */
2057
+	public $address_2;
2058
+
2059
+	/**
2060
+	 * @var string $city
2061
+	 * eg Inna City
2062
+	 */
2063
+	public $city;
2064
+
2065
+	/**
2066
+	 * @var int $STA_ID
2067
+	 * eg 4
2068
+	 */
2069
+	public $STA_ID;
2070
+
2071
+	/**
2072
+	 * @var string $CNT_ISO
2073
+	 * eg US
2074
+	 */
2075
+	public $CNT_ISO;
2076
+
2077
+	/**
2078
+	 * @var string $zip
2079
+	 * eg 12345  or V1A 2B3
2080
+	 */
2081
+	public $zip;
2082
+
2083
+	/**
2084
+	 * @var string $email
2085
+	 * eg [email protected]
2086
+	 */
2087
+	public $email;
2088
+
2089
+
2090
+	/**
2091
+	 * @var string $phone
2092
+	 * eg. 111-111-1111
2093
+	 */
2094
+	public $phone;
2095
+
2096
+
2097
+	/**
2098
+	 * @var string $vat
2099
+	 * VAT/Tax Number
2100
+	 */
2101
+	public $vat;
2102
+
2103
+	/**
2104
+	 * @var string $logo_url
2105
+	 * eg http://www.somedomain.com/wp-content/uploads/kittehs.jpg
2106
+	 */
2107
+	public $logo_url;
2108
+
2109
+
2110
+	/**
2111
+	 * The below are all various properties for holding links to organization social network profiles
2112
+	 *
2113
+	 * @var string
2114
+	 */
2115
+	/**
2116
+	 * facebook (facebook.com/profile.name)
2117
+	 *
2118
+	 * @var string
2119
+	 */
2120
+	public $facebook;
2121
+
2122
+
2123
+	/**
2124
+	 * twitter (twitter.com/twitter_handle)
2125
+	 *
2126
+	 * @var string
2127
+	 */
2128
+	public $twitter;
2129
+
2130
+
2131
+	/**
2132
+	 * linkedin (linkedin.com/in/profile_name)
2133
+	 *
2134
+	 * @var string
2135
+	 */
2136
+	public $linkedin;
2137
+
2138
+
2139
+	/**
2140
+	 * pinterest (www.pinterest.com/profile_name)
2141
+	 *
2142
+	 * @var string
2143
+	 */
2144
+	public $pinterest;
2145
+
2146
+
2147
+	/**
2148
+	 * google+ (google.com/+profileName)
2149
+	 *
2150
+	 * @var string
2151
+	 */
2152
+	public $google;
2153
+
2154
+
2155
+	/**
2156
+	 * instagram (instagram.com/handle)
2157
+	 *
2158
+	 * @var string
2159
+	 */
2160
+	public $instagram;
2161
+
2162
+
2163
+
2164
+	/**
2165
+	 *    class constructor
2166
+	 *
2167
+	 * @access    public
2168
+	 */
2169
+	public function __construct()
2170
+	{
2171
+		// set default organization settings
2172
+		$this->name = get_bloginfo('name');
2173
+		$this->address_1 = '123 Onna Road';
2174
+		$this->address_2 = 'PO Box 123';
2175
+		$this->city = 'Inna City';
2176
+		$this->STA_ID = 4;
2177
+		$this->CNT_ISO = 'US';
2178
+		$this->zip = '12345';
2179
+		$this->email = get_bloginfo('admin_email');
2180
+		$this->phone = '';
2181
+		$this->vat = '123456789';
2182
+		$this->logo_url = '';
2183
+		$this->facebook = '';
2184
+		$this->twitter = '';
2185
+		$this->linkedin = '';
2186
+		$this->pinterest = '';
2187
+		$this->google = '';
2188
+		$this->instagram = '';
2189
+	}
2482 2190
 
2191
+}
2483 2192
 
2484 2193
 
2485
-    /**
2486
-     * @return void
2487
-     */
2488
-    public function set_default_reg_status_on_EEM_Event()
2489
-    {
2490
-        EEM_Event::set_default_reg_status($this->default_STS_ID);
2491
-    }
2492 2194
 
2195
+/**
2196
+ * Class for defining what's in the EE_Config relating to currency
2197
+ */
2198
+class EE_Currency_Config extends EE_Config_Base
2199
+{
2493 2200
 
2201
+	/**
2202
+	 * @var string $code
2203
+	 * eg 'US'
2204
+	 */
2205
+	public $code;
2206
+
2207
+	/**
2208
+	 * @var string $name
2209
+	 * eg 'Dollar'
2210
+	 */
2211
+	public $name;
2212
+
2213
+	/**
2214
+	 * plural name
2215
+	 *
2216
+	 * @var string $plural
2217
+	 * eg 'Dollars'
2218
+	 */
2219
+	public $plural;
2220
+
2221
+	/**
2222
+	 * currency sign
2223
+	 *
2224
+	 * @var string $sign
2225
+	 * eg '$'
2226
+	 */
2227
+	public $sign;
2228
+
2229
+	/**
2230
+	 * Whether the currency sign should come before the number or not
2231
+	 *
2232
+	 * @var boolean $sign_b4
2233
+	 */
2234
+	public $sign_b4;
2235
+
2236
+	/**
2237
+	 * How many digits should come after the decimal place
2238
+	 *
2239
+	 * @var int $dec_plc
2240
+	 */
2241
+	public $dec_plc;
2242
+
2243
+	/**
2244
+	 * Symbol to use for decimal mark
2245
+	 *
2246
+	 * @var string $dec_mrk
2247
+	 * eg '.'
2248
+	 */
2249
+	public $dec_mrk;
2250
+
2251
+	/**
2252
+	 * Symbol to use for thousands
2253
+	 *
2254
+	 * @var string $thsnds
2255
+	 * eg ','
2256
+	 */
2257
+	public $thsnds;
2258
+
2259
+
2260
+
2261
+	/**
2262
+	 *    class constructor
2263
+	 *
2264
+	 * @access    public
2265
+	 * @param string $CNT_ISO
2266
+	 * @throws \EE_Error
2267
+	 */
2268
+	public function __construct($CNT_ISO = '')
2269
+	{
2270
+		/** @var \EventEspresso\core\services\database\TableAnalysis $table_analysis */
2271
+		$table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true);
2272
+		// get country code from organization settings or use default
2273
+		$ORG_CNT = isset(EE_Registry::instance()->CFG->organization)
2274
+				   && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config
2275
+			? EE_Registry::instance()->CFG->organization->CNT_ISO
2276
+			: '';
2277
+		// but override if requested
2278
+		$CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT;
2279
+		// so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists
2280
+		if (
2281
+			! empty($CNT_ISO)
2282
+			&& EE_Maintenance_Mode::instance()->models_can_query()
2283
+			&& $table_analysis->tableExists(EE_Registry::instance()->load_model('Country')->table())
2284
+		) {
2285
+			// retrieve the country settings from the db, just in case they have been customized
2286
+			$country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2287
+			if ($country instanceof EE_Country) {
2288
+				$this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2289
+				$this->name = $country->currency_name_single();    // Dollar
2290
+				$this->plural = $country->currency_name_plural();    // Dollars
2291
+				$this->sign = $country->currency_sign();            // currency sign: $
2292
+				$this->sign_b4 = $country->currency_sign_before();        // currency sign before or after: $TRUE  or  FALSE$
2293
+				$this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2294
+				$this->dec_mrk = $country->currency_decimal_mark();    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2295
+				$this->thsnds = $country->currency_thousands_separator();    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2296
+			}
2297
+		}
2298
+		// fallback to hardcoded defaults, in case the above failed
2299
+		if (empty($this->code)) {
2300
+			// set default currency settings
2301
+			$this->code = 'USD';    // currency code: USD, CAD, EUR
2302
+			$this->name = __('Dollar', 'event_espresso');    // Dollar
2303
+			$this->plural = __('Dollars', 'event_espresso');    // Dollars
2304
+			$this->sign = '$';    // currency sign: $
2305
+			$this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2306
+			$this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2307
+			$this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2308
+			$this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2309
+		}
2310
+	}
2311
+}
2494 2312
 
2495
-    /**
2496
-     * @return boolean
2497
-     */
2498
-    public function track_invalid_checkout_access()
2499
-    {
2500
-        return $this->track_invalid_checkout_access;
2501
-    }
2502 2313
 
2503 2314
 
2315
+/**
2316
+ * Class for defining what's in the EE_Config relating to registration settings
2317
+ */
2318
+class EE_Registration_Config extends EE_Config_Base
2319
+{
2504 2320
 
2505
-    /**
2506
-     * @param boolean $track_invalid_checkout_access
2507
-     */
2508
-    public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2509
-    {
2510
-        $this->track_invalid_checkout_access = filter_var(
2511
-            $track_invalid_checkout_access,
2512
-            FILTER_VALIDATE_BOOLEAN
2513
-        );
2514
-    }
2321
+	/**
2322
+	 * Default registration status
2323
+	 *
2324
+	 * @var string $default_STS_ID
2325
+	 * eg 'RPP'
2326
+	 */
2327
+	public $default_STS_ID;
2328
+
2329
+	/**
2330
+	 * level of validation to apply to email addresses
2331
+	 *
2332
+	 * @var string $email_validation_level
2333
+	 * options: 'basic', 'wp_default', 'i18n', 'i18n_dns'
2334
+	 */
2335
+	public $email_validation_level;
2336
+
2337
+	/**
2338
+	 *    whether or not to show alternate payment options during the reg process if payment status is pending
2339
+	 *
2340
+	 * @var boolean $show_pending_payment_options
2341
+	 */
2342
+	public $show_pending_payment_options;
2343
+
2344
+	/**
2345
+	 * Whether to skip the registration confirmation page
2346
+	 *
2347
+	 * @var boolean $skip_reg_confirmation
2348
+	 */
2349
+	public $skip_reg_confirmation;
2350
+
2351
+	/**
2352
+	 * an array of SPCO reg steps where:
2353
+	 *        the keys denotes the reg step order
2354
+	 *        each element consists of an array with the following elements:
2355
+	 *            "file_path" => the file path to the EE_SPCO_Reg_Step class
2356
+	 *            "class_name" => the specific EE_SPCO_Reg_Step child class name
2357
+	 *            "slug" => the URL param used to trigger the reg step
2358
+	 *
2359
+	 * @var array $reg_steps
2360
+	 */
2361
+	public $reg_steps;
2362
+
2363
+	/**
2364
+	 * Whether registration confirmation should be the last page of SPCO
2365
+	 *
2366
+	 * @var boolean $reg_confirmation_last
2367
+	 */
2368
+	public $reg_confirmation_last;
2369
+
2370
+	/**
2371
+	 * Whether or not to enable the EE Bot Trap
2372
+	 *
2373
+	 * @var boolean $use_bot_trap
2374
+	 */
2375
+	public $use_bot_trap;
2376
+
2377
+	/**
2378
+	 * Whether or not to encrypt some data sent by the EE Bot Trap
2379
+	 *
2380
+	 * @var boolean $use_encryption
2381
+	 */
2382
+	public $use_encryption;
2383
+
2384
+	/**
2385
+	 * Whether or not to use ReCaptcha
2386
+	 *
2387
+	 * @var boolean $use_captcha
2388
+	 */
2389
+	public $use_captcha;
2390
+
2391
+	/**
2392
+	 * ReCaptcha Theme
2393
+	 *
2394
+	 * @var string $recaptcha_theme
2395
+	 *    options: 'dark    ', 'light'
2396
+	 */
2397
+	public $recaptcha_theme;
2398
+
2399
+	/**
2400
+	 * ReCaptcha Type
2401
+	 *
2402
+	 * @var string $recaptcha_type
2403
+	 *    options: 'audio', 'image'
2404
+	 */
2405
+	public $recaptcha_type;
2406
+
2407
+	/**
2408
+	 * ReCaptcha language
2409
+	 *
2410
+	 * @var string $recaptcha_language
2411
+	 * eg 'en'
2412
+	 */
2413
+	public $recaptcha_language;
2414
+
2415
+	/**
2416
+	 * ReCaptcha public key
2417
+	 *
2418
+	 * @var string $recaptcha_publickey
2419
+	 */
2420
+	public $recaptcha_publickey;
2421
+
2422
+	/**
2423
+	 * ReCaptcha private key
2424
+	 *
2425
+	 * @var string $recaptcha_privatekey
2426
+	 */
2427
+	public $recaptcha_privatekey;
2428
+
2429
+	/**
2430
+	 * ReCaptcha width
2431
+	 *
2432
+	 * @var int $recaptcha_width
2433
+	 * @deprecated
2434
+	 */
2435
+	public $recaptcha_width;
2436
+
2437
+	/**
2438
+	 * Whether or not invalid attempts to directly access the registration checkout page should be tracked.
2439
+	 *
2440
+	 * @var boolean $track_invalid_checkout_access
2441
+	 */
2442
+	protected $track_invalid_checkout_access = true;
2443
+
2444
+
2445
+
2446
+	/**
2447
+	 *    class constructor
2448
+	 *
2449
+	 * @access    public
2450
+	 */
2451
+	public function __construct()
2452
+	{
2453
+		// set default registration settings
2454
+		$this->default_STS_ID = EEM_Registration::status_id_pending_payment;
2455
+		$this->email_validation_level = 'wp_default';
2456
+		$this->show_pending_payment_options = true;
2457
+		$this->skip_reg_confirmation = false;
2458
+		$this->reg_steps = array();
2459
+		$this->reg_confirmation_last = false;
2460
+		$this->use_bot_trap = true;
2461
+		$this->use_encryption = true;
2462
+		$this->use_captcha = false;
2463
+		$this->recaptcha_theme = 'light';
2464
+		$this->recaptcha_type = 'image';
2465
+		$this->recaptcha_language = 'en';
2466
+		$this->recaptcha_publickey = null;
2467
+		$this->recaptcha_privatekey = null;
2468
+		$this->recaptcha_width = 500;
2469
+	}
2470
+
2471
+
2472
+
2473
+	/**
2474
+	 * This is called by the config loader and hooks are initialized AFTER the config has been populated.
2475
+	 *
2476
+	 * @since 4.8.8.rc.019
2477
+	 */
2478
+	public function do_hooks()
2479
+	{
2480
+		add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event'));
2481
+	}
2482
+
2483
+
2484
+
2485
+	/**
2486
+	 * @return void
2487
+	 */
2488
+	public function set_default_reg_status_on_EEM_Event()
2489
+	{
2490
+		EEM_Event::set_default_reg_status($this->default_STS_ID);
2491
+	}
2492
+
2493
+
2494
+
2495
+	/**
2496
+	 * @return boolean
2497
+	 */
2498
+	public function track_invalid_checkout_access()
2499
+	{
2500
+		return $this->track_invalid_checkout_access;
2501
+	}
2502
+
2503
+
2504
+
2505
+	/**
2506
+	 * @param boolean $track_invalid_checkout_access
2507
+	 */
2508
+	public function set_track_invalid_checkout_access($track_invalid_checkout_access)
2509
+	{
2510
+		$this->track_invalid_checkout_access = filter_var(
2511
+			$track_invalid_checkout_access,
2512
+			FILTER_VALIDATE_BOOLEAN
2513
+		);
2514
+	}
2515 2515
 
2516 2516
 
2517 2517
 }
@@ -2524,160 +2524,160 @@  discard block
 block discarded – undo
2524 2524
 class EE_Admin_Config extends EE_Config_Base
2525 2525
 {
2526 2526
 
2527
-    /**
2528
-     * @var boolean $use_personnel_manager
2529
-     */
2530
-    public $use_personnel_manager;
2531
-
2532
-    /**
2533
-     * @var boolean $use_dashboard_widget
2534
-     */
2535
-    public $use_dashboard_widget;
2536
-
2537
-    /**
2538
-     * @var int $events_in_dashboard
2539
-     */
2540
-    public $events_in_dashboard;
2541
-
2542
-    /**
2543
-     * @var boolean $use_event_timezones
2544
-     */
2545
-    public $use_event_timezones;
2546
-
2547
-    /**
2548
-     * @var boolean $use_full_logging
2549
-     */
2550
-    public $use_full_logging;
2551
-
2552
-    /**
2553
-     * @var string $log_file_name
2554
-     */
2555
-    public $log_file_name;
2556
-
2557
-    /**
2558
-     * @var string $debug_file_name
2559
-     */
2560
-    public $debug_file_name;
2561
-
2562
-    /**
2563
-     * @var boolean $use_remote_logging
2564
-     */
2565
-    public $use_remote_logging;
2566
-
2567
-    /**
2568
-     * @var string $remote_logging_url
2569
-     */
2570
-    public $remote_logging_url;
2571
-
2572
-    /**
2573
-     * @var boolean $show_reg_footer
2574
-     */
2575
-    public $show_reg_footer;
2576
-
2577
-    /**
2578
-     * @var string $affiliate_id
2579
-     */
2580
-    public $affiliate_id;
2581
-
2582
-    /**
2583
-     * help tours on or off (global setting)
2584
-     *
2585
-     * @var boolean
2586
-     */
2587
-    public $help_tour_activation;
2588
-
2589
-    /**
2590
-     * adds extra layer of encoding to session data to prevent serialization errors
2591
-     * but is incompatible with some server configuration errors
2592
-     * if you get "500 internal server errors" during registration, try turning this on
2593
-     * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2594
-     *
2595
-     * @var boolean $encode_session_data
2596
-     */
2597
-    private $encode_session_data = false;
2598
-
2599
-
2600
-
2601
-    /**
2602
-     *    class constructor
2603
-     *
2604
-     * @access    public
2605
-     */
2606
-    public function __construct()
2607
-    {
2608
-        // set default general admin settings
2609
-        $this->use_personnel_manager = true;
2610
-        $this->use_dashboard_widget = true;
2611
-        $this->events_in_dashboard = 30;
2612
-        $this->use_event_timezones = false;
2613
-        $this->use_full_logging = false;
2614
-        $this->use_remote_logging = false;
2615
-        $this->remote_logging_url = null;
2616
-        $this->show_reg_footer = true;
2617
-        $this->affiliate_id = 'default';
2618
-        $this->help_tour_activation = true;
2619
-        $this->encode_session_data = false;
2620
-    }
2621
-
2622
-
2623
-
2624
-    /**
2625
-     * @param bool $reset
2626
-     * @return string
2627
-     */
2628
-    public function log_file_name($reset = false)
2629
-    {
2630
-        if (empty($this->log_file_name) || $reset) {
2631
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2632
-            EE_Config::instance()->update_espresso_config(false, false);
2633
-        }
2634
-        return $this->log_file_name;
2635
-    }
2636
-
2637
-
2638
-
2639
-    /**
2640
-     * @param bool $reset
2641
-     * @return string
2642
-     */
2643
-    public function debug_file_name($reset = false)
2644
-    {
2645
-        if (empty($this->debug_file_name) || $reset) {
2646
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2647
-            EE_Config::instance()->update_espresso_config(false, false);
2648
-        }
2649
-        return $this->debug_file_name;
2650
-    }
2651
-
2652
-
2653
-
2654
-    /**
2655
-     * @return string
2656
-     */
2657
-    public function affiliate_id()
2658
-    {
2659
-        return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2660
-    }
2661
-
2662
-
2663
-
2664
-    /**
2665
-     * @return boolean
2666
-     */
2667
-    public function encode_session_data()
2668
-    {
2669
-        return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2670
-    }
2671
-
2672
-
2673
-
2674
-    /**
2675
-     * @param boolean $encode_session_data
2676
-     */
2677
-    public function set_encode_session_data($encode_session_data)
2678
-    {
2679
-        $this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2680
-    }
2527
+	/**
2528
+	 * @var boolean $use_personnel_manager
2529
+	 */
2530
+	public $use_personnel_manager;
2531
+
2532
+	/**
2533
+	 * @var boolean $use_dashboard_widget
2534
+	 */
2535
+	public $use_dashboard_widget;
2536
+
2537
+	/**
2538
+	 * @var int $events_in_dashboard
2539
+	 */
2540
+	public $events_in_dashboard;
2541
+
2542
+	/**
2543
+	 * @var boolean $use_event_timezones
2544
+	 */
2545
+	public $use_event_timezones;
2546
+
2547
+	/**
2548
+	 * @var boolean $use_full_logging
2549
+	 */
2550
+	public $use_full_logging;
2551
+
2552
+	/**
2553
+	 * @var string $log_file_name
2554
+	 */
2555
+	public $log_file_name;
2556
+
2557
+	/**
2558
+	 * @var string $debug_file_name
2559
+	 */
2560
+	public $debug_file_name;
2561
+
2562
+	/**
2563
+	 * @var boolean $use_remote_logging
2564
+	 */
2565
+	public $use_remote_logging;
2566
+
2567
+	/**
2568
+	 * @var string $remote_logging_url
2569
+	 */
2570
+	public $remote_logging_url;
2571
+
2572
+	/**
2573
+	 * @var boolean $show_reg_footer
2574
+	 */
2575
+	public $show_reg_footer;
2576
+
2577
+	/**
2578
+	 * @var string $affiliate_id
2579
+	 */
2580
+	public $affiliate_id;
2581
+
2582
+	/**
2583
+	 * help tours on or off (global setting)
2584
+	 *
2585
+	 * @var boolean
2586
+	 */
2587
+	public $help_tour_activation;
2588
+
2589
+	/**
2590
+	 * adds extra layer of encoding to session data to prevent serialization errors
2591
+	 * but is incompatible with some server configuration errors
2592
+	 * if you get "500 internal server errors" during registration, try turning this on
2593
+	 * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off
2594
+	 *
2595
+	 * @var boolean $encode_session_data
2596
+	 */
2597
+	private $encode_session_data = false;
2598
+
2599
+
2600
+
2601
+	/**
2602
+	 *    class constructor
2603
+	 *
2604
+	 * @access    public
2605
+	 */
2606
+	public function __construct()
2607
+	{
2608
+		// set default general admin settings
2609
+		$this->use_personnel_manager = true;
2610
+		$this->use_dashboard_widget = true;
2611
+		$this->events_in_dashboard = 30;
2612
+		$this->use_event_timezones = false;
2613
+		$this->use_full_logging = false;
2614
+		$this->use_remote_logging = false;
2615
+		$this->remote_logging_url = null;
2616
+		$this->show_reg_footer = true;
2617
+		$this->affiliate_id = 'default';
2618
+		$this->help_tour_activation = true;
2619
+		$this->encode_session_data = false;
2620
+	}
2621
+
2622
+
2623
+
2624
+	/**
2625
+	 * @param bool $reset
2626
+	 * @return string
2627
+	 */
2628
+	public function log_file_name($reset = false)
2629
+	{
2630
+		if (empty($this->log_file_name) || $reset) {
2631
+			$this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2632
+			EE_Config::instance()->update_espresso_config(false, false);
2633
+		}
2634
+		return $this->log_file_name;
2635
+	}
2636
+
2637
+
2638
+
2639
+	/**
2640
+	 * @param bool $reset
2641
+	 * @return string
2642
+	 */
2643
+	public function debug_file_name($reset = false)
2644
+	{
2645
+		if (empty($this->debug_file_name) || $reset) {
2646
+			$this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2647
+			EE_Config::instance()->update_espresso_config(false, false);
2648
+		}
2649
+		return $this->debug_file_name;
2650
+	}
2651
+
2652
+
2653
+
2654
+	/**
2655
+	 * @return string
2656
+	 */
2657
+	public function affiliate_id()
2658
+	{
2659
+		return ! empty($this->affiliate_id) ? $this->affiliate_id : 'default';
2660
+	}
2661
+
2662
+
2663
+
2664
+	/**
2665
+	 * @return boolean
2666
+	 */
2667
+	public function encode_session_data()
2668
+	{
2669
+		return filter_var($this->encode_session_data, FILTER_VALIDATE_BOOLEAN);
2670
+	}
2671
+
2672
+
2673
+
2674
+	/**
2675
+	 * @param boolean $encode_session_data
2676
+	 */
2677
+	public function set_encode_session_data($encode_session_data)
2678
+	{
2679
+		$this->encode_session_data = filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN);
2680
+	}
2681 2681
 
2682 2682
 
2683 2683
 }
@@ -2690,71 +2690,71 @@  discard block
 block discarded – undo
2690 2690
 class EE_Template_Config extends EE_Config_Base
2691 2691
 {
2692 2692
 
2693
-    /**
2694
-     * @var boolean $enable_default_style
2695
-     */
2696
-    public $enable_default_style;
2697
-
2698
-    /**
2699
-     * @var string $custom_style_sheet
2700
-     */
2701
-    public $custom_style_sheet;
2702
-
2703
-    /**
2704
-     * @var boolean $display_address_in_regform
2705
-     */
2706
-    public $display_address_in_regform;
2707
-
2708
-    /**
2709
-     * @var int $display_description_on_multi_reg_page
2710
-     */
2711
-    public $display_description_on_multi_reg_page;
2712
-
2713
-    /**
2714
-     * @var boolean $use_custom_templates
2715
-     */
2716
-    public $use_custom_templates;
2717
-
2718
-    /**
2719
-     * @var string $current_espresso_theme
2720
-     */
2721
-    public $current_espresso_theme;
2722
-
2723
-    /**
2724
-     * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2725
-     */
2726
-    public $EED_Ticket_Selector;
2727
-
2728
-    /**
2729
-     * @var EE_Event_Single_Config $EED_Event_Single
2730
-     */
2731
-    public $EED_Event_Single;
2732
-
2733
-    /**
2734
-     * @var EE_Events_Archive_Config $EED_Events_Archive
2735
-     */
2736
-    public $EED_Events_Archive;
2737
-
2738
-
2739
-
2740
-    /**
2741
-     *    class constructor
2742
-     *
2743
-     * @access    public
2744
-     */
2745
-    public function __construct()
2746
-    {
2747
-        // set default template settings
2748
-        $this->enable_default_style = true;
2749
-        $this->custom_style_sheet = null;
2750
-        $this->display_address_in_regform = true;
2751
-        $this->display_description_on_multi_reg_page = false;
2752
-        $this->use_custom_templates = false;
2753
-        $this->current_espresso_theme = 'Espresso_Arabica_2014';
2754
-        $this->EED_Event_Single = null;
2755
-        $this->EED_Events_Archive = null;
2756
-        $this->EED_Ticket_Selector = null;
2757
-    }
2693
+	/**
2694
+	 * @var boolean $enable_default_style
2695
+	 */
2696
+	public $enable_default_style;
2697
+
2698
+	/**
2699
+	 * @var string $custom_style_sheet
2700
+	 */
2701
+	public $custom_style_sheet;
2702
+
2703
+	/**
2704
+	 * @var boolean $display_address_in_regform
2705
+	 */
2706
+	public $display_address_in_regform;
2707
+
2708
+	/**
2709
+	 * @var int $display_description_on_multi_reg_page
2710
+	 */
2711
+	public $display_description_on_multi_reg_page;
2712
+
2713
+	/**
2714
+	 * @var boolean $use_custom_templates
2715
+	 */
2716
+	public $use_custom_templates;
2717
+
2718
+	/**
2719
+	 * @var string $current_espresso_theme
2720
+	 */
2721
+	public $current_espresso_theme;
2722
+
2723
+	/**
2724
+	 * @var EE_Ticket_Selector_Config $EED_Ticket_Selector
2725
+	 */
2726
+	public $EED_Ticket_Selector;
2727
+
2728
+	/**
2729
+	 * @var EE_Event_Single_Config $EED_Event_Single
2730
+	 */
2731
+	public $EED_Event_Single;
2732
+
2733
+	/**
2734
+	 * @var EE_Events_Archive_Config $EED_Events_Archive
2735
+	 */
2736
+	public $EED_Events_Archive;
2737
+
2738
+
2739
+
2740
+	/**
2741
+	 *    class constructor
2742
+	 *
2743
+	 * @access    public
2744
+	 */
2745
+	public function __construct()
2746
+	{
2747
+		// set default template settings
2748
+		$this->enable_default_style = true;
2749
+		$this->custom_style_sheet = null;
2750
+		$this->display_address_in_regform = true;
2751
+		$this->display_description_on_multi_reg_page = false;
2752
+		$this->use_custom_templates = false;
2753
+		$this->current_espresso_theme = 'Espresso_Arabica_2014';
2754
+		$this->EED_Event_Single = null;
2755
+		$this->EED_Events_Archive = null;
2756
+		$this->EED_Ticket_Selector = null;
2757
+	}
2758 2758
 
2759 2759
 }
2760 2760
 
@@ -2766,115 +2766,115 @@  discard block
 block discarded – undo
2766 2766
 class EE_Map_Config extends EE_Config_Base
2767 2767
 {
2768 2768
 
2769
-    /**
2770
-     * @var boolean $use_google_maps
2771
-     */
2772
-    public $use_google_maps;
2773
-
2774
-    /**
2775
-     * @var string $api_key
2776
-     */
2777
-    public $google_map_api_key;
2778
-
2779
-    /**
2780
-     * @var int $event_details_map_width
2781
-     */
2782
-    public $event_details_map_width;
2783
-
2784
-    /**
2785
-     * @var int $event_details_map_height
2786
-     */
2787
-    public $event_details_map_height;
2788
-
2789
-    /**
2790
-     * @var int $event_details_map_zoom
2791
-     */
2792
-    public $event_details_map_zoom;
2793
-
2794
-    /**
2795
-     * @var boolean $event_details_display_nav
2796
-     */
2797
-    public $event_details_display_nav;
2798
-
2799
-    /**
2800
-     * @var boolean $event_details_nav_size
2801
-     */
2802
-    public $event_details_nav_size;
2803
-
2804
-    /**
2805
-     * @var string $event_details_control_type
2806
-     */
2807
-    public $event_details_control_type;
2808
-
2809
-    /**
2810
-     * @var string $event_details_map_align
2811
-     */
2812
-    public $event_details_map_align;
2813
-
2814
-    /**
2815
-     * @var int $event_list_map_width
2816
-     */
2817
-    public $event_list_map_width;
2818
-
2819
-    /**
2820
-     * @var int $event_list_map_height
2821
-     */
2822
-    public $event_list_map_height;
2823
-
2824
-    /**
2825
-     * @var int $event_list_map_zoom
2826
-     */
2827
-    public $event_list_map_zoom;
2828
-
2829
-    /**
2830
-     * @var boolean $event_list_display_nav
2831
-     */
2832
-    public $event_list_display_nav;
2833
-
2834
-    /**
2835
-     * @var boolean $event_list_nav_size
2836
-     */
2837
-    public $event_list_nav_size;
2838
-
2839
-    /**
2840
-     * @var string $event_list_control_type
2841
-     */
2842
-    public $event_list_control_type;
2843
-
2844
-    /**
2845
-     * @var string $event_list_map_align
2846
-     */
2847
-    public $event_list_map_align;
2848
-
2849
-
2850
-
2851
-    /**
2852
-     *    class constructor
2853
-     *
2854
-     * @access    public
2855
-     */
2856
-    public function __construct()
2857
-    {
2858
-        // set default map settings
2859
-        $this->use_google_maps = true;
2860
-        $this->google_map_api_key = '';
2861
-        // for event details pages (reg page)
2862
-        $this->event_details_map_width = 585;            // ee_map_width_single
2863
-        $this->event_details_map_height = 362;            // ee_map_height_single
2864
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2865
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2866
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2867
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2868
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2869
-        // for event list pages
2870
-        $this->event_list_map_width = 300;            // ee_map_width
2871
-        $this->event_list_map_height = 185;        // ee_map_height
2872
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2873
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2874
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2875
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2876
-        $this->event_list_map_align = 'center';            // ee_map_align
2877
-    }
2769
+	/**
2770
+	 * @var boolean $use_google_maps
2771
+	 */
2772
+	public $use_google_maps;
2773
+
2774
+	/**
2775
+	 * @var string $api_key
2776
+	 */
2777
+	public $google_map_api_key;
2778
+
2779
+	/**
2780
+	 * @var int $event_details_map_width
2781
+	 */
2782
+	public $event_details_map_width;
2783
+
2784
+	/**
2785
+	 * @var int $event_details_map_height
2786
+	 */
2787
+	public $event_details_map_height;
2788
+
2789
+	/**
2790
+	 * @var int $event_details_map_zoom
2791
+	 */
2792
+	public $event_details_map_zoom;
2793
+
2794
+	/**
2795
+	 * @var boolean $event_details_display_nav
2796
+	 */
2797
+	public $event_details_display_nav;
2798
+
2799
+	/**
2800
+	 * @var boolean $event_details_nav_size
2801
+	 */
2802
+	public $event_details_nav_size;
2803
+
2804
+	/**
2805
+	 * @var string $event_details_control_type
2806
+	 */
2807
+	public $event_details_control_type;
2808
+
2809
+	/**
2810
+	 * @var string $event_details_map_align
2811
+	 */
2812
+	public $event_details_map_align;
2813
+
2814
+	/**
2815
+	 * @var int $event_list_map_width
2816
+	 */
2817
+	public $event_list_map_width;
2818
+
2819
+	/**
2820
+	 * @var int $event_list_map_height
2821
+	 */
2822
+	public $event_list_map_height;
2823
+
2824
+	/**
2825
+	 * @var int $event_list_map_zoom
2826
+	 */
2827
+	public $event_list_map_zoom;
2828
+
2829
+	/**
2830
+	 * @var boolean $event_list_display_nav
2831
+	 */
2832
+	public $event_list_display_nav;
2833
+
2834
+	/**
2835
+	 * @var boolean $event_list_nav_size
2836
+	 */
2837
+	public $event_list_nav_size;
2838
+
2839
+	/**
2840
+	 * @var string $event_list_control_type
2841
+	 */
2842
+	public $event_list_control_type;
2843
+
2844
+	/**
2845
+	 * @var string $event_list_map_align
2846
+	 */
2847
+	public $event_list_map_align;
2848
+
2849
+
2850
+
2851
+	/**
2852
+	 *    class constructor
2853
+	 *
2854
+	 * @access    public
2855
+	 */
2856
+	public function __construct()
2857
+	{
2858
+		// set default map settings
2859
+		$this->use_google_maps = true;
2860
+		$this->google_map_api_key = '';
2861
+		// for event details pages (reg page)
2862
+		$this->event_details_map_width = 585;            // ee_map_width_single
2863
+		$this->event_details_map_height = 362;            // ee_map_height_single
2864
+		$this->event_details_map_zoom = 14;            // ee_map_zoom_single
2865
+		$this->event_details_display_nav = true;            // ee_map_nav_display_single
2866
+		$this->event_details_nav_size = false;            // ee_map_nav_size_single
2867
+		$this->event_details_control_type = 'default';        // ee_map_type_control_single
2868
+		$this->event_details_map_align = 'center';            // ee_map_align_single
2869
+		// for event list pages
2870
+		$this->event_list_map_width = 300;            // ee_map_width
2871
+		$this->event_list_map_height = 185;        // ee_map_height
2872
+		$this->event_list_map_zoom = 12;            // ee_map_zoom
2873
+		$this->event_list_display_nav = false;        // ee_map_nav_display
2874
+		$this->event_list_nav_size = true;            // ee_map_nav_size
2875
+		$this->event_list_control_type = 'dropdown';        // ee_map_type_control
2876
+		$this->event_list_map_align = 'center';            // ee_map_align
2877
+	}
2878 2878
 
2879 2879
 }
2880 2880
 
@@ -2886,47 +2886,47 @@  discard block
 block discarded – undo
2886 2886
 class EE_Events_Archive_Config extends EE_Config_Base
2887 2887
 {
2888 2888
 
2889
-    public $display_status_banner;
2889
+	public $display_status_banner;
2890 2890
 
2891
-    public $display_description;
2891
+	public $display_description;
2892 2892
 
2893
-    public $display_ticket_selector;
2893
+	public $display_ticket_selector;
2894 2894
 
2895
-    public $display_datetimes;
2895
+	public $display_datetimes;
2896 2896
 
2897
-    public $display_venue;
2897
+	public $display_venue;
2898 2898
 
2899
-    public $display_expired_events;
2899
+	public $display_expired_events;
2900 2900
 
2901
-    public $use_sortable_display_order;
2901
+	public $use_sortable_display_order;
2902 2902
 
2903
-    public $display_order_tickets;
2903
+	public $display_order_tickets;
2904 2904
 
2905
-    public $display_order_datetimes;
2905
+	public $display_order_datetimes;
2906 2906
 
2907
-    public $display_order_event;
2907
+	public $display_order_event;
2908 2908
 
2909
-    public $display_order_venue;
2909
+	public $display_order_venue;
2910 2910
 
2911 2911
 
2912 2912
 
2913
-    /**
2914
-     *    class constructor
2915
-     */
2916
-    public function __construct()
2917
-    {
2918
-        $this->display_status_banner = 0;
2919
-        $this->display_description = 1;
2920
-        $this->display_ticket_selector = 0;
2921
-        $this->display_datetimes = 1;
2922
-        $this->display_venue = 0;
2923
-        $this->display_expired_events = 0;
2924
-        $this->use_sortable_display_order = false;
2925
-        $this->display_order_tickets = 100;
2926
-        $this->display_order_datetimes = 110;
2927
-        $this->display_order_event = 120;
2928
-        $this->display_order_venue = 130;
2929
-    }
2913
+	/**
2914
+	 *    class constructor
2915
+	 */
2916
+	public function __construct()
2917
+	{
2918
+		$this->display_status_banner = 0;
2919
+		$this->display_description = 1;
2920
+		$this->display_ticket_selector = 0;
2921
+		$this->display_datetimes = 1;
2922
+		$this->display_venue = 0;
2923
+		$this->display_expired_events = 0;
2924
+		$this->use_sortable_display_order = false;
2925
+		$this->display_order_tickets = 100;
2926
+		$this->display_order_datetimes = 110;
2927
+		$this->display_order_event = 120;
2928
+		$this->display_order_venue = 130;
2929
+	}
2930 2930
 }
2931 2931
 
2932 2932
 
@@ -2937,35 +2937,35 @@  discard block
 block discarded – undo
2937 2937
 class EE_Event_Single_Config extends EE_Config_Base
2938 2938
 {
2939 2939
 
2940
-    public $display_status_banner_single;
2940
+	public $display_status_banner_single;
2941 2941
 
2942
-    public $display_venue;
2942
+	public $display_venue;
2943 2943
 
2944
-    public $use_sortable_display_order;
2944
+	public $use_sortable_display_order;
2945 2945
 
2946
-    public $display_order_tickets;
2946
+	public $display_order_tickets;
2947 2947
 
2948
-    public $display_order_datetimes;
2948
+	public $display_order_datetimes;
2949 2949
 
2950
-    public $display_order_event;
2950
+	public $display_order_event;
2951 2951
 
2952
-    public $display_order_venue;
2952
+	public $display_order_venue;
2953 2953
 
2954 2954
 
2955 2955
 
2956
-    /**
2957
-     *    class constructor
2958
-     */
2959
-    public function __construct()
2960
-    {
2961
-        $this->display_status_banner_single = 0;
2962
-        $this->display_venue = 1;
2963
-        $this->use_sortable_display_order = false;
2964
-        $this->display_order_tickets = 100;
2965
-        $this->display_order_datetimes = 110;
2966
-        $this->display_order_event = 120;
2967
-        $this->display_order_venue = 130;
2968
-    }
2956
+	/**
2957
+	 *    class constructor
2958
+	 */
2959
+	public function __construct()
2960
+	{
2961
+		$this->display_status_banner_single = 0;
2962
+		$this->display_venue = 1;
2963
+		$this->use_sortable_display_order = false;
2964
+		$this->display_order_tickets = 100;
2965
+		$this->display_order_datetimes = 110;
2966
+		$this->display_order_event = 120;
2967
+		$this->display_order_venue = 130;
2968
+	}
2969 2969
 }
2970 2970
 
2971 2971
 
@@ -2976,151 +2976,151 @@  discard block
 block discarded – undo
2976 2976
 class EE_Ticket_Selector_Config extends EE_Config_Base
2977 2977
 {
2978 2978
 
2979
-    /**
2980
-     * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
2981
-     */
2982
-    const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
2983
-
2984
-    /**
2985
-     * constant to indicate that a datetime selector should only be shown for ticket selectors
2986
-     * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
2987
-     */
2988
-    const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
2989
-
2990
-    /**
2991
-     * @var boolean $show_ticket_sale_columns
2992
-     */
2993
-    public $show_ticket_sale_columns;
2994
-
2995
-    /**
2996
-     * @var boolean $show_ticket_details
2997
-     */
2998
-    public $show_ticket_details;
2999
-
3000
-    /**
3001
-     * @var boolean $show_expired_tickets
3002
-     */
3003
-    public $show_expired_tickets;
3004
-
3005
-    /**
3006
-     * whether or not to display a dropdown box populated with event datetimes
3007
-     * that toggles which tickets are displayed for a ticket selector.
3008
-     * uses one of the *_DATETIME_SELECTOR constants defined above
3009
-     *
3010
-     * @var string $show_datetime_selector
3011
-     */
3012
-    private $show_datetime_selector = 'no_datetime_selector';
3013
-
3014
-    /**
3015
-     * the number of datetimes an event has to have before conditionally displaying a datetime selector
3016
-     *
3017
-     * @var int $datetime_selector_threshold
3018
-     */
3019
-    private $datetime_selector_threshold = 3;
3020
-
3021
-
3022
-
3023
-    /**
3024
-     *    class constructor
3025
-     */
3026
-    public function __construct()
3027
-    {
3028
-        $this->show_ticket_sale_columns = true;
3029
-        $this->show_ticket_details = true;
3030
-        $this->show_expired_tickets = true;
3031
-        $this->show_datetime_selector = \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3032
-        $this->datetime_selector_threshold = 3;
3033
-    }
3034
-
3035
-
3036
-
3037
-    /**
3038
-     * returns true if a datetime selector should be displayed
3039
-     *
3040
-     * @param array $datetimes
3041
-     * @return bool
3042
-     */
3043
-    public function showDatetimeSelector(array $datetimes)
3044
-    {
3045
-        // if the settings are NOT: don't show OR below threshold, THEN active = true
3046
-        return ! (
3047
-            $this->getShowDatetimeSelector() === \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3048
-            || (
3049
-                $this->getShowDatetimeSelector() === \EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3050
-                && count($datetimes) < $this->getDatetimeSelectorThreshold()
3051
-            )
3052
-        );
3053
-    }
3054
-
3055
-
3056
-
3057
-    /**
3058
-     * @return string
3059
-     */
3060
-    public function getShowDatetimeSelector()
3061
-    {
3062
-        return $this->show_datetime_selector;
3063
-    }
3064
-
3065
-
3066
-
3067
-    /**
3068
-     * @param bool $keys_only
3069
-     * @return array
3070
-     */
3071
-    public function getShowDatetimeSelectorOptions($keys_only = true)
3072
-    {
3073
-        return $keys_only
3074
-            ? array(
3075
-                \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3076
-                \EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3077
-            )
3078
-            : array(
3079
-                \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3080
-                    'Do not show date & time filter', 'event_espresso'
3081
-                ),
3082
-                \EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3083
-                    'Maybe show date & time filter', 'event_espresso'
3084
-                ),
3085
-            );
3086
-    }
3087
-
3088
-
3089
-
3090
-    /**
3091
-     * @param string $show_datetime_selector
3092
-     */
3093
-    public function setShowDatetimeSelector($show_datetime_selector)
3094
-    {
3095
-        $this->show_datetime_selector = in_array(
3096
-            $show_datetime_selector,
3097
-            $this->getShowDatetimeSelectorOptions(),
3098
-            true
3099
-        )
3100
-            ? $show_datetime_selector
3101
-            : \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3102
-    }
3103
-
3104
-
3105
-
3106
-    /**
3107
-     * @return int
3108
-     */
3109
-    public function getDatetimeSelectorThreshold()
3110
-    {
3111
-        return $this->datetime_selector_threshold;
3112
-    }
3113
-
3114
-
3115
-
3116
-    /**
3117
-     * @param int $datetime_selector_threshold
3118
-     */
3119
-    public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3120
-    {
3121
-        $datetime_selector_threshold = absint($datetime_selector_threshold);
3122
-        $this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3123
-    }
2979
+	/**
2980
+	 * constant to indicate that a datetime selector should NEVER be shown for ticket selectors
2981
+	 */
2982
+	const DO_NOT_SHOW_DATETIME_SELECTOR = 'no_datetime_selector';
2983
+
2984
+	/**
2985
+	 * constant to indicate that a datetime selector should only be shown for ticket selectors
2986
+	 * when the number of datetimes for the event matches the value set for $datetime_selector_threshold
2987
+	 */
2988
+	const MAYBE_SHOW_DATETIME_SELECTOR = 'maybe_datetime_selector';
2989
+
2990
+	/**
2991
+	 * @var boolean $show_ticket_sale_columns
2992
+	 */
2993
+	public $show_ticket_sale_columns;
2994
+
2995
+	/**
2996
+	 * @var boolean $show_ticket_details
2997
+	 */
2998
+	public $show_ticket_details;
2999
+
3000
+	/**
3001
+	 * @var boolean $show_expired_tickets
3002
+	 */
3003
+	public $show_expired_tickets;
3004
+
3005
+	/**
3006
+	 * whether or not to display a dropdown box populated with event datetimes
3007
+	 * that toggles which tickets are displayed for a ticket selector.
3008
+	 * uses one of the *_DATETIME_SELECTOR constants defined above
3009
+	 *
3010
+	 * @var string $show_datetime_selector
3011
+	 */
3012
+	private $show_datetime_selector = 'no_datetime_selector';
3013
+
3014
+	/**
3015
+	 * the number of datetimes an event has to have before conditionally displaying a datetime selector
3016
+	 *
3017
+	 * @var int $datetime_selector_threshold
3018
+	 */
3019
+	private $datetime_selector_threshold = 3;
3020
+
3021
+
3022
+
3023
+	/**
3024
+	 *    class constructor
3025
+	 */
3026
+	public function __construct()
3027
+	{
3028
+		$this->show_ticket_sale_columns = true;
3029
+		$this->show_ticket_details = true;
3030
+		$this->show_expired_tickets = true;
3031
+		$this->show_datetime_selector = \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3032
+		$this->datetime_selector_threshold = 3;
3033
+	}
3034
+
3035
+
3036
+
3037
+	/**
3038
+	 * returns true if a datetime selector should be displayed
3039
+	 *
3040
+	 * @param array $datetimes
3041
+	 * @return bool
3042
+	 */
3043
+	public function showDatetimeSelector(array $datetimes)
3044
+	{
3045
+		// if the settings are NOT: don't show OR below threshold, THEN active = true
3046
+		return ! (
3047
+			$this->getShowDatetimeSelector() === \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR
3048
+			|| (
3049
+				$this->getShowDatetimeSelector() === \EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR
3050
+				&& count($datetimes) < $this->getDatetimeSelectorThreshold()
3051
+			)
3052
+		);
3053
+	}
3054
+
3055
+
3056
+
3057
+	/**
3058
+	 * @return string
3059
+	 */
3060
+	public function getShowDatetimeSelector()
3061
+	{
3062
+		return $this->show_datetime_selector;
3063
+	}
3064
+
3065
+
3066
+
3067
+	/**
3068
+	 * @param bool $keys_only
3069
+	 * @return array
3070
+	 */
3071
+	public function getShowDatetimeSelectorOptions($keys_only = true)
3072
+	{
3073
+		return $keys_only
3074
+			? array(
3075
+				\EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
3076
+				\EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR,
3077
+			)
3078
+			: array(
3079
+				\EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR => esc_html__(
3080
+					'Do not show date & time filter', 'event_espresso'
3081
+				),
3082
+				\EE_Ticket_Selector_Config::MAYBE_SHOW_DATETIME_SELECTOR  => esc_html__(
3083
+					'Maybe show date & time filter', 'event_espresso'
3084
+				),
3085
+			);
3086
+	}
3087
+
3088
+
3089
+
3090
+	/**
3091
+	 * @param string $show_datetime_selector
3092
+	 */
3093
+	public function setShowDatetimeSelector($show_datetime_selector)
3094
+	{
3095
+		$this->show_datetime_selector = in_array(
3096
+			$show_datetime_selector,
3097
+			$this->getShowDatetimeSelectorOptions(),
3098
+			true
3099
+		)
3100
+			? $show_datetime_selector
3101
+			: \EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR;
3102
+	}
3103
+
3104
+
3105
+
3106
+	/**
3107
+	 * @return int
3108
+	 */
3109
+	public function getDatetimeSelectorThreshold()
3110
+	{
3111
+		return $this->datetime_selector_threshold;
3112
+	}
3113
+
3114
+
3115
+
3116
+	/**
3117
+	 * @param int $datetime_selector_threshold
3118
+	 */
3119
+	public function setDatetimeSelectorThreshold($datetime_selector_threshold)
3120
+	{
3121
+		$datetime_selector_threshold = absint($datetime_selector_threshold);
3122
+		$this->datetime_selector_threshold = $datetime_selector_threshold ? $datetime_selector_threshold : 3;
3123
+	}
3124 3124
 
3125 3125
 
3126 3126
 }
@@ -3137,85 +3137,85 @@  discard block
 block discarded – undo
3137 3137
 class EE_Environment_Config extends EE_Config_Base
3138 3138
 {
3139 3139
 
3140
-    /**
3141
-     * Hold any php environment variables that we want to track.
3142
-     *
3143
-     * @var stdClass;
3144
-     */
3145
-    public $php;
3146
-
3147
-
3148
-
3149
-    /**
3150
-     *    constructor
3151
-     */
3152
-    public function __construct()
3153
-    {
3154
-        $this->php = new stdClass();
3155
-        $this->_set_php_values();
3156
-    }
3157
-
3158
-
3159
-
3160
-    /**
3161
-     * This sets the php environment variables.
3162
-     *
3163
-     * @since 4.4.0
3164
-     * @return void
3165
-     */
3166
-    protected function _set_php_values()
3167
-    {
3168
-        $this->php->max_input_vars = ini_get('max_input_vars');
3169
-        $this->php->version = phpversion();
3170
-    }
3171
-
3172
-
3173
-
3174
-    /**
3175
-     * helper method for determining whether input_count is
3176
-     * reaching the potential maximum the server can handle
3177
-     * according to max_input_vars
3178
-     *
3179
-     * @param int   $input_count the count of input vars.
3180
-     * @return array {
3181
-     *                           An array that represents whether available space and if no available space the error
3182
-     *                           message.
3183
-     * @type bool   $has_space   whether more inputs can be added.
3184
-     * @type string $msg         Any message to be displayed.
3185
-     *                           }
3186
-     */
3187
-    public function max_input_vars_limit_check($input_count = 0)
3188
-    {
3189
-        if ( ! empty($this->php->max_input_vars)
3190
-             && ($input_count >= $this->php->max_input_vars)
3191
-             && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)
3192
-        ) {
3193
-            return sprintf(
3194
-                __(
3195
-                    'The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.',
3196
-                    'event_espresso'
3197
-                ),
3198
-                '<br>',
3199
-                $input_count,
3200
-                $this->php->max_input_vars
3201
-            );
3202
-        } else {
3203
-            return '';
3204
-        }
3205
-    }
3206
-
3207
-
3208
-
3209
-    /**
3210
-     * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3211
-     *
3212
-     * @since 4.4.1
3213
-     * @return void
3214
-     */
3215
-    public function recheck_values()
3216
-    {
3217
-        $this->_set_php_values();
3218
-    }
3140
+	/**
3141
+	 * Hold any php environment variables that we want to track.
3142
+	 *
3143
+	 * @var stdClass;
3144
+	 */
3145
+	public $php;
3146
+
3147
+
3148
+
3149
+	/**
3150
+	 *    constructor
3151
+	 */
3152
+	public function __construct()
3153
+	{
3154
+		$this->php = new stdClass();
3155
+		$this->_set_php_values();
3156
+	}
3157
+
3158
+
3159
+
3160
+	/**
3161
+	 * This sets the php environment variables.
3162
+	 *
3163
+	 * @since 4.4.0
3164
+	 * @return void
3165
+	 */
3166
+	protected function _set_php_values()
3167
+	{
3168
+		$this->php->max_input_vars = ini_get('max_input_vars');
3169
+		$this->php->version = phpversion();
3170
+	}
3171
+
3172
+
3173
+
3174
+	/**
3175
+	 * helper method for determining whether input_count is
3176
+	 * reaching the potential maximum the server can handle
3177
+	 * according to max_input_vars
3178
+	 *
3179
+	 * @param int   $input_count the count of input vars.
3180
+	 * @return array {
3181
+	 *                           An array that represents whether available space and if no available space the error
3182
+	 *                           message.
3183
+	 * @type bool   $has_space   whether more inputs can be added.
3184
+	 * @type string $msg         Any message to be displayed.
3185
+	 *                           }
3186
+	 */
3187
+	public function max_input_vars_limit_check($input_count = 0)
3188
+	{
3189
+		if ( ! empty($this->php->max_input_vars)
3190
+			 && ($input_count >= $this->php->max_input_vars)
3191
+			 && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)
3192
+		) {
3193
+			return sprintf(
3194
+				__(
3195
+					'The maximum number of inputs on this page has been exceeded.  You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.',
3196
+					'event_espresso'
3197
+				),
3198
+				'<br>',
3199
+				$input_count,
3200
+				$this->php->max_input_vars
3201
+			);
3202
+		} else {
3203
+			return '';
3204
+		}
3205
+	}
3206
+
3207
+
3208
+
3209
+	/**
3210
+	 * The purpose of this method is just to force rechecking php values so if they've changed, they get updated.
3211
+	 *
3212
+	 * @since 4.4.1
3213
+	 * @return void
3214
+	 */
3215
+	public function recheck_values()
3216
+	{
3217
+		$this->_set_php_values();
3218
+	}
3219 3219
 
3220 3220
 
3221 3221
 }
@@ -3232,22 +3232,22 @@  discard block
 block discarded – undo
3232 3232
 class EE_Tax_Config extends EE_Config_Base
3233 3233
 {
3234 3234
 
3235
-    /*
3235
+	/*
3236 3236
      * flag to indicate whether or not to display ticket prices with the taxes included
3237 3237
      *
3238 3238
      * @var boolean $prices_displayed_including_taxes
3239 3239
      */
3240
-    public $prices_displayed_including_taxes;
3240
+	public $prices_displayed_including_taxes;
3241 3241
 
3242 3242
 
3243 3243
 
3244
-    /**
3245
-     *    class constructor
3246
-     */
3247
-    public function __construct()
3248
-    {
3249
-        $this->prices_displayed_including_taxes = true;
3250
-    }
3244
+	/**
3245
+	 *    class constructor
3246
+	 */
3247
+	public function __construct()
3248
+	{
3249
+		$this->prices_displayed_including_taxes = true;
3250
+	}
3251 3251
 }
3252 3252
 
3253 3253
 
@@ -3260,34 +3260,34 @@  discard block
 block discarded – undo
3260 3260
 class EE_Gateway_Config extends EE_Config_Base
3261 3261
 {
3262 3262
 
3263
-    /**
3264
-     * Array with keys that are payment gateways slugs, and values are arrays
3265
-     * with any config info the gateway wants to store
3266
-     *
3267
-     * @var array
3268
-     */
3269
-    public $payment_settings;
3270
-
3271
-    /**
3272
-     * Where keys are gateway slugs, and values are booleans indicating whether or not
3273
-     * the gateway is stored in the uploads directory
3274
-     *
3275
-     * @var array
3276
-     */
3277
-    public $active_gateways;
3278
-
3279
-
3280
-
3281
-    /**
3282
-     *    class constructor
3283
-     *
3284
-     * @deprecated
3285
-     */
3286
-    public function __construct()
3287
-    {
3288
-        $this->payment_settings = array();
3289
-        $this->active_gateways = array('Invoice' => false);
3290
-    }
3263
+	/**
3264
+	 * Array with keys that are payment gateways slugs, and values are arrays
3265
+	 * with any config info the gateway wants to store
3266
+	 *
3267
+	 * @var array
3268
+	 */
3269
+	public $payment_settings;
3270
+
3271
+	/**
3272
+	 * Where keys are gateway slugs, and values are booleans indicating whether or not
3273
+	 * the gateway is stored in the uploads directory
3274
+	 *
3275
+	 * @var array
3276
+	 */
3277
+	public $active_gateways;
3278
+
3279
+
3280
+
3281
+	/**
3282
+	 *    class constructor
3283
+	 *
3284
+	 * @deprecated
3285
+	 */
3286
+	public function __construct()
3287
+	{
3288
+		$this->payment_settings = array();
3289
+		$this->active_gateways = array('Invoice' => false);
3290
+	}
3291 3291
 }
3292 3292
 
3293 3293
 // End of file EE_Config.core.php
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                 $this
279 279
             );
280 280
             if (is_object($settings) && property_exists($this, $config)) {
281
-                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__' . $config, $settings);
281
+                $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings);
282 282
                 //call configs populate method to ensure any defaults are set for empty values.
283 283
                 if (method_exists($settings, 'populate')) {
284 284
                     $this->{$config}->populate();
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
      */
688 688
     private function _generate_config_option_name($section = '', $name = '')
689 689
     {
690
-        return 'ee_config-' . strtolower($section . '-' . str_replace(array('EE_', 'EED_'), '', $name));
690
+        return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name));
691 691
     }
692 692
 
693 693
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
     {
706 706
         return ! empty($config_class)
707 707
             ? $config_class
708
-            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))) . '_Config';
708
+            : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config';
709 709
     }
710 710
 
711 711
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
                             'event_espresso'
822 822
                         ),
823 823
                         $config_class,
824
-                        'EE_Config->' . $section . '->' . $name
824
+                        'EE_Config->'.$section.'->'.$name
825 825
                     ),
826 826
                     __FILE__,
827 827
                     __FUNCTION__,
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
         // retrieve the wp-option for this config class.
895 895
         $config_option = maybe_unserialize(get_option($config_option_name, array()));
896 896
         if (empty($config_option)) {
897
-            EE_Config::log($config_option_name . '-NOT-FOUND');
897
+            EE_Config::log($config_option_name.'-NOT-FOUND');
898 898
         }
899 899
         return $config_option;
900 900
     }
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
             //copy incoming $_REQUEST and sanitize it so we can save it
914 914
             $_request = $_REQUEST;
915 915
             array_walk_recursive($_request, 'sanitize_text_field');
916
-            $config_log[(string)microtime(true)] = array(
916
+            $config_log[(string) microtime(true)] = array(
917 917
                 'config_name' => $config_option_name,
918 918
                 'request'     => $_request,
919 919
             );
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
             )
1020 1020
         ) {
1021 1021
             // grab list of installed widgets
1022
-            $widgets_to_register = glob(EE_WIDGETS . '*', GLOB_ONLYDIR);
1022
+            $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR);
1023 1023
             // filter list of modules to register
1024 1024
             $widgets_to_register = apply_filters(
1025 1025
                 'FHEE__EE_Config__register_widgets__widgets_to_register',
@@ -1076,31 +1076,31 @@  discard block
 block discarded – undo
1076 1076
         // create classname from widget directory name
1077 1077
         $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget)));
1078 1078
         // add class prefix
1079
-        $widget_class = 'EEW_' . $widget;
1079
+        $widget_class = 'EEW_'.$widget;
1080 1080
         // does the widget exist ?
1081
-        if ( ! is_readable($widget_path . DS . $widget_class . $widget_ext)) {
1081
+        if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) {
1082 1082
             $msg = sprintf(
1083 1083
                 __(
1084 1084
                     'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s',
1085 1085
                     'event_espresso'
1086 1086
                 ),
1087 1087
                 $widget_class,
1088
-                $widget_path . DS . $widget_class . $widget_ext
1088
+                $widget_path.DS.$widget_class.$widget_ext
1089 1089
             );
1090
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1090
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1091 1091
             return;
1092 1092
         }
1093 1093
         // load the widget class file
1094
-        require_once($widget_path . DS . $widget_class . $widget_ext);
1094
+        require_once($widget_path.DS.$widget_class.$widget_ext);
1095 1095
         // verify that class exists
1096 1096
         if ( ! class_exists($widget_class)) {
1097 1097
             $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class);
1098
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1098
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1099 1099
             return;
1100 1100
         }
1101 1101
         register_widget($widget_class);
1102 1102
         // add to array of registered widgets
1103
-        EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext;
1103
+        EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext;
1104 1104
     }
1105 1105
 
1106 1106
 
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
     private function _register_shortcodes()
1115 1115
     {
1116 1116
         // grab list of installed shortcodes
1117
-        $shortcodes_to_register = glob(EE_SHORTCODES . '*', GLOB_ONLYDIR);
1117
+        $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR);
1118 1118
         // filter list of modules to register
1119 1119
         $shortcodes_to_register = apply_filters(
1120 1120
             'FHEE__EE_Config__register_shortcodes__shortcodes_to_register',
@@ -1164,44 +1164,44 @@  discard block
 block discarded – undo
1164 1164
             // remove last segment
1165 1165
             array_pop($shortcode_path);
1166 1166
             // glue it back together
1167
-            $shortcode_path = implode(DS, $shortcode_path) . DS;
1167
+            $shortcode_path = implode(DS, $shortcode_path).DS;
1168 1168
         } else {
1169 1169
             // we need to generate the filename based off of the folder name
1170 1170
             // grab and sanitize shortcode directory name
1171 1171
             $shortcode = sanitize_key(basename($shortcode_path));
1172
-            $shortcode_path = rtrim($shortcode_path, DS) . DS;
1172
+            $shortcode_path = rtrim($shortcode_path, DS).DS;
1173 1173
         }
1174 1174
         // create classname from shortcode directory or file name
1175 1175
         $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode)));
1176 1176
         // add class prefix
1177
-        $shortcode_class = 'EES_' . $shortcode;
1177
+        $shortcode_class = 'EES_'.$shortcode;
1178 1178
         // does the shortcode exist ?
1179
-        if ( ! is_readable($shortcode_path . DS . $shortcode_class . $shortcode_ext)) {
1179
+        if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) {
1180 1180
             $msg = sprintf(
1181 1181
                 __(
1182 1182
                     'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s',
1183 1183
                     'event_espresso'
1184 1184
                 ),
1185 1185
                 $shortcode_class,
1186
-                $shortcode_path . DS . $shortcode_class . $shortcode_ext
1186
+                $shortcode_path.DS.$shortcode_class.$shortcode_ext
1187 1187
             );
1188
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1188
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1189 1189
             return false;
1190 1190
         }
1191 1191
         // load the shortcode class file
1192
-        require_once($shortcode_path . $shortcode_class . $shortcode_ext);
1192
+        require_once($shortcode_path.$shortcode_class.$shortcode_ext);
1193 1193
         // verify that class exists
1194 1194
         if ( ! class_exists($shortcode_class)) {
1195 1195
             $msg = sprintf(
1196 1196
                 __('The requested %s shortcode class does not exist.', 'event_espresso'),
1197 1197
                 $shortcode_class
1198 1198
             );
1199
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1199
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1200 1200
             return false;
1201 1201
         }
1202 1202
         $shortcode = strtoupper($shortcode);
1203 1203
         // add to array of registered shortcodes
1204
-        EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext;
1204
+        EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext;
1205 1205
         return true;
1206 1206
     }
1207 1207
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
     private function _register_modules()
1217 1217
     {
1218 1218
         // grab list of installed modules
1219
-        $modules_to_register = glob(EE_MODULES . '*', GLOB_ONLYDIR);
1219
+        $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR);
1220 1220
         // filter list of modules to register
1221 1221
         $modules_to_register = apply_filters(
1222 1222
             'FHEE__EE_Config__register_modules__modules_to_register',
@@ -1227,8 +1227,8 @@  discard block
 block discarded – undo
1227 1227
             foreach ($modules_to_register as $module_path) {
1228 1228
                 /**TEMPORARILY EXCLUDE gateways from modules for time being**/
1229 1229
                 if (
1230
-                    $module_path !== EE_MODULES . 'zzz-copy-this-module-template'
1231
-                    && $module_path !== EE_MODULES . 'gateways'
1230
+                    $module_path !== EE_MODULES.'zzz-copy-this-module-template'
1231
+                    && $module_path !== EE_MODULES.'gateways'
1232 1232
                 ) {
1233 1233
                     // add to list of installed modules
1234 1234
                     EE_Config::register_module($module_path);
@@ -1266,25 +1266,25 @@  discard block
 block discarded – undo
1266 1266
             // remove last segment
1267 1267
             array_pop($module_path);
1268 1268
             // glue it back together
1269
-            $module_path = implode(DS, $module_path) . DS;
1269
+            $module_path = implode(DS, $module_path).DS;
1270 1270
             // take first segment from file name pieces and sanitize it
1271 1271
             $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]);
1272 1272
             // ensure class prefix is added
1273
-            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_' . $module : $module;
1273
+            $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module;
1274 1274
         } else {
1275 1275
             // we need to generate the filename based off of the folder name
1276 1276
             // grab and sanitize module name
1277 1277
             $module = strtolower(basename($module_path));
1278 1278
             $module = preg_replace('/[^a-z0-9_\-]/', '', $module);
1279 1279
             // like trailingslashit()
1280
-            $module_path = rtrim($module_path, DS) . DS;
1280
+            $module_path = rtrim($module_path, DS).DS;
1281 1281
             // create classname from module directory name
1282 1282
             $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module)));
1283 1283
             // add class prefix
1284
-            $module_class = 'EED_' . $module;
1284
+            $module_class = 'EED_'.$module;
1285 1285
         }
1286 1286
         // does the module exist ?
1287
-        if ( ! is_readable($module_path . DS . $module_class . $module_ext)) {
1287
+        if ( ! is_readable($module_path.DS.$module_class.$module_ext)) {
1288 1288
             $msg = sprintf(
1289 1289
                 __(
1290 1290
                     'The requested %s module file could not be found or is not readable due to file permissions.',
@@ -1292,19 +1292,19 @@  discard block
 block discarded – undo
1292 1292
                 ),
1293 1293
                 $module
1294 1294
             );
1295
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1295
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1296 1296
             return false;
1297 1297
         }
1298 1298
         // load the module class file
1299
-        require_once($module_path . $module_class . $module_ext);
1299
+        require_once($module_path.$module_class.$module_ext);
1300 1300
         // verify that class exists
1301 1301
         if ( ! class_exists($module_class)) {
1302 1302
             $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
1303
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1303
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1304 1304
             return false;
1305 1305
         }
1306 1306
         // add to array of registered modules
1307
-        EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext;
1307
+        EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext;
1308 1308
         do_action(
1309 1309
             'AHEE__EE_Config__register_module__complete',
1310 1310
             $module_class,
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
         // cycle thru shortcode folders
1328 1328
         foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) {
1329 1329
             // add class prefix
1330
-            $shortcode_class = 'EES_' . $shortcode;
1330
+            $shortcode_class = 'EES_'.$shortcode;
1331 1331
             // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system
1332 1332
             // which set hooks ?
1333 1333
             if (is_admin()) {
@@ -1394,26 +1394,26 @@  discard block
 block discarded – undo
1394 1394
     {
1395 1395
         do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name);
1396 1396
         $module = str_replace('EED_', '', $module);
1397
-        $module_class = 'EED_' . $module;
1397
+        $module_class = 'EED_'.$module;
1398 1398
         if ( ! isset(EE_Registry::instance()->modules->{$module_class})) {
1399 1399
             $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module);
1400
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1400
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1401 1401
             return false;
1402 1402
         }
1403 1403
         if (empty($route)) {
1404 1404
             $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route);
1405
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1405
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1406 1406
             return false;
1407 1407
         }
1408
-        if ( ! method_exists('EED_' . $module, $method_name)) {
1408
+        if ( ! method_exists('EED_'.$module, $method_name)) {
1409 1409
             $msg = sprintf(
1410 1410
                 __('A valid class method for the %s route has not been supplied.', 'event_espresso'),
1411 1411
                 $route
1412 1412
             );
1413
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1413
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1414 1414
             return false;
1415 1415
         }
1416
-        EE_Config::$_module_route_map[$key][$route] = array('EED_' . $module, $method_name);
1416
+        EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name);
1417 1417
         return true;
1418 1418
     }
1419 1419
 
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
     public static function get_route($route = null, $key = 'ee')
1431 1431
     {
1432 1432
         do_action('AHEE__EE_Config__get_route__begin', $route);
1433
-        $route = (string)apply_filters('FHEE__EE_Config__get_route', $route);
1433
+        $route = (string) apply_filters('FHEE__EE_Config__get_route', $route);
1434 1434
         if (isset(EE_Config::$_module_route_map[$key][$route])) {
1435 1435
             return EE_Config::$_module_route_map[$key][$route];
1436 1436
         }
@@ -1471,12 +1471,12 @@  discard block
 block discarded – undo
1471 1471
                 __('The module route %s for this forward has not been registered.', 'event_espresso'),
1472 1472
                 $route
1473 1473
             );
1474
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1474
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1475 1475
             return false;
1476 1476
         }
1477 1477
         if (empty($forward)) {
1478 1478
             $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route);
1479
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1479
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1480 1480
             return false;
1481 1481
         }
1482 1482
         if (is_array($forward)) {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
                     __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'),
1486 1486
                     $route
1487 1487
                 );
1488
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1488
+                EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1489 1489
                 return false;
1490 1490
             }
1491 1491
             if ( ! method_exists($forward[0], $forward[1])) {
@@ -1494,7 +1494,7 @@  discard block
 block discarded – undo
1494 1494
                     $forward[1],
1495 1495
                     $route
1496 1496
                 );
1497
-                EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1497
+                EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1498 1498
                 return false;
1499 1499
             }
1500 1500
         } else if ( ! function_exists($forward)) {
@@ -1503,7 +1503,7 @@  discard block
 block discarded – undo
1503 1503
                 $forward,
1504 1504
                 $route
1505 1505
             );
1506
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1506
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1507 1507
             return false;
1508 1508
         }
1509 1509
         EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward;
@@ -1558,7 +1558,7 @@  discard block
 block discarded – undo
1558 1558
                 __('The module route %s for this view has not been registered.', 'event_espresso'),
1559 1559
                 $route
1560 1560
             );
1561
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1561
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1562 1562
             return false;
1563 1563
         }
1564 1564
         if ( ! is_readable($view)) {
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
                 ),
1570 1570
                 $view
1571 1571
             );
1572
-            EE_Error::add_error($msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__);
1572
+            EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
1573 1573
             return false;
1574 1574
         }
1575 1575
         EE_Config::$_module_view_map[$key][$route][absint($status)] = $view;
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
             $this->reg_page_url = add_query_arg(
1887 1887
                                       array('uts' => time()),
1888 1888
                                       get_permalink($this->reg_page_id)
1889
-                                  ) . '#checkout';
1889
+                                  ).'#checkout';
1890 1890
         }
1891 1891
         return $this->reg_page_url;
1892 1892
     }
@@ -1990,13 +1990,13 @@  discard block
 block discarded – undo
1990 1990
         $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1;
1991 1991
         $option = 'ee_ueip_optin';
1992 1992
         //set correct table for query
1993
-        $table_name = $wpdb->get_blog_prefix($current_main_site_id) . 'options';
1993
+        $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options';
1994 1994
         //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because
1995 1995
         //get_blog_option() does a switch_to_blog an that could cause infinite recursion because EE_Core_Config might be
1996 1996
         //re-constructed on the blog switch.  Note, we are still executing any core wp filters on this option retrieval.
1997 1997
         //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog
1998 1998
         //for the purpose of caching.
1999
-        $pre = apply_filters('pre_option_' . $option, false, $option);
1999
+        $pre = apply_filters('pre_option_'.$option, false, $option);
2000 2000
         if (false !== $pre) {
2001 2001
             EE_Core_Config::$ee_ueip_option = $pre;
2002 2002
             return EE_Core_Config::$ee_ueip_option;
@@ -2006,9 +2006,9 @@  discard block
 block discarded – undo
2006 2006
         if (is_object($row)) {
2007 2007
             $value = $row->option_value;
2008 2008
         } else { //option does not exist so use default.
2009
-            return apply_filters('default_option_' . $option, false, $option);
2009
+            return apply_filters('default_option_'.$option, false, $option);
2010 2010
         }
2011
-        EE_Core_Config::$ee_ueip_option = apply_filters('option_' . $option, maybe_unserialize($value), $option);
2011
+        EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option);
2012 2012
         return EE_Core_Config::$ee_ueip_option;
2013 2013
     }
2014 2014
 
@@ -2285,27 +2285,27 @@  discard block
 block discarded – undo
2285 2285
             // retrieve the country settings from the db, just in case they have been customized
2286 2286
             $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO);
2287 2287
             if ($country instanceof EE_Country) {
2288
-                $this->code = $country->currency_code();    // currency code: USD, CAD, EUR
2289
-                $this->name = $country->currency_name_single();    // Dollar
2290
-                $this->plural = $country->currency_name_plural();    // Dollars
2291
-                $this->sign = $country->currency_sign();            // currency sign: $
2292
-                $this->sign_b4 = $country->currency_sign_before();        // currency sign before or after: $TRUE  or  FALSE$
2293
-                $this->dec_plc = $country->currency_decimal_places();    // decimal places: 2 = 0.00  3 = 0.000
2294
-                $this->dec_mrk = $country->currency_decimal_mark();    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2295
-                $this->thsnds = $country->currency_thousands_separator();    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2288
+                $this->code = $country->currency_code(); // currency code: USD, CAD, EUR
2289
+                $this->name = $country->currency_name_single(); // Dollar
2290
+                $this->plural = $country->currency_name_plural(); // Dollars
2291
+                $this->sign = $country->currency_sign(); // currency sign: $
2292
+                $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE  or  FALSE$
2293
+                $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00  3 = 0.000
2294
+                $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2295
+                $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2296 2296
             }
2297 2297
         }
2298 2298
         // fallback to hardcoded defaults, in case the above failed
2299 2299
         if (empty($this->code)) {
2300 2300
             // set default currency settings
2301
-            $this->code = 'USD';    // currency code: USD, CAD, EUR
2302
-            $this->name = __('Dollar', 'event_espresso');    // Dollar
2303
-            $this->plural = __('Dollars', 'event_espresso');    // Dollars
2304
-            $this->sign = '$';    // currency sign: $
2305
-            $this->sign_b4 = true;    // currency sign before or after: $TRUE  or  FALSE$
2306
-            $this->dec_plc = 2;    // decimal places: 2 = 0.00  3 = 0.000
2307
-            $this->dec_mrk = '.';    // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2308
-            $this->thsnds = ',';    // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2301
+            $this->code = 'USD'; // currency code: USD, CAD, EUR
2302
+            $this->name = __('Dollar', 'event_espresso'); // Dollar
2303
+            $this->plural = __('Dollars', 'event_espresso'); // Dollars
2304
+            $this->sign = '$'; // currency sign: $
2305
+            $this->sign_b4 = true; // currency sign before or after: $TRUE  or  FALSE$
2306
+            $this->dec_plc = 2; // decimal places: 2 = 0.00  3 = 0.000
2307
+            $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01   or (decimal) '.' = 0.01
2308
+            $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000   or (decimal) '.' = 1.000
2309 2309
         }
2310 2310
     }
2311 2311
 }
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
     public function log_file_name($reset = false)
2629 2629
     {
2630 2630
         if (empty($this->log_file_name) || $reset) {
2631
-            $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt';
2631
+            $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt';
2632 2632
             EE_Config::instance()->update_espresso_config(false, false);
2633 2633
         }
2634 2634
         return $this->log_file_name;
@@ -2643,7 +2643,7 @@  discard block
 block discarded – undo
2643 2643
     public function debug_file_name($reset = false)
2644 2644
     {
2645 2645
         if (empty($this->debug_file_name) || $reset) {
2646
-            $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt';
2646
+            $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt';
2647 2647
             EE_Config::instance()->update_espresso_config(false, false);
2648 2648
         }
2649 2649
         return $this->debug_file_name;
@@ -2859,21 +2859,21 @@  discard block
 block discarded – undo
2859 2859
         $this->use_google_maps = true;
2860 2860
         $this->google_map_api_key = '';
2861 2861
         // for event details pages (reg page)
2862
-        $this->event_details_map_width = 585;            // ee_map_width_single
2863
-        $this->event_details_map_height = 362;            // ee_map_height_single
2864
-        $this->event_details_map_zoom = 14;            // ee_map_zoom_single
2865
-        $this->event_details_display_nav = true;            // ee_map_nav_display_single
2866
-        $this->event_details_nav_size = false;            // ee_map_nav_size_single
2867
-        $this->event_details_control_type = 'default';        // ee_map_type_control_single
2868
-        $this->event_details_map_align = 'center';            // ee_map_align_single
2862
+        $this->event_details_map_width = 585; // ee_map_width_single
2863
+        $this->event_details_map_height = 362; // ee_map_height_single
2864
+        $this->event_details_map_zoom = 14; // ee_map_zoom_single
2865
+        $this->event_details_display_nav = true; // ee_map_nav_display_single
2866
+        $this->event_details_nav_size = false; // ee_map_nav_size_single
2867
+        $this->event_details_control_type = 'default'; // ee_map_type_control_single
2868
+        $this->event_details_map_align = 'center'; // ee_map_align_single
2869 2869
         // for event list pages
2870
-        $this->event_list_map_width = 300;            // ee_map_width
2871
-        $this->event_list_map_height = 185;        // ee_map_height
2872
-        $this->event_list_map_zoom = 12;            // ee_map_zoom
2873
-        $this->event_list_display_nav = false;        // ee_map_nav_display
2874
-        $this->event_list_nav_size = true;            // ee_map_nav_size
2875
-        $this->event_list_control_type = 'dropdown';        // ee_map_type_control
2876
-        $this->event_list_map_align = 'center';            // ee_map_align
2870
+        $this->event_list_map_width = 300; // ee_map_width
2871
+        $this->event_list_map_height = 185; // ee_map_height
2872
+        $this->event_list_map_zoom = 12; // ee_map_zoom
2873
+        $this->event_list_display_nav = false; // ee_map_nav_display
2874
+        $this->event_list_nav_size = true; // ee_map_nav_size
2875
+        $this->event_list_control_type = 'dropdown'; // ee_map_type_control
2876
+        $this->event_list_map_align = 'center'; // ee_map_align
2877 2877
     }
2878 2878
 
2879 2879
 }
Please login to merge, or discard this patch.
core/libraries/iframe_display/IframeEmbedButton.php 2 patches
Indentation   +276 added lines, -276 removed lines patch added patch discarded remove patch
@@ -16,282 +16,282 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * @var string $iframe_name
21
-     */
22
-    private $iframe_name;
23
-
24
-    /**
25
-     * @var string $route_name
26
-     */
27
-    private $route_name;
28
-
29
-    /**
30
-     * @var string $slug
31
-     */
32
-    private $slug;
33
-
34
-    /**
35
-     * @var boolean $append_filterable_content
36
-     */
37
-    private $append_filterable_content;
38
-
39
-
40
-
41
-    /**
42
-     * IframeEmbedButton constructor.
43
-     *
44
-     * @param string $iframe_name i18n name for the iframe. This will be used in HTML
45
-     * @param string $route_name  the name of the registered route
46
-     * @param string $slug        URL slug used for the thing the iframe button is being embedded in.
47
-     *                            will most likely be "event" since that's the only usage atm
48
-     */
49
-    public function __construct( $iframe_name, $route_name, $slug = 'event' )
50
-    {
51
-        $this->iframe_name = $iframe_name;
52
-        $this->route_name = $route_name;
53
-        $this->slug = $slug;
54
-    }
55
-
56
-
57
-
58
-    /**
59
-     * Adds an iframe embed code button to the Event editor.
60
-     */
61
-    public function addEventEditorIframeEmbedButtonFilter()
62
-    {
63
-        // add button for iframe code to event editor.
64
-        add_filter(
65
-            'get_sample_permalink_html',
66
-            array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ),
67
-            10,
68
-            2
69
-        );
70
-        add_action(
71
-            'admin_enqueue_scripts',
72
-            array( $this, 'embedButtonAssets' ),
73
-            10
74
-        );
75
-    }
76
-
77
-
78
-
79
-    /**
80
-     * @param $permalink_string
81
-     * @param $id
82
-     * @return string
83
-     */
84
-    public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id )
85
-    {
86
-        return $this->eventEditorIframeEmbedButton(
87
-            $permalink_string,
88
-            $id
89
-        );
90
-    }
91
-
92
-
93
-
94
-    /**
95
-     * iframe embed code button to the Event editor.
96
-     *
97
-     * @param string $permalink_string
98
-     * @param int    $id
99
-     * @return string
100
-     */
101
-    public function eventEditorIframeEmbedButton(
102
-        $permalink_string,
103
-        $id
104
-    ) {
105
-        //make sure this is ONLY when editing and the event id has been set.
106
-        if ( ! empty( $id ) ) {
107
-            $post = get_post( $id );
108
-            //if NOT event then let's get out.
109
-            if ( $post->post_type !== 'espresso_events' ) {
110
-                return $permalink_string;
111
-            }
112
-            $permalink_string .= $this->embedButtonHtml(
113
-                array( $this->slug => $id ),
114
-                'button-small'
115
-            );
116
-        }
117
-        return $permalink_string;
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
124
-     *
125
-     * @param string $action name of the WP do_action() to hook into
126
-     */
127
-    public function addActionIframeEmbedButton( $action )
128
-    {
129
-        // add button for iframe code to event editor.
130
-        add_action(
131
-            $action,
132
-            array( $this, 'addActionIframeEmbedButtonCallback' ),
133
-            10, 2
134
-        );
135
-    }
136
-
137
-
138
-
139
-    /**
140
-     * @return void
141
-     */
142
-    public function addActionIframeEmbedButtonCallback()
143
-    {
144
-        echo $this->embedButtonHtml();
145
-    }
146
-
147
-
148
-
149
-    /**
150
-     * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter
151
-     *
152
-     * @param string $filter     name of the WP apply_filters() to hook into
153
-     * @param bool   $append     if true, will add iframe embed button to end of content,
154
-     *                           else if false, will add to the beginning of the content
155
-     */
156
-    public function addFilterIframeEmbedButton( $filter, $append = true )
157
-    {
158
-        $this->append_filterable_content = $append;
159
-        // add button for iframe code to event editor.
160
-        add_filter(
161
-            $filter,
162
-            array( $this, 'addFilterIframeEmbedButtonCallback' ),
163
-            10
164
-        );
165
-    }
166
-
167
-
168
-
169
-    /**
170
-     * @param array|string $filterable_content
171
-     * @return array|string
172
-     */
173
-    public function addFilterIframeEmbedButtonCallback( $filterable_content )
174
-    {
175
-        $embedButtonHtml = $this->embedButtonHtml();
176
-        if ( is_array( $filterable_content ) ) {
177
-            $filterable_content = $this->append_filterable_content
178
-                ? $filterable_content + array( $this->route_name => $embedButtonHtml )
179
-                : array( $this->route_name => $embedButtonHtml ) + $filterable_content;
180
-        } else {
181
-            $filterable_content = $this->append_filterable_content
182
-                ? $filterable_content . $embedButtonHtml
183
-                : $embedButtonHtml . $filterable_content;
184
-        }
185
-        return $filterable_content;
186
-    }
187
-
188
-
189
-
190
-    /**
191
-     * iframe_embed_html
192
-     *
193
-     * @param array  $query_args
194
-     * @param string $button_class
195
-     * @return string
196
-     */
197
-    public function embedButtonHtml( $query_args = array(), $button_class = '' )
198
-    {
199
-        // incoming args will replace the defaults listed here in the second array (union preserves first array)
200
-        $query_args = (array)$query_args + array( $this->route_name => 'iframe' );
201
-        $query_args = (array)apply_filters(
202
-            'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args',
203
-            $query_args
204
-        );
205
-        // add this route to our localized vars
206
-        $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] )
207
-            ? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ]
208
-            : array();
209
-        $iframe_module_routes[ $this->route_name ] = $this->route_name;
210
-        \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes;
211
-        $iframe_embed_html = \EEH_HTML::link(
212
-            '#',
213
-            sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ),
214
-            sprintf(
215
-                esc_html__(
216
-                    'click here to generate code for embedding %1$s iframe into another site.',
217
-                    'event_espresso'
218
-                ),
219
-                \EEH_Inflector::add_indefinite_article( $this->iframe_name )
220
-            ),
221
-            "{$this->route_name}-iframe-embed-trigger-js",
222
-            'iframe-embed-trigger-js button ' . $button_class,
223
-            '',
224
-            ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"'
225
-        );
226
-        $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js',
227
-                                              'display:none;' );
228
-        $iframe_embed_html .= esc_html(
229
-            \EEH_HTML::div(
230
-                '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>',
231
-                '',
232
-                '',
233
-                'width:100%; height: 500px;'
234
-            )
235
-        );
236
-        $iframe_embed_html .= \EEH_HTML::divx();
237
-        return $iframe_embed_html;
238
-    }
239
-
240
-
241
-
242
-    /**
243
-     * enqueue iframe button js
244
-     */
245
-    public function embedButtonAssets()
246
-    {
247
-        \EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__(
248
-            'copy and paste the following into any other site\'s content to display this event:',
249
-            'event_espresso'
250
-        );
251
-        \EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__(
252
-            'click anywhere outside of this window to close it.',
253
-            'event_espresso'
254
-        );
255
-        wp_register_script(
256
-            'iframe_embed_button',
257
-            plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js',
258
-            array( 'ee-dialog' ),
259
-            EVENT_ESPRESSO_VERSION,
260
-            true
261
-        );
262
-        wp_enqueue_script( 'iframe_embed_button' );
263
-    }
264
-
265
-
266
-
267
-    /**
268
-     * generates embed button sections for admin pages
269
-     *
270
-     * @param array $embed_buttons
271
-     * @return string
272
-     */
273
-    public function addIframeEmbedButtonsSection( array $embed_buttons )
274
-    {
275
-        $embed_buttons = (array)apply_filters(
276
-            'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons',
277
-            $embed_buttons
278
-        );
279
-        if ( empty($embed_buttons)) {
280
-            return '';
281
-        }
282
-        // add button for iframe code to event editor.
283
-        $html = \EEH_HTML::br( 2 );
284
-        $html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) );
285
-        $html .= \EEH_HTML::p(
286
-            esc_html__(
287
-                'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
288
-                'event_espresso'
289
-            )
290
-        );
291
-        $html .= ' &nbsp; ' . implode( ' &nbsp; ', $embed_buttons ) . ' ';
292
-        $html .= \EEH_HTML::br( 2 );
293
-        return $html;
294
-    }
19
+	/**
20
+	 * @var string $iframe_name
21
+	 */
22
+	private $iframe_name;
23
+
24
+	/**
25
+	 * @var string $route_name
26
+	 */
27
+	private $route_name;
28
+
29
+	/**
30
+	 * @var string $slug
31
+	 */
32
+	private $slug;
33
+
34
+	/**
35
+	 * @var boolean $append_filterable_content
36
+	 */
37
+	private $append_filterable_content;
38
+
39
+
40
+
41
+	/**
42
+	 * IframeEmbedButton constructor.
43
+	 *
44
+	 * @param string $iframe_name i18n name for the iframe. This will be used in HTML
45
+	 * @param string $route_name  the name of the registered route
46
+	 * @param string $slug        URL slug used for the thing the iframe button is being embedded in.
47
+	 *                            will most likely be "event" since that's the only usage atm
48
+	 */
49
+	public function __construct( $iframe_name, $route_name, $slug = 'event' )
50
+	{
51
+		$this->iframe_name = $iframe_name;
52
+		$this->route_name = $route_name;
53
+		$this->slug = $slug;
54
+	}
55
+
56
+
57
+
58
+	/**
59
+	 * Adds an iframe embed code button to the Event editor.
60
+	 */
61
+	public function addEventEditorIframeEmbedButtonFilter()
62
+	{
63
+		// add button for iframe code to event editor.
64
+		add_filter(
65
+			'get_sample_permalink_html',
66
+			array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ),
67
+			10,
68
+			2
69
+		);
70
+		add_action(
71
+			'admin_enqueue_scripts',
72
+			array( $this, 'embedButtonAssets' ),
73
+			10
74
+		);
75
+	}
76
+
77
+
78
+
79
+	/**
80
+	 * @param $permalink_string
81
+	 * @param $id
82
+	 * @return string
83
+	 */
84
+	public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id )
85
+	{
86
+		return $this->eventEditorIframeEmbedButton(
87
+			$permalink_string,
88
+			$id
89
+		);
90
+	}
91
+
92
+
93
+
94
+	/**
95
+	 * iframe embed code button to the Event editor.
96
+	 *
97
+	 * @param string $permalink_string
98
+	 * @param int    $id
99
+	 * @return string
100
+	 */
101
+	public function eventEditorIframeEmbedButton(
102
+		$permalink_string,
103
+		$id
104
+	) {
105
+		//make sure this is ONLY when editing and the event id has been set.
106
+		if ( ! empty( $id ) ) {
107
+			$post = get_post( $id );
108
+			//if NOT event then let's get out.
109
+			if ( $post->post_type !== 'espresso_events' ) {
110
+				return $permalink_string;
111
+			}
112
+			$permalink_string .= $this->embedButtonHtml(
113
+				array( $this->slug => $id ),
114
+				'button-small'
115
+			);
116
+		}
117
+		return $permalink_string;
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * Adds an iframe embed code button via a WP do_action() as determined by the first parameter
124
+	 *
125
+	 * @param string $action name of the WP do_action() to hook into
126
+	 */
127
+	public function addActionIframeEmbedButton( $action )
128
+	{
129
+		// add button for iframe code to event editor.
130
+		add_action(
131
+			$action,
132
+			array( $this, 'addActionIframeEmbedButtonCallback' ),
133
+			10, 2
134
+		);
135
+	}
136
+
137
+
138
+
139
+	/**
140
+	 * @return void
141
+	 */
142
+	public function addActionIframeEmbedButtonCallback()
143
+	{
144
+		echo $this->embedButtonHtml();
145
+	}
146
+
147
+
148
+
149
+	/**
150
+	 * Adds an iframe embed code button via a WP apply_filters() as determined by the first parameter
151
+	 *
152
+	 * @param string $filter     name of the WP apply_filters() to hook into
153
+	 * @param bool   $append     if true, will add iframe embed button to end of content,
154
+	 *                           else if false, will add to the beginning of the content
155
+	 */
156
+	public function addFilterIframeEmbedButton( $filter, $append = true )
157
+	{
158
+		$this->append_filterable_content = $append;
159
+		// add button for iframe code to event editor.
160
+		add_filter(
161
+			$filter,
162
+			array( $this, 'addFilterIframeEmbedButtonCallback' ),
163
+			10
164
+		);
165
+	}
166
+
167
+
168
+
169
+	/**
170
+	 * @param array|string $filterable_content
171
+	 * @return array|string
172
+	 */
173
+	public function addFilterIframeEmbedButtonCallback( $filterable_content )
174
+	{
175
+		$embedButtonHtml = $this->embedButtonHtml();
176
+		if ( is_array( $filterable_content ) ) {
177
+			$filterable_content = $this->append_filterable_content
178
+				? $filterable_content + array( $this->route_name => $embedButtonHtml )
179
+				: array( $this->route_name => $embedButtonHtml ) + $filterable_content;
180
+		} else {
181
+			$filterable_content = $this->append_filterable_content
182
+				? $filterable_content . $embedButtonHtml
183
+				: $embedButtonHtml . $filterable_content;
184
+		}
185
+		return $filterable_content;
186
+	}
187
+
188
+
189
+
190
+	/**
191
+	 * iframe_embed_html
192
+	 *
193
+	 * @param array  $query_args
194
+	 * @param string $button_class
195
+	 * @return string
196
+	 */
197
+	public function embedButtonHtml( $query_args = array(), $button_class = '' )
198
+	{
199
+		// incoming args will replace the defaults listed here in the second array (union preserves first array)
200
+		$query_args = (array)$query_args + array( $this->route_name => 'iframe' );
201
+		$query_args = (array)apply_filters(
202
+			'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args',
203
+			$query_args
204
+		);
205
+		// add this route to our localized vars
206
+		$iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] )
207
+			? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ]
208
+			: array();
209
+		$iframe_module_routes[ $this->route_name ] = $this->route_name;
210
+		\EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes;
211
+		$iframe_embed_html = \EEH_HTML::link(
212
+			'#',
213
+			sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ),
214
+			sprintf(
215
+				esc_html__(
216
+					'click here to generate code for embedding %1$s iframe into another site.',
217
+					'event_espresso'
218
+				),
219
+				\EEH_Inflector::add_indefinite_article( $this->iframe_name )
220
+			),
221
+			"{$this->route_name}-iframe-embed-trigger-js",
222
+			'iframe-embed-trigger-js button ' . $button_class,
223
+			'',
224
+			' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"'
225
+		);
226
+		$iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js',
227
+											  'display:none;' );
228
+		$iframe_embed_html .= esc_html(
229
+			\EEH_HTML::div(
230
+				'<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>',
231
+				'',
232
+				'',
233
+				'width:100%; height: 500px;'
234
+			)
235
+		);
236
+		$iframe_embed_html .= \EEH_HTML::divx();
237
+		return $iframe_embed_html;
238
+	}
239
+
240
+
241
+
242
+	/**
243
+	 * enqueue iframe button js
244
+	 */
245
+	public function embedButtonAssets()
246
+	{
247
+		\EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__(
248
+			'copy and paste the following into any other site\'s content to display this event:',
249
+			'event_espresso'
250
+		);
251
+		\EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__(
252
+			'click anywhere outside of this window to close it.',
253
+			'event_espresso'
254
+		);
255
+		wp_register_script(
256
+			'iframe_embed_button',
257
+			plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js',
258
+			array( 'ee-dialog' ),
259
+			EVENT_ESPRESSO_VERSION,
260
+			true
261
+		);
262
+		wp_enqueue_script( 'iframe_embed_button' );
263
+	}
264
+
265
+
266
+
267
+	/**
268
+	 * generates embed button sections for admin pages
269
+	 *
270
+	 * @param array $embed_buttons
271
+	 * @return string
272
+	 */
273
+	public function addIframeEmbedButtonsSection( array $embed_buttons )
274
+	{
275
+		$embed_buttons = (array)apply_filters(
276
+			'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons',
277
+			$embed_buttons
278
+		);
279
+		if ( empty($embed_buttons)) {
280
+			return '';
281
+		}
282
+		// add button for iframe code to event editor.
283
+		$html = \EEH_HTML::br( 2 );
284
+		$html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) );
285
+		$html .= \EEH_HTML::p(
286
+			esc_html__(
287
+				'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
288
+				'event_espresso'
289
+			)
290
+		);
291
+		$html .= ' &nbsp; ' . implode( ' &nbsp; ', $embed_buttons ) . ' ';
292
+		$html .= \EEH_HTML::br( 2 );
293
+		return $html;
294
+	}
295 295
 
296 296
 
297 297
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\iframe_display;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param string $slug        URL slug used for the thing the iframe button is being embedded in.
47 47
      *                            will most likely be "event" since that's the only usage atm
48 48
      */
49
-    public function __construct( $iframe_name, $route_name, $slug = 'event' )
49
+    public function __construct($iframe_name, $route_name, $slug = 'event')
50 50
     {
51 51
         $this->iframe_name = $iframe_name;
52 52
         $this->route_name = $route_name;
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
         // add button for iframe code to event editor.
64 64
         add_filter(
65 65
             'get_sample_permalink_html',
66
-            array( $this, 'appendIframeEmbedButtonToSamplePermalinkHtml' ),
66
+            array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'),
67 67
             10,
68 68
             2
69 69
         );
70 70
         add_action(
71 71
             'admin_enqueue_scripts',
72
-            array( $this, 'embedButtonAssets' ),
72
+            array($this, 'embedButtonAssets'),
73 73
             10
74 74
         );
75 75
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * @param $id
82 82
      * @return string
83 83
      */
84
-    public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id )
84
+    public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id)
85 85
     {
86 86
         return $this->eventEditorIframeEmbedButton(
87 87
             $permalink_string,
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
         $id
104 104
     ) {
105 105
         //make sure this is ONLY when editing and the event id has been set.
106
-        if ( ! empty( $id ) ) {
107
-            $post = get_post( $id );
106
+        if ( ! empty($id)) {
107
+            $post = get_post($id);
108 108
             //if NOT event then let's get out.
109
-            if ( $post->post_type !== 'espresso_events' ) {
109
+            if ($post->post_type !== 'espresso_events') {
110 110
                 return $permalink_string;
111 111
             }
112 112
             $permalink_string .= $this->embedButtonHtml(
113
-                array( $this->slug => $id ),
113
+                array($this->slug => $id),
114 114
                 'button-small'
115 115
             );
116 116
         }
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @param string $action name of the WP do_action() to hook into
126 126
      */
127
-    public function addActionIframeEmbedButton( $action )
127
+    public function addActionIframeEmbedButton($action)
128 128
     {
129 129
         // add button for iframe code to event editor.
130 130
         add_action(
131 131
             $action,
132
-            array( $this, 'addActionIframeEmbedButtonCallback' ),
132
+            array($this, 'addActionIframeEmbedButtonCallback'),
133 133
             10, 2
134 134
         );
135 135
     }
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
      * @param bool   $append     if true, will add iframe embed button to end of content,
154 154
      *                           else if false, will add to the beginning of the content
155 155
      */
156
-    public function addFilterIframeEmbedButton( $filter, $append = true )
156
+    public function addFilterIframeEmbedButton($filter, $append = true)
157 157
     {
158 158
         $this->append_filterable_content = $append;
159 159
         // add button for iframe code to event editor.
160 160
         add_filter(
161 161
             $filter,
162
-            array( $this, 'addFilterIframeEmbedButtonCallback' ),
162
+            array($this, 'addFilterIframeEmbedButtonCallback'),
163 163
             10
164 164
         );
165 165
     }
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
      * @param array|string $filterable_content
171 171
      * @return array|string
172 172
      */
173
-    public function addFilterIframeEmbedButtonCallback( $filterable_content )
173
+    public function addFilterIframeEmbedButtonCallback($filterable_content)
174 174
     {
175 175
         $embedButtonHtml = $this->embedButtonHtml();
176
-        if ( is_array( $filterable_content ) ) {
176
+        if (is_array($filterable_content)) {
177 177
             $filterable_content = $this->append_filterable_content
178
-                ? $filterable_content + array( $this->route_name => $embedButtonHtml )
179
-                : array( $this->route_name => $embedButtonHtml ) + $filterable_content;
178
+                ? $filterable_content + array($this->route_name => $embedButtonHtml)
179
+                : array($this->route_name => $embedButtonHtml) + $filterable_content;
180 180
         } else {
181 181
             $filterable_content = $this->append_filterable_content
182
-                ? $filterable_content . $embedButtonHtml
183
-                : $embedButtonHtml . $filterable_content;
182
+                ? $filterable_content.$embedButtonHtml
183
+                : $embedButtonHtml.$filterable_content;
184 184
         }
185 185
         return $filterable_content;
186 186
     }
@@ -194,40 +194,40 @@  discard block
 block discarded – undo
194 194
      * @param string $button_class
195 195
      * @return string
196 196
      */
197
-    public function embedButtonHtml( $query_args = array(), $button_class = '' )
197
+    public function embedButtonHtml($query_args = array(), $button_class = '')
198 198
     {
199 199
         // incoming args will replace the defaults listed here in the second array (union preserves first array)
200
-        $query_args = (array)$query_args + array( $this->route_name => 'iframe' );
201
-        $query_args = (array)apply_filters(
200
+        $query_args = (array) $query_args + array($this->route_name => 'iframe');
201
+        $query_args = (array) apply_filters(
202 202
             'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args',
203 203
             $query_args
204 204
         );
205 205
         // add this route to our localized vars
206
-        $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] )
207
-            ? \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ]
206
+        $iframe_module_routes = isset(\EE_Registry::$i18n_js_strings['iframe_module_routes'])
207
+            ? \EE_Registry::$i18n_js_strings['iframe_module_routes']
208 208
             : array();
209
-        $iframe_module_routes[ $this->route_name ] = $this->route_name;
210
-        \EE_Registry::$i18n_js_strings[ 'iframe_module_routes' ] = $iframe_module_routes;
209
+        $iframe_module_routes[$this->route_name] = $this->route_name;
210
+        \EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes;
211 211
         $iframe_embed_html = \EEH_HTML::link(
212 212
             '#',
213
-            sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ),
213
+            sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name),
214 214
             sprintf(
215 215
                 esc_html__(
216 216
                     'click here to generate code for embedding %1$s iframe into another site.',
217 217
                     'event_espresso'
218 218
                 ),
219
-                \EEH_Inflector::add_indefinite_article( $this->iframe_name )
219
+                \EEH_Inflector::add_indefinite_article($this->iframe_name)
220 220
             ),
221 221
             "{$this->route_name}-iframe-embed-trigger-js",
222
-            'iframe-embed-trigger-js button ' . $button_class,
222
+            'iframe-embed-trigger-js button '.$button_class,
223 223
             '',
224
-            ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"'
224
+            ' data-iframe_embed_button="#'.$this->route_name.'-iframe-js" tabindex="-1"'
225 225
         );
226
-        $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js',
227
-                                              'display:none;' );
226
+        $iframe_embed_html .= \EEH_HTML::div('', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js',
227
+                                              'display:none;');
228 228
         $iframe_embed_html .= esc_html(
229 229
             \EEH_HTML::div(
230
-                '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>',
230
+                '<iframe src="'.add_query_arg($query_args, site_url()).'" width="100%" height="100%"></iframe>',
231 231
                 '',
232 232
                 '',
233 233
                 'width:100%; height: 500px;'
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function embedButtonAssets()
246 246
     {
247
-        \EE_Registry::$i18n_js_strings[ 'iframe_embed_title' ] = esc_html__(
247
+        \EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__(
248 248
             'copy and paste the following into any other site\'s content to display this event:',
249 249
             'event_espresso'
250 250
         );
251
-        \EE_Registry::$i18n_js_strings[ 'iframe_embed_close_msg' ] = esc_html__(
251
+        \EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__(
252 252
             'click anywhere outside of this window to close it.',
253 253
             'event_espresso'
254 254
         );
255 255
         wp_register_script(
256 256
             'iframe_embed_button',
257
-            plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js',
258
-            array( 'ee-dialog' ),
257
+            plugin_dir_url(__FILE__).'iframe-embed-button.js',
258
+            array('ee-dialog'),
259 259
             EVENT_ESPRESSO_VERSION,
260 260
             true
261 261
         );
262
-        wp_enqueue_script( 'iframe_embed_button' );
262
+        wp_enqueue_script('iframe_embed_button');
263 263
     }
264 264
 
265 265
 
@@ -270,26 +270,26 @@  discard block
 block discarded – undo
270 270
      * @param array $embed_buttons
271 271
      * @return string
272 272
      */
273
-    public function addIframeEmbedButtonsSection( array $embed_buttons )
273
+    public function addIframeEmbedButtonsSection(array $embed_buttons)
274 274
     {
275
-        $embed_buttons = (array)apply_filters(
275
+        $embed_buttons = (array) apply_filters(
276 276
             'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons',
277 277
             $embed_buttons
278 278
         );
279
-        if ( empty($embed_buttons)) {
279
+        if (empty($embed_buttons)) {
280 280
             return '';
281 281
         }
282 282
         // add button for iframe code to event editor.
283
-        $html = \EEH_HTML::br( 2 );
284
-        $html .= \EEH_HTML::h3( esc_html__( 'iFrame Embed Code', 'event_espresso' ) );
283
+        $html = \EEH_HTML::br(2);
284
+        $html .= \EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso'));
285 285
         $html .= \EEH_HTML::p(
286 286
             esc_html__(
287 287
                 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.',
288 288
                 'event_espresso'
289 289
             )
290 290
         );
291
-        $html .= ' &nbsp; ' . implode( ' &nbsp; ', $embed_buttons ) . ' ';
292
-        $html .= \EEH_HTML::br( 2 );
291
+        $html .= ' &nbsp; '.implode(' &nbsp; ', $embed_buttons).' ';
292
+        $html .= \EEH_HTML::br(2);
293 293
         return $html;
294 294
     }
295 295
 
Please login to merge, or discard this patch.
core/libraries/iframe_display/EventListIframeEmbedButton.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
 class EventListIframeEmbedButton extends IframeEmbedButton
16 16
 {
17 17
 
18
-    /**
19
-     * EventListIframeEmbedButton constructor.
20
-     */
21
-    public function __construct()
22
-    {
23
-        parent::__construct(
24
-            esc_html__( 'Event List', 'event_espresso' ),
25
-            'event_list'
26
-        );
27
-    }
18
+	/**
19
+	 * EventListIframeEmbedButton constructor.
20
+	 */
21
+	public function __construct()
22
+	{
23
+		parent::__construct(
24
+			esc_html__( 'Event List', 'event_espresso' ),
25
+			'event_list'
26
+		);
27
+	}
28 28
 
29 29
 
30 30
 
31 31
 	public function addEmbedButton() {
32
-        add_filter(
32
+		add_filter(
33 33
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
34 34
 			array( $this, 'addEventListIframeEmbedButtonSection' )
35 35
 		);
@@ -49,19 +49,19 @@  discard block
 block discarded – undo
49 49
 	 * @param array $after_list_table
50 50
 	 * @return array
51 51
 	 */
52
-    public function addEventListIframeEmbedButtonSection( array $after_list_table )
53
-    {
54
-        return \EEH_Array::insert_into_array(
55
-    		$after_list_table,
56
-		    array(
57
-			    'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection(
58
-			        array()
59
-				    // array( 'event_list' => $this->embedButtonHtml() )
60
-			    )
61
-		    ),
62
-		    'legend'
63
-	    );
64
-    }
52
+	public function addEventListIframeEmbedButtonSection( array $after_list_table )
53
+	{
54
+		return \EEH_Array::insert_into_array(
55
+			$after_list_table,
56
+			array(
57
+				'iframe_embed_buttons' => $this->addIframeEmbedButtonsSection(
58
+					array()
59
+					// array( 'event_list' => $this->embedButtonHtml() )
60
+				)
61
+			),
62
+			'legend'
63
+		);
64
+	}
65 65
 
66 66
 
67 67
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\iframe_display;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function __construct()
22 22
     {
23 23
         parent::__construct(
24
-            esc_html__( 'Event List', 'event_espresso' ),
24
+            esc_html__('Event List', 'event_espresso'),
25 25
             'event_list'
26 26
         );
27 27
     }
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	public function addEmbedButton() {
32 32
         add_filter(
33 33
 			'FHEE__EE_Admin_Page___display_admin_list_table_page__after_list_table__template_args_array',
34
-			array( $this, 'addEventListIframeEmbedButtonSection' )
34
+			array($this, 'addEventListIframeEmbedButtonSection')
35 35
 		);
36 36
 		add_action(
37 37
 			'admin_enqueue_scripts',
38
-			array( $this, 'embedButtonAssets' ),
38
+			array($this, 'embedButtonAssets'),
39 39
 			10
40 40
 		);
41 41
 	}
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array $after_list_table
50 50
 	 * @return array
51 51
 	 */
52
-    public function addEventListIframeEmbedButtonSection( array $after_list_table )
52
+    public function addEventListIframeEmbedButtonSection(array $after_list_table)
53 53
     {
54 54
         return \EEH_Array::insert_into_array(
55 55
     		$after_list_table,
Please login to merge, or discard this patch.