Completed
Branch master (7421d0)
by
unknown
11:25 queued 06:55
created
caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 2 patches
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -13,245 +13,245 @@
 block discarded – undo
13 13
  */
14 14
 class EED_Events_Archive_Caff extends EED_Events_Archive
15 15
 {
16
-    /**
17
-     * @return EED_Events_Archive_Caff|EED_Module
18
-     * @throws EE_Error
19
-     * @throws ReflectionException
20
-     */
21
-    public static function instance()
22
-    {
23
-        return parent::get_instance(__CLASS__);
24
-    }
16
+	/**
17
+	 * @return EED_Events_Archive_Caff|EED_Module
18
+	 * @throws EE_Error
19
+	 * @throws ReflectionException
20
+	 */
21
+	public static function instance()
22
+	{
23
+		return parent::get_instance(__CLASS__);
24
+	}
25 25
 
26 26
 
27
-    /**
28
-     * set_hooks - for hooking into EE Core, other modules, etc
29
-     *
30
-     * @return    void
31
-     */
32
-    public static function set_hooks()
33
-    {
34
-    }
27
+	/**
28
+	 * set_hooks - for hooking into EE Core, other modules, etc
29
+	 *
30
+	 * @return    void
31
+	 */
32
+	public static function set_hooks()
33
+	{
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
-     *
40
-     * @access    public
41
-     * @return    void
42
-     */
43
-    public static function set_hooks_admin()
44
-    {
45
-        self::setDefinitions();
46
-        add_action(
47
-            'AHEE__template_settings__template__before_settings_form',
48
-            ['EED_Events_Archive_Caff', 'template_settings_form']
49
-        );
50
-        add_filter(
51
-            'FHEE__General_Settings_Admin_Page__update_template_settings__data',
52
-            ['EED_Events_Archive_Caff', 'update_template_settings'],
53
-            10,
54
-            2
55
-        );
56
-        // AJAX
57
-        add_action(
58
-            'wp_ajax_espresso_update_event_archive_order',
59
-            ['EED_Events_Archive_Caff', 'update_event_archive_order']
60
-        );
61
-        add_action(
62
-            'wp_ajax_nopriv_espresso_update_event_archive_order',
63
-            ['EED_Events_Archive_Caff', 'update_event_archive_order']
64
-        );
65
-    }
37
+	/**
38
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
+	 *
40
+	 * @access    public
41
+	 * @return    void
42
+	 */
43
+	public static function set_hooks_admin()
44
+	{
45
+		self::setDefinitions();
46
+		add_action(
47
+			'AHEE__template_settings__template__before_settings_form',
48
+			['EED_Events_Archive_Caff', 'template_settings_form']
49
+		);
50
+		add_filter(
51
+			'FHEE__General_Settings_Admin_Page__update_template_settings__data',
52
+			['EED_Events_Archive_Caff', 'update_template_settings'],
53
+			10,
54
+			2
55
+		);
56
+		// AJAX
57
+		add_action(
58
+			'wp_ajax_espresso_update_event_archive_order',
59
+			['EED_Events_Archive_Caff', 'update_event_archive_order']
60
+		);
61
+		add_action(
62
+			'wp_ajax_nopriv_espresso_update_event_archive_order',
63
+			['EED_Events_Archive_Caff', 'update_event_archive_order']
64
+		);
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * run - initial module setup
70
-     *
71
-     * @param WP $WP
72
-     * @return    void
73
-     */
74
-    public function run($WP)
75
-    {
76
-    }
68
+	/**
69
+	 * run - initial module setup
70
+	 *
71
+	 * @param WP $WP
72
+	 * @return    void
73
+	 */
74
+	public function run($WP)
75
+	{
76
+	}
77 77
 
78 78
 
79
-    /**
80
-     * Conditionally set constants if they haven't been defined yet.
81
-     */
82
-    public static function setDefinitions()
83
-    {
84
-        if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) {
85
-            define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
86
-            define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
87
-        }
88
-    }
79
+	/**
80
+	 * Conditionally set constants if they haven't been defined yet.
81
+	 */
82
+	public static function setDefinitions()
83
+	{
84
+		if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) {
85
+			define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
86
+			define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
87
+		}
88
+	}
89 89
 
90 90
 
91
-    /**
92
-     * @return void
93
-     * @throws EE_Error
94
-     * @throws ReflectionException
95
-     */
96
-    public static function template_settings_form()
97
-    {
98
-        /** @var EE_Admin_Page_Loader $admin_page_loader */
99
-        $admin_page_loader = LoaderFactory::getLoader()->getShared('EE_Admin_Page_Loader');
100
-        // grab general settings admin page and remove the existing hook callback
101
-        $gen_set_admin = $admin_page_loader->get_admin_page_object('general_settings');
102
-        if ($gen_set_admin instanceof General_Settings_Admin_Page) {
103
-            remove_action(
104
-                'AHEE__template_settings__template__before_settings_form',
105
-                [$gen_set_admin, 'template_settings_caff_features'],
106
-                100
107
-            );
108
-        }
91
+	/**
92
+	 * @return void
93
+	 * @throws EE_Error
94
+	 * @throws ReflectionException
95
+	 */
96
+	public static function template_settings_form()
97
+	{
98
+		/** @var EE_Admin_Page_Loader $admin_page_loader */
99
+		$admin_page_loader = LoaderFactory::getLoader()->getShared('EE_Admin_Page_Loader');
100
+		// grab general settings admin page and remove the existing hook callback
101
+		$gen_set_admin = $admin_page_loader->get_admin_page_object('general_settings');
102
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
103
+			remove_action(
104
+				'AHEE__template_settings__template__before_settings_form',
105
+				[$gen_set_admin, 'template_settings_caff_features'],
106
+				100
107
+			);
108
+		}
109 109
 
110
-        // first just grab the template settings
111
-        $config = EE_Registry::instance()->CFG->template_settings;
112
-        // then if the Event Archive config is valid, use that, else create a new one
113
-        $config = $config instanceof EE_Template_Config
114
-        && $config->EED_Events_Archive instanceof EE_Events_Archive_Config
115
-            ? $config->EED_Events_Archive
116
-            : new EE_Events_Archive_Config();
117
-        /** @var EE_Events_Archive_Config $config */
118
-        $config = apply_filters(
119
-            'FHEE__EED_Events_Archive__template_settings_form__event_list_config',
120
-            $config
121
-        );
110
+		// first just grab the template settings
111
+		$config = EE_Registry::instance()->CFG->template_settings;
112
+		// then if the Event Archive config is valid, use that, else create a new one
113
+		$config = $config instanceof EE_Template_Config
114
+		&& $config->EED_Events_Archive instanceof EE_Events_Archive_Config
115
+			? $config->EED_Events_Archive
116
+			: new EE_Events_Archive_Config();
117
+		/** @var EE_Events_Archive_Config $config */
118
+		$config = apply_filters(
119
+			'FHEE__EED_Events_Archive__template_settings_form__event_list_config',
120
+			$config
121
+		);
122 122
 
123
-        $config->display_status_banner               = $config->display_status_banner ?? false;
124
-        $config->display_description                 = $config->display_description ?? true;
125
-        $config->display_ticket_selector             = $config->display_ticket_selector ?? false;
126
-        $config->display_datetimes                   = $config->display_datetimes ?? true;
127
-        $config->display_venue                       = $config->display_venue ?? false;
128
-        $config->display_expired_events              = $config->display_expired_events ?? false;
129
-        $config->display_events_with_expired_tickets = $config->display_events_with_expired_tickets ?? false;
130
-        // display order options
131
-        $config->use_sortable_display_order = $config->use_sortable_display_order ?? false;
132
-        $config->display_order_event        = $config->display_order_event ?? 100;
133
-        $config->display_order_datetimes    = $config->display_order_datetimes ?? 110;
134
-        $config->display_order_tickets      = $config->display_order_tickets ?? 120;
135
-        $config->display_order_venue        = $config->display_order_venue ?? 130;
123
+		$config->display_status_banner               = $config->display_status_banner ?? false;
124
+		$config->display_description                 = $config->display_description ?? true;
125
+		$config->display_ticket_selector             = $config->display_ticket_selector ?? false;
126
+		$config->display_datetimes                   = $config->display_datetimes ?? true;
127
+		$config->display_venue                       = $config->display_venue ?? false;
128
+		$config->display_expired_events              = $config->display_expired_events ?? false;
129
+		$config->display_events_with_expired_tickets = $config->display_events_with_expired_tickets ?? false;
130
+		// display order options
131
+		$config->use_sortable_display_order = $config->use_sortable_display_order ?? false;
132
+		$config->display_order_event        = $config->display_order_event ?? 100;
133
+		$config->display_order_datetimes    = $config->display_order_datetimes ?? 110;
134
+		$config->display_order_tickets      = $config->display_order_tickets ?? 120;
135
+		$config->display_order_venue        = $config->display_order_venue ?? 130;
136 136
 
137
-        // get template parts
138
-        $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config);
139
-        // convert to array so that we can add more properties
140
-        $config                                = get_object_vars($config);
141
-        $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts(
142
-            'event-archive-sortable-js',
143
-            '',
144
-            'archive-sortable-li archive-sortable-js'
145
-        );
146
-        EEH_Template::display_template(
147
-            EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
148
-            $config
149
-        );
150
-    }
137
+		// get template parts
138
+		$template_parts = EED_Events_Archive::instance()->initialize_template_parts($config);
139
+		// convert to array so that we can add more properties
140
+		$config                                = get_object_vars($config);
141
+		$config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts(
142
+			'event-archive-sortable-js',
143
+			'',
144
+			'archive-sortable-li archive-sortable-js'
145
+		);
146
+		EEH_Template::display_template(
147
+			EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
148
+			$config
149
+		);
150
+	}
151 151
 
152 152
 
153
-    /**
154
-     * @param EE_Template_Config $CFG
155
-     * @param array              $REQ
156
-     * @return EE_Template_Config
157
-     */
158
-    public static function update_template_settings(EE_Template_Config $CFG, array $REQ): EE_Template_Config
159
-    {
160
-        // unless we are resetting the config...
161
-        if (
162
-            ! isset($REQ['EED_Events_Archive_reset_event_list_settings'])
163
-            || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1
164
-        ) {
165
-            /** @var EE_Events_Archive_Config $config */
166
-            $config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config
167
-                ? $CFG->EED_Events_Archive
168
-                : new EE_Events_Archive_Config();
153
+	/**
154
+	 * @param EE_Template_Config $CFG
155
+	 * @param array              $REQ
156
+	 * @return EE_Template_Config
157
+	 */
158
+	public static function update_template_settings(EE_Template_Config $CFG, array $REQ): EE_Template_Config
159
+	{
160
+		// unless we are resetting the config...
161
+		if (
162
+			! isset($REQ['EED_Events_Archive_reset_event_list_settings'])
163
+			|| absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1
164
+		) {
165
+			/** @var EE_Events_Archive_Config $config */
166
+			$config = $CFG->EED_Events_Archive instanceof EE_Events_Archive_Config
167
+				? $CFG->EED_Events_Archive
168
+				: new EE_Events_Archive_Config();
169 169
 
170
-            $config->display_status_banner      = isset($REQ['EED_Events_Archive_display_status_banner'])
171
-                ? filter_var($REQ['EED_Events_Archive_display_status_banner'], FILTER_VALIDATE_BOOL)
172
-                : false;
173
-            $config->display_description        = isset($REQ['EED_Events_Archive_display_description'])
174
-                ? filter_var($REQ['EED_Events_Archive_display_description'], FILTER_VALIDATE_BOOL)
175
-                : true;
176
-            $config->display_ticket_selector    = isset($REQ['EED_Events_Archive_display_ticket_selector'])
177
-                ? filter_var($REQ['EED_Events_Archive_display_ticket_selector'], FILTER_VALIDATE_BOOL)
178
-                : false;
179
-            $config->display_datetimes          = isset($REQ['EED_Events_Archive_display_datetimes'])
180
-                ? filter_var($REQ['EED_Events_Archive_display_datetimes'], FILTER_VALIDATE_BOOL)
181
-                : true;
182
-            $config->display_venue              = isset($REQ['EED_Events_Archive_display_venue'])
183
-                ? filter_var($REQ['EED_Events_Archive_display_venue'], FILTER_VALIDATE_BOOL)
184
-                : false;
185
-            $config->display_expired_events     = isset($REQ['EED_Events_Archive_display_expired_events'])
186
-                ? filter_var($REQ['EED_Events_Archive_display_expired_events'], FILTER_VALIDATE_BOOL)
187
-                : false;
188
-            $config->display_events_with_expired_tickets     = isset($REQ['EED_Events_Archive_display_events_with_expired_tickets'])
189
-                ? filter_var($REQ['EED_Events_Archive_display_events_with_expired_tickets'], FILTER_VALIDATE_BOOL)
190
-                : false;
191
-            $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order'])
192
-                ? filter_var($REQ['EED_Events_Archive_use_sortable_display_order'], FILTER_VALIDATE_BOOL)
193
-                : false;
194
-            $config->display_order_event        = $config->use_sortable_display_order
195
-                ? $config->display_order_event
196
-                : EED_Events_Archive::EVENT_DETAILS_PRIORITY;
197
-            $config->display_order_datetimes    = $config->use_sortable_display_order
198
-                ? $config->display_order_datetimes
199
-                : EED_Events_Archive::EVENT_DATETIMES_PRIORITY;
200
-            $config->display_order_tickets      = $config->use_sortable_display_order
201
-                ? $config->display_order_tickets
202
-                : EED_Events_Archive::EVENT_TICKETS_PRIORITY;
203
-            $config->display_order_venue        = $config->use_sortable_display_order
204
-                ? $config->display_order_venue
205
-                : EED_Events_Archive::EVENT_VENUES_PRIORITY;
206
-        } else {
207
-            $config = new EE_Events_Archive_Config();
208
-        }
170
+			$config->display_status_banner      = isset($REQ['EED_Events_Archive_display_status_banner'])
171
+				? filter_var($REQ['EED_Events_Archive_display_status_banner'], FILTER_VALIDATE_BOOL)
172
+				: false;
173
+			$config->display_description        = isset($REQ['EED_Events_Archive_display_description'])
174
+				? filter_var($REQ['EED_Events_Archive_display_description'], FILTER_VALIDATE_BOOL)
175
+				: true;
176
+			$config->display_ticket_selector    = isset($REQ['EED_Events_Archive_display_ticket_selector'])
177
+				? filter_var($REQ['EED_Events_Archive_display_ticket_selector'], FILTER_VALIDATE_BOOL)
178
+				: false;
179
+			$config->display_datetimes          = isset($REQ['EED_Events_Archive_display_datetimes'])
180
+				? filter_var($REQ['EED_Events_Archive_display_datetimes'], FILTER_VALIDATE_BOOL)
181
+				: true;
182
+			$config->display_venue              = isset($REQ['EED_Events_Archive_display_venue'])
183
+				? filter_var($REQ['EED_Events_Archive_display_venue'], FILTER_VALIDATE_BOOL)
184
+				: false;
185
+			$config->display_expired_events     = isset($REQ['EED_Events_Archive_display_expired_events'])
186
+				? filter_var($REQ['EED_Events_Archive_display_expired_events'], FILTER_VALIDATE_BOOL)
187
+				: false;
188
+			$config->display_events_with_expired_tickets     = isset($REQ['EED_Events_Archive_display_events_with_expired_tickets'])
189
+				? filter_var($REQ['EED_Events_Archive_display_events_with_expired_tickets'], FILTER_VALIDATE_BOOL)
190
+				: false;
191
+			$config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order'])
192
+				? filter_var($REQ['EED_Events_Archive_use_sortable_display_order'], FILTER_VALIDATE_BOOL)
193
+				: false;
194
+			$config->display_order_event        = $config->use_sortable_display_order
195
+				? $config->display_order_event
196
+				: EED_Events_Archive::EVENT_DETAILS_PRIORITY;
197
+			$config->display_order_datetimes    = $config->use_sortable_display_order
198
+				? $config->display_order_datetimes
199
+				: EED_Events_Archive::EVENT_DATETIMES_PRIORITY;
200
+			$config->display_order_tickets      = $config->use_sortable_display_order
201
+				? $config->display_order_tickets
202
+				: EED_Events_Archive::EVENT_TICKETS_PRIORITY;
203
+			$config->display_order_venue        = $config->use_sortable_display_order
204
+				? $config->display_order_venue
205
+				: EED_Events_Archive::EVENT_VENUES_PRIORITY;
206
+		} else {
207
+			$config = new EE_Events_Archive_Config();
208
+		}
209 209
 
210
-        $CFG->EED_Events_Archive = $config;
211
-        do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ);
212
-        return $CFG;
213
-    }
210
+		$CFG->EED_Events_Archive = $config;
211
+		do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ);
212
+		return $CFG;
213
+	}
214 214
 
215 215
 
216
-    /**
217
-     * @return void
218
-     * @throws InvalidArgumentException
219
-     * @throws InvalidDataTypeException
220
-     * @throws InvalidInterfaceException
221
-     */
222
-    public static function update_event_archive_order()
223
-    {
224
-        $config         = EE_Registry::instance()->CFG;
225
-        $config_saved   = false;
226
-        $template_parts = EED_Events_Archive_Caff::getRequest()->getRequestParam('elements');
227
-        if (! empty($template_parts)) {
228
-            $template_parts = explode(',', trim($template_parts, ','));
229
-            foreach ($template_parts as $key => $template_part) {
230
-                $template_part = "display_order_$template_part";
231
-                $priority      = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY;
232
-                if (
233
-                    $config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config
234
-                    && property_exists(
235
-                        $config->template_settings->EED_Events_Archive,
236
-                        $template_part
237
-                    )
238
-                ) {
239
-                    $config->template_settings->EED_Events_Archive->{$template_part} = $priority;
240
-                }
241
-                do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority);
242
-            }
243
-            $config_saved = $config->update_espresso_config(false, false);
244
-        }
245
-        if ($config_saved) {
246
-            EE_Error::add_success(esc_html__('Display Order has been successfully updated.', 'event_espresso'));
247
-        } else {
248
-            EE_Error::add_error(
249
-                esc_html__('Display Order was not updated.', 'event_espresso'),
250
-                __FILE__,
251
-                __FUNCTION__,
252
-                __LINE__
253
-            );
254
-        }
255
-        wp_send_json(EE_Error::get_notices(false));
256
-    }
216
+	/**
217
+	 * @return void
218
+	 * @throws InvalidArgumentException
219
+	 * @throws InvalidDataTypeException
220
+	 * @throws InvalidInterfaceException
221
+	 */
222
+	public static function update_event_archive_order()
223
+	{
224
+		$config         = EE_Registry::instance()->CFG;
225
+		$config_saved   = false;
226
+		$template_parts = EED_Events_Archive_Caff::getRequest()->getRequestParam('elements');
227
+		if (! empty($template_parts)) {
228
+			$template_parts = explode(',', trim($template_parts, ','));
229
+			foreach ($template_parts as $key => $template_part) {
230
+				$template_part = "display_order_$template_part";
231
+				$priority      = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY;
232
+				if (
233
+					$config->template_settings->EED_Events_Archive instanceof EE_Events_Archive_Config
234
+					&& property_exists(
235
+						$config->template_settings->EED_Events_Archive,
236
+						$template_part
237
+					)
238
+				) {
239
+					$config->template_settings->EED_Events_Archive->{$template_part} = $priority;
240
+				}
241
+				do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority);
242
+			}
243
+			$config_saved = $config->update_espresso_config(false, false);
244
+		}
245
+		if ($config_saved) {
246
+			EE_Error::add_success(esc_html__('Display Order has been successfully updated.', 'event_espresso'));
247
+		} else {
248
+			EE_Error::add_error(
249
+				esc_html__('Display Order was not updated.', 'event_espresso'),
250
+				__FILE__,
251
+				__FUNCTION__,
252
+				__LINE__
253
+			);
254
+		}
255
+		wp_send_json(EE_Error::get_notices(false));
256
+	}
257 257
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public static function setDefinitions()
83 83
     {
84
-        if (! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) {
85
-            define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__) . 'templates/');
86
-            define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__) . 'assets/');
84
+        if ( ! defined('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH')) {
85
+            define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates/');
86
+            define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets/');
87 87
         }
88 88
     }
89 89
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             'archive-sortable-li archive-sortable-js'
145 145
         );
146 146
         EEH_Template::display_template(
147
-            EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php',
147
+            EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php',
148 148
             $config
149 149
         );
150 150
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             $config->display_expired_events     = isset($REQ['EED_Events_Archive_display_expired_events'])
186 186
                 ? filter_var($REQ['EED_Events_Archive_display_expired_events'], FILTER_VALIDATE_BOOL)
187 187
                 : false;
188
-            $config->display_events_with_expired_tickets     = isset($REQ['EED_Events_Archive_display_events_with_expired_tickets'])
188
+            $config->display_events_with_expired_tickets = isset($REQ['EED_Events_Archive_display_events_with_expired_tickets'])
189 189
                 ? filter_var($REQ['EED_Events_Archive_display_events_with_expired_tickets'], FILTER_VALIDATE_BOOL)
190 190
                 : false;
191 191
             $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order'])
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $config         = EE_Registry::instance()->CFG;
225 225
         $config_saved   = false;
226 226
         $template_parts = EED_Events_Archive_Caff::getRequest()->getRequestParam('elements');
227
-        if (! empty($template_parts)) {
227
+        if ( ! empty($template_parts)) {
228 228
             $template_parts = explode(',', trim($template_parts, ','));
229 229
             foreach ($template_parts as $key => $template_part) {
230 230
                 $template_part = "display_order_$template_part";
Please login to merge, or discard this patch.
events_archive_caff/templates/admin-event-list-settings.template.php 2 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
24 24
 
25 25
 $values = EEH_Form_Fields::prep_answer_options(
26
-    array(
27
-        array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
28
-        array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
29
-    )
26
+	array(
27
+		array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
28
+		array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
29
+	)
30 30
 );
31 31
 
32 32
 $description = EEH_Form_Fields::prep_answer_options(
33
-    array(
34
-        array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
35
-        array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
36
-        array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
37
-    )
33
+	array(
34
+		array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
35
+		array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
36
+		array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
37
+	)
38 38
 );
39 39
 
40 40
 ?>
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
         <th>
54 54
             <label for="event_listings_url">
55 55
                 <?php esc_html_e('Events List URL', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
56
-                    'event_listings_url_info'
57
-                ); ?>
56
+					'event_listings_url_info'
57
+				); ?>
58 58
             </label>
59 59
         </th>
60 60
         <td>
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
                 <span class="dashicons dashicons-external"></span>
64 64
             </a>
65 65
             <p class="description"><?php
66
-                esc_html_e(
67
-                    'This is the URL where all events will be displayed.  You can change the slug below.',
68
-                    'event_espresso'
69
-                ); ?></p>
66
+				esc_html_e(
67
+					'This is the URL where all events will be displayed.  You can change the slug below.',
68
+					'event_espresso'
69
+				); ?></p>
70 70
         </td>
71 71
     </tr>
72 72
 
@@ -79,29 +79,29 @@  discard block
 block discarded – undo
79 79
         <td>
80 80
             <span class="base-url"><?php echo site_url() . '/ ';?></span>
81 81
             <?php echo EEH_Form_Fields::text(
82
-                'not_used',
83
-                EE_Registry::instance()->CFG->core->event_cpt_slug,
84
-                'event_cpt_slug',
85
-                'event_cpt_slug',
86
-                'regular'
87
-            ); ?>
82
+				'not_used',
83
+				EE_Registry::instance()->CFG->core->event_cpt_slug,
84
+				'event_cpt_slug',
85
+				'event_cpt_slug',
86
+				'regular'
87
+			); ?>
88 88
             <p class="description"><?php
89
-                esc_html_e(
90
-                    'This allows you to configure what slug is used for the url of all event pages.',
91
-                    'event_espresso'
92
-                ); ?></p>
89
+				esc_html_e(
90
+					'This allows you to configure what slug is used for the url of all event pages.',
91
+					'event_espresso'
92
+				); ?></p>
93 93
             <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?>
94 94
                 <p class="important-notice">
95 95
                     <?php
96
-                    sprintf(
97
-                        esc_html__(
98
-                            'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
99
-                            'event_espresso'
100
-                        ),
101
-                        '<code>',
102
-                        '</code>'
103
-                    );
104
-                    ?>
96
+					sprintf(
97
+						esc_html__(
98
+							'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
99
+							'event_espresso'
100
+						),
101
+						'<code>',
102
+						'</code>'
103
+					);
104
+					?>
105 105
                 </p>
106 106
             <?php endif; ?>
107 107
         </td>
@@ -115,20 +115,20 @@  discard block
 block discarded – undo
115 115
         </th>
116 116
         <td>
117 117
             <?php echo wp_kses(
118
-                EEH_Form_Fields::select(
119
-                    'display_status_banner',
120
-                    $display_status_banner,
121
-                    $values,
122
-                    'EED_Events_Archive_display_status_banner',
123
-                    'EED_Events_Archive_display_status_banner'
124
-                ),
125
-                AllowedTags::getWithFormTags()
126
-            ); ?>
118
+				EEH_Form_Fields::select(
119
+					'display_status_banner',
120
+					$display_status_banner,
121
+					$values,
122
+					'EED_Events_Archive_display_status_banner',
123
+					'EED_Events_Archive_display_status_banner'
124
+				),
125
+				AllowedTags::getWithFormTags()
126
+			); ?>
127 127
             <p class="description"><?php
128
-                esc_html_e(
129
-                    'Whether the status banner should be shown on the events list page next to the Event title.  The status banner is the banner that shows the status of the event (e.g. "Upcoming", "Expired", etc.).',
130
-                    'event_espresso'
131
-                ); ?></p>
128
+				esc_html_e(
129
+					'Whether the status banner should be shown on the events list page next to the Event title.  The status banner is the banner that shows the status of the event (e.g. "Upcoming", "Expired", etc.).',
130
+					'event_espresso'
131
+				); ?></p>
132 132
         </td>
133 133
     </tr>
134 134
 
@@ -136,26 +136,26 @@  discard block
 block discarded – undo
136 136
         <th>
137 137
             <label for="EED_Events_Archive_display_description">
138 138
                 <?php esc_html_e('Display Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
139
-                    'display_description_info'
140
-                ); ?>
139
+					'display_description_info'
140
+				); ?>
141 141
             </label>
142 142
         </th>
143 143
         <td>
144 144
             <?php echo wp_kses(
145
-                EEH_Form_Fields::select(
146
-                    'description',
147
-                    $display_description,
148
-                    $description,
149
-                    'EED_Events_Archive_display_description',
150
-                    'EED_Events_Archive_display_description'
151
-                ),
152
-                AllowedTags::getWithFormTags()
153
-            ); ?>
145
+				EEH_Form_Fields::select(
146
+					'description',
147
+					$display_description,
148
+					$description,
149
+					'EED_Events_Archive_display_description',
150
+					'EED_Events_Archive_display_description'
151
+				),
152
+				AllowedTags::getWithFormTags()
153
+			); ?>
154 154
             <p class="description"><?php
155
-                esc_html_e(
156
-                    'Whether the event description should be shown on the events list page.  If you choose "none" then the description will not be shown.  If you choose "excerpt" then the short description will be shown.  If you choose "full description" then the full description will be shown.',
157
-                    'event_espresso'
158
-                ); ?></p>
155
+				esc_html_e(
156
+					'Whether the event description should be shown on the events list page.  If you choose "none" then the description will not be shown.  If you choose "excerpt" then the short description will be shown.  If you choose "full description" then the full description will be shown.',
157
+					'event_espresso'
158
+				); ?></p>
159 159
         </td>
160 160
     </tr>
161 161
 
@@ -163,26 +163,26 @@  discard block
 block discarded – undo
163 163
         <th>
164 164
             <label for="EED_Events_Archive_display_ticket_selector">
165 165
                 <?php esc_html_e('Display Ticket Selector', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
166
-                    'display_ticket_selector_info'
167
-                ); ?>
166
+					'display_ticket_selector_info'
167
+				); ?>
168 168
             </label>
169 169
         </th>
170 170
         <td>
171 171
             <?php echo wp_kses(
172
-                EEH_Form_Fields::select(
173
-                    'ticket_selector',
174
-                    $display_ticket_selector,
175
-                    $values,
176
-                    'EED_Events_Archive_display_ticket_selector',
177
-                    'EED_Events_Archive_display_ticket_selector'
178
-                ),
179
-                AllowedTags::getWithFormTags()
180
-            ); ?>
172
+				EEH_Form_Fields::select(
173
+					'ticket_selector',
174
+					$display_ticket_selector,
175
+					$values,
176
+					'EED_Events_Archive_display_ticket_selector',
177
+					'EED_Events_Archive_display_ticket_selector'
178
+				),
179
+				AllowedTags::getWithFormTags()
180
+			); ?>
181 181
             <p class="description"><?php
182
-                esc_html_e(
183
-                    'Whether the ticket selector should be shown on the events list page.',
184
-                    'event_espresso'
185
-                ); ?></p>
182
+				esc_html_e(
183
+					'Whether the ticket selector should be shown on the events list page.',
184
+					'event_espresso'
185
+				); ?></p>
186 186
         </td>
187 187
     </tr>
188 188
 
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
         <th>
191 191
             <label for="EED_Events_Archive_display_datetimes">
192 192
                 <?php esc_html_e('Display Datetimes', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
193
-                    'display_datetimes_info'
194
-                ); ?>
193
+					'display_datetimes_info'
194
+				); ?>
195 195
             </label>
196 196
         </th>
197 197
         <td>
198 198
             <?php echo wp_kses(
199
-                EEH_Form_Fields::select(
200
-                    'venue_details',
201
-                    $display_datetimes,
202
-                    $values,
203
-                    'EED_Events_Archive_display_datetimes',
204
-                    'EED_Events_Archive_display_datetimes'
205
-                ),
206
-                AllowedTags::getWithFormTags()
207
-            ); ?>
199
+				EEH_Form_Fields::select(
200
+					'venue_details',
201
+					$display_datetimes,
202
+					$values,
203
+					'EED_Events_Archive_display_datetimes',
204
+					'EED_Events_Archive_display_datetimes'
205
+				),
206
+				AllowedTags::getWithFormTags()
207
+			); ?>
208 208
             <p class="description"><?php
209
-                esc_html_e(
210
-                    'Whether the date and time details should be shown on the events list page.',
211
-                    'event_espresso'
212
-                ); ?></p>
209
+				esc_html_e(
210
+					'Whether the date and time details should be shown on the events list page.',
211
+					'event_espresso'
212
+				); ?></p>
213 213
         </td>
214 214
     </tr>
215 215
 
@@ -217,26 +217,26 @@  discard block
 block discarded – undo
217 217
         <th>
218 218
             <label for="EED_Events_Archive_display_venue">
219 219
                 <?php esc_html_e('Display Venue Details', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
220
-                    'display_venue_details_info'
221
-                ); ?>
220
+					'display_venue_details_info'
221
+				); ?>
222 222
             </label>
223 223
         </th>
224 224
         <td>
225 225
             <?php echo wp_kses(
226
-                EEH_Form_Fields::select(
227
-                    'display_venue',
228
-                    $display_venue,
229
-                    $values,
230
-                    'EED_Events_Archive_display_venue',
231
-                    'EED_Events_Archive_display_venue'
232
-                ),
233
-                AllowedTags::getWithFormTags()
234
-            ); ?>
226
+				EEH_Form_Fields::select(
227
+					'display_venue',
228
+					$display_venue,
229
+					$values,
230
+					'EED_Events_Archive_display_venue',
231
+					'EED_Events_Archive_display_venue'
232
+				),
233
+				AllowedTags::getWithFormTags()
234
+			); ?>
235 235
             <p class="description"><?php
236
-                esc_html_e(
237
-                    'Whether the venue details should be shown on the events list page.',
238
-                    'event_espresso'
239
-                ); ?></p>
236
+				esc_html_e(
237
+					'Whether the venue details should be shown on the events list page.',
238
+					'event_espresso'
239
+				); ?></p>
240 240
         </td>
241 241
     </tr>
242 242
 
@@ -244,26 +244,26 @@  discard block
 block discarded – undo
244 244
         <th>
245 245
             <label for="EED_Events_Archive_display_expired_events">
246 246
                 <?php esc_html_e('Display Expired Events', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link(
247
-                    'display_expired_events_info'
248
-                ); ?>
247
+					'display_expired_events_info'
248
+				); ?>
249 249
             </label>
250 250
         </th>
251 251
         <td>
252 252
             <?php echo wp_kses(
253
-                EEH_Form_Fields::select(
254
-                    'expired_events',
255
-                    $display_expired_events,
256
-                    $values,
257
-                    'EED_Events_Archive_display_expired_events',
258
-                    'EED_Events_Archive_display_expired_events'
259
-                ),
260
-                AllowedTags::getWithFormTags()
261
-            ); ?>
253
+				EEH_Form_Fields::select(
254
+					'expired_events',
255
+					$display_expired_events,
256
+					$values,
257
+					'EED_Events_Archive_display_expired_events',
258
+					'EED_Events_Archive_display_expired_events'
259
+				),
260
+				AllowedTags::getWithFormTags()
261
+			); ?>
262 262
             <p class="description"><?php
263
-                esc_html_e(
264
-                    'Whether expired events should be shown on the events list page.',
265
-                    'event_espresso'
266
-                ); ?></p>
263
+				esc_html_e(
264
+					'Whether expired events should be shown on the events list page.',
265
+					'event_espresso'
266
+				); ?></p>
267 267
         </td>
268 268
     </tr>
269 269
 
@@ -275,20 +275,20 @@  discard block
 block discarded – undo
275 275
         </th>
276 276
         <td>
277 277
             <?php echo wp_kses(
278
-                EEH_Form_Fields::select(
279
-                    'expired_tickets',
280
-                    $display_events_with_expired_tickets,
281
-                    $values,
282
-                    'EED_Events_Archive_display_events_with_expired_tickets',
283
-                    'EED_Events_Archive_display_events_with_expired_tickets'
284
-                ),
285
-                AllowedTags::getWithFormTags()
286
-            ); ?>
278
+				EEH_Form_Fields::select(
279
+					'expired_tickets',
280
+					$display_events_with_expired_tickets,
281
+					$values,
282
+					'EED_Events_Archive_display_events_with_expired_tickets',
283
+					'EED_Events_Archive_display_events_with_expired_tickets'
284
+				),
285
+				AllowedTags::getWithFormTags()
286
+			); ?>
287 287
             <p class="description">
288 288
                 <?php esc_html_e(
289
-                    'Whether events where ALL tickets are expired should be shown on the events list page.',
290
-                    'event_espresso'
291
-                ); ?>
289
+					'Whether events where ALL tickets are expired should be shown on the events list page.',
290
+					'event_espresso'
291
+				); ?>
292 292
             </p>
293 293
             <span class="ee-feature-highlight-2024-notice">
294 294
                 ✨ <?php esc_html_e('NEW','event_espresso'); ?>
@@ -300,51 +300,51 @@  discard block
 block discarded – undo
300 300
         <th>
301 301
             <label for="EED_Events_Archive_use_sortable_display_order">
302 302
                 <?php esc_html_e(
303
-                    'Use Custom Display Order?',
304
-                    'event_espresso'
305
-                ); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?>
303
+					'Use Custom Display Order?',
304
+					'event_espresso'
305
+				); ?><?php // echo EEH_Template::get_help_tab_link('use_sortable_display_order_info');?>
306 306
             </label>
307 307
         </th>
308 308
         <td>
309 309
             <?php echo wp_kses(
310
-                EEH_Form_Fields::select(
311
-                    'use_sortable_display_order',
312
-                    $use_sortable_display_order,
313
-                    $values,
314
-                    'EED_Events_Archive_use_sortable_display_order',
315
-                    'EED_Events_Archive_use_sortable_display_order'
316
-                ),
317
-                AllowedTags::getWithFormTags()
318
-            ); ?>
310
+				EEH_Form_Fields::select(
311
+					'use_sortable_display_order',
312
+					$use_sortable_display_order,
313
+					$values,
314
+					'EED_Events_Archive_use_sortable_display_order',
315
+					'EED_Events_Archive_use_sortable_display_order'
316
+				),
317
+				AllowedTags::getWithFormTags()
318
+			); ?>
319 319
             <p class="description"><?php
320
-                esc_html_e(
321
-                    'Selecting "Yes" will allow you to drag and drop the order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
322
-                    'event_espresso'
323
-                ); ?></p>
320
+				esc_html_e(
321
+					'Selecting "Yes" will allow you to drag and drop the order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
322
+					'event_espresso'
323
+				); ?></p>
324 324
         </td>
325 325
     </tr>
326 326
 
327 327
     <tr>
328 328
         <th>
329 329
             <?php esc_html_e(
330
-                'Display Order',
331
-                'event_espresso'
332
-            ); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?>
330
+				'Display Order',
331
+				'event_espresso'
332
+			); ?><?php // echo EEH_Template::get_help_tab_link( 'event_archive_order_info' ); ?>
333 333
         </th>
334 334
         <td>
335 335
 
336 336
             <?php wp_nonce_field(
337
-                'espresso_update_event_archive_order',
338
-                'espresso_update_event_archive_order_nonce',
339
-                false
340
-            ); ?>
337
+				'espresso_update_event_archive_order',
338
+				'espresso_update_event_archive_order_nonce',
339
+				false
340
+			); ?>
341 341
             <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?>
342 342
 
343 343
             <p class="description"><?php
344
-                esc_html_e(
345
-                    'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
346
-                    'event_espresso'
347
-                ); ?></p>
344
+				esc_html_e(
345
+					'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
346
+					'event_espresso'
347
+				); ?></p>
348 348
 
349 349
         </td>
350 350
     </tr>
@@ -357,20 +357,20 @@  discard block
 block discarded – undo
357 357
         </th>
358 358
         <td>
359 359
             <?php echo wp_kses(
360
-                EEH_Form_Fields::select(
361
-                    'reset_event_list_settings',
362
-                    0,
363
-                    $values,
364
-                    'EED_Events_Archive_reset_event_list_settings',
365
-                    'EED_Events_Archive_reset_event_list_settings'
366
-                ),
367
-                AllowedTags::getWithFormTags()
368
-            ); ?>
360
+				EEH_Form_Fields::select(
361
+					'reset_event_list_settings',
362
+					0,
363
+					$values,
364
+					'EED_Events_Archive_reset_event_list_settings',
365
+					'EED_Events_Archive_reset_event_list_settings'
366
+				),
367
+				AllowedTags::getWithFormTags()
368
+			); ?>
369 369
             <p class="description"><?php
370
-                esc_html_e(
371
-                    'Selecting "Yes" will reset the Event List Settings to their default values.',
372
-                    'event_espresso'
373
-                ); ?></p>
370
+				esc_html_e(
371
+					'Selecting "Yes" will reset the Event List Settings to their default values.',
372
+					'event_espresso'
373
+				); ?></p>
374 374
         </td>
375 375
     </tr>
376 376
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             </label>
78 78
         </th>
79 79
         <td>
80
-            <span class="base-url"><?php echo site_url() . '/ ';?></span>
80
+            <span class="base-url"><?php echo site_url().'/ '; ?></span>
81 81
             <?php echo EEH_Form_Fields::text(
82 82
                 'not_used',
83 83
                 EE_Registry::instance()->CFG->core->event_cpt_slug,
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
                 ); ?>
292 292
             </p>
293 293
             <span class="ee-feature-highlight-2024-notice">
294
-                ✨ <?php esc_html_e('NEW','event_espresso'); ?>
294
+                ✨ <?php esc_html_e('NEW', 'event_espresso'); ?>
295 295
             </span>
296 296
         </td>
297 297
     </tr>
Please login to merge, or discard this patch.
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 1 patch
Indentation   +291 added lines, -291 removed lines patch added patch discarded remove patch
@@ -15,316 +15,316 @@
 block discarded – undo
15 15
  */
16 16
 class EED_Ticket_Selector_Caff extends EED_Ticket_Selector
17 17
 {
18
-    /**
19
-     * @return EED_Module|EED_Ticket_Selector_Caff
20
-     */
21
-    public static function instance()
22
-    {
23
-        return parent::get_instance(__CLASS__);
24
-    }
18
+	/**
19
+	 * @return EED_Module|EED_Ticket_Selector_Caff
20
+	 */
21
+	public static function instance()
22
+	{
23
+		return parent::get_instance(__CLASS__);
24
+	}
25 25
 
26 26
 
27
-    /**
28
-     *    set_hooks - for hooking into EE Core, other modules, etc
29
-     *
30
-     * @access    public
31
-     * @return    void
32
-     */
33
-    public static function set_hooks()
34
-    {
35
-        add_action(
36
-            'AHEE__ticket_selector_chart_template__ticket_details__after_description',
37
-            array('EED_Ticket_Selector_Caff', 'ticket_price_details'),
38
-            10,
39
-            3
40
-        );
41
-    }
27
+	/**
28
+	 *    set_hooks - for hooking into EE Core, other modules, etc
29
+	 *
30
+	 * @access    public
31
+	 * @return    void
32
+	 */
33
+	public static function set_hooks()
34
+	{
35
+		add_action(
36
+			'AHEE__ticket_selector_chart_template__ticket_details__after_description',
37
+			array('EED_Ticket_Selector_Caff', 'ticket_price_details'),
38
+			10,
39
+			3
40
+		);
41
+	}
42 42
 
43
-    /**
44
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
45
-     *
46
-     * @access    public
47
-     * @return    void
48
-     */
49
-    public static function set_hooks_admin()
50
-    {
51
-        define(
52
-            'TICKET_SELECTOR_CAFF_TEMPLATES_PATH',
53
-            str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/'
54
-        );
55
-        add_action(
56
-            'AHEE__template_settings__template__before_settings_form',
57
-            array('EED_Ticket_Selector_Caff', 'template_settings_form'),
58
-            10
59
-        );
60
-        add_filter(
61
-            'FHEE__General_Settings_Admin_Page__update_template_settings__data',
62
-            array('EED_Ticket_Selector_Caff', 'update_template_settings'),
63
-            10,
64
-            2
65
-        );
66
-    }
43
+	/**
44
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
45
+	 *
46
+	 * @access    public
47
+	 * @return    void
48
+	 */
49
+	public static function set_hooks_admin()
50
+	{
51
+		define(
52
+			'TICKET_SELECTOR_CAFF_TEMPLATES_PATH',
53
+			str_replace('\\', '/', plugin_dir_path(__FILE__)) . 'templates/'
54
+		);
55
+		add_action(
56
+			'AHEE__template_settings__template__before_settings_form',
57
+			array('EED_Ticket_Selector_Caff', 'template_settings_form'),
58
+			10
59
+		);
60
+		add_filter(
61
+			'FHEE__General_Settings_Admin_Page__update_template_settings__data',
62
+			array('EED_Ticket_Selector_Caff', 'update_template_settings'),
63
+			10,
64
+			2
65
+		);
66
+	}
67 67
 
68 68
 
69
-    /**
70
-     * @param \WP $WP
71
-     */
72
-    public function run($WP)
73
-    {
74
-        $this->set_config();
75
-    }
69
+	/**
70
+	 * @param \WP $WP
71
+	 */
72
+	public function run($WP)
73
+	{
74
+		$this->set_config();
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * @static
80
-     * @return void
81
-     * @throws EE_Error
82
-     * @throws InvalidArgumentException
83
-     * @throws InvalidDataTypeException
84
-     * @throws InvalidInterfaceException
85
-     */
86
-    public static function template_settings_form()
87
-    {
88
-        echo EED_Ticket_Selector_Caff::_ticket_selector_settings_form()->get_html();
89
-    }
78
+	/**
79
+	 * @static
80
+	 * @return void
81
+	 * @throws EE_Error
82
+	 * @throws InvalidArgumentException
83
+	 * @throws InvalidDataTypeException
84
+	 * @throws InvalidInterfaceException
85
+	 */
86
+	public static function template_settings_form()
87
+	{
88
+		echo EED_Ticket_Selector_Caff::_ticket_selector_settings_form()->get_html();
89
+	}
90 90
 
91 91
 
92
-    /**
93
-     * @return \EE_Form_Section_Proper
94
-     * @throws \EE_Error
95
-     */
96
-    public static function _ticket_selector_settings_form()
97
-    {
92
+	/**
93
+	 * @return \EE_Form_Section_Proper
94
+	 * @throws \EE_Error
95
+	 */
96
+	public static function _ticket_selector_settings_form()
97
+	{
98 98
 
99
-        return new EE_Form_Section_Proper(
100
-            array(
101
-                'name'            => 'ticket_selector_settings_form',
102
-                'html_id'         => 'ticket_selector_settings_form',
103
-                'layout_strategy' => new EE_Div_Per_Section_Layout(),
104
-                'subsections'     => apply_filters(
105
-                    'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
106
-                    array(
107
-                        'appearance_settings_hdr' => new EE_Form_Section_HTML(
108
-                            EEH_HTML::br(2) .
109
-                            EEH_HTML::h2(esc_html__('Ticket Selector Template Settings', 'event_espresso'))
110
-                        ),
111
-                        'appearance_settings'     => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings(),
112
-                    )
113
-                ),
114
-            )
115
-        );
116
-    }
99
+		return new EE_Form_Section_Proper(
100
+			array(
101
+				'name'            => 'ticket_selector_settings_form',
102
+				'html_id'         => 'ticket_selector_settings_form',
103
+				'layout_strategy' => new EE_Div_Per_Section_Layout(),
104
+				'subsections'     => apply_filters(
105
+					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
106
+					array(
107
+						'appearance_settings_hdr' => new EE_Form_Section_HTML(
108
+							EEH_HTML::br(2) .
109
+							EEH_HTML::h2(esc_html__('Ticket Selector Template Settings', 'event_espresso'))
110
+						),
111
+						'appearance_settings'     => EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings(),
112
+					)
113
+				),
114
+			)
115
+		);
116
+	}
117 117
 
118 118
 
119
-    /**
120
-     * @return \EE_Form_Section_Proper
121
-     * @throws \EE_Error
122
-     */
123
-    public static function _ticket_selector_appearance_settings()
124
-    {
125
-        if (
126
-            ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config
127
-        ) {
128
-            EED_Ticket_Selector::instance()->set_config();
129
-            EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = EED_Ticket_Selector::instance()
130
-                                                                                                      ->config();
131
-        }
132
-        $EE_Ticket_Selector_Config = EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector;
133
-        // get option for whether to show datetime selector in TS
134
-        $show_datetime_selector = $EE_Ticket_Selector_Config->getShowDatetimeSelector();
135
-        // and option for how may datetimes must exist if display is conditional
136
-        $datetime_selector_threshold = $EE_Ticket_Selector_Config->getDatetimeSelectorThreshold();
119
+	/**
120
+	 * @return \EE_Form_Section_Proper
121
+	 * @throws \EE_Error
122
+	 */
123
+	public static function _ticket_selector_appearance_settings()
124
+	{
125
+		if (
126
+			! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config
127
+		) {
128
+			EED_Ticket_Selector::instance()->set_config();
129
+			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = EED_Ticket_Selector::instance()
130
+																									  ->config();
131
+		}
132
+		$EE_Ticket_Selector_Config = EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector;
133
+		// get option for whether to show datetime selector in TS
134
+		$show_datetime_selector = $EE_Ticket_Selector_Config->getShowDatetimeSelector();
135
+		// and option for how may datetimes must exist if display is conditional
136
+		$datetime_selector_threshold = $EE_Ticket_Selector_Config->getDatetimeSelectorThreshold();
137 137
 
138
-        return new EE_Form_Section_Proper(
139
-            array(
140
-                'name'            => 'ticket_selector_settings_tbl',
141
-                'html_id'         => 'ticket_selector_settings_tbl',
142
-                'html_class'      => 'form-table',
143
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
144
-                'subsections'     => apply_filters(
145
-                    'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections',
146
-                    array(
147
-                        'show_ticket_details'         => new EE_Yes_No_Input(
148
-                            array(
149
-                                'html_label_text'         => esc_html__(
150
-                                    'Show Ticket Details?',
151
-                                    'event_espresso'
152
-                                ),
153
-                                'html_help_text'          => esc_html__(
154
-                                    'This lets you choose whether the extra ticket details section is displayed with the ticket selector.',
155
-                                    'event_espresso'
156
-                                ),
157
-                                'default'                 => $EE_Ticket_Selector_Config->show_ticket_details ?? true,
158
-                                'display_html_label_text' => false,
159
-                            )
160
-                        ),
161
-                        'show_ticket_sale_columns'    => new EE_Yes_No_Input(
162
-                            array(
163
-                                'html_label_text'         => esc_html__(
164
-                                    'Show Ticket Sale Info?',
165
-                                    'event_espresso'
166
-                                ),
167
-                                'html_help_text'          => esc_html__(
168
-                                    'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.',
169
-                                    'event_espresso'
170
-                                ),
171
-                                'default'                 => $EE_Ticket_Selector_Config->show_ticket_sale_columns ?? true,
172
-                                'display_html_label_text' => false,
173
-                            )
174
-                        ),
175
-                        'show_expired_tickets'        => new EE_Yes_No_Input(
176
-                            array(
177
-                                'html_label_text'         => esc_html__(
178
-                                    'Show Expired Tickets?',
179
-                                    'event_espresso'
180
-                                ),
181
-                                'html_help_text'          => esc_html__(
182
-                                    'Indicate whether to show expired tickets in the ticket selector',
183
-                                    'event_espresso'
184
-                                ),
185
-                                'default'                 => $EE_Ticket_Selector_Config->show_expired_tickets ?? true,
186
-                                'display_html_label_text' => false,
187
-                            )
188
-                        ),
189
-                        'show_datetime_selector'      => new EE_Select_Input(
190
-                            $EE_Ticket_Selector_Config->getShowDatetimeSelectorOptions(false),
191
-                            array(
192
-                                'html_label_text'         => esc_html__(
193
-                                    'Show Date & Time Filter?',
194
-                                    'event_espresso'
195
-                                ),
196
-                                'html_help_text'          => sprintf(
197
-                                    esc_html__(
198
-                                        'Indicates whether or not to display a dropdown select box above each ticket selector that displays dates and times for the available tickets. Ticket options can be unselected, which removes (hides) them from the list of tickets being displayed.%1$sOptions include:%1$s &bull; %2$sdo not show date & time filter%3$s%1$s &nbsp; this option will NEVER display a date filter, regardless of how many dates exist.%1$s &bull; %2$smaybe show date & time filter%3$s%1$s &nbsp; this option will conditionally display the date filter when the number of dates for the event matches the value set for "Date Filter Threshold".',
199
-                                        'event_espresso'
200
-                                    ),
201
-                                    '<br>',
202
-                                    '<strong>',
203
-                                    '</strong>'
204
-                                ),
205
-                                'default'                 => ! empty($show_datetime_selector)
206
-                                    ? $show_datetime_selector
207
-                                    : EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
208
-                                'display_html_label_text' => false,
209
-                                'html_class'              => 'ee-input-width--reg',
210
-                            )
211
-                        ),
212
-                        'datetime_selector_threshold' => new EE_Select_Input(
213
-                            array_combine($r = range(1, 10), $r),
214
-                            array(
215
-                                'html_label_text'         => esc_html__(
216
-                                    'Date & Time Filter Threshold',
217
-                                    'event_espresso'
218
-                                ),
219
-                                'html_help_text'          => esc_html__(
220
-                                    'The number of unique dates an event has to have before conditionally displaying a date & time filter',
221
-                                    'event_espresso'
222
-                                ),
223
-                                'default'                 => ! empty($datetime_selector_threshold)
224
-                                    ? $datetime_selector_threshold
225
-                                    : 3,
226
-                                'display_html_label_text' => false,
227
-                                'html_class'              => 'ee-input-width--tiny',
228
-                            )
229
-                        ),
230
-                        'datetime_selector_max_checked' => new EE_Integer_Input(
231
-                            array(
232
-                                'html_label_text'         => esc_html__(
233
-                                    'Date & Time Filter Max Checked',
234
-                                    'event_espresso'
235
-                                ),
236
-                                'html_help_text'          => sprintf(
237
-                                    esc_html__(
238
-                                        'Determines the maximum number of dates that will be checked upon initial loading for a Date and Time Filter.%1$sIf set to zero or left blank, then ALL dates will be checked upon initial loading.',
239
-                                        'event_espresso'
240
-                                    ),
241
-                                    '<br>'
242
-                                ),
243
-                                'default'                 => $EE_Ticket_Selector_Config->getDatetimeSelectorMaxChecked(),
244
-                                'display_html_label_text' => false,
245
-                                'min_value'               => 0,
246
-                                'html_class'              => 'ee-input-width--tiny',
247
-                            )
248
-                        ),
249
-                    )
250
-                ),
251
-            )
252
-        );
253
-    }
138
+		return new EE_Form_Section_Proper(
139
+			array(
140
+				'name'            => 'ticket_selector_settings_tbl',
141
+				'html_id'         => 'ticket_selector_settings_tbl',
142
+				'html_class'      => 'form-table',
143
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
144
+				'subsections'     => apply_filters(
145
+					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_appearance_settings__form_subsections',
146
+					array(
147
+						'show_ticket_details'         => new EE_Yes_No_Input(
148
+							array(
149
+								'html_label_text'         => esc_html__(
150
+									'Show Ticket Details?',
151
+									'event_espresso'
152
+								),
153
+								'html_help_text'          => esc_html__(
154
+									'This lets you choose whether the extra ticket details section is displayed with the ticket selector.',
155
+									'event_espresso'
156
+								),
157
+								'default'                 => $EE_Ticket_Selector_Config->show_ticket_details ?? true,
158
+								'display_html_label_text' => false,
159
+							)
160
+						),
161
+						'show_ticket_sale_columns'    => new EE_Yes_No_Input(
162
+							array(
163
+								'html_label_text'         => esc_html__(
164
+									'Show Ticket Sale Info?',
165
+									'event_espresso'
166
+								),
167
+								'html_help_text'          => esc_html__(
168
+									'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.',
169
+									'event_espresso'
170
+								),
171
+								'default'                 => $EE_Ticket_Selector_Config->show_ticket_sale_columns ?? true,
172
+								'display_html_label_text' => false,
173
+							)
174
+						),
175
+						'show_expired_tickets'        => new EE_Yes_No_Input(
176
+							array(
177
+								'html_label_text'         => esc_html__(
178
+									'Show Expired Tickets?',
179
+									'event_espresso'
180
+								),
181
+								'html_help_text'          => esc_html__(
182
+									'Indicate whether to show expired tickets in the ticket selector',
183
+									'event_espresso'
184
+								),
185
+								'default'                 => $EE_Ticket_Selector_Config->show_expired_tickets ?? true,
186
+								'display_html_label_text' => false,
187
+							)
188
+						),
189
+						'show_datetime_selector'      => new EE_Select_Input(
190
+							$EE_Ticket_Selector_Config->getShowDatetimeSelectorOptions(false),
191
+							array(
192
+								'html_label_text'         => esc_html__(
193
+									'Show Date & Time Filter?',
194
+									'event_espresso'
195
+								),
196
+								'html_help_text'          => sprintf(
197
+									esc_html__(
198
+										'Indicates whether or not to display a dropdown select box above each ticket selector that displays dates and times for the available tickets. Ticket options can be unselected, which removes (hides) them from the list of tickets being displayed.%1$sOptions include:%1$s &bull; %2$sdo not show date & time filter%3$s%1$s &nbsp; this option will NEVER display a date filter, regardless of how many dates exist.%1$s &bull; %2$smaybe show date & time filter%3$s%1$s &nbsp; this option will conditionally display the date filter when the number of dates for the event matches the value set for "Date Filter Threshold".',
199
+										'event_espresso'
200
+									),
201
+									'<br>',
202
+									'<strong>',
203
+									'</strong>'
204
+								),
205
+								'default'                 => ! empty($show_datetime_selector)
206
+									? $show_datetime_selector
207
+									: EE_Ticket_Selector_Config::DO_NOT_SHOW_DATETIME_SELECTOR,
208
+								'display_html_label_text' => false,
209
+								'html_class'              => 'ee-input-width--reg',
210
+							)
211
+						),
212
+						'datetime_selector_threshold' => new EE_Select_Input(
213
+							array_combine($r = range(1, 10), $r),
214
+							array(
215
+								'html_label_text'         => esc_html__(
216
+									'Date & Time Filter Threshold',
217
+									'event_espresso'
218
+								),
219
+								'html_help_text'          => esc_html__(
220
+									'The number of unique dates an event has to have before conditionally displaying a date & time filter',
221
+									'event_espresso'
222
+								),
223
+								'default'                 => ! empty($datetime_selector_threshold)
224
+									? $datetime_selector_threshold
225
+									: 3,
226
+								'display_html_label_text' => false,
227
+								'html_class'              => 'ee-input-width--tiny',
228
+							)
229
+						),
230
+						'datetime_selector_max_checked' => new EE_Integer_Input(
231
+							array(
232
+								'html_label_text'         => esc_html__(
233
+									'Date & Time Filter Max Checked',
234
+									'event_espresso'
235
+								),
236
+								'html_help_text'          => sprintf(
237
+									esc_html__(
238
+										'Determines the maximum number of dates that will be checked upon initial loading for a Date and Time Filter.%1$sIf set to zero or left blank, then ALL dates will be checked upon initial loading.',
239
+										'event_espresso'
240
+									),
241
+									'<br>'
242
+								),
243
+								'default'                 => $EE_Ticket_Selector_Config->getDatetimeSelectorMaxChecked(),
244
+								'display_html_label_text' => false,
245
+								'min_value'               => 0,
246
+								'html_class'              => 'ee-input-width--tiny',
247
+							)
248
+						),
249
+					)
250
+				),
251
+			)
252
+		);
253
+	}
254 254
 
255 255
 
256
-    /**
257
-     * callback for updating template settings
258
-     *
259
-     * @since 4.6.18.rc.006
260
-     * @param EE_Template_Config $CFG
261
-     * @param array              $REQ incoming request
262
-     * @return EE_Template_Config
263
-     * @throws EE_Error
264
-     * @throws InvalidArgumentException
265
-     * @throws ReflectionException
266
-     * @throws InvalidDataTypeException
267
-     * @throws InvalidInterfaceException
268
-     */
269
-    public static function update_template_settings(EE_Template_Config $CFG, $REQ)
270
-    {
271
-        if (! $CFG->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
272
-            EED_Ticket_Selector::instance()->set_config();
273
-            $CFG->EED_Ticket_Selector = EED_Ticket_Selector::instance()->config();
274
-        }
275
-        try {
276
-            $ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
256
+	/**
257
+	 * callback for updating template settings
258
+	 *
259
+	 * @since 4.6.18.rc.006
260
+	 * @param EE_Template_Config $CFG
261
+	 * @param array              $REQ incoming request
262
+	 * @return EE_Template_Config
263
+	 * @throws EE_Error
264
+	 * @throws InvalidArgumentException
265
+	 * @throws ReflectionException
266
+	 * @throws InvalidDataTypeException
267
+	 * @throws InvalidInterfaceException
268
+	 */
269
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ)
270
+	{
271
+		if (! $CFG->EED_Ticket_Selector instanceof EE_Ticket_Selector_Config) {
272
+			EED_Ticket_Selector::instance()->set_config();
273
+			$CFG->EED_Ticket_Selector = EED_Ticket_Selector::instance()->config();
274
+		}
275
+		try {
276
+			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
277 277
 
278
-            // check for form submission
279
-            if ($ticket_selector_form->was_submitted()) {
280
-                // capture form data
281
-                $ticket_selector_form->receive_form_submission();
278
+			// check for form submission
279
+			if ($ticket_selector_form->was_submitted()) {
280
+				// capture form data
281
+				$ticket_selector_form->receive_form_submission();
282 282
 
283
-                // validate form data
284
-                if ($ticket_selector_form->is_valid()) {
285
-                    // grab validated data from form
286
-                    $valid_data = $ticket_selector_form->valid_data();
283
+				// validate form data
284
+				if ($ticket_selector_form->is_valid()) {
285
+					// grab validated data from form
286
+					$valid_data = $ticket_selector_form->valid_data();
287 287
 
288
-                    // set data on config
289
-                    $CFG->EED_Ticket_Selector->show_ticket_sale_columns = $valid_data['appearance_settings']['show_ticket_sale_columns'];
290
-                    $CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
291
-                    $CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
292
-                    $CFG->EED_Ticket_Selector->setShowDatetimeSelector(
293
-                        $valid_data['appearance_settings']['show_datetime_selector']
294
-                    );
295
-                    $CFG->EED_Ticket_Selector->setDatetimeSelectorThreshold(
296
-                        $valid_data['appearance_settings']['datetime_selector_threshold']
297
-                    );
298
-                    $CFG->EED_Ticket_Selector->setDatetimeSelectorMaxChecked(
299
-                        $valid_data['appearance_settings']['datetime_selector_max_checked']
300
-                    );
301
-                } else {
302
-                    if ($ticket_selector_form->submission_error_message() !== '') {
303
-                        EE_Error::add_error(
304
-                            $ticket_selector_form->submission_error_message(),
305
-                            __FILE__,
306
-                            __FUNCTION__,
307
-                            __LINE__
308
-                        );
309
-                    }
310
-                }
311
-            }
312
-        } catch (EE_Error $e) {
313
-            $e->get_error();
314
-        }
288
+					// set data on config
289
+					$CFG->EED_Ticket_Selector->show_ticket_sale_columns = $valid_data['appearance_settings']['show_ticket_sale_columns'];
290
+					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
291
+					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
292
+					$CFG->EED_Ticket_Selector->setShowDatetimeSelector(
293
+						$valid_data['appearance_settings']['show_datetime_selector']
294
+					);
295
+					$CFG->EED_Ticket_Selector->setDatetimeSelectorThreshold(
296
+						$valid_data['appearance_settings']['datetime_selector_threshold']
297
+					);
298
+					$CFG->EED_Ticket_Selector->setDatetimeSelectorMaxChecked(
299
+						$valid_data['appearance_settings']['datetime_selector_max_checked']
300
+					);
301
+				} else {
302
+					if ($ticket_selector_form->submission_error_message() !== '') {
303
+						EE_Error::add_error(
304
+							$ticket_selector_form->submission_error_message(),
305
+							__FILE__,
306
+							__FUNCTION__,
307
+							__LINE__
308
+						);
309
+					}
310
+				}
311
+			}
312
+		} catch (EE_Error $e) {
313
+			$e->get_error();
314
+		}
315 315
 
316
-        return $CFG;
317
-    }
316
+		return $CFG;
317
+	}
318 318
 
319 319
 
320
-    /**
321
-     * @param \EE_Ticket $ticket
322
-     * @param int        $ticket_price
323
-     * @param bool       $display_ticket_price
324
-     */
325
-    public static function ticket_price_details(EE_Ticket $ticket, $ticket_price = 0, $display_ticket_price = false)
326
-    {
327
-        require str_replace('\\', '/', plugin_dir_path(__FILE__))
328
-                . 'templates/ticket_selector_price_details.template.php';
329
-    }
320
+	/**
321
+	 * @param \EE_Ticket $ticket
322
+	 * @param int        $ticket_price
323
+	 * @param bool       $display_ticket_price
324
+	 */
325
+	public static function ticket_price_details(EE_Ticket $ticket, $ticket_price = 0, $display_ticket_price = false)
326
+	{
327
+		require str_replace('\\', '/', plugin_dir_path(__FILE__))
328
+				. 'templates/ticket_selector_price_details.template.php';
329
+	}
330 330
 }
Please login to merge, or discard this patch.
caffeinated/core/services/licensing/LicenseService.php 2 patches
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -18,96 +18,96 @@
 block discarded – undo
18 18
  */
19 19
 class LicenseService
20 20
 {
21
-    private Config $config;
21
+	private Config $config;
22 22
 
23
-    private FeatureFlags $feature;
23
+	private FeatureFlags $feature;
24 24
 
25
-    private Stats $stats_collection;
25
+	private Stats $stats_collection;
26 26
 
27
-    public function __construct(Stats $stats_collection, Config $config, FeatureFlags $feature)
28
-    {
29
-        $this->config = $config;
30
-        $this->stats_collection = $stats_collection;
31
-        $this->feature          = $feature;
32
-    }
27
+	public function __construct(Stats $stats_collection, Config $config, FeatureFlags $feature)
28
+	{
29
+		$this->config = $config;
30
+		$this->stats_collection = $stats_collection;
31
+		$this->feature          = $feature;
32
+	}
33 33
 
34
-    public function loadPueClient()
35
-    {
36
-        // PUE Auto Upgrades stuff
37
-        if (
38
-            ! $this->feature->allowed('use_edd_plugin_licensing')
39
-            && is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')
40
-        ) { // include the file
41
-            require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
34
+	public function loadPueClient()
35
+	{
36
+		// PUE Auto Upgrades stuff
37
+		if (
38
+			! $this->feature->allowed('use_edd_plugin_licensing')
39
+			&& is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')
40
+		) { // include the file
41
+			require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
42 42
 
43
-            // $options needs to be an array with the included keys as listed.
44
-            $options = array(
45
-                // 'optionName' => '', //(optional) - used as the reference for saving update information in the
46
-                // clients options table.  Will be automatically set if left blank.
47
-                'apikey'                => $this->config->siteLicenseKey(),
48
-                // (required), you will need to obtain the apikey that the client gets from your site and
49
-                // then saves in their sites options table (see 'getting an api-key' below)
50
-                'lang_domain'           => $this->config->i18nDomain(),
51
-                // (optional) - put here whatever reference you are using for the localization of your plugin (if it's
52
-                // localized).  That way strings in this file will be included in the translation for your plugin.
53
-                'checkPeriod'           => $this->config->checkPeriod(),
54
-                // (optional) - use this parameter to indicate how often you want the client's install to ping your
55
-                // server for update checks.  The integer indicates hours.  If you don't include this parameter it will
56
-                // default to 12 hours.
57
-                'option_key'            => $this->config->optionKey(),
58
-                // this is what is used to reference the api_key in your plugin options.  PUE uses this to trigger
59
-                // updating your information message whenever this option_key is modified.
60
-                'options_page_slug'     => $this->config->optionsPageSlug(),
61
-                'plugin_basename'       => EE_PLUGIN_BASENAME,
62
-                'use_wp_update'         => true,
63
-                // if TRUE then you want FREE versions of the plugin to be updated from WP
64
-                'extra_stats'           => $this->stats_collection->statsCallback(),
65
-                'turn_on_notices_saved' => true,
66
-            );
67
-            // initiate the class and start the plugin update engine!
68
-            new PluginUpdateEngineChecker(
69
-                $this->config->hostServerUrl(),
70
-                $this->config->pluginSlug(),
71
-                $options
72
-            );
73
-        }
74
-        do_action('AHEE__EE_System__brew_espresso__after_pue_init');
75
-    }
43
+			// $options needs to be an array with the included keys as listed.
44
+			$options = array(
45
+				// 'optionName' => '', //(optional) - used as the reference for saving update information in the
46
+				// clients options table.  Will be automatically set if left blank.
47
+				'apikey'                => $this->config->siteLicenseKey(),
48
+				// (required), you will need to obtain the apikey that the client gets from your site and
49
+				// then saves in their sites options table (see 'getting an api-key' below)
50
+				'lang_domain'           => $this->config->i18nDomain(),
51
+				// (optional) - put here whatever reference you are using for the localization of your plugin (if it's
52
+				// localized).  That way strings in this file will be included in the translation for your plugin.
53
+				'checkPeriod'           => $this->config->checkPeriod(),
54
+				// (optional) - use this parameter to indicate how often you want the client's install to ping your
55
+				// server for update checks.  The integer indicates hours.  If you don't include this parameter it will
56
+				// default to 12 hours.
57
+				'option_key'            => $this->config->optionKey(),
58
+				// this is what is used to reference the api_key in your plugin options.  PUE uses this to trigger
59
+				// updating your information message whenever this option_key is modified.
60
+				'options_page_slug'     => $this->config->optionsPageSlug(),
61
+				'plugin_basename'       => EE_PLUGIN_BASENAME,
62
+				'use_wp_update'         => true,
63
+				// if TRUE then you want FREE versions of the plugin to be updated from WP
64
+				'extra_stats'           => $this->stats_collection->statsCallback(),
65
+				'turn_on_notices_saved' => true,
66
+			);
67
+			// initiate the class and start the plugin update engine!
68
+			new PluginUpdateEngineChecker(
69
+				$this->config->hostServerUrl(),
70
+				$this->config->pluginSlug(),
71
+				$options
72
+			);
73
+		}
74
+		do_action('AHEE__EE_System__brew_espresso__after_pue_init');
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * This is a handy helper method for retrieving whether there is an update available for the given plugin.
80
-     *
81
-     * @param string $basename  Use the equivalent result from plugin_basename() for this param as WP uses that to
82
-     *                          identify plugins. Defaults to core update
83
-     * @return bool           True if update available, false if not.
84
-     */
85
-    public static function isUpdateAvailable(string $basename = ''): bool
86
-    {
87
-        $feature = LoaderFactory::getShared(FeatureFlags::class);
88
-        if (! $feature->allowed('use_edd_plugin_licensing')) {
89
-            return false;
90
-        }
91
-        $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
78
+	/**
79
+	 * This is a handy helper method for retrieving whether there is an update available for the given plugin.
80
+	 *
81
+	 * @param string $basename  Use the equivalent result from plugin_basename() for this param as WP uses that to
82
+	 *                          identify plugins. Defaults to core update
83
+	 * @return bool           True if update available, false if not.
84
+	 */
85
+	public static function isUpdateAvailable(string $basename = ''): bool
86
+	{
87
+		$feature = LoaderFactory::getShared(FeatureFlags::class);
88
+		if (! $feature->allowed('use_edd_plugin_licensing')) {
89
+			return false;
90
+		}
91
+		$basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
92 92
 
93
-        $update = false;
93
+		$update = false;
94 94
 
95
-        // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
96
-        $folder = '/' . dirname($basename);
95
+		// should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
96
+		$folder = '/' . dirname($basename);
97 97
 
98
-        $plugins = get_plugins($folder);
99
-        $current = get_site_transient('update_plugins');
100
-        foreach ($plugins as $plugin_file => $plugin_data) {
101
-            if (isset($current->response[ $plugin_file ])) {
102
-                $update = true;
103
-            }
104
-        }
98
+		$plugins = get_plugins($folder);
99
+		$current = get_site_transient('update_plugins');
100
+		foreach ($plugins as $plugin_file => $plugin_data) {
101
+			if (isset($current->response[ $plugin_file ])) {
102
+				$update = true;
103
+			}
104
+		}
105 105
 
106
-        // it's possible that there is an update but an invalid site-license-key is in use
107
-        if (get_site_option('pue_json_error_' . $basename)) {
108
-            $update = true;
109
-        }
106
+		// it's possible that there is an update but an invalid site-license-key is in use
107
+		if (get_site_option('pue_json_error_' . $basename)) {
108
+			$update = true;
109
+		}
110 110
 
111
-        return $update;
112
-    }
111
+		return $update;
112
+	}
113 113
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
         // PUE Auto Upgrades stuff
37 37
         if (
38 38
             ! $this->feature->allowed('use_edd_plugin_licensing')
39
-            && is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')
39
+            && is_readable(EE_THIRD_PARTY.'pue/pue-client.php')
40 40
         ) { // include the file
41
-            require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
41
+            require_once(EE_THIRD_PARTY.'pue/pue-client.php');
42 42
 
43 43
             // $options needs to be an array with the included keys as listed.
44 44
             $options = array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public static function isUpdateAvailable(string $basename = ''): bool
86 86
     {
87 87
         $feature = LoaderFactory::getShared(FeatureFlags::class);
88
-        if (! $feature->allowed('use_edd_plugin_licensing')) {
88
+        if ( ! $feature->allowed('use_edd_plugin_licensing')) {
89 89
             return false;
90 90
         }
91 91
         $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
         $update = false;
94 94
 
95 95
         // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
96
-        $folder = '/' . dirname($basename);
96
+        $folder = '/'.dirname($basename);
97 97
 
98 98
         $plugins = get_plugins($folder);
99 99
         $current = get_site_transient('update_plugins');
100 100
         foreach ($plugins as $plugin_file => $plugin_data) {
101
-            if (isset($current->response[ $plugin_file ])) {
101
+            if (isset($current->response[$plugin_file])) {
102 102
                 $update = true;
103 103
             }
104 104
         }
105 105
 
106 106
         // it's possible that there is an update but an invalid site-license-key is in use
107
-        if (get_site_option('pue_json_error_' . $basename)) {
107
+        if (get_site_option('pue_json_error_'.$basename)) {
108 108
             $update = true;
109 109
         }
110 110
 
Please login to merge, or discard this patch.
caffeinated/core/services/licensing/UserExperienceForm.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -19,130 +19,130 @@
 block discarded – undo
19 19
  */
20 20
 class UserExperienceForm
21 21
 {
22
-    /**
23
-     * @var EE_Core_Config
24
-     */
25
-    protected $core_config;
22
+	/**
23
+	 * @var EE_Core_Config
24
+	 */
25
+	protected $core_config;
26 26
 
27
-    /**
28
-     * @var EE_Network_Core_Config
29
-     */
30
-    protected $network_core_config;
27
+	/**
28
+	 * @var EE_Network_Core_Config
29
+	 */
30
+	protected $network_core_config;
31 31
 
32 32
 
33
-    /**
34
-     * @param EE_Core_Config         $core_config
35
-     * @param EE_Network_Core_Config $network_core_config
36
-     */
37
-    public function __construct(EE_Core_Config $core_config, EE_Network_Core_Config $network_core_config)
38
-    {
39
-        $this->core_config         = $core_config;
40
-        $this->network_core_config = $network_core_config;
41
-    }
33
+	/**
34
+	 * @param EE_Core_Config         $core_config
35
+	 * @param EE_Network_Core_Config $network_core_config
36
+	 */
37
+	public function __construct(EE_Core_Config $core_config, EE_Network_Core_Config $network_core_config)
38
+	{
39
+		$this->core_config         = $core_config;
40
+		$this->network_core_config = $network_core_config;
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @throws EE_Error
46
-     */
47
-    public function uxipFormSections(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper
48
-    {
49
-        if (is_main_site()) {
50
-            $org_settings_form->add_subsections(
51
-                [
52
-                    'site_license_key_hdr' => new EE_Form_Section_HTML(
53
-                        EEH_HTML::h2(
54
-                            esc_html__('Your Event Espresso License Key', 'event_espresso')
55
-                            . ' '
56
-                            . EEH_HTML::span(
57
-                                EEH_Template::get_help_tab_link('site_license_key_info')
58
-                            ),
59
-                            '',
60
-                            'site-license-key-hdr'
61
-                        )
62
-                    ),
63
-                    'site_license_key'     => new EE_Text_Input(
64
-                        [
65
-                            'html_name'        => 'ee_site_license_key',
66
-                            'html_id'          => 'site_license_key',
67
-                            'html_label_text'  => esc_html__('Support License Key', 'event_espresso'),
68
-                            /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
69
-                            'html_help_text'   => sprintf(
70
-                                esc_html__(
71
-                                    'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
72
-                                    'event_espresso'
73
-                                ),
74
-                                '<strong>',
75
-                                '</strong>'
76
-                            ),
77
-                            /** phpcs:enable */
78
-                            'default'          => $this->network_core_config->site_license_key ?? '',
79
-                            'required'         => false,
80
-                            'form_html_filter' => new VsprintfFilter(
81
-                                '%1$s %4$s %2$s %3$s',
82
-                                ['<div class="ee-layout-row--fixed">', $this->getValidationIndicator(), '</div>']
83
-                            )
84
-                        ]
85
-                    )
86
-                ]
87
-            );
88
-            $org_settings_form->add_subsections(
89
-                [
90
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(Stats::optinText(false)),
91
-                    'uxip_optin' => new EE_Checkbox_Multi_Input(
92
-                        [
93
-                            true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso'),
94
-                        ],
95
-                        [
96
-                            'html_name'       => EE_Core_Config::OPTION_NAME_UXIP,
97
-                            'html_label_text' => esc_html__(
98
-                                'UXIP Opt In?',
99
-                                'event_espresso'
100
-                            ),
101
-                            'default'         => isset($this->core_config->ee_ueip_optin)
102
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
103
-                                : false,
104
-                            'required'        => false,
105
-                            'label_size'      => 100,
106
-                        ]
107
-                    ),
108
-                ],
109
-                'organization_instagram',
110
-                false
111
-            );
112
-        }
113
-        return $org_settings_form;
114
-    }
44
+	/**
45
+	 * @throws EE_Error
46
+	 */
47
+	public function uxipFormSections(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper
48
+	{
49
+		if (is_main_site()) {
50
+			$org_settings_form->add_subsections(
51
+				[
52
+					'site_license_key_hdr' => new EE_Form_Section_HTML(
53
+						EEH_HTML::h2(
54
+							esc_html__('Your Event Espresso License Key', 'event_espresso')
55
+							. ' '
56
+							. EEH_HTML::span(
57
+								EEH_Template::get_help_tab_link('site_license_key_info')
58
+							),
59
+							'',
60
+							'site-license-key-hdr'
61
+						)
62
+					),
63
+					'site_license_key'     => new EE_Text_Input(
64
+						[
65
+							'html_name'        => 'ee_site_license_key',
66
+							'html_id'          => 'site_license_key',
67
+							'html_label_text'  => esc_html__('Support License Key', 'event_espresso'),
68
+							/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
69
+							'html_help_text'   => sprintf(
70
+								esc_html__(
71
+									'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
72
+									'event_espresso'
73
+								),
74
+								'<strong>',
75
+								'</strong>'
76
+							),
77
+							/** phpcs:enable */
78
+							'default'          => $this->network_core_config->site_license_key ?? '',
79
+							'required'         => false,
80
+							'form_html_filter' => new VsprintfFilter(
81
+								'%1$s %4$s %2$s %3$s',
82
+								['<div class="ee-layout-row--fixed">', $this->getValidationIndicator(), '</div>']
83
+							)
84
+						]
85
+					)
86
+				]
87
+			);
88
+			$org_settings_form->add_subsections(
89
+				[
90
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(Stats::optinText(false)),
91
+					'uxip_optin' => new EE_Checkbox_Multi_Input(
92
+						[
93
+							true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso'),
94
+						],
95
+						[
96
+							'html_name'       => EE_Core_Config::OPTION_NAME_UXIP,
97
+							'html_label_text' => esc_html__(
98
+								'UXIP Opt In?',
99
+								'event_espresso'
100
+							),
101
+							'default'         => isset($this->core_config->ee_ueip_optin)
102
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
103
+								: false,
104
+							'required'        => false,
105
+							'label_size'      => 100,
106
+						]
107
+					),
108
+				],
109
+				'organization_instagram',
110
+				false
111
+			);
112
+		}
113
+		return $org_settings_form;
114
+	}
115 115
 
116 116
 
117 117
 
118
-    /**
119
-     * Return whether the site license key has been verified or not.
120
-     *
121
-     * @return bool
122
-     */
123
-    private function licenseKeyVerified(): bool
124
-    {
125
-        if (empty($this->network_core_config->site_license_key)) {
126
-            return false;
127
-        }
128
-        $verify_fail = get_option(
129
-            'puvererr_' . basename(EE_PLUGIN_BASENAME),
130
-            false
131
-        );
132
-        return $verify_fail === false
133
-               || (
134
-                   ! empty($this->network_core_config->site_license_key)
135
-                   && $verify_fail === false
136
-               );
137
-    }
118
+	/**
119
+	 * Return whether the site license key has been verified or not.
120
+	 *
121
+	 * @return bool
122
+	 */
123
+	private function licenseKeyVerified(): bool
124
+	{
125
+		if (empty($this->network_core_config->site_license_key)) {
126
+			return false;
127
+		}
128
+		$verify_fail = get_option(
129
+			'puvererr_' . basename(EE_PLUGIN_BASENAME),
130
+			false
131
+		);
132
+		return $verify_fail === false
133
+			   || (
134
+				   ! empty($this->network_core_config->site_license_key)
135
+				   && $verify_fail === false
136
+			   );
137
+	}
138 138
 
139 139
 
140
-    /**
141
-     * @return string
142
-     */
143
-    private function getValidationIndicator(): string
144
-    {
145
-        $verified_class = $this->licenseKeyVerified() ? 'ee-status--success' : 'ee-status--error';
146
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . '"></span>';
147
-    }
140
+	/**
141
+	 * @return string
142
+	 */
143
+	private function getValidationIndicator(): string
144
+	{
145
+		$verified_class = $this->licenseKeyVerified() ? 'ee-status--success' : 'ee-status--error';
146
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . '"></span>';
147
+	}
148 148
 }
Please login to merge, or discard this patch.
caffeinated/core/domain/services/pue/StatsGatherer.php 1 patch
Indentation   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -19,288 +19,288 @@
 block discarded – undo
19 19
  */
20 20
 class StatsGatherer
21 21
 {
22
-    public const COUNT_ALL_EVENTS                 = 'event';
22
+	public const COUNT_ALL_EVENTS                 = 'event';
23 23
 
24
-    public const COUNT_ACTIVE_EVENTS              = 'active_event';
24
+	public const COUNT_ACTIVE_EVENTS              = 'active_event';
25 25
 
26
-    public const COUNT_DATETIMES                  = 'datetime';
26
+	public const COUNT_DATETIMES                  = 'datetime';
27 27
 
28
-    public const COUNT_TICKETS                    = 'ticket';
28
+	public const COUNT_TICKETS                    = 'ticket';
29 29
 
30
-    public const COUNT_DATETIMES_SOLD             = 'datetime_sold';
30
+	public const COUNT_DATETIMES_SOLD             = 'datetime_sold';
31 31
 
32
-    public const COUNT_TICKETS_FREE               = 'free_ticket';
32
+	public const COUNT_TICKETS_FREE               = 'free_ticket';
33 33
 
34
-    public const COUNT_TICKETS_PAID               = 'paid_ticket';
34
+	public const COUNT_TICKETS_PAID               = 'paid_ticket';
35 35
 
36
-    public const COUNT_TICKETS_SOLD               = 'ticket_sold';
36
+	public const COUNT_TICKETS_SOLD               = 'ticket_sold';
37 37
 
38
-    public const COUNT_REGISTRATIONS_APPROVED     = 'registrations_approved';
38
+	public const COUNT_REGISTRATIONS_APPROVED     = 'registrations_approved';
39 39
 
40
-    public const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved';
40
+	public const COUNT_REGISTRATIONS_NOT_APPROVED = 'registrations_not_approved';
41 41
 
42
-    public const COUNT_REGISTRATIONS_PENDING      = 'registrations_pending';
42
+	public const COUNT_REGISTRATIONS_PENDING      = 'registrations_pending';
43 43
 
44
-    public const COUNT_REGISTRATIONS_INCOMPLETE   = 'registrations_incomplete';
44
+	public const COUNT_REGISTRATIONS_INCOMPLETE   = 'registrations_incomplete';
45 45
 
46
-    public const COUNT_REGISTRATIONS_ALL          = 'registrations_all';
46
+	public const COUNT_REGISTRATIONS_ALL          = 'registrations_all';
47 47
 
48
-    public const COUNT_REGISTRATIONS_CANCELLED    = 'registrations_cancelled';
48
+	public const COUNT_REGISTRATIONS_CANCELLED    = 'registrations_cancelled';
49 49
 
50
-    public const COUNT_REGISTRATIONS_DECLINED     = 'registrations_declined';
50
+	public const COUNT_REGISTRATIONS_DECLINED     = 'registrations_declined';
51 51
 
52
-    public const SUM_TRANSACTIONS_COMPLETE_TOTAL  = 'transactions_complete_total_sum';
52
+	public const SUM_TRANSACTIONS_COMPLETE_TOTAL  = 'transactions_complete_total_sum';
53 53
 
54
-    public const SUM_TRANSACTIONS_ALL_PAID        = 'transactions_all_paid';
54
+	public const SUM_TRANSACTIONS_ALL_PAID        = 'transactions_all_paid';
55 55
 
56
-    public const INFO_SITE_CURRENCY               = 'site_currency';
56
+	public const INFO_SITE_CURRENCY               = 'site_currency';
57 57
 
58 58
 
59
-    /**
60
-     * @var EEM_Payment_Method
61
-     */
62
-    private $payment_method_model;
63
-
64
-
65
-    /**
66
-     * @var EEM_Event
67
-     */
68
-    private $event_model;
69
-
70
-    /**
71
-     * @var EEM_Datetime
72
-     */
73
-    private $datetime_model;
74
-
75
-
76
-    /**
77
-     * @var EEM_Ticket
78
-     */
79
-    private $ticket_model;
80
-
81
-
82
-    /**
83
-     * @var EEM_Registration
84
-     */
85
-    private $registration_model;
86
-
87
-
88
-    /**
89
-     * @var EEM_Transaction
90
-     */
91
-    private $transaction_model;
92
-
93
-
94
-    /**
95
-     * @var EE_Config
96
-     */
97
-    private $config;
98
-
99
-
100
-    /**
101
-     * StatsGatherer constructor.
102
-     *
103
-     * @param EEM_Payment_Method $payment_method_model
104
-     * @param EEM_Event          $event_model
105
-     * @param EEM_Datetime       $datetime_model
106
-     * @param EEM_Ticket         $ticket_model
107
-     * @param EEM_Registration   $registration_model
108
-     * @param EEM_Transaction    $transaction_model
109
-     * @param EE_Config          $config
110
-     */
111
-    public function __construct(
112
-        EEM_Payment_Method $payment_method_model,
113
-        EEM_Event $event_model,
114
-        EEM_Datetime $datetime_model,
115
-        EEM_Ticket $ticket_model,
116
-        EEM_Registration $registration_model,
117
-        EEM_Transaction $transaction_model,
118
-        EE_Config $config
119
-    ) {
120
-        $this->payment_method_model = $payment_method_model;
121
-        $this->event_model          = $event_model;
122
-        $this->datetime_model       = $datetime_model;
123
-        $this->ticket_model         = $ticket_model;
124
-        $this->registration_model   = $registration_model;
125
-        $this->transaction_model    = $transaction_model;
126
-        $this->config               = $config;
127
-    }
128
-
129
-
130
-    /**
131
-     * Return the stats array for PUE UXIP stats.
132
-     *
133
-     * @return array
134
-     */
135
-    public function stats(): array
136
-    {
137
-        global $wp_version;
138
-        $stats = $this->paymentMethodStats();
139
-        // a-ok so let's setup our stats.
140
-        $stats = array_merge(
141
-            $stats,
142
-            [
143
-                'is_multisite'                    => is_multisite() && is_main_site(),
144
-                'active_theme'                    => $this->getActiveThemeStat(),
145
-                'ee4_all_events_count'            => $this->getCountFor(self::COUNT_ALL_EVENTS),
146
-                'ee4_active_events_count'         => $this->getCountFor(self::COUNT_ACTIVE_EVENTS),
147
-                'all_dtts_count'                  => $this->getCountFor(self::COUNT_DATETIMES),
148
-                'dtt_sold'                        => $this->getCountFor(self::COUNT_DATETIMES_SOLD),
149
-                'all_tkt_count'                   => $this->getCountFor(self::COUNT_TICKETS),
150
-                'free_tkt_count'                  => $this->getCountFor(self::COUNT_TICKETS_FREE),
151
-                'paid_tkt_count'                  => $this->getCountFor(self::COUNT_TICKETS_PAID),
152
-                'tkt_sold'                        => $this->getCountFor(self::COUNT_TICKETS_SOLD),
153
-                'approve_registration_count'      => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED),
154
-                'pending_registration_count'      => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING),
155
-                'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED),
156
-                'incomplete_registration_count'   => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE),
157
-                'cancelled_registration_count'    => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED),
158
-                'declined_registration_count'     => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED),
159
-                'all_registration_count'          => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL),
160
-                'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL),
161
-                'all_transaction_paid_sum'        => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID),
162
-                self::INFO_SITE_CURRENCY          => $this->config->currency instanceof EE_Currency_Config
163
-                    ? $this->config->currency->code
164
-                    : 'unknown',
165
-                'phpversion'                      => implode(
166
-                    '.',
167
-                    [PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION]
168
-                ),
169
-                'wpversion'                       => $wp_version,
170
-                'active_addons'                   => $this->getActiveAddons(),
171
-            ]
172
-        );
173
-        // remove any values that equal null.  This ensures any stats that weren't retrieved successfully are excluded.
174
-        return array_filter($stats, function ($value) {
175
-            return $value !== null;
176
-        });
177
-    }
178
-
179
-
180
-    /**
181
-     * @param string $which enum (@see constants prefixed with COUNT)
182
-     * @return int|float|null
183
-     */
184
-    private function getCountFor(string $which)
185
-    {
186
-        try {
187
-            switch ($which) {
188
-                case self::COUNT_ALL_EVENTS:
189
-                    $count = $this->event_model->count();
190
-                    break;
191
-                case self::COUNT_TICKETS:
192
-                    $count = $this->ticket_model->count();
193
-                    break;
194
-                case self::COUNT_DATETIMES:
195
-                    $count = $this->datetime_model->count();
196
-                    break;
197
-                case self::COUNT_ACTIVE_EVENTS:
198
-                    $count = $this->event_model->get_active_events([], true);
199
-                    break;
200
-                case self::COUNT_DATETIMES_SOLD:
201
-                    $count = $this->datetime_model->sum([], 'DTT_sold');
202
-                    break;
203
-                case self::COUNT_TICKETS_FREE:
204
-                    $count = $this->ticket_model->count([['TKT_price' => 0]]);
205
-                    break;
206
-                case self::COUNT_TICKETS_PAID:
207
-                    $count = $this->ticket_model->count([['TKT_price' => ['>', 0]]]);
208
-                    break;
209
-                case self::COUNT_TICKETS_SOLD:
210
-                    $count = $this->ticket_model->sum([], 'TKT_sold');
211
-                    break;
212
-                case self::COUNT_REGISTRATIONS_ALL:
213
-                    $count = $this->registration_model->count();
214
-                    break;
215
-                case self::COUNT_REGISTRATIONS_CANCELLED:
216
-                    $count = $this->registration_model->count([['STS_ID' => RegStatus::CANCELLED]]);
217
-                    break;
218
-                case self::COUNT_REGISTRATIONS_INCOMPLETE:
219
-                    $count = $this->registration_model->count([['STS_ID' => RegStatus::INCOMPLETE]]);
220
-                    break;
221
-                case self::COUNT_REGISTRATIONS_NOT_APPROVED:
222
-                    $count = $this->registration_model->count([['STS_ID' => RegStatus::AWAITING_REVIEW]]);
223
-                    break;
224
-                case self::COUNT_REGISTRATIONS_DECLINED:
225
-                    $count = $this->registration_model->count([['STS_ID' => RegStatus::DECLINED]]);
226
-                    break;
227
-                case self::COUNT_REGISTRATIONS_PENDING:
228
-                    $count = $this->registration_model->count(
229
-                        [['STS_ID' => RegStatus::PENDING_PAYMENT]]
230
-                    );
231
-                    break;
232
-                case self::COUNT_REGISTRATIONS_APPROVED:
233
-                    $count = $this->registration_model->count([['STS_ID' => RegStatus::APPROVED]]);
234
-                    break;
235
-                case self::SUM_TRANSACTIONS_COMPLETE_TOTAL:
236
-                    $count = $this->transaction_model->sum(
237
-                        [['STS_ID' => EEM_Transaction::complete_status_code]],
238
-                        'TXN_total'
239
-                    );
240
-                    break;
241
-                case self::SUM_TRANSACTIONS_ALL_PAID:
242
-                    $count = $this->transaction_model->sum([], 'TXN_paid');
243
-                    break;
244
-                default:
245
-                    $count = null;
246
-                    break;
247
-            }
248
-        } catch (Exception $e) {
249
-            $count = null;
250
-        }
251
-        return $count;
252
-    }
253
-
254
-
255
-    /**
256
-     * Return the active theme.
257
-     *
258
-     * @return false|string
259
-     */
260
-    private function getActiveThemeStat()
261
-    {
262
-        $theme = wp_get_theme();
263
-        return $theme->get('Name');
264
-    }
265
-
266
-
267
-    /**
268
-     * @return array
269
-     */
270
-    private function paymentMethodStats(): array
271
-    {
272
-        $payment_method_stats = [];
273
-        try {
274
-            $active_payment_methods = $this->payment_method_model->get_all_active(
275
-                null,
276
-                ['group_by' => 'PMD_type']
277
-            );
278
-            if ($active_payment_methods) {
279
-                foreach ($active_payment_methods as $payment_method) {
280
-                    $payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1;
281
-                }
282
-            }
283
-        } catch (Exception $e) {
284
-            // do nothing just prevents fatals.
285
-        }
286
-        return $payment_method_stats;
287
-    }
288
-
289
-
290
-    /**
291
-     * Return a list of active EE add-ons and their versions.
292
-     *
293
-     * @return string
294
-     */
295
-    private function getActiveAddons(): string
296
-    {
297
-        $activeAddons = [];
298
-        $addOns       = EE_Registry::instance()->addons;
299
-        if (! empty($addOns)) {
300
-            foreach ($addOns as $addon) {
301
-                $activeAddons[] = $addon->name() . '@' . $addon->version();
302
-            }
303
-        }
304
-        return implode(',', $activeAddons);
305
-    }
59
+	/**
60
+	 * @var EEM_Payment_Method
61
+	 */
62
+	private $payment_method_model;
63
+
64
+
65
+	/**
66
+	 * @var EEM_Event
67
+	 */
68
+	private $event_model;
69
+
70
+	/**
71
+	 * @var EEM_Datetime
72
+	 */
73
+	private $datetime_model;
74
+
75
+
76
+	/**
77
+	 * @var EEM_Ticket
78
+	 */
79
+	private $ticket_model;
80
+
81
+
82
+	/**
83
+	 * @var EEM_Registration
84
+	 */
85
+	private $registration_model;
86
+
87
+
88
+	/**
89
+	 * @var EEM_Transaction
90
+	 */
91
+	private $transaction_model;
92
+
93
+
94
+	/**
95
+	 * @var EE_Config
96
+	 */
97
+	private $config;
98
+
99
+
100
+	/**
101
+	 * StatsGatherer constructor.
102
+	 *
103
+	 * @param EEM_Payment_Method $payment_method_model
104
+	 * @param EEM_Event          $event_model
105
+	 * @param EEM_Datetime       $datetime_model
106
+	 * @param EEM_Ticket         $ticket_model
107
+	 * @param EEM_Registration   $registration_model
108
+	 * @param EEM_Transaction    $transaction_model
109
+	 * @param EE_Config          $config
110
+	 */
111
+	public function __construct(
112
+		EEM_Payment_Method $payment_method_model,
113
+		EEM_Event $event_model,
114
+		EEM_Datetime $datetime_model,
115
+		EEM_Ticket $ticket_model,
116
+		EEM_Registration $registration_model,
117
+		EEM_Transaction $transaction_model,
118
+		EE_Config $config
119
+	) {
120
+		$this->payment_method_model = $payment_method_model;
121
+		$this->event_model          = $event_model;
122
+		$this->datetime_model       = $datetime_model;
123
+		$this->ticket_model         = $ticket_model;
124
+		$this->registration_model   = $registration_model;
125
+		$this->transaction_model    = $transaction_model;
126
+		$this->config               = $config;
127
+	}
128
+
129
+
130
+	/**
131
+	 * Return the stats array for PUE UXIP stats.
132
+	 *
133
+	 * @return array
134
+	 */
135
+	public function stats(): array
136
+	{
137
+		global $wp_version;
138
+		$stats = $this->paymentMethodStats();
139
+		// a-ok so let's setup our stats.
140
+		$stats = array_merge(
141
+			$stats,
142
+			[
143
+				'is_multisite'                    => is_multisite() && is_main_site(),
144
+				'active_theme'                    => $this->getActiveThemeStat(),
145
+				'ee4_all_events_count'            => $this->getCountFor(self::COUNT_ALL_EVENTS),
146
+				'ee4_active_events_count'         => $this->getCountFor(self::COUNT_ACTIVE_EVENTS),
147
+				'all_dtts_count'                  => $this->getCountFor(self::COUNT_DATETIMES),
148
+				'dtt_sold'                        => $this->getCountFor(self::COUNT_DATETIMES_SOLD),
149
+				'all_tkt_count'                   => $this->getCountFor(self::COUNT_TICKETS),
150
+				'free_tkt_count'                  => $this->getCountFor(self::COUNT_TICKETS_FREE),
151
+				'paid_tkt_count'                  => $this->getCountFor(self::COUNT_TICKETS_PAID),
152
+				'tkt_sold'                        => $this->getCountFor(self::COUNT_TICKETS_SOLD),
153
+				'approve_registration_count'      => $this->getCountFor(self::COUNT_REGISTRATIONS_APPROVED),
154
+				'pending_registration_count'      => $this->getCountFor(self::COUNT_REGISTRATIONS_PENDING),
155
+				'not_approved_registration_count' => $this->getCountFor(self::COUNT_REGISTRATIONS_NOT_APPROVED),
156
+				'incomplete_registration_count'   => $this->getCountFor(self::COUNT_REGISTRATIONS_INCOMPLETE),
157
+				'cancelled_registration_count'    => $this->getCountFor(self::COUNT_REGISTRATIONS_CANCELLED),
158
+				'declined_registration_count'     => $this->getCountFor(self::COUNT_REGISTRATIONS_DECLINED),
159
+				'all_registration_count'          => $this->getCountFor(self::COUNT_REGISTRATIONS_ALL),
160
+				'completed_transaction_total_sum' => $this->getCountFor(self::SUM_TRANSACTIONS_COMPLETE_TOTAL),
161
+				'all_transaction_paid_sum'        => $this->getCountFor(self::SUM_TRANSACTIONS_ALL_PAID),
162
+				self::INFO_SITE_CURRENCY          => $this->config->currency instanceof EE_Currency_Config
163
+					? $this->config->currency->code
164
+					: 'unknown',
165
+				'phpversion'                      => implode(
166
+					'.',
167
+					[PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION]
168
+				),
169
+				'wpversion'                       => $wp_version,
170
+				'active_addons'                   => $this->getActiveAddons(),
171
+			]
172
+		);
173
+		// remove any values that equal null.  This ensures any stats that weren't retrieved successfully are excluded.
174
+		return array_filter($stats, function ($value) {
175
+			return $value !== null;
176
+		});
177
+	}
178
+
179
+
180
+	/**
181
+	 * @param string $which enum (@see constants prefixed with COUNT)
182
+	 * @return int|float|null
183
+	 */
184
+	private function getCountFor(string $which)
185
+	{
186
+		try {
187
+			switch ($which) {
188
+				case self::COUNT_ALL_EVENTS:
189
+					$count = $this->event_model->count();
190
+					break;
191
+				case self::COUNT_TICKETS:
192
+					$count = $this->ticket_model->count();
193
+					break;
194
+				case self::COUNT_DATETIMES:
195
+					$count = $this->datetime_model->count();
196
+					break;
197
+				case self::COUNT_ACTIVE_EVENTS:
198
+					$count = $this->event_model->get_active_events([], true);
199
+					break;
200
+				case self::COUNT_DATETIMES_SOLD:
201
+					$count = $this->datetime_model->sum([], 'DTT_sold');
202
+					break;
203
+				case self::COUNT_TICKETS_FREE:
204
+					$count = $this->ticket_model->count([['TKT_price' => 0]]);
205
+					break;
206
+				case self::COUNT_TICKETS_PAID:
207
+					$count = $this->ticket_model->count([['TKT_price' => ['>', 0]]]);
208
+					break;
209
+				case self::COUNT_TICKETS_SOLD:
210
+					$count = $this->ticket_model->sum([], 'TKT_sold');
211
+					break;
212
+				case self::COUNT_REGISTRATIONS_ALL:
213
+					$count = $this->registration_model->count();
214
+					break;
215
+				case self::COUNT_REGISTRATIONS_CANCELLED:
216
+					$count = $this->registration_model->count([['STS_ID' => RegStatus::CANCELLED]]);
217
+					break;
218
+				case self::COUNT_REGISTRATIONS_INCOMPLETE:
219
+					$count = $this->registration_model->count([['STS_ID' => RegStatus::INCOMPLETE]]);
220
+					break;
221
+				case self::COUNT_REGISTRATIONS_NOT_APPROVED:
222
+					$count = $this->registration_model->count([['STS_ID' => RegStatus::AWAITING_REVIEW]]);
223
+					break;
224
+				case self::COUNT_REGISTRATIONS_DECLINED:
225
+					$count = $this->registration_model->count([['STS_ID' => RegStatus::DECLINED]]);
226
+					break;
227
+				case self::COUNT_REGISTRATIONS_PENDING:
228
+					$count = $this->registration_model->count(
229
+						[['STS_ID' => RegStatus::PENDING_PAYMENT]]
230
+					);
231
+					break;
232
+				case self::COUNT_REGISTRATIONS_APPROVED:
233
+					$count = $this->registration_model->count([['STS_ID' => RegStatus::APPROVED]]);
234
+					break;
235
+				case self::SUM_TRANSACTIONS_COMPLETE_TOTAL:
236
+					$count = $this->transaction_model->sum(
237
+						[['STS_ID' => EEM_Transaction::complete_status_code]],
238
+						'TXN_total'
239
+					);
240
+					break;
241
+				case self::SUM_TRANSACTIONS_ALL_PAID:
242
+					$count = $this->transaction_model->sum([], 'TXN_paid');
243
+					break;
244
+				default:
245
+					$count = null;
246
+					break;
247
+			}
248
+		} catch (Exception $e) {
249
+			$count = null;
250
+		}
251
+		return $count;
252
+	}
253
+
254
+
255
+	/**
256
+	 * Return the active theme.
257
+	 *
258
+	 * @return false|string
259
+	 */
260
+	private function getActiveThemeStat()
261
+	{
262
+		$theme = wp_get_theme();
263
+		return $theme->get('Name');
264
+	}
265
+
266
+
267
+	/**
268
+	 * @return array
269
+	 */
270
+	private function paymentMethodStats(): array
271
+	{
272
+		$payment_method_stats = [];
273
+		try {
274
+			$active_payment_methods = $this->payment_method_model->get_all_active(
275
+				null,
276
+				['group_by' => 'PMD_type']
277
+			);
278
+			if ($active_payment_methods) {
279
+				foreach ($active_payment_methods as $payment_method) {
280
+					$payment_method_stats[ $payment_method->name() . '_active_payment_method' ] = 1;
281
+				}
282
+			}
283
+		} catch (Exception $e) {
284
+			// do nothing just prevents fatals.
285
+		}
286
+		return $payment_method_stats;
287
+	}
288
+
289
+
290
+	/**
291
+	 * Return a list of active EE add-ons and their versions.
292
+	 *
293
+	 * @return string
294
+	 */
295
+	private function getActiveAddons(): string
296
+	{
297
+		$activeAddons = [];
298
+		$addOns       = EE_Registry::instance()->addons;
299
+		if (! empty($addOns)) {
300
+			foreach ($addOns as $addon) {
301
+				$activeAddons[] = $addon->name() . '@' . $addon->version();
302
+			}
303
+		}
304
+		return implode(',', $activeAddons);
305
+	}
306 306
 }
Please login to merge, or discard this patch.
caffeinated/core/domain/entities/routing/handlers/admin/PueRequests.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -20,126 +20,126 @@
 block discarded – undo
20 20
  */
21 21
 class PueRequests extends Route
22 22
 {
23
-    /**
24
-     * @var   bool
25
-     * @since 5.0.0.p
26
-     */
27
-    private $load_pue = true;
23
+	/**
24
+	 * @var   bool
25
+	 * @since 5.0.0.p
26
+	 */
27
+	private $load_pue = true;
28 28
 
29 29
 
30
-    /**
31
-     * returns true if the current request matches this route
32
-     *
33
-     * @return bool
34
-     * @since   5.0.0.p
35
-     */
36
-    public function matchesCurrentRequest(): bool
37
-    {
38
-        // route may match, but PUE loading is still conditional based on this filter
39
-        $this->load_pue = apply_filters('FHEE__EE_System__brew_espresso__load_pue', true);
40
-        return $this->request->isAdmin() || $this->request->isAjax() || $this->request->isActivation();
41
-    }
30
+	/**
31
+	 * returns true if the current request matches this route
32
+	 *
33
+	 * @return bool
34
+	 * @since   5.0.0.p
35
+	 */
36
+	public function matchesCurrentRequest(): bool
37
+	{
38
+		// route may match, but PUE loading is still conditional based on this filter
39
+		$this->load_pue = apply_filters('FHEE__EE_System__brew_espresso__load_pue', true);
40
+		return $this->request->isAdmin() || $this->request->isAjax() || $this->request->isActivation();
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * @since 5.0.0.p
46
-     */
47
-    protected function registerDependencies()
48
-    {
49
-        if ($this->load_pue) {
50
-            $this->dependency_map->registerDependencies(
51
-                'EventEspresso\caffeinated\core\services\licensing\LicenseService',
52
-                [
53
-                    'EventEspresso\caffeinated\core\domain\services\pue\Stats'     => EE_Dependency_Map::load_from_cache,
54
-                    'EventEspresso\caffeinated\core\domain\services\pue\Config'    => EE_Dependency_Map::load_from_cache,
55
-                    'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache,
56
-                ]
57
-            );
58
-            $this->dependency_map->registerDependencies(
59
-                'EventEspresso\caffeinated\core\domain\services\pue\Stats',
60
-                [
61
-                    'EventEspresso\caffeinated\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
62
-                    'EE_Maintenance_Mode'                                              => EE_Dependency_Map::load_from_cache,
63
-                    'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
64
-                ]
65
-            );
66
-            $this->dependency_map->registerDependencies(
67
-                'EventEspresso\caffeinated\core\domain\services\pue\Config',
68
-                [
69
-                    'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
70
-                    'EE_Config'         => EE_Dependency_Map::load_from_cache,
71
-                ]
72
-            );
73
-            $this->dependency_map->registerDependencies(
74
-                'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer',
75
-                [
76
-                    'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
77
-                    'EEM_Event'          => EE_Dependency_Map::load_from_cache,
78
-                    'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
79
-                    'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
80
-                    'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
81
-                    'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
82
-                    'EE_Config'          => EE_Dependency_Map::load_from_cache,
83
-                ]
84
-            );
85
-            $this->dependency_map->registerDependencies(
86
-                'EventEspresso\caffeinated\core\services\licensing\UserExperienceForm',
87
-                [
88
-                    'EE_Core_Config'         => EE_Dependency_Map::load_from_cache,
89
-                    'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache,
90
-                ]
91
-            );
92
-        }
93
-    }
44
+	/**
45
+	 * @since 5.0.0.p
46
+	 */
47
+	protected function registerDependencies()
48
+	{
49
+		if ($this->load_pue) {
50
+			$this->dependency_map->registerDependencies(
51
+				'EventEspresso\caffeinated\core\services\licensing\LicenseService',
52
+				[
53
+					'EventEspresso\caffeinated\core\domain\services\pue\Stats'     => EE_Dependency_Map::load_from_cache,
54
+					'EventEspresso\caffeinated\core\domain\services\pue\Config'    => EE_Dependency_Map::load_from_cache,
55
+					'EventEspresso\core\domain\services\capabilities\FeatureFlags' => EE_Dependency_Map::load_from_cache,
56
+				]
57
+			);
58
+			$this->dependency_map->registerDependencies(
59
+				'EventEspresso\caffeinated\core\domain\services\pue\Stats',
60
+				[
61
+					'EventEspresso\caffeinated\core\domain\services\pue\Config'        => EE_Dependency_Map::load_from_cache,
62
+					'EE_Maintenance_Mode'                                              => EE_Dependency_Map::load_from_cache,
63
+					'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer' => EE_Dependency_Map::load_from_cache,
64
+				]
65
+			);
66
+			$this->dependency_map->registerDependencies(
67
+				'EventEspresso\caffeinated\core\domain\services\pue\Config',
68
+				[
69
+					'EE_Network_Config' => EE_Dependency_Map::load_from_cache,
70
+					'EE_Config'         => EE_Dependency_Map::load_from_cache,
71
+				]
72
+			);
73
+			$this->dependency_map->registerDependencies(
74
+				'EventEspresso\caffeinated\core\domain\services\pue\StatsGatherer',
75
+				[
76
+					'EEM_Payment_Method' => EE_Dependency_Map::load_from_cache,
77
+					'EEM_Event'          => EE_Dependency_Map::load_from_cache,
78
+					'EEM_Datetime'       => EE_Dependency_Map::load_from_cache,
79
+					'EEM_Ticket'         => EE_Dependency_Map::load_from_cache,
80
+					'EEM_Registration'   => EE_Dependency_Map::load_from_cache,
81
+					'EEM_Transaction'    => EE_Dependency_Map::load_from_cache,
82
+					'EE_Config'          => EE_Dependency_Map::load_from_cache,
83
+				]
84
+			);
85
+			$this->dependency_map->registerDependencies(
86
+				'EventEspresso\caffeinated\core\services\licensing\UserExperienceForm',
87
+				[
88
+					'EE_Core_Config'         => EE_Dependency_Map::load_from_cache,
89
+					'EE_Network_Core_Config' => EE_Dependency_Map::load_from_cache,
90
+				]
91
+			);
92
+		}
93
+	}
94 94
 
95 95
 
96
-    /**
97
-     * implements logic required to run during request
98
-     *
99
-     * @return bool
100
-     * @since   5.0.0.p
101
-     */
102
-    protected function requestHandler(): bool
103
-    {
104
-        add_filter(
105
-            'FHEE__EE_Register_Addon__register',
106
-            [RegisterAddonPUE::class, 'registerPUE'],
107
-            10,
108
-            4
109
-        );
110
-        add_action(
111
-            'AHEE__EE_Register_Addon___load_and_init_addon_class',
112
-            [RegisterAddonPUE::class, 'setAddonPueSlug'],
113
-            10,
114
-            2
115
-        );
116
-        if ($this->load_pue) {
117
-            add_action('AHEE__EE_System__brew_espresso__complete', [$this, 'loadLicenseService']);
118
-            add_filter(
119
-                'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
120
-                [$this, 'loadUserExperienceForm']
121
-            );
122
-        }
96
+	/**
97
+	 * implements logic required to run during request
98
+	 *
99
+	 * @return bool
100
+	 * @since   5.0.0.p
101
+	 */
102
+	protected function requestHandler(): bool
103
+	{
104
+		add_filter(
105
+			'FHEE__EE_Register_Addon__register',
106
+			[RegisterAddonPUE::class, 'registerPUE'],
107
+			10,
108
+			4
109
+		);
110
+		add_action(
111
+			'AHEE__EE_Register_Addon___load_and_init_addon_class',
112
+			[RegisterAddonPUE::class, 'setAddonPueSlug'],
113
+			10,
114
+			2
115
+		);
116
+		if ($this->load_pue) {
117
+			add_action('AHEE__EE_System__brew_espresso__complete', [$this, 'loadLicenseService']);
118
+			add_filter(
119
+				'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
120
+				[$this, 'loadUserExperienceForm']
121
+			);
122
+		}
123 123
 
124
-        return true;
125
-    }
124
+		return true;
125
+	}
126 126
 
127 127
 
128
-    public function loadLicenseService()
129
-    {
130
-        /** @var LicenseService $license_service */
131
-        $license_service = $this->loader->getShared(LicenseService::class);
132
-        $license_service->loadPueClient();
133
-    }
128
+	public function loadLicenseService()
129
+	{
130
+		/** @var LicenseService $license_service */
131
+		$license_service = $this->loader->getShared(LicenseService::class);
132
+		$license_service->loadPueClient();
133
+	}
134 134
 
135 135
 
136
-    /**
137
-     * @throws EE_Error
138
-     */
139
-    public function loadUserExperienceForm(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper
140
-    {
141
-        /** @var UserExperienceForm $uxip_form */
142
-        $uxip_form = $this->loader->getShared(UserExperienceForm::class);
143
-        return $uxip_form->uxipFormSections($org_settings_form);
144
-    }
136
+	/**
137
+	 * @throws EE_Error
138
+	 */
139
+	public function loadUserExperienceForm(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper
140
+	{
141
+		/** @var UserExperienceForm $uxip_form */
142
+		$uxip_form = $this->loader->getShared(UserExperienceForm::class);
143
+		return $uxip_form->uxipFormSections($org_settings_form);
144
+	}
145 145
 }
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Email_Newsletter_Validator.class.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -11,72 +11,72 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator
13 13
 {
14
-    /**
15
-     * EE_Messages_Email_Newsletter_Validator constructor.
16
-     *
17
-     * @param array $fields
18
-     * @param string $context
19
-     * @throws EE_Error
20
-     * @throws ReflectionException
21
-     */
22
-    public function __construct($fields, $context)
23
-    {
24
-        $this->_m_name = 'email';
25
-        $this->_mt_name = 'newsletter';
14
+	/**
15
+	 * EE_Messages_Email_Newsletter_Validator constructor.
16
+	 *
17
+	 * @param array $fields
18
+	 * @param string $context
19
+	 * @throws EE_Error
20
+	 * @throws ReflectionException
21
+	 */
22
+	public function __construct($fields, $context)
23
+	{
24
+		$this->_m_name = 'email';
25
+		$this->_mt_name = 'newsletter';
26 26
 
27
-        parent::__construct($fields, $context);
28
-    }
27
+		parent::__construct($fields, $context);
28
+	}
29 29
 
30
-    /**
31
-     * custom validator (restricting what was originally set by the messenger)
32
-     */
33
-    protected function _modify_validator()
34
-    {
35
-        if ($this->_context === 'attendee') {
36
-            $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
-                'recipient_details',
38
-                'email',
39
-                'organization',
40
-            );
41
-        }
30
+	/**
31
+	 * custom validator (restricting what was originally set by the messenger)
32
+	 */
33
+	protected function _modify_validator()
34
+	{
35
+		if ($this->_context === 'attendee') {
36
+			$this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
+				'recipient_details',
38
+				'email',
39
+				'organization',
40
+			);
41
+		}
42 42
 
43
-        // excluded shortcodes
44
-        $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
-        foreach ($fields as $field) {
46
-            $this->_specific_shortcode_excludes[ $field ] = array(
47
-                '[RECIPIENT_REGISTRATION_CODE]',
48
-                '[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
-                '[EVENT_AUTHOR_EMAIL]',
50
-            );
51
-        }
52
-        $add_excludes = array(
53
-            '[RECIPIENT_FNAME]',
54
-            '[RECIPIENT_LNAME]',
55
-            '[RECIPIENT_EMAIL]',
56
-            '[COMPANY]',
57
-            '[CO_ADD1]',
58
-            '[CO_ADD2]',
59
-            '[CO_CITY]',
60
-            '[CO_STATE]',
61
-            '[CO_ZIP]',
62
-            '[CO_LOGO]',
63
-            '[CO_PHONE]',
64
-            '[CO_LOGO_URL]',
65
-            '[CO_FACEBOOK_URL]',
66
-            '[CO_TWITTER_URL]',
67
-            '[CO_PINTEREST_URL]',
68
-            '[CO_GOOGLE_URL]',
69
-            '[CO_LINKEDIN_URL]',
70
-            '[CO_INSTAGRAM_URL]',
71
-        );
72
-        $this->_specific_shortcode_excludes['from'] =
73
-            array_merge(
74
-                $this->_specific_shortcode_excludes['from'],
75
-                $add_excludes
76
-            );
77
-        $this->_specific_shortcode_excludes['content'] = array_merge(
78
-            $this->_specific_shortcode_excludes['content'],
79
-            array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
-        );
81
-    }
43
+		// excluded shortcodes
44
+		$fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
+		foreach ($fields as $field) {
46
+			$this->_specific_shortcode_excludes[ $field ] = array(
47
+				'[RECIPIENT_REGISTRATION_CODE]',
48
+				'[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
+				'[EVENT_AUTHOR_EMAIL]',
50
+			);
51
+		}
52
+		$add_excludes = array(
53
+			'[RECIPIENT_FNAME]',
54
+			'[RECIPIENT_LNAME]',
55
+			'[RECIPIENT_EMAIL]',
56
+			'[COMPANY]',
57
+			'[CO_ADD1]',
58
+			'[CO_ADD2]',
59
+			'[CO_CITY]',
60
+			'[CO_STATE]',
61
+			'[CO_ZIP]',
62
+			'[CO_LOGO]',
63
+			'[CO_PHONE]',
64
+			'[CO_LOGO_URL]',
65
+			'[CO_FACEBOOK_URL]',
66
+			'[CO_TWITTER_URL]',
67
+			'[CO_PINTEREST_URL]',
68
+			'[CO_GOOGLE_URL]',
69
+			'[CO_LINKEDIN_URL]',
70
+			'[CO_INSTAGRAM_URL]',
71
+		);
72
+		$this->_specific_shortcode_excludes['from'] =
73
+			array_merge(
74
+				$this->_specific_shortcode_excludes['from'],
75
+				$add_excludes
76
+			);
77
+		$this->_specific_shortcode_excludes['content'] = array_merge(
78
+			$this->_specific_shortcode_excludes['content'],
79
+			array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
+		);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
caffeinated/core/libraries/shortcodes/EE_Question_Shortcodes.lib.php 2 patches
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -17,88 +17,88 @@
 block discarded – undo
17 17
  */
18 18
 class EE_Question_Shortcodes extends EE_Shortcodes
19 19
 {
20
-    /**
21
-     * _init_props
22
-     *
23
-     * @access protected
24
-     * @return void
25
-     */
26
-    protected function _init_props()
27
-    {
28
-        $this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
29
-        $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
30
-        $this->_shortcodes = array(
31
-            '[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'),
32
-            '[ANSWER]'   => esc_html__('Will parse to the answer for a question', 'event_espresso'),
33
-        );
34
-    }
20
+	/**
21
+	 * _init_props
22
+	 *
23
+	 * @access protected
24
+	 * @return void
25
+	 */
26
+	protected function _init_props()
27
+	{
28
+		$this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
29
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
30
+		$this->_shortcodes = array(
31
+			'[QUESTION]' => esc_html__('Will parse to a question.', 'event_espresso'),
32
+			'[ANSWER]'   => esc_html__('Will parse to the answer for a question', 'event_espresso'),
33
+		);
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
39
-     * will have to take care of handling.
40
-     *
41
-     * @access protected
42
-     *
43
-     * @param string $shortcode the shortcode to be parsed.
44
-     *
45
-     * @return string parsed shortcode
46
-     * @throws EE_Error
47
-     * @throws ReflectionException
48
-     */
49
-    protected function _parser($shortcode)
50
-    {
51
-        if (
52
-            ! $this->_data instanceof EE_Answer
53
-            || ! isset($this->_extra_data['data'])
54
-            || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee
55
-        ) {
56
-            return '';
57
-        }
37
+	/**
38
+	 * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
39
+	 * will have to take care of handling.
40
+	 *
41
+	 * @access protected
42
+	 *
43
+	 * @param string $shortcode the shortcode to be parsed.
44
+	 *
45
+	 * @return string parsed shortcode
46
+	 * @throws EE_Error
47
+	 * @throws ReflectionException
48
+	 */
49
+	protected function _parser($shortcode)
50
+	{
51
+		if (
52
+			! $this->_data instanceof EE_Answer
53
+			|| ! isset($this->_extra_data['data'])
54
+			|| ! $this->_extra_data['data'] instanceof EE_Messages_Addressee
55
+		) {
56
+			return '';
57
+		}
58 58
 
59
-        switch ($shortcode) {
60
-            case '[QUESTION]':
61
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
62
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
63
-                if (! $question instanceof EE_Question) {
64
-                    return ''; // get out because we can't figure out what the question is.
65
-                }
59
+		switch ($shortcode) {
60
+			case '[QUESTION]':
61
+				$question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
62
+					? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
63
+				if (! $question instanceof EE_Question) {
64
+					return ''; // get out because we can't figure out what the question is.
65
+				}
66 66
 
67
-                return $question->get('QST_display_text');
67
+				return $question->get('QST_display_text');
68 68
 
69
-            case '[ANSWER]':
70
-                // need to get the question to determine the type of question (some questions require translation of the answer).
71
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
72
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
73
-                if (! $question instanceof EE_Question) {
74
-                    return ''; // get out cause we can't figure out what the question type is!
75
-                }
69
+			case '[ANSWER]':
70
+				// need to get the question to determine the type of question (some questions require translation of the answer).
71
+				$question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
72
+					? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
73
+				if (! $question instanceof EE_Question) {
74
+					return ''; // get out cause we can't figure out what the question type is!
75
+				}
76 76
 
77
-                // what we show for the answer depends on the question type!
78
-                switch ($question->get('QST_type')) {
79
-                    case 'STATE':
80
-                        $state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
81
-                        $answer = $state instanceof EE_State ? $state->name() : '';
82
-                        break;
77
+				// what we show for the answer depends on the question type!
78
+				switch ($question->get('QST_type')) {
79
+					case 'STATE':
80
+						$state = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
81
+						$answer = $state instanceof EE_State ? $state->name() : '';
82
+						break;
83 83
 
84
-                    case 'COUNTRY':
85
-                        $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
86
-                        $answer = $country instanceof EE_Country ? $country->name() : '';
87
-                        break;
84
+					case 'COUNTRY':
85
+						$country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
86
+						$answer = $country instanceof EE_Country ? $country->name() : '';
87
+						break;
88 88
 
89
-                    default:
90
-                        $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
91
-                        break;
92
-                }
89
+					default:
90
+						$answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
91
+						break;
92
+				}
93 93
 
94
-                return apply_filters(
95
-                    'FHEE__EE_Question_Shortcodes___parser__answer',
96
-                    $answer,
97
-                    $question,
98
-                    $this->_data
99
-                );
100
-        }
94
+				return apply_filters(
95
+					'FHEE__EE_Question_Shortcodes___parser__answer',
96
+					$answer,
97
+					$question,
98
+					$this->_data
99
+				);
100
+		}
101 101
 
102
-        return '';
103
-    }
102
+		return '';
103
+	}
104 104
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
 
59 59
         switch ($shortcode) {
60 60
             case '[QUESTION]':
61
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
62
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
63
-                if (! $question instanceof EE_Question) {
61
+                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()])
62
+                    ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
63
+                if ( ! $question instanceof EE_Question) {
64 64
                     return ''; // get out because we can't figure out what the question is.
65 65
                 }
66 66
 
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 
69 69
             case '[ANSWER]':
70 70
                 // need to get the question to determine the type of question (some questions require translation of the answer).
71
-                $question = isset($this->_extra_data['data']->questions[ $this->_data->ID() ])
72
-                    ? $this->_extra_data['data']->questions[ $this->_data->ID() ] : $this->_data->question();
73
-                if (! $question instanceof EE_Question) {
71
+                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()])
72
+                    ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
73
+                if ( ! $question instanceof EE_Question) {
74 74
                     return ''; // get out cause we can't figure out what the question type is!
75 75
                 }
76 76
 
Please login to merge, or discard this patch.