Completed
Branch fix/kses-4 (622913)
by
unknown
14:52 queued 13:07
created
admin_pages/maintenance/templates/ee_data_reset_and_delete.template.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     </h4>
36 36
     <p>
37 37
         <?php esc_html_e(
38
-            'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
-            'event_espresso'
40
-        ); ?>
38
+			'Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.',
39
+			'event_espresso'
40
+		); ?>
41 41
     </p>
42 42
     <div class="float-right"><?php echo wp_kses($reset_capabilities_button, AllowedTags::getAllowedTags()); ?></div>
43 43
     <div class="clear"></div>
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
     </h4>
52 52
     <p>
53 53
         <?php esc_html_e(
54
-            ' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
55
-            'event_espresso'
56
-        ); ?>
54
+			' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.',
55
+			'event_espresso'
56
+		); ?>
57 57
     </p>
58 58
     <p>
59 59
         <?php esc_html_e(
60
-            'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
61
-            'event_espresso'
62
-        ); ?>
60
+			'Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.',
61
+			'event_espresso'
62
+		); ?>
63 63
     </p>
64 64
     <div class="float-right">
65 65
         <a class="button button-primary ee-confirm" href="<?php echo esc_url_raw($reset_db_url); ?>">
@@ -78,61 +78,61 @@  discard block
 block discarded – undo
78 78
     </h4>
79 79
     <p>
80 80
         <?php esc_html_e(
81
-            ' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
82
-            'event_espresso'
83
-        ); ?>
81
+			' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
82
+			'event_espresso'
83
+		); ?>
84 84
     </p>
85 85
     <p>
86 86
         <?php esc_html_e(
87
-            'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
88
-            'event_espresso'
89
-        ); ?>
87
+			'If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.',
88
+			'event_espresso'
89
+		); ?>
90 90
     </p>
91 91
     <p class="important-notice">
92 92
         <?php printf(
93
-            esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
94
-            '<em>',
95
-            '</em>'
96
-        ); ?>
93
+			esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'),
94
+			'<em>',
95
+			'</em>'
96
+		); ?>
97 97
         <br />
98 98
     </p>
99 99
     <ol>
100 100
         <li>
101 101
             <?php printf(
102
-                esc_html__(
103
-                    'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
104
-                    'event_espresso'
105
-                ),
106
-                '<strong>',
107
-                '</strong>'
108
-            ); ?>
102
+				esc_html__(
103
+					'First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.',
104
+					'event_espresso'
105
+				),
106
+				'<strong>',
107
+				'</strong>'
108
+			); ?>
109 109
         </li>
110 110
         <li>
111 111
             <?php printf(
112
-                esc_html__(
113
-                    'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
114
-                    'event_espresso'
115
-                ),
116
-                '<strong>',
117
-                '</strong>'
118
-            ); ?>
112
+				esc_html__(
113
+					'Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s',
114
+					'event_espresso'
115
+				),
116
+				'<strong>',
117
+				'</strong>'
118
+			); ?>
119 119
         </li>
120 120
         <li>
121 121
             <?php printf(
122
-                esc_html__(
123
-                    'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
124
-                    'event_espresso'
125
-                ),
126
-                '<strong>',
127
-                '</strong>'
128
-            ); ?>
122
+				esc_html__(
123
+					'Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s',
124
+					'event_espresso'
125
+				),
126
+				'<strong>',
127
+				'</strong>'
128
+			); ?>
129 129
         </li>
130 130
         <li>
131 131
             <?php printf(
132
-                esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'),
133
-                '<strong>',
134
-                '</strong>'
135
-            ); ?>
132
+				esc_html__('Note: Event Espresso 4 categories are %snot%s deleted by this script', 'event_espresso'),
133
+				'<strong>',
134
+				'</strong>'
135
+			); ?>
136 136
             <br>
137 137
             <a href="<?php echo esc_url_raw(admin_url('edit-tags.php?taxonomy=espresso_event_categories')); ?>">
138 138
                 <?php esc_html_e('You can go here to delete Event Espresso categories', 'event_espresso'); ?>
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_migration_page.template.php 1 patch
Indentation   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -36,55 +36,55 @@  discard block
 block discarded – undo
36 36
             <h3 class="espresso-header">
37 37
                 <span class="dashicons dashicons-flag ee-icon-size-22"></span>
38 38
                 <?php
39
-                echo esc_html(
40
-                    apply_filters(
41
-                        'FHEE__ee_migration_page__header',
42
-                        sprintf(
43
-                            __("Your Event Espresso data needs to be updated.", "event_espresso"),
44
-                            $current_db_state,
45
-                            $next_db_state
46
-                        ),
47
-                        $current_db_state,
48
-                        $next_db_state
49
-                    )
50
-                );
51
-                ?>
39
+				echo esc_html(
40
+					apply_filters(
41
+						'FHEE__ee_migration_page__header',
42
+						sprintf(
43
+							__("Your Event Espresso data needs to be updated.", "event_espresso"),
44
+							$current_db_state,
45
+							$next_db_state
46
+						),
47
+						$current_db_state,
48
+						$next_db_state
49
+					)
50
+				);
51
+				?>
52 52
             </h3>
53 53
         <?php } elseif ($show_most_recent_migration) { ?>
54 54
             <h3 class="espresso-header">
55 55
                 <span class="dashicons dashicons-awards ee-icon-size-22"></span>
56 56
                 <?php echo esc_html(
57
-                    apply_filters(
58
-                        'FHEE__ee_migration_page__done_migration_header',
59
-                        sprintf(
60
-                            __(
61
-                                'Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
62
-                                "event_espresso"
63
-                            ),
64
-                            $ultimate_db_state
65
-                        )
66
-                    )
67
-                ); ?>
57
+					apply_filters(
58
+						'FHEE__ee_migration_page__done_migration_header',
59
+						sprintf(
60
+							__(
61
+								'Congratulations! Your database is "up-to-date" and you are ready to begin using %s',
62
+								"event_espresso"
63
+							),
64
+							$ultimate_db_state
65
+						)
66
+					)
67
+				); ?>
68 68
             </h3>
69 69
             <p>
70 70
                 <?php echo esc_html(
71
-                    apply_filters(
72
-                        'FHEE__ee_migration_page__p_after_done_migration_header',
73
-                        sprintf(
74
-                            __(
75
-                                "Time to find out about all the great new features %s has to offer.",
76
-                                "event_espresso"
77
-                            ),
78
-                            $ultimate_db_state
79
-                        )
80
-                    )
81
-                ); ?> &nbsp;
71
+					apply_filters(
72
+						'FHEE__ee_migration_page__p_after_done_migration_header',
73
+						sprintf(
74
+							__(
75
+								"Time to find out about all the great new features %s has to offer.",
76
+								"event_espresso"
77
+							),
78
+							$ultimate_db_state
79
+						)
80
+					)
81
+				); ?> &nbsp;
82 82
                 <b>
83 83
                     <a class="button-primary"
84 84
                        id='get-started-after-migrate'
85 85
                        href="<?php
86
-                        echo esc_url_raw(add_query_arg(['page' => 'espresso_about'], admin_url('admin.php')));
87
-                        ?>"
86
+						echo esc_url_raw(add_query_arg(['page' => 'espresso_about'], admin_url('admin.php')));
87
+						?>"
88 88
                     >
89 89
                         <?php esc_html_e("Let's Get Started", "event_espresso"); ?>&nbsp;
90 90
                         <span class="dashicons dashicons-arrow-right ee-icon-size-22" style="margin:0;"></span>
@@ -95,46 +95,46 @@  discard block
 block discarded – undo
95 95
 
96 96
 
97 97
         <?php
98
-        if ($show_backup_db_text) {
99
-            echo wp_kses($migration_options_html, AllowedTags::getAllowedTags());
100
-        } ?>
98
+		if ($show_backup_db_text) {
99
+			echo wp_kses($migration_options_html, AllowedTags::getAllowedTags());
100
+		} ?>
101 101
 
102 102
         <?php
103
-        if ($show_most_recent_migration) {
104
-            if ($most_recent_migration instanceof EE_Data_Migration_Script_Base) {
105
-                if ($most_recent_migration->can_continue()) {
106
-                    // tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
103
+		if ($show_most_recent_migration) {
104
+			if ($most_recent_migration instanceof EE_Data_Migration_Script_Base) {
105
+				if ($most_recent_migration->can_continue()) {
106
+					// tell the user they should continue their migration because it appears to be unfinished... well, assuming there were no errors ?>
107 107
                     <h3 class="espresso-header">
108 108
                         <span class="dashicons dashicons-star-half ee-icon-size-22"></span>
109 109
                         <?php printf(
110
-                            esc_html__(
111
-                                "It appears that your previous Database Update (%s) is incomplete, and should be resumed",
112
-                                "event_espresso"
113
-                            ),
114
-                            $most_recent_migration->pretty_name()
115
-                        ); ?>
110
+							esc_html__(
111
+								"It appears that your previous Database Update (%s) is incomplete, and should be resumed",
112
+								"event_espresso"
113
+							),
114
+							$most_recent_migration->pretty_name()
115
+						); ?>
116 116
                     </h3>
117 117
                     <?php
118
-                } elseif ($most_recent_migration->is_broken()) {
119
-                    // tell the user the migration failed, and they should notify EE?>
118
+				} elseif ($most_recent_migration->is_broken()) {
119
+					// tell the user the migration failed, and they should notify EE?>
120 120
                     <h3 class="espresso-header">
121 121
                         <span class="dashicons dashicons-no ee-icon-size-22"></span>
122 122
                         <?php echo esc_html($most_recent_migration->get_feedback_message()) ?>
123 123
                     </h3>
124 124
                     <?php
125
-                }
126
-                // display errors or not of the most recent migration ran
127
-                if ($most_recent_migration->get_errors()) {
128
-                    ?>
125
+				}
126
+				// display errors or not of the most recent migration ran
127
+				if ($most_recent_migration->get_errors()) {
128
+					?>
129 129
                     <div class="ee-attention">
130 130
                         <strong>
131 131
                             <?php printf(
132
-                                esc_html__(
133
-                                    "Warnings occurred during your last Database Update (%s):",
134
-                                    'event_espresso'
135
-                                ),
136
-                                $most_recent_migration->pretty_name()
137
-                            ); ?>
132
+								esc_html__(
133
+									"Warnings occurred during your last Database Update (%s):",
134
+									'event_espresso'
135
+								),
136
+								$most_recent_migration->pretty_name()
137
+							); ?>
138 138
                         </strong>
139 139
                         <a id="show-hide-migration-warnings" class="display-the-hidden">
140 140
                             <?php esc_html_e("Show Warnings", 'event_espresso'); ?>
@@ -146,32 +146,32 @@  discard block
 block discarded – undo
146 146
                         </ul>
147 147
                     </div>
148 148
                     <?php
149
-                } else {
150
-                    // there were no errors during the last migration, just say so?>
149
+				} else {
150
+					// there were no errors during the last migration, just say so?>
151 151
                     <h2>
152 152
                         <?php printf(
153
-                            esc_html__(
154
-                                "The last Database Update (%s) ran successfully without errors.",
155
-                                "event_espresso"
156
-                            ),
157
-                            $most_recent_migration->pretty_name()
158
-                        ); ?>
153
+							esc_html__(
154
+								"The last Database Update (%s) ran successfully without errors.",
155
+								"event_espresso"
156
+							),
157
+							$most_recent_migration->pretty_name()
158
+						); ?>
159 159
                     </h2>
160 160
                     <?php
161
-                }
162
-            }
163
-        }
164
-        // end of: if ( $show_most_recent_migration )
165
-        ?>
161
+				}
162
+			}
163
+		}
164
+		// end of: if ( $show_most_recent_migration )
165
+		?>
166 166
 
167 167
     </div>
168 168
     <!--end of #migration-prep-->
169 169
 
170 170
     <?php
171
-    if ($show_migration_progress) { ?>
171
+	if ($show_migration_progress) { ?>
172 172
         <div id='migration-monitor' <?php echo ($show_backup_db_text ? "style='display:none'" : ''); ?>>
173 173
             <?php
174
-            if ($show_backup_db_text) { ?>
174
+			if ($show_backup_db_text) { ?>
175 175
                 <p>
176 176
                     <a class="toggle-migration-monitor small-text" style="cursor: pointer;">
177 177
                         <span class="dashicons dashicons-arrow-left-alt2" style="top:0;"></span>
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 
182 182
                 </p>
183 183
                 <?php
184
-            } ?>
184
+			} ?>
185 185
             <div id='progress-area'>
186 186
                 <h3 class="espresso-header">
187 187
                     <?php
188
-                    echo sprintf(
189
-                        _n(
190
-                            "The following task needs to be performed:",
191
-                            "The following %s tasks need to be performed:",
192
-                            count($script_names),
193
-                            "event_espresso"
194
-                        ),
195
-                        count($script_names)
196
-                    ); ?>
188
+					echo sprintf(
189
+						_n(
190
+							"The following task needs to be performed:",
191
+							"The following %s tasks need to be performed:",
192
+							count($script_names),
193
+							"event_espresso"
194
+						),
195
+						count($script_names)
196
+					); ?>
197 197
                 </h3>
198 198
                 <ul style="list-style: inside;">
199 199
                     <?php foreach ($script_names as $script_name) { ?>
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
                 <?php if (count($script_names) > 1) { ?>
205 205
                     <p>
206 206
                         <?php esc_html_e(
207
-                            "Please note: after each task is completed you will need to continue the Database Update, or report an error to Event Espresso.",
208
-                            "event_espresso"
209
-                        ); ?>
207
+							"Please note: after each task is completed you will need to continue the Database Update, or report an error to Event Espresso.",
208
+							"event_espresso"
209
+						); ?>
210 210
                     </p>
211 211
                 <?php } ?>
212 212
 
@@ -217,19 +217,19 @@  discard block
 block discarded – undo
217 217
                         </span>
218 218
                         <br />
219 219
                         <?php esc_html_e(
220
-                            "Depending on the number of events and the complexity of the information in your database, this could take a few minutes.",
221
-                            "event_espresso"
222
-                        ); ?>
220
+							"Depending on the number of events and the complexity of the information in your database, this could take a few minutes.",
221
+							"event_espresso"
222
+						); ?>
223 223
                     </p>
224 224
                     <p>
225 225
                         <?php printf(
226
-                            esc_html__(
227
-                                "%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.",
228
-                                "event_espresso"
229
-                            ),
230
-                            '<strong>',
231
-                            '</strong>'
232
-                        ); ?>
226
+							esc_html__(
227
+								"%sPlease be patient and do NOT navigate away from this page once the migration has begun%s. If any issues arise due to existing malformed data, an itemized report will be made available to you after the migration has completed.",
228
+								"event_espresso"
229
+							),
230
+							'<strong>',
231
+							'</strong>'
232
+						); ?>
233 233
                     </p>
234 234
                     <p>
235 235
                         <?php esc_html_e("Click the button below to begin the migration process.", "event_espresso") ?>
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 
246 246
                 <button id='start-migration' class='button-primary'>
247 247
                     <?php echo ($show_continue_current_migration_script
248
-                        ? esc_html__("Continue Database Update", "event_espresso")
249
-                        : esc_html__("Begin Database Update", "event_espresso")); ?>
248
+						? esc_html__("Continue Database Update", "event_espresso")
249
+						: esc_html__("Begin Database Update", "event_espresso")); ?>
250 250
                 </button>
251 251
                 <br class="clear" />
252 252
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
         </div>
263 263
 
264 264
         <?php
265
-    }
266
-    if ($show_maintenance_switch) {
267
-        ?>
265
+	}
266
+	if ($show_maintenance_switch) {
267
+		?>
268 268
         <h2>
269 269
             <span class="dashicons dashicons-admin-tools"></span>
270 270
             <?php esc_html_e('Set Event Espresso Maintenance Mode', 'event_espresso'); ?>
@@ -279,9 +279,9 @@  discard block
 block discarded – undo
279 279
                                    type='radio'
280 280
                                    value="0"
281 281
                                 <?php echo ($mMode_level === EE_Maintenance_Mode::level_0_not_in_maintenance
282
-                                    ? 'checked="checked"'
283
-                                    : '');
284
-                                ?>
282
+									? 'checked="checked"'
283
+									: '');
284
+								?>
285 285
                             />
286 286
                         </td>
287 287
                         <th align="left">
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
                             </label>
291 291
                             <p class='description' style="font-weight: normal;">
292 292
                                 <?php esc_html_e(
293
-                                    "This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.",
294
-                                    "event_espresso"
295
-                                ); ?>
293
+									"This is the normal operating mode for Event Espresso and allows all functionality to be viewed by all site visitors.",
294
+									"event_espresso"
295
+								); ?>
296 296
                             </p>
297 297
                         </th>
298 298
                     </tr>
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
                                    type='radio'
304 304
                                    value="1"
305 305
                                 <?php echo ($mMode_level === EE_Maintenance_Mode::level_1_frontend_only_maintenance
306
-                                    ? 'checked="checked"'
307
-                                    : '');
308
-                                ?>
306
+									? 'checked="checked"'
307
+									: '');
308
+								?>
309 309
                             />
310 310
                         </td>
311 311
                         <th align="left">
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
                             </label>
315 315
                             <p class='description' style="font-weight: normal;">
316 316
                                 <?php esc_html_e(
317
-                                    "This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.",
318
-                                    "event_espresso"
319
-                                ); ?>
317
+									"This disables Event Espresso frontend functionality for all site visitors that are not administrators, and allows you to configure and/or test things on the frontend of your website before others can see.",
318
+									"event_espresso"
319
+								); ?>
320 320
                             </p>
321 321
                         </th>
322 322
                     </tr>
@@ -330,6 +330,6 @@  discard block
 block discarded – undo
330 330
             </p>
331 331
         </form>
332 332
         <?php
333
-    } ?>
333
+	} ?>
334 334
 
335 335
 </div>
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_system_stati_page.template.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -19,38 +19,38 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function ee_recurse_into_array_for_display($data, $depth = 0, $td = true)
21 21
 {
22
-    if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
23
-        // is_object($incomplete_class) actually returns false, hence why we check for it
24
-        $data = json_decode(json_encode($data), true);
25
-    }
26
-    if (empty($data)) {
27
-        return;
28
-    }
29
-    if (is_array($data)) {
30
-        $depth++;
31
-        ksort($data, SORT_NATURAL | SORT_FLAG_CASE);
32
-        if (EEH_Array::is_associative_array($data)) { ?>
22
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
23
+		// is_object($incomplete_class) actually returns false, hence why we check for it
24
+		$data = json_decode(json_encode($data), true);
25
+	}
26
+	if (empty($data)) {
27
+		return;
28
+	}
29
+	if (is_array($data)) {
30
+		$depth++;
31
+		ksort($data, SORT_NATURAL | SORT_FLAG_CASE);
32
+		if (EEH_Array::is_associative_array($data)) { ?>
33 33
             <table class='ee-system-stati ee-system-stati-<?php echo absint($depth); ?>'>
34 34
                 <tbody>
35 35
                     <?php foreach ($data as $data_key => $data_value) {
36
-                        // if the value is a single element array with no key,
37
-                        // and the value is a primitive (not an array, object, etc.)
38
-                        if (
39
-                            is_array($data_value)
40
-                            && count($data_value) === 1
41
-                            && empty(key($data_value))
42
-                            && is_scalar(reset($data_value))
43
-                        ) {
44
-                            ?>
36
+						// if the value is a single element array with no key,
37
+						// and the value is a primitive (not an array, object, etc.)
38
+						if (
39
+							is_array($data_value)
40
+							&& count($data_value) === 1
41
+							&& empty(key($data_value))
42
+							&& is_scalar(reset($data_value))
43
+						) {
44
+							?>
45 45
                             <tr>
46 46
                                 <td class="ee-system-stati-value" colspan="2">
47 47
                                     <?php echo esc_html(reset($data_value)); ?>
48 48
                                 </td>
49 49
                             </tr>
50 50
                             <?php
51
-                            continue;
52
-                        }
53
-                        ?>
51
+							continue;
52
+						}
53
+						?>
54 54
                         <tr>
55 55
                             <td class='ee-system-stati-key'>
56 56
                                 <span class="ee-system-stati-label">
@@ -65,31 +65,31 @@  discard block
 block discarded – undo
65 65
                             <?php if (is_scalar($data_value)) { ?>
66 66
                                 <?php ee_recurse_into_array_for_display($data_value, $depth); ?>
67 67
                             <?php } else {
68
-                                if (is_array($data_value) && count($data_value) === 1) {
69
-                                    // verify that values have been set
70
-                                    $keys_only = empty(
71
-                                        array_filter(
72
-                                            array_values($data_value),
73
-                                            function ($v) {
74
-                                                return $v !== null && (is_array($v) || trim($v) !== '');
75
-                                            }
76
-                                        )
77
-                                    );
78
-                                    // if the array only consists of keys (no values)
79
-                                    if ($keys_only) {
80
-                                        // then use keys for values
81
-                                        $data_value = array_keys($data_value);
82
-                                        // but if there is only one value now
83
-                                        if (count($data_value) === 1) {
84
-                                            // then pass that single value back into this function
85
-                                            // this prevents extra empty layers of nothing being added to the output
86
-                                            ee_recurse_into_array_for_display(reset($data_value), $depth);
87
-                                            // need to finish the row off though
88
-                                            echo '</tr>';
89
-                                            continue;
90
-                                        }
91
-                                    }
92
-                                } ?>
68
+								if (is_array($data_value) && count($data_value) === 1) {
69
+									// verify that values have been set
70
+									$keys_only = empty(
71
+										array_filter(
72
+											array_values($data_value),
73
+											function ($v) {
74
+												return $v !== null && (is_array($v) || trim($v) !== '');
75
+											}
76
+										)
77
+									);
78
+									// if the array only consists of keys (no values)
79
+									if ($keys_only) {
80
+										// then use keys for values
81
+										$data_value = array_keys($data_value);
82
+										// but if there is only one value now
83
+										if (count($data_value) === 1) {
84
+											// then pass that single value back into this function
85
+											// this prevents extra empty layers of nothing being added to the output
86
+											ee_recurse_into_array_for_display(reset($data_value), $depth);
87
+											// need to finish the row off though
88
+											echo '</tr>';
89
+											continue;
90
+										}
91
+									}
92
+								} ?>
93 93
                                 <td class="ee-system-stati-sub-values">
94 94
                                     <?php ee_recurse_into_array_for_display($data_value, $depth); ?>
95 95
                                 </td>
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
                 <?php } ?>
108 108
             </ul>
109 109
         <?php } else {
110
-            // there's no key (label) and there's only one value,
111
-            // so let's just pass that value back into this function,
112
-            // but reset the depth back to where it was.
113
-            // this prevents extra empty layers of nothing being added to the output
114
-            $depth--;
115
-            ee_recurse_into_array_for_display(reset($data), $depth, false);
116
-        }
117
-    } else {
118
-        echo ($td ? '<td class="ee-system-stati-value">' : '');
119
-        // simple value
120
-        echo wp_kses($data, AllowedTags::getAllowedTags());
121
-        echo ($td ? '</td>' : '');
122
-    }
110
+			// there's no key (label) and there's only one value,
111
+			// so let's just pass that value back into this function,
112
+			// but reset the depth back to where it was.
113
+			// this prevents extra empty layers of nothing being added to the output
114
+			$depth--;
115
+			ee_recurse_into_array_for_display(reset($data), $depth, false);
116
+		}
117
+	} else {
118
+		echo ($td ? '<td class="ee-system-stati-value">' : '');
119
+		// simple value
120
+		echo wp_kses($data, AllowedTags::getAllowedTags());
121
+		echo ($td ? '</td>' : '');
122
+	}
123 123
 }
124 124
 
125 125
 ?>
Please login to merge, or discard this patch.
core/domain/entities/notifications/PersistentAdminNotice.php 2 patches
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -26,315 +26,315 @@
 block discarded – undo
26 26
 class PersistentAdminNotice implements RequiresCapCheckInterface
27 27
 {
28 28
 
29
-    /**
30
-     * @var string $name
31
-     */
32
-    protected $name = '';
33
-
34
-    /**
35
-     * @var string $message
36
-     */
37
-    protected $message = '';
38
-
39
-    /**
40
-     * @var boolean $force_update
41
-     */
42
-    protected $force_update = false;
43
-
44
-    /**
45
-     * @var string $capability
46
-     */
47
-    protected $capability = 'manage_options';
48
-
49
-    /**
50
-     * @var string $cap_context
51
-     */
52
-    protected $cap_context = 'view persistent admin notice';
53
-
54
-    /**
55
-     * @var boolean $dismissed
56
-     */
57
-    protected $dismissed = false;
58
-
59
-    /**
60
-     * @var CapCheckInterface $cap_check
61
-     */
62
-    protected $cap_check;
63
-
64
-    /**
65
-     * if true, then this notice will be deleted from the database
66
-     *
67
-     * @var boolean $purge
68
-     */
69
-    protected $purge = false;
70
-
71
-    /**
72
-     * gets set to true if notice is successfully registered with the PersistentAdminNoticeManager
73
-     * if false, and WP_DEBUG is on, then an exception will be thrown in the admin footer
74
-     *
75
-     * @var boolean $registered
76
-     */
77
-    private $registered = false;
78
-
79
-
80
-    /**
81
-     * PersistentAdminNotice constructor
82
-     *
83
-     * @param string $name         [required] the name, or key of the Persistent Admin Notice to be stored
84
-     * @param string $message      [required] the message to be stored persistently until dismissed
85
-     * @param bool   $force_update enforce the reappearance of a persistent message
86
-     * @param string $capability   user capability required to view this notice
87
-     * @param string $cap_context  description for why the cap check is being performed
88
-     * @param bool   $dismissed    whether or not the user has already dismissed/viewed this notice
89
-     * @throws InvalidDataTypeException
90
-     */
91
-    public function __construct(
92
-        $name,
93
-        $message,
94
-        $force_update = false,
95
-        $capability = 'manage_options',
96
-        $cap_context = 'view persistent admin notice',
97
-        $dismissed = false
98
-    ) {
99
-        $this->setName($name);
100
-        $this->setMessage($message);
101
-        $this->setForceUpdate($force_update);
102
-        $this->setCapability($capability);
103
-        $this->setCapContext($cap_context);
104
-        $this->setDismissed($dismissed);
105
-        add_action(
106
-            'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
107
-            array($this, 'registerPersistentAdminNotice')
108
-        );
109
-        add_action('shutdown', array($this, 'confirmRegistered'), 999);
110
-    }
111
-
112
-
113
-    /**
114
-     * @return string
115
-     */
116
-    public function getName()
117
-    {
118
-        return $this->name;
119
-    }
120
-
121
-
122
-    /**
123
-     * @param string $name
124
-     * @throws InvalidDataTypeException
125
-     */
126
-    private function setName($name)
127
-    {
128
-        if (! is_string($name)) {
129
-            throw new InvalidDataTypeException('$name', $name, 'string');
130
-        }
131
-        $this->name = sanitize_key($name);
132
-    }
133
-
134
-
135
-    /**
136
-     * @return string
137
-     */
138
-    public function getMessage()
139
-    {
140
-        return $this->message;
141
-    }
142
-
143
-
144
-    /**
145
-     * @param string $message
146
-     * @throws InvalidDataTypeException
147
-     */
148
-    private function setMessage($message)
149
-    {
150
-        if (! is_string($message)) {
151
-            throw new InvalidDataTypeException('$message', $message, 'string');
152
-        }
153
-        $allowedtags = AllowedTags::getAllowedTags();
154
-        $this->message = wp_kses($message, $allowedtags);
155
-    }
156
-
157
-
158
-    /**
159
-     * @return bool
160
-     */
161
-    public function getForceUpdate()
162
-    {
163
-        return $this->force_update;
164
-    }
165
-
166
-
167
-    /**
168
-     * @param bool $force_update
169
-     */
170
-    private function setForceUpdate($force_update)
171
-    {
172
-        $this->force_update = filter_var($force_update, FILTER_VALIDATE_BOOLEAN);
173
-    }
174
-
175
-
176
-    /**
177
-     * @return string
178
-     */
179
-    public function getCapability()
180
-    {
181
-        return $this->capability;
182
-    }
183
-
184
-
185
-    /**
186
-     * @param string $capability
187
-     * @throws InvalidDataTypeException
188
-     */
189
-    private function setCapability($capability)
190
-    {
191
-        if (! is_string($capability)) {
192
-            throw new InvalidDataTypeException('$capability', $capability, 'string');
193
-        }
194
-        $this->capability = ! empty($capability) ? $capability : 'manage_options';
195
-    }
196
-
197
-
198
-    /**
199
-     * @return string
200
-     */
201
-    public function getCapContext()
202
-    {
203
-        return $this->cap_context;
204
-    }
205
-
206
-
207
-    /**
208
-     * @param string $cap_context
209
-     * @throws InvalidDataTypeException
210
-     */
211
-    private function setCapContext($cap_context)
212
-    {
213
-        if (! is_string($cap_context)) {
214
-            throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
215
-        }
216
-        $this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
217
-    }
218
-
219
-
220
-    /**
221
-     * @return bool
222
-     */
223
-    public function getDismissed()
224
-    {
225
-        return $this->dismissed;
226
-    }
227
-
228
-
229
-    /**
230
-     * @param bool $dismissed
231
-     */
232
-    public function setDismissed($dismissed)
233
-    {
234
-        $this->dismissed = filter_var($dismissed, FILTER_VALIDATE_BOOLEAN);
235
-    }
236
-
237
-
238
-    /**
239
-     * @return CapCheckInterface
240
-     * @throws InvalidDataTypeException
241
-     */
242
-    public function getCapCheck()
243
-    {
244
-        if (! $this->cap_check instanceof CapCheckInterface) {
245
-            $this->setCapCheck(
246
-                new CapCheck(
247
-                    $this->capability,
248
-                    $this->cap_context
249
-                )
250
-            );
251
-        }
252
-        return $this->cap_check;
253
-    }
254
-
255
-
256
-    /**
257
-     * @param CapCheckInterface $cap_check
258
-     */
259
-    private function setCapCheck(CapCheckInterface $cap_check)
260
-    {
261
-        $this->cap_check = $cap_check;
262
-    }
263
-
264
-
265
-    /**
266
-     * @return bool
267
-     */
268
-    public function getPurge()
269
-    {
270
-        return $this->purge;
271
-    }
272
-
273
-
274
-    /**
275
-     * @param bool $purge
276
-     */
277
-    public function setPurge($purge)
278
-    {
279
-        $this->purge = filter_var($purge, FILTER_VALIDATE_BOOLEAN);
280
-    }
281
-
282
-
283
-    /**
284
-     * given a valid PersistentAdminNotice Collection,
285
-     * this notice will be added if it is not already found in the collection (using its name as the identifier)
286
-     * if an existing notice is found that has already been dismissed,
287
-     * but we are overriding with a forced update, then we will toggle its dismissed state,
288
-     * so that the notice is displayed again
289
-     *
290
-     * @param Collection $persistent_admin_notice_collection
291
-     * @throws InvalidEntityException
292
-     * @throws InvalidDataTypeException
293
-     * @throws DuplicateCollectionIdentifierException
294
-     */
295
-    public function registerPersistentAdminNotice(Collection $persistent_admin_notice_collection)
296
-    {
297
-        if ($this->registered) {
298
-            return;
299
-        }
300
-        // first check if this notice has already been added to the collection
301
-        if ($persistent_admin_notice_collection->has($this->name)) {
302
-            /** @var PersistentAdminNotice $existing */
303
-            $existing = $persistent_admin_notice_collection->get($this->name);
304
-            // we don't need to add it again (we can't actually)
305
-            // but if it has already been dismissed, and we are overriding with a forced update
306
-            if ($existing->getDismissed() && $this->getForceUpdate()) {
307
-                // then toggle the notice's dismissed state to true
308
-                // so that it gets displayed again
309
-                $existing->setDismissed(false);
310
-                // and make sure the message is set
311
-                $existing->setMessage($this->message);
312
-            }
313
-        } else {
314
-            $persistent_admin_notice_collection->add($this, $this->name);
315
-        }
316
-        $this->registered = true;
317
-    }
318
-
319
-
320
-    /**
321
-     * @throws Exception
322
-     */
323
-    public function confirmRegistered()
324
-    {
325
-        if (! apply_filters('PersistentAdminNoticeManager__registerAndSaveNotices__complete', false)) {
326
-            PersistentAdminNoticeManager::loadRegisterAndSaveNotices();
327
-        }
328
-        if (! $this->registered && WP_DEBUG) {
329
-            throw new DomainException(
330
-                sprintf(
331
-                    esc_html__(
332
-                        'The "%1$s" PersistentAdminNotice was not successfully registered. Please ensure that it is being created prior to either the "admin_notices" or "network_admin_notices" hooks being triggered.',
333
-                        'event_espresso'
334
-                    ),
335
-                    $this->name
336
-                )
337
-            );
338
-        }
339
-    }
29
+	/**
30
+	 * @var string $name
31
+	 */
32
+	protected $name = '';
33
+
34
+	/**
35
+	 * @var string $message
36
+	 */
37
+	protected $message = '';
38
+
39
+	/**
40
+	 * @var boolean $force_update
41
+	 */
42
+	protected $force_update = false;
43
+
44
+	/**
45
+	 * @var string $capability
46
+	 */
47
+	protected $capability = 'manage_options';
48
+
49
+	/**
50
+	 * @var string $cap_context
51
+	 */
52
+	protected $cap_context = 'view persistent admin notice';
53
+
54
+	/**
55
+	 * @var boolean $dismissed
56
+	 */
57
+	protected $dismissed = false;
58
+
59
+	/**
60
+	 * @var CapCheckInterface $cap_check
61
+	 */
62
+	protected $cap_check;
63
+
64
+	/**
65
+	 * if true, then this notice will be deleted from the database
66
+	 *
67
+	 * @var boolean $purge
68
+	 */
69
+	protected $purge = false;
70
+
71
+	/**
72
+	 * gets set to true if notice is successfully registered with the PersistentAdminNoticeManager
73
+	 * if false, and WP_DEBUG is on, then an exception will be thrown in the admin footer
74
+	 *
75
+	 * @var boolean $registered
76
+	 */
77
+	private $registered = false;
78
+
79
+
80
+	/**
81
+	 * PersistentAdminNotice constructor
82
+	 *
83
+	 * @param string $name         [required] the name, or key of the Persistent Admin Notice to be stored
84
+	 * @param string $message      [required] the message to be stored persistently until dismissed
85
+	 * @param bool   $force_update enforce the reappearance of a persistent message
86
+	 * @param string $capability   user capability required to view this notice
87
+	 * @param string $cap_context  description for why the cap check is being performed
88
+	 * @param bool   $dismissed    whether or not the user has already dismissed/viewed this notice
89
+	 * @throws InvalidDataTypeException
90
+	 */
91
+	public function __construct(
92
+		$name,
93
+		$message,
94
+		$force_update = false,
95
+		$capability = 'manage_options',
96
+		$cap_context = 'view persistent admin notice',
97
+		$dismissed = false
98
+	) {
99
+		$this->setName($name);
100
+		$this->setMessage($message);
101
+		$this->setForceUpdate($force_update);
102
+		$this->setCapability($capability);
103
+		$this->setCapContext($cap_context);
104
+		$this->setDismissed($dismissed);
105
+		add_action(
106
+			'AHEE__EventEspresso_core_services_notifications_PersistentAdminNoticeManager__registerNotices',
107
+			array($this, 'registerPersistentAdminNotice')
108
+		);
109
+		add_action('shutdown', array($this, 'confirmRegistered'), 999);
110
+	}
111
+
112
+
113
+	/**
114
+	 * @return string
115
+	 */
116
+	public function getName()
117
+	{
118
+		return $this->name;
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param string $name
124
+	 * @throws InvalidDataTypeException
125
+	 */
126
+	private function setName($name)
127
+	{
128
+		if (! is_string($name)) {
129
+			throw new InvalidDataTypeException('$name', $name, 'string');
130
+		}
131
+		$this->name = sanitize_key($name);
132
+	}
133
+
134
+
135
+	/**
136
+	 * @return string
137
+	 */
138
+	public function getMessage()
139
+	{
140
+		return $this->message;
141
+	}
142
+
143
+
144
+	/**
145
+	 * @param string $message
146
+	 * @throws InvalidDataTypeException
147
+	 */
148
+	private function setMessage($message)
149
+	{
150
+		if (! is_string($message)) {
151
+			throw new InvalidDataTypeException('$message', $message, 'string');
152
+		}
153
+		$allowedtags = AllowedTags::getAllowedTags();
154
+		$this->message = wp_kses($message, $allowedtags);
155
+	}
156
+
157
+
158
+	/**
159
+	 * @return bool
160
+	 */
161
+	public function getForceUpdate()
162
+	{
163
+		return $this->force_update;
164
+	}
165
+
166
+
167
+	/**
168
+	 * @param bool $force_update
169
+	 */
170
+	private function setForceUpdate($force_update)
171
+	{
172
+		$this->force_update = filter_var($force_update, FILTER_VALIDATE_BOOLEAN);
173
+	}
174
+
175
+
176
+	/**
177
+	 * @return string
178
+	 */
179
+	public function getCapability()
180
+	{
181
+		return $this->capability;
182
+	}
183
+
184
+
185
+	/**
186
+	 * @param string $capability
187
+	 * @throws InvalidDataTypeException
188
+	 */
189
+	private function setCapability($capability)
190
+	{
191
+		if (! is_string($capability)) {
192
+			throw new InvalidDataTypeException('$capability', $capability, 'string');
193
+		}
194
+		$this->capability = ! empty($capability) ? $capability : 'manage_options';
195
+	}
196
+
197
+
198
+	/**
199
+	 * @return string
200
+	 */
201
+	public function getCapContext()
202
+	{
203
+		return $this->cap_context;
204
+	}
205
+
206
+
207
+	/**
208
+	 * @param string $cap_context
209
+	 * @throws InvalidDataTypeException
210
+	 */
211
+	private function setCapContext($cap_context)
212
+	{
213
+		if (! is_string($cap_context)) {
214
+			throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
215
+		}
216
+		$this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
217
+	}
218
+
219
+
220
+	/**
221
+	 * @return bool
222
+	 */
223
+	public function getDismissed()
224
+	{
225
+		return $this->dismissed;
226
+	}
227
+
228
+
229
+	/**
230
+	 * @param bool $dismissed
231
+	 */
232
+	public function setDismissed($dismissed)
233
+	{
234
+		$this->dismissed = filter_var($dismissed, FILTER_VALIDATE_BOOLEAN);
235
+	}
236
+
237
+
238
+	/**
239
+	 * @return CapCheckInterface
240
+	 * @throws InvalidDataTypeException
241
+	 */
242
+	public function getCapCheck()
243
+	{
244
+		if (! $this->cap_check instanceof CapCheckInterface) {
245
+			$this->setCapCheck(
246
+				new CapCheck(
247
+					$this->capability,
248
+					$this->cap_context
249
+				)
250
+			);
251
+		}
252
+		return $this->cap_check;
253
+	}
254
+
255
+
256
+	/**
257
+	 * @param CapCheckInterface $cap_check
258
+	 */
259
+	private function setCapCheck(CapCheckInterface $cap_check)
260
+	{
261
+		$this->cap_check = $cap_check;
262
+	}
263
+
264
+
265
+	/**
266
+	 * @return bool
267
+	 */
268
+	public function getPurge()
269
+	{
270
+		return $this->purge;
271
+	}
272
+
273
+
274
+	/**
275
+	 * @param bool $purge
276
+	 */
277
+	public function setPurge($purge)
278
+	{
279
+		$this->purge = filter_var($purge, FILTER_VALIDATE_BOOLEAN);
280
+	}
281
+
282
+
283
+	/**
284
+	 * given a valid PersistentAdminNotice Collection,
285
+	 * this notice will be added if it is not already found in the collection (using its name as the identifier)
286
+	 * if an existing notice is found that has already been dismissed,
287
+	 * but we are overriding with a forced update, then we will toggle its dismissed state,
288
+	 * so that the notice is displayed again
289
+	 *
290
+	 * @param Collection $persistent_admin_notice_collection
291
+	 * @throws InvalidEntityException
292
+	 * @throws InvalidDataTypeException
293
+	 * @throws DuplicateCollectionIdentifierException
294
+	 */
295
+	public function registerPersistentAdminNotice(Collection $persistent_admin_notice_collection)
296
+	{
297
+		if ($this->registered) {
298
+			return;
299
+		}
300
+		// first check if this notice has already been added to the collection
301
+		if ($persistent_admin_notice_collection->has($this->name)) {
302
+			/** @var PersistentAdminNotice $existing */
303
+			$existing = $persistent_admin_notice_collection->get($this->name);
304
+			// we don't need to add it again (we can't actually)
305
+			// but if it has already been dismissed, and we are overriding with a forced update
306
+			if ($existing->getDismissed() && $this->getForceUpdate()) {
307
+				// then toggle the notice's dismissed state to true
308
+				// so that it gets displayed again
309
+				$existing->setDismissed(false);
310
+				// and make sure the message is set
311
+				$existing->setMessage($this->message);
312
+			}
313
+		} else {
314
+			$persistent_admin_notice_collection->add($this, $this->name);
315
+		}
316
+		$this->registered = true;
317
+	}
318
+
319
+
320
+	/**
321
+	 * @throws Exception
322
+	 */
323
+	public function confirmRegistered()
324
+	{
325
+		if (! apply_filters('PersistentAdminNoticeManager__registerAndSaveNotices__complete', false)) {
326
+			PersistentAdminNoticeManager::loadRegisterAndSaveNotices();
327
+		}
328
+		if (! $this->registered && WP_DEBUG) {
329
+			throw new DomainException(
330
+				sprintf(
331
+					esc_html__(
332
+						'The "%1$s" PersistentAdminNotice was not successfully registered. Please ensure that it is being created prior to either the "admin_notices" or "network_admin_notices" hooks being triggered.',
333
+						'event_espresso'
334
+					),
335
+					$this->name
336
+				)
337
+			);
338
+		}
339
+	}
340 340
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     private function setName($name)
127 127
     {
128
-        if (! is_string($name)) {
128
+        if ( ! is_string($name)) {
129 129
             throw new InvalidDataTypeException('$name', $name, 'string');
130 130
         }
131 131
         $this->name = sanitize_key($name);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function setMessage($message)
149 149
     {
150
-        if (! is_string($message)) {
150
+        if ( ! is_string($message)) {
151 151
             throw new InvalidDataTypeException('$message', $message, 'string');
152 152
         }
153 153
         $allowedtags = AllowedTags::getAllowedTags();
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     private function setCapability($capability)
190 190
     {
191
-        if (! is_string($capability)) {
191
+        if ( ! is_string($capability)) {
192 192
             throw new InvalidDataTypeException('$capability', $capability, 'string');
193 193
         }
194 194
         $this->capability = ! empty($capability) ? $capability : 'manage_options';
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function setCapContext($cap_context)
212 212
     {
213
-        if (! is_string($cap_context)) {
213
+        if ( ! is_string($cap_context)) {
214 214
             throw new InvalidDataTypeException('$cap_context', $cap_context, 'string');
215 215
         }
216 216
         $this->cap_context = ! empty($cap_context) ? $cap_context : 'view persistent admin notice';
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
      */
242 242
     public function getCapCheck()
243 243
     {
244
-        if (! $this->cap_check instanceof CapCheckInterface) {
244
+        if ( ! $this->cap_check instanceof CapCheckInterface) {
245 245
             $this->setCapCheck(
246 246
                 new CapCheck(
247 247
                     $this->capability,
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function confirmRegistered()
324 324
     {
325
-        if (! apply_filters('PersistentAdminNoticeManager__registerAndSaveNotices__complete', false)) {
325
+        if ( ! apply_filters('PersistentAdminNoticeManager__registerAndSaveNotices__complete', false)) {
326 326
             PersistentAdminNoticeManager::loadRegisterAndSaveNotices();
327 327
         }
328
-        if (! $this->registered && WP_DEBUG) {
328
+        if ( ! $this->registered && WP_DEBUG) {
329 329
             throw new DomainException(
330 330
                 sprintf(
331 331
                     esc_html__(
Please login to merge, or discard this patch.
core/helpers/EEH_HTML.helper.php 1 patch
Indentation   +861 added lines, -861 removed lines patch added patch discarded remove patch
@@ -1,875 +1,875 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- *
5
- * Class EEH_HTML
6
- *
4
+  *
5
+  * Class EEH_HTML
6
+  *
7 7
   * Sometimes when writing PHP you need to generate some standard HTML,
8 8
   * but either not enough to warrant creating a template file,
9 9
   * or the amount of PHP conditionals and/or loops peppered throughout the HTML
10 10
   * just make it really ugly and difficult to read.
11 11
   * This class simply adds a bunch of methods for generating basic HTML tags.
12 12
   * Most of the methods have the same name as the HTML tag they generate, and most have the same set of parameters.
13
- *
14
- * @package         Event Espresso
15
- * @subpackage    core
16
- * @author              Brent Christensen
17
- *
18
- *
19
- */
13
+  *
14
+  * @package         Event Espresso
15
+  * @subpackage    core
16
+  * @author              Brent Christensen
17
+  *
18
+  *
19
+  */
20 20
 class EEH_HTML
21 21
 {
22 22
 
23
-    /**
24
-     *  instance of the EEH_Autoloader object
25
-     *  @var    $_instance
26
-     *  @access     private
27
-     */
28
-    private static $_instance;
29
-
30
-    /**
31
-     *  @var array  $_indent
32
-     *  @access     private
33
-     */
34
-    private static $_indent = array();
35
-
36
-
37
-
38
-    /**
39
-     *  @singleton method used to instantiate class object
40
-     *  @access public
41
-     *  @return EEH_HTML
42
-     */
43
-    public static function instance()
44
-    {
45
-        // check if class object is instantiated, and instantiated properly
46
-        if (! self::$_instance instanceof EEH_HTML) {
47
-            self::$_instance = new EEH_HTML();
48
-        }
49
-        return self::$_instance;
50
-    }
51
-
52
-
53
-
54
-    /**
55
-     *  class constructor
56
-     *
57
-     * @access    private
58
-     * @return \EEH_HTML
59
-     */
60
-    private function __construct()
61
-    {
62
-        // set some initial formatting for table indentation
63
-        EEH_HTML::$_indent = array(
64
-            'table'     => 0,
65
-            'thead' => 1,
66
-            'tbody' => 1,
67
-            'tr'    => 2,
68
-            'th'    => 3,
69
-            'td'    => 3,
70
-            'div'   => 0,
71
-            'h1'    => 0,
72
-            'h2'    => 0,
73
-            'h3'    => 0,
74
-            'h4'    => 0,
75
-            'h5'    => 0,
76
-            'h6'    => 0,
77
-            'p'     => 0,
78
-            'ul'    => 0,
79
-            'li'    => 1
80
-        );
81
-    }
82
-
83
-
84
-
85
-    /**
86
-     * Generates an opening HTML <XX> tag and adds any passed attributes
87
-     * if passed content, it will also add that, as well as the closing </XX> tag
88
-     *
89
-     * @access protected
90
-     * @param string $tag
91
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
92
-     * @param string $id - html id attribute
93
-     * @param string $class - html class attribute
94
-     * @param string $style - html style attribute for applying inline styles
95
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
96
-     * @param bool   $force_close
97
-     * @return string
98
-     */
99
-    protected static function _open_tag(
100
-        $tag = 'div',
101
-        $content = '',
102
-        $id = '',
103
-        $class = '',
104
-        $style = '',
105
-        $other_attributes = '',
106
-        $force_close = false
107
-    ) {
108
-        $attributes = ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
109
-        $attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
110
-        $attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
111
-        $attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
112
-        $html = EEH_HTML::nl(0, $tag) . '<' . $tag . $attributes . '>';
113
-        $html .= ! empty($content) ? EEH_HTML::nl(1, $tag) . $content : '';
114
-        $indent = ! empty($content) || $force_close ? true : false;
115
-        $html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
116
-        return $html;
117
-    }
118
-
119
-
120
-
121
-    /**
122
-     * Generates HTML closing </XX> tag - if passed the id or class attribute
123
-     * used for the opening tag, will append a comment
124
-     *
23
+	/**
24
+	 *  instance of the EEH_Autoloader object
25
+	 *  @var    $_instance
26
+	 *  @access     private
27
+	 */
28
+	private static $_instance;
29
+
30
+	/**
31
+	 *  @var array  $_indent
32
+	 *  @access     private
33
+	 */
34
+	private static $_indent = array();
35
+
36
+
37
+
38
+	/**
39
+	 *  @singleton method used to instantiate class object
40
+	 *  @access public
41
+	 *  @return EEH_HTML
42
+	 */
43
+	public static function instance()
44
+	{
45
+		// check if class object is instantiated, and instantiated properly
46
+		if (! self::$_instance instanceof EEH_HTML) {
47
+			self::$_instance = new EEH_HTML();
48
+		}
49
+		return self::$_instance;
50
+	}
51
+
52
+
53
+
54
+	/**
55
+	 *  class constructor
56
+	 *
57
+	 * @access    private
58
+	 * @return \EEH_HTML
59
+	 */
60
+	private function __construct()
61
+	{
62
+		// set some initial formatting for table indentation
63
+		EEH_HTML::$_indent = array(
64
+			'table'     => 0,
65
+			'thead' => 1,
66
+			'tbody' => 1,
67
+			'tr'    => 2,
68
+			'th'    => 3,
69
+			'td'    => 3,
70
+			'div'   => 0,
71
+			'h1'    => 0,
72
+			'h2'    => 0,
73
+			'h3'    => 0,
74
+			'h4'    => 0,
75
+			'h5'    => 0,
76
+			'h6'    => 0,
77
+			'p'     => 0,
78
+			'ul'    => 0,
79
+			'li'    => 1
80
+		);
81
+	}
82
+
83
+
84
+
85
+	/**
86
+	 * Generates an opening HTML <XX> tag and adds any passed attributes
87
+	 * if passed content, it will also add that, as well as the closing </XX> tag
88
+	 *
89
+	 * @access protected
90
+	 * @param string $tag
91
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
92
+	 * @param string $id - html id attribute
93
+	 * @param string $class - html class attribute
94
+	 * @param string $style - html style attribute for applying inline styles
95
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
96
+	 * @param bool   $force_close
97
+	 * @return string
98
+	 */
99
+	protected static function _open_tag(
100
+		$tag = 'div',
101
+		$content = '',
102
+		$id = '',
103
+		$class = '',
104
+		$style = '',
105
+		$other_attributes = '',
106
+		$force_close = false
107
+	) {
108
+		$attributes = ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
109
+		$attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
110
+		$attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
111
+		$attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
112
+		$html = EEH_HTML::nl(0, $tag) . '<' . $tag . $attributes . '>';
113
+		$html .= ! empty($content) ? EEH_HTML::nl(1, $tag) . $content : '';
114
+		$indent = ! empty($content) || $force_close ? true : false;
115
+		$html .= ! empty($content) || $force_close ? EEH_HTML::_close_tag($tag, $id, $class, $indent) : '';
116
+		return $html;
117
+	}
118
+
119
+
120
+
121
+	/**
122
+	 * Generates HTML closing </XX> tag - if passed the id or class attribute
123
+	 * used for the opening tag, will append a comment
124
+	 *
125 125
 *@access protected
126
-     * @param string $tag
127
-     * @param string $id - html id attribute
128
-     * @param string $class - html class attribute
129
-     * @param bool   $indent
130
-     * @return string
131
-     */
132
-    protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = true)
133
-    {
134
-        $comment = '';
135
-        if ($id) {
136
-            $comment = EEH_HTML::comment('close ' . $id) . EEH_HTML::nl(0, $tag);
137
-        } elseif ($class) {
138
-            $comment = EEH_HTML::comment('close ' . $class) . EEH_HTML::nl(0, $tag);
139
-        }
140
-        $html = $indent ? EEH_HTML::nl(-1, $tag) : '';
141
-        $html .= '</' . $tag . '>' . $comment;
142
-        return $html;
143
-    }
144
-
145
-
146
-
147
-    /**
148
-     *  div - generates HTML opening <div> tag and adds any passed attributes
149
-     *  to add an id use:       echo EEH_HTML::div( 'this is some content', 'footer' );
150
-     *  to add a class use:     echo EEH_HTML::div( 'this is some content', '', 'float_left' );
151
-     *  to add a both an id and a class use:    echo EEH_HTML::div( 'this is some content', 'footer', 'float_left' );
152
-     *
153
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
154
-     * @param string $id - html id attribute
155
-     * @param string $class - html class attribute
156
-     * @param string $style - html style attribute for applying inline styles
157
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
158
-     * @return string
159
-     */
160
-    public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
161
-    {
162
-        return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * Generates HTML closing </div> tag - if passed the id or class attribute used for the opening div tag, will append a comment
169
-     * usage: echo EEH_HTML::divx();
170
-     *
171
-     * @param string $id - html id attribute
172
-     * @param string $class - html class attribute
173
-     * @return string
174
-     */
175
-    public static function divx($id = '', $class = '')
176
-    {
177
-        return EEH_HTML::_close_tag('div', $id, $class);
178
-    }
179
-
180
-
181
-
182
-    /**
183
-     * Generates HTML <h1></h1> tags, inserts content, and adds any passed attributes
184
-     * usage: echo EEH_HTML::h1( 'This is a Heading' );
185
-     *
186
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
187
-     * @param string $id - html id attribute
188
-     * @param string $class - html class attribute
189
-     * @param string $style - html style attribute for applying inline styles
190
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
191
-     * @return string
192
-     */
193
-    public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
194
-    {
195
-        return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, true);
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     * Generates HTML <h2></h2> tags, inserts content, and adds any passed attributes
202
-     * usage: echo EEH_HTML::h2( 'This is a Heading' );
203
-     *
204
-     * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
205
-     * @param string $id               - html id attribute
206
-     * @param string $class            - html class attribute
207
-     * @param string $style            - html style attribute for applying inline styles
208
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
209
-     * @return string
210
-     */
211
-    public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
212
-    {
213
-        return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, true);
214
-    }
215
-
216
-
217
-
218
-    /**
219
-     * Generates HTML <h3></h3> tags, inserts content, and adds any passed attributes
220
-     * usage: echo EEH_HTML::h3( 'This is a Heading' );
221
-     *
222
-     * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
223
-     * @param string $id               - html id attribute
224
-     * @param string $class            - html class attribute
225
-     * @param string $style            - html style attribute for applying inline styles
226
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
227
-     * @return string
228
-     */
229
-    public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
230
-    {
231
-        return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, true);
232
-    }
233
-
234
-
235
-
236
-    /**
237
-     * Generates HTML <h4></h4> tags, inserts content, and adds any passed attributes
238
-     * usage: echo EEH_HTML::h4( 'This is a Heading' );
239
-     *
240
-     * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
241
-     * @param string $id               - html id attribute
242
-     * @param string $class            - html class attribute
243
-     * @param string $style            - html style attribute for applying inline styles
244
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
245
-     * @return string
246
-     */
247
-    public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
248
-    {
249
-        return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, true);
250
-    }
251
-
252
-
253
-
254
-    /**
255
-     * Generates HTML <h5></h5> tags, inserts content, and adds any passed attributes
256
-     * usage: echo EEH_HTML::h5( 'This is a Heading' );
257
-     *
258
-     * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
259
-     * @param string $id               - html id attribute
260
-     * @param string $class            - html class attribute
261
-     * @param string $style            - html style attribute for applying inline styles
262
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
263
-     * @return string
264
-     */
265
-    public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
266
-    {
267
-        return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, true);
268
-    }
269
-
270
-
271
-
272
-    /**
273
-     * Generates HTML <h6></h6> tags, inserts content, and adds any passed attributes
274
-     * usage: echo EEH_HTML::h6( 'This is a Heading' );
275
-     *
276
-     * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
277
-     * @param string $id               - html id attribute
278
-     * @param string $class            - html class attribute
279
-     * @param string $style            - html style attribute for applying inline styles
280
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
281
-     * @return string
282
-     */
283
-    public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
284
-    {
285
-        return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, true);
286
-    }
287
-
288
-
289
-
290
-    /**
291
-     * Generates HTML <p></p> tags, inserts content, and adds any passed attributes
292
-     * usage: echo EEH_HTML::p( 'this is a paragraph' );
293
-     *
294
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
295
-     * @param string $id - html id attribute
296
-     * @param string $class - html class attribute
297
-     * @param string $style - html style attribute for applying inline styles
298
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
299
-     * @return string
300
-     */
301
-    public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
302
-    {
303
-        return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, true);
304
-    }
305
-
306
-
307
-
308
-    /**
309
-     *  ul - generates HTML opening <ul> tag and adds any passed attributes
310
-     *  usage:      echo EEH_HTML::ul( 'my-list-id', 'my-list-class' );
311
-     *
312
-     * @param string $id - html id attribute
313
-     * @param string $class - html class attribute
314
-     * @param string $style - html style attribute for applying inline styles
315
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
316
-     * @return string
317
-     */
318
-    public static function ul($id = '', $class = '', $style = '', $other_attributes = '')
319
-    {
320
-        return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
321
-    }
322
-
323
-
324
-
325
-    /**
326
-     * Generates HTML closing </ul> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
327
-     * usage: echo EEH_HTML::ulx();
328
-     *
329
-     * @param string $id - html id attribute
330
-     * @param string $class - html class attribute
331
-     * @return string
332
-     */
333
-    public static function ulx($id = '', $class = '')
334
-    {
335
-        return EEH_HTML::_close_tag('ul', $id, $class);
336
-    }
337
-
338
-
339
-
340
-    /**
341
-     * Generates HTML <li> tag, inserts content, and adds any passed attributes
342
-     * if passed content, it will also add that, as well as the closing </li> tag
343
-     * usage: echo EEH_HTML::li( 'this is a line item' );
344
-     *
345
-     * @param string $id - html id attribute
346
-     * @param string $class - html class attribute
347
-     * @param string $style - html style attribute for applying inline styles
348
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
349
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
350
-     * @return string
351
-     */
352
-    public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
353
-    {
354
-        return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
355
-    }
356
-
357
-
358
-
359
-    /**
360
-     * Generates HTML closing </li> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
361
-     * usage: echo EEH_HTML::lix();
362
-     *
363
-     * @param string $id - html id attribute
364
-     * @param string $class - html class attribute
365
-     * @return string
366
-     */
367
-    public static function lix($id = '', $class = '')
368
-    {
369
-        return EEH_HTML::_close_tag('li', $id, $class);
370
-    }
371
-
372
-
373
-
374
-    /**
375
-     *    table - generates an HTML <table> tag and adds any passed attributes
376
-     *    usage: echo EEH_HTML::table();
377
-     *
378
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
379
-     * @param string $id - html id attribute
380
-     * @param string $class - html class attribute
381
-     * @param string $style - html style attribute for applying inline styles
382
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
383
-     * @return string
384
-     */
385
-    public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
386
-    {
387
-        return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
388
-    }
389
-
390
-
391
-
392
-    /**
393
-     * tablex - generates an HTML </table> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
394
-     *
395
-     * @param string $id - html id attribute
396
-     * @param string $class - html class attribute
397
-     * @return string
398
-     */
399
-    public static function tablex($id = '', $class = '')
400
-    {
401
-        return EEH_HTML::_close_tag('table', $id, $class);
402
-    }
403
-
404
-
405
-
406
-    /**
407
-     *    thead - generates an HTML <thead> tag and adds any passed attributes
408
-     *    usage: echo EEH_HTML::thead();
409
-     *
410
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
411
-     * @param string $id - html id attribute
412
-     * @param string $class - html class attribute
413
-     * @param string $style - html style attribute for applying inline styles
414
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
415
-     * @return string
416
-     */
417
-    public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
418
-    {
419
-        return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
420
-    }
421
-
422
-
423
-
424
-    /**
425
-     * theadx - generates an HTML </thead> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
426
-     *
427
-     * @param string $id - html id attribute
428
-     * @param string $class - html class attribute
429
-     * @return string
430
-     */
431
-    public static function theadx($id = '', $class = '')
432
-    {
433
-        return EEH_HTML::_close_tag('thead', $id, $class);
434
-    }
435
-
436
-
437
-
438
-    /**
439
-     *    tbody - generates an HTML <tbody> tag and adds any passed attributes
440
-     *    usage: echo EEH_HTML::tbody();
441
-     *
442
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
443
-     * @param string $id - html id attribute
444
-     * @param string $class - html class attribute
445
-     * @param string $style - html style attribute for applying inline styles
446
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
447
-     * @return string
448
-     */
449
-    public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
450
-    {
451
-        return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
452
-    }
453
-
454
-
455
-
456
-    /**
457
-     * tbodyx - generates an HTML </tbody> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
458
-     *
459
-     * @param string $id - html id attribute
460
-     * @param string $class - html class attribute
461
-     * @return string
462
-     */
463
-    public static function tbodyx($id = '', $class = '')
464
-    {
465
-        return EEH_HTML::_close_tag('tbody', $id, $class);
466
-    }
467
-
468
-
469
-
470
-    /**
471
-     *    tr - generates an HTML <tr> tag and adds any passed attributes
472
-     *    usage: echo EEH_HTML::tr();
473
-     *
474
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
475
-     * @param string $id - html id attribute
476
-     * @param string $class - html class attribute
477
-     * @param string $style - html style attribute for applying inline styles
478
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
479
-     * @return string
480
-     */
481
-    public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
482
-    {
483
-        return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
484
-    }
485
-
486
-
487
-
488
-    /**
489
-     * trx - generates an HTML </tr> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
490
-     *
491
-     * @param string $id - html id attribute
492
-     * @param string $class - html class attribute
493
-     * @return string
494
-     */
495
-    public static function trx($id = '', $class = '')
496
-    {
497
-        return EEH_HTML::_close_tag('tr', $id, $class);
498
-    }
499
-
500
-
501
-
502
-    /**
503
-     *    th - generates an HTML <th> tag and adds any passed attributes
504
-     *    usage: echo EEH_HTML::th();
505
-     *
506
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
507
-     * @param string $id - html id attribute
508
-     * @param string $class - html class attribute
509
-     * @param string $style - html style attribute for applying inline styles
510
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
511
-     * @return string
512
-     */
513
-    public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
514
-    {
515
-        return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
516
-    }
517
-
518
-
519
-
520
-    /**
521
-     * thx - generates an HTML </th> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
522
-     *
523
-     * @param string $id - html id attribute
524
-     * @param string $class - html class attribute
525
-     * @return string
526
-     */
527
-    public static function thx($id = '', $class = '')
528
-    {
529
-        return EEH_HTML::_close_tag('th', $id, $class);
530
-    }
531
-
532
-
533
-
534
-    /**
535
-     *    td - generates an HTML <td> tag and adds any passed attributes
536
-     *    usage: echo EEH_HTML::td();
537
-     *
538
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
539
-     * @param string $id - html id attribute
540
-     * @param string $class - html class attribute
541
-     * @param string $style - html style attribute for applying inline styles
542
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
543
-     * @return string
544
-     */
545
-    public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
546
-    {
547
-        return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
548
-    }
549
-
550
-
551
-
552
-    /**
553
-     * tdx - generates an HTML </td> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
554
-     *
555
-     * @param string $id - html id attribute
556
-     * @param string $class - html class attribute
557
-     * @return string
558
-     */
559
-    public static function tdx($id = '', $class = '')
560
-    {
561
-        return EEH_HTML::_close_tag('td', $id, $class);
562
-    }
563
-
564
-
565
-
566
-    /**
567
-     * no_row - for generating a "hidden" table row, good for embedding tables within tables
568
-     * generates a new table row with one td cell that spans however many columns you set
569
-     * removes all styles from the tr and td
570
-     *
571
-     * @param string $content
572
-     * @param int    $colspan
573
-     * @return string
574
-     */
575
-    public static function no_row($content = '', $colspan = 2)
576
-    {
577
-        return EEH_HTML::tr(
578
-            EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"'),
579
-            '',
580
-            '',
581
-            'padding:0; border:none;'
582
-        );
583
-    }
584
-
585
-
586
-
587
-    /**
588
-     * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
589
-     * usage: echo EEH_HTML::span( 'this is some inline text' );
590
-     *
591
-     * @access public
592
-     * @param string $href URL to link to
593
-     * @param string $link_text - the text that will become "hyperlinked"
594
-     * @param string $title - html title attribute
595
-     * @param string $id - html id attribute
596
-     * @param string $class - html class attribute
597
-     * @param string $style - html style attribute for applying inline styles
598
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
599
-     * @return string
600
-     */
601
-    public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '')
602
-    {
603
-        $link_text = ! empty($link_text) ? $link_text : $href;
604
-        $attributes = ! empty($href) ? ' href="' . $href . '"' : '';
605
-        $attributes .= ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
606
-        $attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
607
-        $attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
608
-        $attributes .= ! empty($title) ? ' title="' . esc_attr($title) . '"' : '';
609
-        $attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
610
-        return "<a{$attributes}>{$link_text}</a>";
611
-    }
612
-
613
-
614
-
615
-    /**
616
-     *    img - generates an HTML <img> tag and adds any passed attributes
617
-     *    usage: echo EEH_HTML::img();
618
-     *
619
-     * @param string $src - html src attribute ie: the path or URL to the image
620
-     * @param string $alt - html alt attribute
621
-     * @param string $id - html id attribute
622
-     * @param string $class - html class attribute
623
-     * @param string $style - html style attribute for applying inline styles
624
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
625
-     * @return string
626
-     */
627
-    public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '')
628
-    {
629
-        $attributes = ! empty($src) ? ' src="' . esc_url_raw($src) . '"' : '';
630
-        $attributes .= ! empty($alt) ? ' alt="' . esc_attr($alt) . '"' : '';
631
-        $attributes .= ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
632
-        $attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
633
-        $attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
634
-        $attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
635
-        return '<img' . $attributes  . '/>';
636
-    }
637
-
638
-
639
-
640
-    /**
641
-     * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
642
-     * usage: echo EEH_HTML::span( 'this is some inline text' );
643
-     *
644
-     * @access protected
645
-     * @param string $tag
646
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
647
-     * @param string $id - html id attribute
648
-     * @param string $class - html class attribute
649
-     * @param string $style - html style attribute for applying inline styles
650
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
651
-     * @return string
652
-     */
653
-    protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '')
654
-    {
655
-        $attributes = ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
656
-        $attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
657
-        $attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
658
-        $attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
659
-        return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
660
-    }
661
-
662
-
663
-
664
-    /**
665
-     * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
666
-     * usage: echo EEH_HTML::span( 'this is some inline text' );
667
-     *
668
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
669
-     * @param string $id - html id attribute
670
-     * @param string $class - html class attribute
671
-     * @param string $style - html style attribute for applying inline styles
672
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
673
-     * @return string
674
-     */
675
-    public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
676
-    {
677
-        return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
678
-    }
679
-
680
-
681
-
682
-    /**
683
-     * Generates HTML <span></span> tags, inserts content, and adds any passed attributes
684
-     * usage: echo EEH_HTML::span( 'this is some inline text' );
685
-     *
686
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
687
-     * @param string $id - html id attribute
688
-     * @param string $class - html class attribute
689
-     * @param string $style - html style attribute for applying inline styles
690
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
691
-     * @return string
692
-     */
693
-    public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
694
-    {
695
-        return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
696
-    }
697
-
698
-
699
-
700
-    /**
701
-     * Generates HTML <span></span> tags, inserts content, and adds any passed attributes
702
-     * usage: echo EEH_HTML::span( 'this is some inline text' );
703
-     *
704
-     * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
705
-     * @param string $id - html id attribute
706
-     * @param string $class - html class attribute
707
-     * @param string $style - html style attribute for applying inline styles
708
-     * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
709
-     * @return string
710
-     */
711
-    public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
712
-    {
713
-        return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
714
-    }
715
-
716
-
717
-
718
-    /**
719
-     * Generates an html <--  comment --> tag
720
-     *  usage: echo comment( 'this is a comment' );
721
-     *
722
-     * @param string $comment
723
-     * @return string
724
-     */
725
-    public static function comment($comment = '')
726
-    {
727
-        return ! empty($comment) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
728
-    }
729
-
730
-
731
-
732
-    /**
733
-     * br - generates a line break
734
-     *
735
-     * @param int $nmbr - the number of line breaks to return
736
-     * @return string
737
-     */
738
-    public static function br($nmbr = 1)
739
-    {
740
-        return str_repeat('<br />', $nmbr);
741
-    }
742
-
743
-
744
-
745
-    /**
746
-     * nbsp - generates non-breaking space entities based on number supplied
747
-     *
748
-     * @param int $nmbr - the number of non-breaking spaces to return
749
-     * @return string
750
-     */
751
-    public static function nbsp($nmbr = 1)
752
-    {
753
-        return str_repeat('&nbsp;', $nmbr);
754
-    }
755
-
756
-
757
-
758
-    /**
759
-     * sanitize_id
760
-     *
761
-     * functionally does the same as the wp_core function sanitize_key except it does NOT use
762
-     * strtolower and allows capitals.
763
-     *
764
-     * @param string $id
765
-     * @return string
766
-     */
767
-    public static function sanitize_id($id = '')
768
-    {
769
-        $key = str_replace(' ', '-', trim($id));
770
-        return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
771
-    }
772
-
773
-
774
-
775
-    /**
776
-     * return a newline and tabs ("nl" stands for "new line")
777
-     *
778
-     * @param int    $indent the number of tabs to ADD to the current indent (can be negative or zero)
779
-     * @param string $tag
780
-     * @return string - newline character plus # of indents passed (can be + or -)
781
-     */
782
-    public static function nl($indent = 0, $tag = 'none')
783
-    {
784
-        $html = "\n";
785
-        EEH_HTML::indent($indent, $tag);
786
-        for ($x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++) {
787
-            $html .= "\t";
788
-        }
789
-        return $html;
790
-    }
791
-
792
-
793
-
794
-    /**
795
-     * Changes the indents used in EEH_HTML::nl. Often its convenient to change
796
-     * the indentation level without actually creating a new line
797
-     *
798
-     * @param int    $indent can be negative to decrease the indentation level
799
-     * @param string $tag
800
-     */
801
-    public static function indent($indent, $tag = 'none')
802
-    {
803
-        static $default_indentation = false;
804
-        if (! $default_indentation) {
805
-            EEH_HTML::_set_default_indentation();
806
-            $default_indentation = true;
807
-        }
808
-        if (! isset(EEH_HTML::$_indent[ $tag ])) {
809
-            EEH_HTML::$_indent[ $tag ] = 0;
810
-        }
811
-        EEH_HTML::$_indent[ $tag ] += (int) $indent;
812
-        EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
813
-    }
814
-
815
-
816
-    /**
817
-     *  class _set_default_indentation
818
-     *
819
-     * @access    private
820
-     */
821
-    private static function _set_default_indentation()
822
-    {
823
-        // set some initial formatting for table indentation
824
-        EEH_HTML::$_indent = array(
825
-            'none'  => 0,
826
-            'form'  => 0,
827
-            'radio'     => 0,
828
-            'checkbox'  => 0,
829
-            'select'    => 0,
830
-            'option' => 0,
831
-            'optgroup' => 0,
832
-            'table'     => 1,
833
-            'thead' => 2,
834
-            'tbody' => 2,
835
-            'tr'    => 3,
836
-            'th'    => 4,
837
-            'td'    => 4,
838
-            'div'   => 0,
839
-            'h1'    => 0,
840
-            'h2'    => 0,
841
-            'h3'    => 0,
842
-            'h4'    => 0,
843
-            'h5'    => 0,
844
-            'h6'    => 0,
845
-            'p'     => 0,
846
-            'ul'    => 0,
847
-            'li'    => 1
848
-        );
849
-    }
850
-
851
-
852
-
853
-    /**
854
-     * Retrieves the list of tags considered "simple", that are probably safe for
855
-     * use in inputs
856
-     * @global array $allowedtags
857
-     * @return array
858
-     */
859
-    public static function get_simple_tags()
860
-    {
861
-        global $allowedtags;
862
-        $tags_we_allow = array_merge_recursive(
863
-            $allowedtags,
864
-            [
865
-                'ol' => [],
866
-                'ul' => [],
867
-                'li' => [],
868
-                'br' => [],
869
-                'p' => [],
870
-                'a' => ['target']
871
-            ]
872
-        );
873
-        return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow);
874
-    }
126
+	 * @param string $tag
127
+	 * @param string $id - html id attribute
128
+	 * @param string $class - html class attribute
129
+	 * @param bool   $indent
130
+	 * @return string
131
+	 */
132
+	protected static function _close_tag($tag = 'div', $id = '', $class = '', $indent = true)
133
+	{
134
+		$comment = '';
135
+		if ($id) {
136
+			$comment = EEH_HTML::comment('close ' . $id) . EEH_HTML::nl(0, $tag);
137
+		} elseif ($class) {
138
+			$comment = EEH_HTML::comment('close ' . $class) . EEH_HTML::nl(0, $tag);
139
+		}
140
+		$html = $indent ? EEH_HTML::nl(-1, $tag) : '';
141
+		$html .= '</' . $tag . '>' . $comment;
142
+		return $html;
143
+	}
144
+
145
+
146
+
147
+	/**
148
+	 *  div - generates HTML opening <div> tag and adds any passed attributes
149
+	 *  to add an id use:       echo EEH_HTML::div( 'this is some content', 'footer' );
150
+	 *  to add a class use:     echo EEH_HTML::div( 'this is some content', '', 'float_left' );
151
+	 *  to add a both an id and a class use:    echo EEH_HTML::div( 'this is some content', 'footer', 'float_left' );
152
+	 *
153
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
154
+	 * @param string $id - html id attribute
155
+	 * @param string $class - html class attribute
156
+	 * @param string $style - html style attribute for applying inline styles
157
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
158
+	 * @return string
159
+	 */
160
+	public static function div($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
161
+	{
162
+		return EEH_HTML::_open_tag('div', $content, $id, $class, $style, $other_attributes);
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * Generates HTML closing </div> tag - if passed the id or class attribute used for the opening div tag, will append a comment
169
+	 * usage: echo EEH_HTML::divx();
170
+	 *
171
+	 * @param string $id - html id attribute
172
+	 * @param string $class - html class attribute
173
+	 * @return string
174
+	 */
175
+	public static function divx($id = '', $class = '')
176
+	{
177
+		return EEH_HTML::_close_tag('div', $id, $class);
178
+	}
179
+
180
+
181
+
182
+	/**
183
+	 * Generates HTML <h1></h1> tags, inserts content, and adds any passed attributes
184
+	 * usage: echo EEH_HTML::h1( 'This is a Heading' );
185
+	 *
186
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
187
+	 * @param string $id - html id attribute
188
+	 * @param string $class - html class attribute
189
+	 * @param string $style - html style attribute for applying inline styles
190
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
191
+	 * @return string
192
+	 */
193
+	public static function h1($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
194
+	{
195
+		return EEH_HTML::_open_tag('h1', $content, $id, $class, $style, $other_attributes, true);
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 * Generates HTML <h2></h2> tags, inserts content, and adds any passed attributes
202
+	 * usage: echo EEH_HTML::h2( 'This is a Heading' );
203
+	 *
204
+	 * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
205
+	 * @param string $id               - html id attribute
206
+	 * @param string $class            - html class attribute
207
+	 * @param string $style            - html style attribute for applying inline styles
208
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
209
+	 * @return string
210
+	 */
211
+	public static function h2($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
212
+	{
213
+		return EEH_HTML::_open_tag('h2', $content, $id, $class, $style, $other_attributes, true);
214
+	}
215
+
216
+
217
+
218
+	/**
219
+	 * Generates HTML <h3></h3> tags, inserts content, and adds any passed attributes
220
+	 * usage: echo EEH_HTML::h3( 'This is a Heading' );
221
+	 *
222
+	 * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
223
+	 * @param string $id               - html id attribute
224
+	 * @param string $class            - html class attribute
225
+	 * @param string $style            - html style attribute for applying inline styles
226
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
227
+	 * @return string
228
+	 */
229
+	public static function h3($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
230
+	{
231
+		return EEH_HTML::_open_tag('h3', $content, $id, $class, $style, $other_attributes, true);
232
+	}
233
+
234
+
235
+
236
+	/**
237
+	 * Generates HTML <h4></h4> tags, inserts content, and adds any passed attributes
238
+	 * usage: echo EEH_HTML::h4( 'This is a Heading' );
239
+	 *
240
+	 * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
241
+	 * @param string $id               - html id attribute
242
+	 * @param string $class            - html class attribute
243
+	 * @param string $style            - html style attribute for applying inline styles
244
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
245
+	 * @return string
246
+	 */
247
+	public static function h4($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
248
+	{
249
+		return EEH_HTML::_open_tag('h4', $content, $id, $class, $style, $other_attributes, true);
250
+	}
251
+
252
+
253
+
254
+	/**
255
+	 * Generates HTML <h5></h5> tags, inserts content, and adds any passed attributes
256
+	 * usage: echo EEH_HTML::h5( 'This is a Heading' );
257
+	 *
258
+	 * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
259
+	 * @param string $id               - html id attribute
260
+	 * @param string $class            - html class attribute
261
+	 * @param string $style            - html style attribute for applying inline styles
262
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
263
+	 * @return string
264
+	 */
265
+	public static function h5($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
266
+	{
267
+		return EEH_HTML::_open_tag('h5', $content, $id, $class, $style, $other_attributes, true);
268
+	}
269
+
270
+
271
+
272
+	/**
273
+	 * Generates HTML <h6></h6> tags, inserts content, and adds any passed attributes
274
+	 * usage: echo EEH_HTML::h6( 'This is a Heading' );
275
+	 *
276
+	 * @param string $content          - inserted after opening tag, and appends closing tag, otherwise tag is left open
277
+	 * @param string $id               - html id attribute
278
+	 * @param string $class            - html class attribute
279
+	 * @param string $style            - html style attribute for applying inline styles
280
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
281
+	 * @return string
282
+	 */
283
+	public static function h6($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
284
+	{
285
+		return EEH_HTML::_open_tag('h6', $content, $id, $class, $style, $other_attributes, true);
286
+	}
287
+
288
+
289
+
290
+	/**
291
+	 * Generates HTML <p></p> tags, inserts content, and adds any passed attributes
292
+	 * usage: echo EEH_HTML::p( 'this is a paragraph' );
293
+	 *
294
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
295
+	 * @param string $id - html id attribute
296
+	 * @param string $class - html class attribute
297
+	 * @param string $style - html style attribute for applying inline styles
298
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
299
+	 * @return string
300
+	 */
301
+	public static function p($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
302
+	{
303
+		return EEH_HTML::_open_tag('p', $content, $id, $class, $style, $other_attributes, true);
304
+	}
305
+
306
+
307
+
308
+	/**
309
+	 *  ul - generates HTML opening <ul> tag and adds any passed attributes
310
+	 *  usage:      echo EEH_HTML::ul( 'my-list-id', 'my-list-class' );
311
+	 *
312
+	 * @param string $id - html id attribute
313
+	 * @param string $class - html class attribute
314
+	 * @param string $style - html style attribute for applying inline styles
315
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
316
+	 * @return string
317
+	 */
318
+	public static function ul($id = '', $class = '', $style = '', $other_attributes = '')
319
+	{
320
+		return EEH_HTML::_open_tag('ul', '', $id, $class, $style, $other_attributes);
321
+	}
322
+
323
+
324
+
325
+	/**
326
+	 * Generates HTML closing </ul> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
327
+	 * usage: echo EEH_HTML::ulx();
328
+	 *
329
+	 * @param string $id - html id attribute
330
+	 * @param string $class - html class attribute
331
+	 * @return string
332
+	 */
333
+	public static function ulx($id = '', $class = '')
334
+	{
335
+		return EEH_HTML::_close_tag('ul', $id, $class);
336
+	}
337
+
338
+
339
+
340
+	/**
341
+	 * Generates HTML <li> tag, inserts content, and adds any passed attributes
342
+	 * if passed content, it will also add that, as well as the closing </li> tag
343
+	 * usage: echo EEH_HTML::li( 'this is a line item' );
344
+	 *
345
+	 * @param string $id - html id attribute
346
+	 * @param string $class - html class attribute
347
+	 * @param string $style - html style attribute for applying inline styles
348
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
349
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
350
+	 * @return string
351
+	 */
352
+	public static function li($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
353
+	{
354
+		return EEH_HTML::_open_tag('li', $content, $id, $class, $style, $other_attributes);
355
+	}
356
+
357
+
358
+
359
+	/**
360
+	 * Generates HTML closing </li> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
361
+	 * usage: echo EEH_HTML::lix();
362
+	 *
363
+	 * @param string $id - html id attribute
364
+	 * @param string $class - html class attribute
365
+	 * @return string
366
+	 */
367
+	public static function lix($id = '', $class = '')
368
+	{
369
+		return EEH_HTML::_close_tag('li', $id, $class);
370
+	}
371
+
372
+
373
+
374
+	/**
375
+	 *    table - generates an HTML <table> tag and adds any passed attributes
376
+	 *    usage: echo EEH_HTML::table();
377
+	 *
378
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
379
+	 * @param string $id - html id attribute
380
+	 * @param string $class - html class attribute
381
+	 * @param string $style - html style attribute for applying inline styles
382
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
383
+	 * @return string
384
+	 */
385
+	public static function table($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
386
+	{
387
+		return EEH_HTML::_open_tag('table', $content, $id, $class, $style, $other_attributes);
388
+	}
389
+
390
+
391
+
392
+	/**
393
+	 * tablex - generates an HTML </table> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
394
+	 *
395
+	 * @param string $id - html id attribute
396
+	 * @param string $class - html class attribute
397
+	 * @return string
398
+	 */
399
+	public static function tablex($id = '', $class = '')
400
+	{
401
+		return EEH_HTML::_close_tag('table', $id, $class);
402
+	}
403
+
404
+
405
+
406
+	/**
407
+	 *    thead - generates an HTML <thead> tag and adds any passed attributes
408
+	 *    usage: echo EEH_HTML::thead();
409
+	 *
410
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
411
+	 * @param string $id - html id attribute
412
+	 * @param string $class - html class attribute
413
+	 * @param string $style - html style attribute for applying inline styles
414
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
415
+	 * @return string
416
+	 */
417
+	public static function thead($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
418
+	{
419
+		return EEH_HTML::_open_tag('thead', $content, $id, $class, $style, $other_attributes);
420
+	}
421
+
422
+
423
+
424
+	/**
425
+	 * theadx - generates an HTML </thead> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
426
+	 *
427
+	 * @param string $id - html id attribute
428
+	 * @param string $class - html class attribute
429
+	 * @return string
430
+	 */
431
+	public static function theadx($id = '', $class = '')
432
+	{
433
+		return EEH_HTML::_close_tag('thead', $id, $class);
434
+	}
435
+
436
+
437
+
438
+	/**
439
+	 *    tbody - generates an HTML <tbody> tag and adds any passed attributes
440
+	 *    usage: echo EEH_HTML::tbody();
441
+	 *
442
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
443
+	 * @param string $id - html id attribute
444
+	 * @param string $class - html class attribute
445
+	 * @param string $style - html style attribute for applying inline styles
446
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
447
+	 * @return string
448
+	 */
449
+	public static function tbody($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
450
+	{
451
+		return EEH_HTML::_open_tag('tbody', $content, $id, $class, $style, $other_attributes);
452
+	}
453
+
454
+
455
+
456
+	/**
457
+	 * tbodyx - generates an HTML </tbody> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
458
+	 *
459
+	 * @param string $id - html id attribute
460
+	 * @param string $class - html class attribute
461
+	 * @return string
462
+	 */
463
+	public static function tbodyx($id = '', $class = '')
464
+	{
465
+		return EEH_HTML::_close_tag('tbody', $id, $class);
466
+	}
467
+
468
+
469
+
470
+	/**
471
+	 *    tr - generates an HTML <tr> tag and adds any passed attributes
472
+	 *    usage: echo EEH_HTML::tr();
473
+	 *
474
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
475
+	 * @param string $id - html id attribute
476
+	 * @param string $class - html class attribute
477
+	 * @param string $style - html style attribute for applying inline styles
478
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
479
+	 * @return string
480
+	 */
481
+	public static function tr($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
482
+	{
483
+		return EEH_HTML::_open_tag('tr', $content, $id, $class, $style, $other_attributes);
484
+	}
485
+
486
+
487
+
488
+	/**
489
+	 * trx - generates an HTML </tr> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
490
+	 *
491
+	 * @param string $id - html id attribute
492
+	 * @param string $class - html class attribute
493
+	 * @return string
494
+	 */
495
+	public static function trx($id = '', $class = '')
496
+	{
497
+		return EEH_HTML::_close_tag('tr', $id, $class);
498
+	}
499
+
500
+
501
+
502
+	/**
503
+	 *    th - generates an HTML <th> tag and adds any passed attributes
504
+	 *    usage: echo EEH_HTML::th();
505
+	 *
506
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
507
+	 * @param string $id - html id attribute
508
+	 * @param string $class - html class attribute
509
+	 * @param string $style - html style attribute for applying inline styles
510
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
511
+	 * @return string
512
+	 */
513
+	public static function th($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
514
+	{
515
+		return EEH_HTML::_open_tag('th', $content, $id, $class, $style, $other_attributes);
516
+	}
517
+
518
+
519
+
520
+	/**
521
+	 * thx - generates an HTML </th> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
522
+	 *
523
+	 * @param string $id - html id attribute
524
+	 * @param string $class - html class attribute
525
+	 * @return string
526
+	 */
527
+	public static function thx($id = '', $class = '')
528
+	{
529
+		return EEH_HTML::_close_tag('th', $id, $class);
530
+	}
531
+
532
+
533
+
534
+	/**
535
+	 *    td - generates an HTML <td> tag and adds any passed attributes
536
+	 *    usage: echo EEH_HTML::td();
537
+	 *
538
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
539
+	 * @param string $id - html id attribute
540
+	 * @param string $class - html class attribute
541
+	 * @param string $style - html style attribute for applying inline styles
542
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
543
+	 * @return string
544
+	 */
545
+	public static function td($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
546
+	{
547
+		return EEH_HTML::_open_tag('td', $content, $id, $class, $style, $other_attributes);
548
+	}
549
+
550
+
551
+
552
+	/**
553
+	 * tdx - generates an HTML </td> tag - if passed the id or class attribute used for the opening ul tag, will append a comment
554
+	 *
555
+	 * @param string $id - html id attribute
556
+	 * @param string $class - html class attribute
557
+	 * @return string
558
+	 */
559
+	public static function tdx($id = '', $class = '')
560
+	{
561
+		return EEH_HTML::_close_tag('td', $id, $class);
562
+	}
563
+
564
+
565
+
566
+	/**
567
+	 * no_row - for generating a "hidden" table row, good for embedding tables within tables
568
+	 * generates a new table row with one td cell that spans however many columns you set
569
+	 * removes all styles from the tr and td
570
+	 *
571
+	 * @param string $content
572
+	 * @param int    $colspan
573
+	 * @return string
574
+	 */
575
+	public static function no_row($content = '', $colspan = 2)
576
+	{
577
+		return EEH_HTML::tr(
578
+			EEH_HTML::td($content, '', '', 'padding:0; border:none;', 'colspan="' . $colspan . '"'),
579
+			'',
580
+			'',
581
+			'padding:0; border:none;'
582
+		);
583
+	}
584
+
585
+
586
+
587
+	/**
588
+	 * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
589
+	 * usage: echo EEH_HTML::span( 'this is some inline text' );
590
+	 *
591
+	 * @access public
592
+	 * @param string $href URL to link to
593
+	 * @param string $link_text - the text that will become "hyperlinked"
594
+	 * @param string $title - html title attribute
595
+	 * @param string $id - html id attribute
596
+	 * @param string $class - html class attribute
597
+	 * @param string $style - html style attribute for applying inline styles
598
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
599
+	 * @return string
600
+	 */
601
+	public static function link($href = '', $link_text = '', $title = '', $id = '', $class = '', $style = '', $other_attributes = '')
602
+	{
603
+		$link_text = ! empty($link_text) ? $link_text : $href;
604
+		$attributes = ! empty($href) ? ' href="' . $href . '"' : '';
605
+		$attributes .= ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
606
+		$attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
607
+		$attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
608
+		$attributes .= ! empty($title) ? ' title="' . esc_attr($title) . '"' : '';
609
+		$attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
610
+		return "<a{$attributes}>{$link_text}</a>";
611
+	}
612
+
613
+
614
+
615
+	/**
616
+	 *    img - generates an HTML <img> tag and adds any passed attributes
617
+	 *    usage: echo EEH_HTML::img();
618
+	 *
619
+	 * @param string $src - html src attribute ie: the path or URL to the image
620
+	 * @param string $alt - html alt attribute
621
+	 * @param string $id - html id attribute
622
+	 * @param string $class - html class attribute
623
+	 * @param string $style - html style attribute for applying inline styles
624
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
625
+	 * @return string
626
+	 */
627
+	public static function img($src = '', $alt = '', $id = '', $class = '', $style = '', $other_attributes = '')
628
+	{
629
+		$attributes = ! empty($src) ? ' src="' . esc_url_raw($src) . '"' : '';
630
+		$attributes .= ! empty($alt) ? ' alt="' . esc_attr($alt) . '"' : '';
631
+		$attributes .= ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
632
+		$attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
633
+		$attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
634
+		$attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
635
+		return '<img' . $attributes  . '/>';
636
+	}
637
+
638
+
639
+
640
+	/**
641
+	 * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
642
+	 * usage: echo EEH_HTML::span( 'this is some inline text' );
643
+	 *
644
+	 * @access protected
645
+	 * @param string $tag
646
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
647
+	 * @param string $id - html id attribute
648
+	 * @param string $class - html class attribute
649
+	 * @param string $style - html style attribute for applying inline styles
650
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
651
+	 * @return string
652
+	 */
653
+	protected static function _inline_tag($tag = 'span', $content = '', $id = '', $class = '', $style = '', $other_attributes = '')
654
+	{
655
+		$attributes = ! empty($id) ? ' id="' . EEH_HTML::sanitize_id($id) . '"' : '';
656
+		$attributes .= ! empty($class) ? ' class="' . $class . '"' : '';
657
+		$attributes .= ! empty($style) ? ' style="' . $style . '"' : '';
658
+		$attributes .= ! empty($other_attributes) ? ' ' . $other_attributes : '';
659
+		return '<' . $tag . ' ' . $attributes . '>'  . $content  . '</' . $tag . '>';
660
+	}
661
+
662
+
663
+
664
+	/**
665
+	 * Generates HTML <label></label> tags, inserts content, and adds any passed attributes
666
+	 * usage: echo EEH_HTML::span( 'this is some inline text' );
667
+	 *
668
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
669
+	 * @param string $id - html id attribute
670
+	 * @param string $class - html class attribute
671
+	 * @param string $style - html style attribute for applying inline styles
672
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
673
+	 * @return string
674
+	 */
675
+	public static function label($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
676
+	{
677
+		return EEH_HTML::_inline_tag('label', $content, $id, $class, $style, $other_attributes);
678
+	}
679
+
680
+
681
+
682
+	/**
683
+	 * Generates HTML <span></span> tags, inserts content, and adds any passed attributes
684
+	 * usage: echo EEH_HTML::span( 'this is some inline text' );
685
+	 *
686
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
687
+	 * @param string $id - html id attribute
688
+	 * @param string $class - html class attribute
689
+	 * @param string $style - html style attribute for applying inline styles
690
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
691
+	 * @return string
692
+	 */
693
+	public static function span($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
694
+	{
695
+		return EEH_HTML::_inline_tag('span', $content, $id, $class, $style, $other_attributes);
696
+	}
697
+
698
+
699
+
700
+	/**
701
+	 * Generates HTML <span></span> tags, inserts content, and adds any passed attributes
702
+	 * usage: echo EEH_HTML::span( 'this is some inline text' );
703
+	 *
704
+	 * @param string $content - inserted after opening tag, and appends closing tag, otherwise tag is left open
705
+	 * @param string $id - html id attribute
706
+	 * @param string $class - html class attribute
707
+	 * @param string $style - html style attribute for applying inline styles
708
+	 * @param string $other_attributes - additional attributes like "colspan", inline JS, "rel" tags, etc
709
+	 * @return string
710
+	 */
711
+	public static function strong($content = '', $id = '', $class = '', $style = '', $other_attributes = '')
712
+	{
713
+		return EEH_HTML::_inline_tag('strong', $content, $id, $class, $style, $other_attributes);
714
+	}
715
+
716
+
717
+
718
+	/**
719
+	 * Generates an html <--  comment --> tag
720
+	 *  usage: echo comment( 'this is a comment' );
721
+	 *
722
+	 * @param string $comment
723
+	 * @return string
724
+	 */
725
+	public static function comment($comment = '')
726
+	{
727
+		return ! empty($comment) ? EEH_HTML::nl() . '<!-- ' . $comment . ' -->' : '';
728
+	}
729
+
730
+
731
+
732
+	/**
733
+	 * br - generates a line break
734
+	 *
735
+	 * @param int $nmbr - the number of line breaks to return
736
+	 * @return string
737
+	 */
738
+	public static function br($nmbr = 1)
739
+	{
740
+		return str_repeat('<br />', $nmbr);
741
+	}
742
+
743
+
744
+
745
+	/**
746
+	 * nbsp - generates non-breaking space entities based on number supplied
747
+	 *
748
+	 * @param int $nmbr - the number of non-breaking spaces to return
749
+	 * @return string
750
+	 */
751
+	public static function nbsp($nmbr = 1)
752
+	{
753
+		return str_repeat('&nbsp;', $nmbr);
754
+	}
755
+
756
+
757
+
758
+	/**
759
+	 * sanitize_id
760
+	 *
761
+	 * functionally does the same as the wp_core function sanitize_key except it does NOT use
762
+	 * strtolower and allows capitals.
763
+	 *
764
+	 * @param string $id
765
+	 * @return string
766
+	 */
767
+	public static function sanitize_id($id = '')
768
+	{
769
+		$key = str_replace(' ', '-', trim($id));
770
+		return preg_replace('/[^a-zA-Z0-9_\-]/', '', $key);
771
+	}
772
+
773
+
774
+
775
+	/**
776
+	 * return a newline and tabs ("nl" stands for "new line")
777
+	 *
778
+	 * @param int    $indent the number of tabs to ADD to the current indent (can be negative or zero)
779
+	 * @param string $tag
780
+	 * @return string - newline character plus # of indents passed (can be + or -)
781
+	 */
782
+	public static function nl($indent = 0, $tag = 'none')
783
+	{
784
+		$html = "\n";
785
+		EEH_HTML::indent($indent, $tag);
786
+		for ($x = 0; $x < EEH_HTML::$_indent[ $tag ]; $x++) {
787
+			$html .= "\t";
788
+		}
789
+		return $html;
790
+	}
791
+
792
+
793
+
794
+	/**
795
+	 * Changes the indents used in EEH_HTML::nl. Often its convenient to change
796
+	 * the indentation level without actually creating a new line
797
+	 *
798
+	 * @param int    $indent can be negative to decrease the indentation level
799
+	 * @param string $tag
800
+	 */
801
+	public static function indent($indent, $tag = 'none')
802
+	{
803
+		static $default_indentation = false;
804
+		if (! $default_indentation) {
805
+			EEH_HTML::_set_default_indentation();
806
+			$default_indentation = true;
807
+		}
808
+		if (! isset(EEH_HTML::$_indent[ $tag ])) {
809
+			EEH_HTML::$_indent[ $tag ] = 0;
810
+		}
811
+		EEH_HTML::$_indent[ $tag ] += (int) $indent;
812
+		EEH_HTML::$_indent[ $tag ] = EEH_HTML::$_indent[ $tag ] >= 0 ? EEH_HTML::$_indent[ $tag ] : 0;
813
+	}
814
+
815
+
816
+	/**
817
+	 *  class _set_default_indentation
818
+	 *
819
+	 * @access    private
820
+	 */
821
+	private static function _set_default_indentation()
822
+	{
823
+		// set some initial formatting for table indentation
824
+		EEH_HTML::$_indent = array(
825
+			'none'  => 0,
826
+			'form'  => 0,
827
+			'radio'     => 0,
828
+			'checkbox'  => 0,
829
+			'select'    => 0,
830
+			'option' => 0,
831
+			'optgroup' => 0,
832
+			'table'     => 1,
833
+			'thead' => 2,
834
+			'tbody' => 2,
835
+			'tr'    => 3,
836
+			'th'    => 4,
837
+			'td'    => 4,
838
+			'div'   => 0,
839
+			'h1'    => 0,
840
+			'h2'    => 0,
841
+			'h3'    => 0,
842
+			'h4'    => 0,
843
+			'h5'    => 0,
844
+			'h6'    => 0,
845
+			'p'     => 0,
846
+			'ul'    => 0,
847
+			'li'    => 1
848
+		);
849
+	}
850
+
851
+
852
+
853
+	/**
854
+	 * Retrieves the list of tags considered "simple", that are probably safe for
855
+	 * use in inputs
856
+	 * @global array $allowedtags
857
+	 * @return array
858
+	 */
859
+	public static function get_simple_tags()
860
+	{
861
+		global $allowedtags;
862
+		$tags_we_allow = array_merge_recursive(
863
+			$allowedtags,
864
+			[
865
+				'ol' => [],
866
+				'ul' => [],
867
+				'li' => [],
868
+				'br' => [],
869
+				'p' => [],
870
+				'a' => ['target']
871
+			]
872
+		);
873
+		return apply_filters('FHEE__EEH_HTML__get_simple_tags', $tags_we_allow);
874
+	}
875 875
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 2 patches
Indentation   +926 added lines, -926 removed lines patch added patch discarded remove patch
@@ -7,36 +7,36 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
8 8
 
9 9
 if (! function_exists('espresso_get_template_part')) {
10
-    /**
11
-     * espresso_get_template_part
12
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
13
-     * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
14
-     *
15
-     * @param string $slug The slug name for the generic template.
16
-     * @param string $name The name of the specialised template.
17
-     */
18
-    function espresso_get_template_part($slug = null, $name = null)
19
-    {
20
-        EEH_Template::get_template_part($slug, $name);
21
-    }
10
+	/**
11
+	 * espresso_get_template_part
12
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
13
+	 * so not a very useful function at all except that it adds familiarity PLUS filtering based off of the entire template part name
14
+	 *
15
+	 * @param string $slug The slug name for the generic template.
16
+	 * @param string $name The name of the specialised template.
17
+	 */
18
+	function espresso_get_template_part($slug = null, $name = null)
19
+	{
20
+		EEH_Template::get_template_part($slug, $name);
21
+	}
22 22
 }
23 23
 
24 24
 
25 25
 if (! function_exists('espresso_get_object_css_class')) {
26
-    /**
27
-     * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28
-     *
29
-     * @param EE_Base_Class $object the EE object the css class is being generated for
30
-     * @param string        $prefix added to the beginning of the generated class
31
-     * @param string        $suffix added to the end of the generated class
32
-     * @return string
33
-     * @throws EE_Error
34
-     * @throws ReflectionException
35
-     */
36
-    function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
37
-    {
38
-        return EEH_Template::get_object_css_class($object, $prefix, $suffix);
39
-    }
26
+	/**
27
+	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28
+	 *
29
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
30
+	 * @param string        $prefix added to the beginning of the generated class
31
+	 * @param string        $suffix added to the end of the generated class
32
+	 * @return string
33
+	 * @throws EE_Error
34
+	 * @throws ReflectionException
35
+	 */
36
+	function espresso_get_object_css_class($object = null, $prefix = '', $suffix = '')
37
+	{
38
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
39
+	}
40 40
 }
41 41
 
42 42
 
@@ -51,640 +51,640 @@  discard block
 block discarded – undo
51 51
 class EEH_Template
52 52
 {
53 53
 
54
-    private static $_espresso_themes = [];
55
-
56
-
57
-    /**
58
-     *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
59
-     *
60
-     * @return boolean
61
-     */
62
-    public static function is_espresso_theme()
63
-    {
64
-        return wp_get_theme()->get('TextDomain') === 'event_espresso';
65
-    }
66
-
67
-
68
-    /**
69
-     *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
70
-     *    load its functions.php file ( if not already loaded )
71
-     *
72
-     * @return void
73
-     */
74
-    public static function load_espresso_theme_functions()
75
-    {
76
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
77
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
78
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
79
-            }
80
-        }
81
-    }
82
-
83
-
84
-    /**
85
-     *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
86
-     *
87
-     * @return array
88
-     */
89
-    public static function get_espresso_themes()
90
-    {
91
-        if (empty(EEH_Template::$_espresso_themes)) {
92
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
93
-            if (empty($espresso_themes)) {
94
-                return [];
95
-            }
96
-            if (($key = array_search('global_assets', $espresso_themes)) !== false) {
97
-                unset($espresso_themes[ $key ]);
98
-            }
99
-            EEH_Template::$_espresso_themes = [];
100
-            foreach ($espresso_themes as $espresso_theme) {
101
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
102
-            }
103
-        }
104
-        return EEH_Template::$_espresso_themes;
105
-    }
106
-
107
-
108
-    /**
109
-     * EEH_Template::get_template_part
110
-     * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
111
-     * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
112
-     * filtering based off of the entire template part name
113
-     *
114
-     * @param string $slug The slug name for the generic template.
115
-     * @param string $name The name of the specialised template.
116
-     * @param array  $template_args
117
-     * @param bool   $return_string
118
-     * @return string        the html output for the formatted money value
119
-     */
120
-    public static function get_template_part(
121
-        $slug = null,
122
-        $name = null,
123
-        $template_args = [],
124
-        $return_string = false
125
-    ) {
126
-        do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127
-        $templates = [];
128
-        $name      = (string) $name;
129
-        if ($name != '') {
130
-            $templates[] = "{$slug}-{$name}.php";
131
-        }
132
-        // allow template parts to be turned off via something like:
133
-        // add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
134
-        if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
135
-            return EEH_Template::locate_template($templates, $template_args, true, $return_string);
136
-        }
137
-        return '';
138
-    }
139
-
140
-
141
-    /**
142
-     *    locate_template
143
-     *    locate a template file by looking in the following places, in the following order:
144
-     *        <server path up to>/wp-content/themes/<current active WordPress theme>/
145
-     *        <assumed full absolute server path>
146
-     *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
147
-     *        <server path up to>/wp-content/uploads/espresso/templates/
148
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
149
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
150
-     *        <server path up to>/wp-content/plugins/<EE4 folder>/
151
-     *    as soon as the template is found in one of these locations, it will be returned or loaded
152
-     *        Example:
153
-     *          You are using the WordPress Twenty Sixteen theme,
154
-     *        and you want to customize the "some-event.template.php" template,
155
-     *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
156
-     *          Assuming WP is installed on your server in the "/home/public_html/" folder,
157
-     *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
158
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
159
-     *        /relative/path/to/some-event.template.php
160
-     *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
161
-     *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
162
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
164
-     *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
165
-     *          Had you passed an absolute path to your template that was in some other location,
166
-     *        ie: "/absolute/path/to/some-event.template.php"
167
-     *          then the search would have been :
168
-     *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
169
-     *        /absolute/path/to/some-event.template.php
170
-     *          and stopped there upon finding it in the second location
171
-     *
172
-     * @param array|string $templates       array of template file names including extension (or just a single string)
173
-     * @param array        $template_args   an array of arguments to be extracted for use in the template
174
-     * @param boolean      $load            whether to pass the located template path on to the
175
-     *                                      EEH_Template::display_template() method or simply return it
176
-     * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
177
-     *                                      string
178
-     * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
179
-     *                                      generate a custom template or not. Used in places where you don't actually
180
-     *                                      load the template, you just want to know if there's a custom version of it.
181
-     * @return mixed
182
-     * @throws DomainException
183
-     * @throws InvalidArgumentException
184
-     * @throws InvalidDataTypeException
185
-     * @throws InvalidInterfaceException
186
-     */
187
-    public static function locate_template(
188
-        $templates = [],
189
-        $template_args = [],
190
-        $load = true,
191
-        $return_string = true,
192
-        $check_if_custom = false
193
-    ) {
194
-        // first use WP locate_template to check for template in the current theme folder
195
-        $template_path = locate_template($templates);
196
-
197
-        if ($check_if_custom && ! empty($template_path)) {
198
-            return true;
199
-        }
200
-
201
-        // not in the theme
202
-        if (empty($template_path)) {
203
-            // not even a template to look for ?
204
-            if (empty($templates)) {
205
-                $loader = LoaderFactory::getLoader();
206
-                /** @var RequestInterface $request */
207
-                $request = $loader->getShared(RequestInterface::class);
208
-                // get post_type
209
-                $post_type = $request->getRequestParam('post_type');
210
-                /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
211
-                $custom_post_types = $loader->getShared(
212
-                    'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
213
-                );
214
-                // get array of EE Custom Post Types
215
-                $EE_CPTs = $custom_post_types->getDefinitions();
216
-                // build template name based on request
217
-                if (isset($EE_CPTs[ $post_type ])) {
218
-                    $archive_or_single = is_archive() ? 'archive' : '';
219
-                    $archive_or_single = is_single() ? 'single' : $archive_or_single;
220
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
221
-                }
222
-            }
223
-            // currently active EE template theme
224
-            $current_theme = EE_Config::get_current_theme();
225
-
226
-            // array of paths to folders that may contain templates
227
-            $template_folder_paths = [
228
-                // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
229
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
230
-                // then in the root of the /wp-content/uploads/espresso/templates/ folder
231
-                EVENT_ESPRESSO_TEMPLATE_DIR,
232
-            ];
233
-
234
-            // add core plugin folders for checking only if we're not $check_if_custom
235
-            if (! $check_if_custom) {
236
-                $core_paths            = [
237
-                    // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
238
-                    EE_PUBLIC . $current_theme,
239
-                    // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
240
-                    EE_TEMPLATES . $current_theme,
241
-                    // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
242
-                    EE_PLUGIN_DIR_PATH,
243
-                ];
244
-                $template_folder_paths = array_merge($template_folder_paths, $core_paths);
245
-            }
246
-
247
-            // now filter that array
248
-            $template_folder_paths = apply_filters(
249
-                'FHEE__EEH_Template__locate_template__template_folder_paths',
250
-                $template_folder_paths
251
-            );
252
-            $templates             = is_array($templates) ? $templates : [$templates];
253
-            $template_folder_paths =
254
-                is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
255
-            // array to hold all possible template paths
256
-            $full_template_paths = [];
257
-            $file_name           = '';
258
-
259
-            // loop through $templates
260
-            foreach ($templates as $template) {
261
-                // normalize directory separators
262
-                $template                      = EEH_File::standardise_directory_separators($template);
263
-                $file_name                     = basename($template);
264
-                $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
265
-                // while looping through all template folder paths
266
-                foreach ($template_folder_paths as $template_folder_path) {
267
-                    // normalize directory separators
268
-                    $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
269
-                    // determine if any common base path exists between the two paths
270
-                    $common_base_path = EEH_Template::_find_common_base_path(
271
-                        [$template_folder_path, $template_path_minus_file_name]
272
-                    );
273
-                    if ($common_base_path !== '') {
274
-                        // both paths have a common base, so just tack the filename onto our search path
275
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
276
-                    } else {
277
-                        // no common base path, so let's just concatenate
278
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
279
-                    }
280
-                    // build up our template locations array by adding our resolved paths
281
-                    $full_template_paths[] = $resolved_path;
282
-                }
283
-                // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
284
-                array_unshift($full_template_paths, $template);
285
-                // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
286
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
287
-            }
288
-            // filter final array of full template paths
289
-            $full_template_paths = apply_filters(
290
-                'FHEE__EEH_Template__locate_template__full_template_paths',
291
-                $full_template_paths,
292
-                $file_name
293
-            );
294
-            // now loop through our final array of template location paths and check each location
295
-            foreach ((array) $full_template_paths as $full_template_path) {
296
-                if (is_readable($full_template_path)) {
297
-                    $template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
298
-                    break;
299
-                }
300
-            }
301
-        }
302
-
303
-        // hook that can be used to display the full template path that will be used
304
-        do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
305
-
306
-        // if we got it and you want to see it...
307
-        if ($template_path && $load && ! $check_if_custom) {
308
-            if ($return_string) {
309
-                return EEH_Template::display_template($template_path, $template_args, true);
310
-            }
311
-            EEH_Template::display_template($template_path, $template_args);
312
-        }
313
-        return $check_if_custom && ! empty($template_path) ? true : $template_path;
314
-    }
315
-
316
-
317
-    /**
318
-     * _find_common_base_path
319
-     * given two paths, this determines if there is a common base path between the two
320
-     *
321
-     * @param array $paths
322
-     * @return string
323
-     */
324
-    protected static function _find_common_base_path($paths)
325
-    {
326
-        $last_offset      = 0;
327
-        $common_base_path = '';
328
-        while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
329
-            $dir_length = $index - $last_offset + 1;
330
-            $directory  = substr($paths[0], $last_offset, $dir_length);
331
-            foreach ($paths as $path) {
332
-                if (substr($path, $last_offset, $dir_length) != $directory) {
333
-                    return $common_base_path;
334
-                }
335
-            }
336
-            $common_base_path .= $directory;
337
-            $last_offset      = $index + 1;
338
-        }
339
-        return substr($common_base_path, 0, -1);
340
-    }
341
-
342
-
343
-    /**
344
-     * load and display a template
345
-     *
346
-     * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
347
-     * @param array       $template_args    an array of arguments to be extracted for use in the template
348
-     * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
349
-     *                                      string
350
-     * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
351
-     *                                      not found or is not readable
352
-     * @return string
353
-     * @throws DomainException
354
-     */
355
-    public static function display_template(
356
-        $template_path = false,
357
-        $template_args = [],
358
-        $return_string = false,
359
-        $throw_exceptions = false
360
-    ) {
361
-
362
-        /**
363
-         * These two filters are intended for last minute changes to templates being loaded and/or template arg
364
-         * modifications.  NOTE... modifying these things can cause breakage as most templates running through
365
-         * the display_template method are templates we DON'T want modified (usually because of js
366
-         * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
367
-         * using this.
368
-         *
369
-         * @since 4.6.0
370
-         */
371
-        $template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
372
-        $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
373
-
374
-        // you gimme nuttin - YOU GET NUTTIN !!
375
-        if (! $template_path || ! is_readable($template_path)) {
376
-            // ignore whether template is accessible ?
377
-            if ($throw_exceptions) {
378
-                throw new DomainException(
379
-                    esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
380
-                );
381
-            }
382
-            return '';
383
-        }
384
-        // if $template_args are not in an array, then make it so
385
-        if (! is_array($template_args) && ! is_object($template_args)) {
386
-            $template_args = [$template_args];
387
-        }
388
-        extract($template_args, EXTR_SKIP);
389
-
390
-        if ($return_string) {
391
-            // because we want to return a string, we are going to capture the output
392
-            ob_start();
393
-            include($template_path);
394
-            return ob_get_clean();
395
-        }
396
-        include($template_path);
397
-        return '';
398
-    }
399
-
400
-
401
-    /**
402
-     * get_object_css_class - attempts to generate a css class based on the type of EE object passed
403
-     *
404
-     * @param EE_Base_Class $object the EE object the css class is being generated for
405
-     * @param string        $prefix added to the beginning of the generated class
406
-     * @param string        $suffix added to the end of the generated class
407
-     * @return string
408
-     * @throws EE_Error
409
-     * @throws ReflectionException
410
-     */
411
-    public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
412
-    {
413
-        // in the beginning...
414
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
415
-        // da muddle
416
-        $class = '';
417
-        // the end
418
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
419
-        // is the passed object an EE object ?
420
-        if ($object instanceof EE_Base_Class) {
421
-            // grab the exact type of object
422
-            $obj_class = get_class($object);
423
-            // depending on the type of object...
424
-            switch ($obj_class) {
425
-                // no specifics just yet...
426
-                default:
427
-                    $class = strtolower(str_replace('_', '-', $obj_class));
428
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
429
-            }
430
-        }
431
-        return $prefix . $class . $suffix;
432
-    }
433
-
434
-
435
-    /**
436
-     * EEH_Template::format_currency
437
-     * This helper takes a raw float value and formats it according to the default config country currency settings, or
438
-     * the country currency settings from the supplied country ISO code
439
-     *
440
-     * @param float   $amount       raw money value
441
-     * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
442
-     * @param boolean $display_code whether to display the country code (USD). Default = TRUE
443
-     * @param string  $CNT_ISO      2 letter ISO code for a country
444
-     * @param string  $cur_code_span_class
445
-     * @return string        the html output for the formatted money value
446
-     */
447
-    public static function format_currency(
448
-        $amount = null,
449
-        $return_raw = false,
450
-        $display_code = true,
451
-        $CNT_ISO = '',
452
-        $cur_code_span_class = 'currency-code'
453
-    ) {
454
-        // ensure amount was received
455
-        if ($amount === null) {
456
-            $msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
457
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
458
-            return '';
459
-        }
460
-        // ensure amount is float
461
-        $amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
462
-        $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
463
-        // filter raw amount (allows 0.00 to be changed to "free" for example)
464
-        $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
465
-        // still a number, or was amount converted to a string like "free" ?
466
-        if (! is_float($amount_formatted)) {
467
-            return esc_html($amount_formatted);
468
-        }
469
-        try {
470
-            // was a country ISO code passed ? if so generate currency config object for that country
471
-            $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
472
-        } catch (Exception $e) {
473
-            // eat exception
474
-            $mny = null;
475
-        }
476
-        // verify results
477
-        if (! $mny instanceof EE_Currency_Config) {
478
-            // set default config country currency settings
479
-            $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
480
-                ? EE_Registry::instance()->CFG->currency
481
-                : new EE_Currency_Config();
482
-        }
483
-        // format float
484
-        $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
485
-        // add formatting ?
486
-        if (! $return_raw) {
487
-            // add currency sign
488
-            if ($mny->sign_b4) {
489
-                if ($amount >= 0) {
490
-                    $amount_formatted = $mny->sign . $amount_formatted;
491
-                } else {
492
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
493
-                }
494
-            } else {
495
-                $amount_formatted = $amount_formatted . $mny->sign;
496
-            }
497
-
498
-            // filter to allow global setting of display_code
499
-            $display_code = (bool) apply_filters(
500
-                'FHEE__EEH_Template__format_currency__display_code',
501
-                $display_code
502
-            );
503
-
504
-            // add currency code ?
505
-            $amount_formatted = $display_code
506
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
507
-                : $amount_formatted;
508
-        }
509
-        // filter results
510
-        $amount_formatted = apply_filters(
511
-            'FHEE__EEH_Template__format_currency__amount_formatted',
512
-            $amount_formatted,
513
-            $mny,
514
-            $return_raw
515
-        );
516
-        // clean up vars
517
-        unset($mny);
518
-        // return formatted currency amount
519
-        return $amount_formatted;
520
-    }
521
-
522
-
523
-    /**
524
-     * This function is used for outputting the localized label for a given status id in the schema requested (and
525
-     * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
526
-     * related status model or model object (i.e. in documentation etc.)
527
-     *
528
-     * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
529
-     *                            match, then 'Unknown' will be returned.
530
-     * @param boolean $plural     Whether to return plural or not
531
-     * @param string  $schema     'UPPER', 'lower', or 'Sentence'
532
-     * @return string             The localized label for the status id.
533
-     * @throws EE_Error
534
-     */
535
-    public static function pretty_status($status_id, $plural = false, $schema = 'upper')
536
-    {
537
-        $status = EEM_Status::instance()->localized_status(
538
-            [$status_id => esc_html__('unknown', 'event_espresso')],
539
-            $plural,
540
-            $schema
541
-        );
542
-        return $status[ $status_id ];
543
-    }
544
-
545
-
546
-    /**
547
-     * This helper just returns a button or link for the given parameters
548
-     *
549
-     * @param string $url   the url for the link, note that `esc_url` will be called on it
550
-     * @param string $label What is the label you want displayed for the button
551
-     * @param string $class what class is used for the button (defaults to 'button-primary')
552
-     * @param string $icon
553
-     * @param string $title
554
-     * @return string the html output for the button
555
-     */
556
-    public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
557
-    {
558
-        $icon_html = '';
559
-        if (! empty($icon)) {
560
-            $dashicons = preg_split("(ee-icon |dashicons )", $icon);
561
-            $dashicons = array_filter($dashicons);
562
-            $count     = count($dashicons);
563
-            $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
564
-            foreach ($dashicons as $dashicon) {
565
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
566
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
567
-            }
568
-            $icon_html .= $count > 1 ? '</span>' : '';
569
-        }
570
-        // sanitize & escape
571
-        $id    = sanitize_title_with_dashes($label);
572
-        $url   = esc_url_raw($url);
573
-        $class = esc_attr($class);
574
-        $title = esc_attr($title);
575
-        $label = esc_html($label);
576
-        return "<a id='{$id}' href='{$url}' class='{$class}' title='{$title}'>{$icon_html}{$label}</a>";
577
-    }
578
-
579
-
580
-    /**
581
-     * This returns a generated link that will load the related help tab on admin pages.
582
-     *
583
-     * @param string      $help_tab_id the id for the connected help tab
584
-     * @param bool|string $page        The page identifier for the page the help tab is on
585
-     * @param bool|string $action      The action (route) for the admin page the help tab is on.
586
-     * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
587
-     * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
588
-     * @return string              generated link
589
-     */
590
-    public static function get_help_tab_link(
591
-        $help_tab_id,
592
-        $page = false,
593
-        $action = false,
594
-        $icon_style = false,
595
-        $help_text = false
596
-    ) {
597
-        $allowedtags = AllowedTags::getAllowedTags();
598
-        /** @var RequestInterface $request */
599
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
600
-        $page    = $page ?: $request->getRequestParam('page', '', 'key');
601
-        $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
602
-
603
-
604
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
605
-        $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
606
-        $help_text    = ! $help_text ? '' : $help_text;
607
-        return '<a id="'
608
-               . esc_attr($help_tab_lnk)
609
-               . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'
610
-               . esc_attr($icon)
611
-               . '" title="'
612
-               . esc_attr__(
613
-                   'Click to open the \'Help\' tab for more information about this feature.',
614
-                   'event_espresso'
615
-               )
616
-               . '" > '
617
-               . wp_kses($help_text, $allowedtags)
618
-               . ' </a>';
619
-    }
620
-
621
-
622
-    /**
623
-     * This is a helper method to generate a status legend for a given status array.
624
-     * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
625
-     * status_array.
626
-     *
627
-     * @param array  $status_array   array of statuses that will make up the legend. In format:
628
-     *                               array(
629
-     *                               'status_item' => 'status_name'
630
-     *                               )
631
-     * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
632
-     *                               the legend.
633
-     * @return string               html structure for status.
634
-     * @throws EE_Error
635
-     */
636
-    public static function status_legend($status_array, $active_status = '')
637
-    {
638
-        if (! is_array($status_array)) {
639
-            throw new EE_Error(
640
-                esc_html__(
641
-                    'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
642
-                    'event_espresso'
643
-                )
644
-            );
645
-        }
646
-
647
-        $content = '
54
+	private static $_espresso_themes = [];
55
+
56
+
57
+	/**
58
+	 *    is_espresso_theme - returns TRUE or FALSE on whether the currently active WP theme is an espresso theme
59
+	 *
60
+	 * @return boolean
61
+	 */
62
+	public static function is_espresso_theme()
63
+	{
64
+		return wp_get_theme()->get('TextDomain') === 'event_espresso';
65
+	}
66
+
67
+
68
+	/**
69
+	 *    load_espresso_theme_functions - if current theme is an espresso theme, or uses ee theme template parts, then
70
+	 *    load its functions.php file ( if not already loaded )
71
+	 *
72
+	 * @return void
73
+	 */
74
+	public static function load_espresso_theme_functions()
75
+	{
76
+		if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
77
+			if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
78
+				require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
79
+			}
80
+		}
81
+	}
82
+
83
+
84
+	/**
85
+	 *    get_espresso_themes - returns an array of Espresso Child themes located in the /templates/ directory
86
+	 *
87
+	 * @return array
88
+	 */
89
+	public static function get_espresso_themes()
90
+	{
91
+		if (empty(EEH_Template::$_espresso_themes)) {
92
+			$espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
93
+			if (empty($espresso_themes)) {
94
+				return [];
95
+			}
96
+			if (($key = array_search('global_assets', $espresso_themes)) !== false) {
97
+				unset($espresso_themes[ $key ]);
98
+			}
99
+			EEH_Template::$_espresso_themes = [];
100
+			foreach ($espresso_themes as $espresso_theme) {
101
+				EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
102
+			}
103
+		}
104
+		return EEH_Template::$_espresso_themes;
105
+	}
106
+
107
+
108
+	/**
109
+	 * EEH_Template::get_template_part
110
+	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead,
111
+	 * and doesn't add base versions of files so not a very useful function at all except that it adds familiarity PLUS
112
+	 * filtering based off of the entire template part name
113
+	 *
114
+	 * @param string $slug The slug name for the generic template.
115
+	 * @param string $name The name of the specialised template.
116
+	 * @param array  $template_args
117
+	 * @param bool   $return_string
118
+	 * @return string        the html output for the formatted money value
119
+	 */
120
+	public static function get_template_part(
121
+		$slug = null,
122
+		$name = null,
123
+		$template_args = [],
124
+		$return_string = false
125
+	) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127
+		$templates = [];
128
+		$name      = (string) $name;
129
+		if ($name != '') {
130
+			$templates[] = "{$slug}-{$name}.php";
131
+		}
132
+		// allow template parts to be turned off via something like:
133
+		// add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
134
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", true)) {
135
+			return EEH_Template::locate_template($templates, $template_args, true, $return_string);
136
+		}
137
+		return '';
138
+	}
139
+
140
+
141
+	/**
142
+	 *    locate_template
143
+	 *    locate a template file by looking in the following places, in the following order:
144
+	 *        <server path up to>/wp-content/themes/<current active WordPress theme>/
145
+	 *        <assumed full absolute server path>
146
+	 *        <server path up to>/wp-content/uploads/espresso/templates/<current EE theme>/
147
+	 *        <server path up to>/wp-content/uploads/espresso/templates/
148
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/public/<current EE theme>/
149
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/core/templates/<current EE theme>/
150
+	 *        <server path up to>/wp-content/plugins/<EE4 folder>/
151
+	 *    as soon as the template is found in one of these locations, it will be returned or loaded
152
+	 *        Example:
153
+	 *          You are using the WordPress Twenty Sixteen theme,
154
+	 *        and you want to customize the "some-event.template.php" template,
155
+	 *          which is located in the "/relative/path/to/" folder relative to the main EE plugin folder.
156
+	 *          Assuming WP is installed on your server in the "/home/public_html/" folder,
157
+	 *        EEH_Template::locate_template() will look at the following paths in order until the template is found:
158
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
159
+	 *        /relative/path/to/some-event.template.php
160
+	 *        /home/public_html/wp-content/uploads/espresso/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
161
+	 *        /home/public_html/wp-content/uploads/espresso/templates/relative/path/to/some-event.template.php
162
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/relative/path/to/some-event.template.php
163
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/core/templates/Espresso_Arabica_2014/relative/path/to/some-event.template.php
164
+	 *        /home/public_html/wp-content/plugins/event-espresso-core-reg/relative/path/to/some-event.template.php
165
+	 *          Had you passed an absolute path to your template that was in some other location,
166
+	 *        ie: "/absolute/path/to/some-event.template.php"
167
+	 *          then the search would have been :
168
+	 *        /home/public_html/wp-content/themes/twentysixteen/some-event.template.php
169
+	 *        /absolute/path/to/some-event.template.php
170
+	 *          and stopped there upon finding it in the second location
171
+	 *
172
+	 * @param array|string $templates       array of template file names including extension (or just a single string)
173
+	 * @param array        $template_args   an array of arguments to be extracted for use in the template
174
+	 * @param boolean      $load            whether to pass the located template path on to the
175
+	 *                                      EEH_Template::display_template() method or simply return it
176
+	 * @param boolean      $return_string   whether to send output immediately to screen, or capture and return as a
177
+	 *                                      string
178
+	 * @param boolean      $check_if_custom If TRUE, this flags this method to return boolean for whether this will
179
+	 *                                      generate a custom template or not. Used in places where you don't actually
180
+	 *                                      load the template, you just want to know if there's a custom version of it.
181
+	 * @return mixed
182
+	 * @throws DomainException
183
+	 * @throws InvalidArgumentException
184
+	 * @throws InvalidDataTypeException
185
+	 * @throws InvalidInterfaceException
186
+	 */
187
+	public static function locate_template(
188
+		$templates = [],
189
+		$template_args = [],
190
+		$load = true,
191
+		$return_string = true,
192
+		$check_if_custom = false
193
+	) {
194
+		// first use WP locate_template to check for template in the current theme folder
195
+		$template_path = locate_template($templates);
196
+
197
+		if ($check_if_custom && ! empty($template_path)) {
198
+			return true;
199
+		}
200
+
201
+		// not in the theme
202
+		if (empty($template_path)) {
203
+			// not even a template to look for ?
204
+			if (empty($templates)) {
205
+				$loader = LoaderFactory::getLoader();
206
+				/** @var RequestInterface $request */
207
+				$request = $loader->getShared(RequestInterface::class);
208
+				// get post_type
209
+				$post_type = $request->getRequestParam('post_type');
210
+				/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_types */
211
+				$custom_post_types = $loader->getShared(
212
+					'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
213
+				);
214
+				// get array of EE Custom Post Types
215
+				$EE_CPTs = $custom_post_types->getDefinitions();
216
+				// build template name based on request
217
+				if (isset($EE_CPTs[ $post_type ])) {
218
+					$archive_or_single = is_archive() ? 'archive' : '';
219
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
220
+					$templates         = $archive_or_single . '-' . $post_type . '.php';
221
+				}
222
+			}
223
+			// currently active EE template theme
224
+			$current_theme = EE_Config::get_current_theme();
225
+
226
+			// array of paths to folders that may contain templates
227
+			$template_folder_paths = [
228
+				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
229
+				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
230
+				// then in the root of the /wp-content/uploads/espresso/templates/ folder
231
+				EVENT_ESPRESSO_TEMPLATE_DIR,
232
+			];
233
+
234
+			// add core plugin folders for checking only if we're not $check_if_custom
235
+			if (! $check_if_custom) {
236
+				$core_paths            = [
237
+					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
238
+					EE_PUBLIC . $current_theme,
239
+					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
240
+					EE_TEMPLATES . $current_theme,
241
+					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
242
+					EE_PLUGIN_DIR_PATH,
243
+				];
244
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
245
+			}
246
+
247
+			// now filter that array
248
+			$template_folder_paths = apply_filters(
249
+				'FHEE__EEH_Template__locate_template__template_folder_paths',
250
+				$template_folder_paths
251
+			);
252
+			$templates             = is_array($templates) ? $templates : [$templates];
253
+			$template_folder_paths =
254
+				is_array($template_folder_paths) ? $template_folder_paths : [$template_folder_paths];
255
+			// array to hold all possible template paths
256
+			$full_template_paths = [];
257
+			$file_name           = '';
258
+
259
+			// loop through $templates
260
+			foreach ($templates as $template) {
261
+				// normalize directory separators
262
+				$template                      = EEH_File::standardise_directory_separators($template);
263
+				$file_name                     = basename($template);
264
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
265
+				// while looping through all template folder paths
266
+				foreach ($template_folder_paths as $template_folder_path) {
267
+					// normalize directory separators
268
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
269
+					// determine if any common base path exists between the two paths
270
+					$common_base_path = EEH_Template::_find_common_base_path(
271
+						[$template_folder_path, $template_path_minus_file_name]
272
+					);
273
+					if ($common_base_path !== '') {
274
+						// both paths have a common base, so just tack the filename onto our search path
275
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
276
+					} else {
277
+						// no common base path, so let's just concatenate
278
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
279
+					}
280
+					// build up our template locations array by adding our resolved paths
281
+					$full_template_paths[] = $resolved_path;
282
+				}
283
+				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
284
+				array_unshift($full_template_paths, $template);
285
+				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
286
+				array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
287
+			}
288
+			// filter final array of full template paths
289
+			$full_template_paths = apply_filters(
290
+				'FHEE__EEH_Template__locate_template__full_template_paths',
291
+				$full_template_paths,
292
+				$file_name
293
+			);
294
+			// now loop through our final array of template location paths and check each location
295
+			foreach ((array) $full_template_paths as $full_template_path) {
296
+				if (is_readable($full_template_path)) {
297
+					$template_path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $full_template_path);
298
+					break;
299
+				}
300
+			}
301
+		}
302
+
303
+		// hook that can be used to display the full template path that will be used
304
+		do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path);
305
+
306
+		// if we got it and you want to see it...
307
+		if ($template_path && $load && ! $check_if_custom) {
308
+			if ($return_string) {
309
+				return EEH_Template::display_template($template_path, $template_args, true);
310
+			}
311
+			EEH_Template::display_template($template_path, $template_args);
312
+		}
313
+		return $check_if_custom && ! empty($template_path) ? true : $template_path;
314
+	}
315
+
316
+
317
+	/**
318
+	 * _find_common_base_path
319
+	 * given two paths, this determines if there is a common base path between the two
320
+	 *
321
+	 * @param array $paths
322
+	 * @return string
323
+	 */
324
+	protected static function _find_common_base_path($paths)
325
+	{
326
+		$last_offset      = 0;
327
+		$common_base_path = '';
328
+		while (($index = strpos($paths[0], '/', $last_offset)) !== false) {
329
+			$dir_length = $index - $last_offset + 1;
330
+			$directory  = substr($paths[0], $last_offset, $dir_length);
331
+			foreach ($paths as $path) {
332
+				if (substr($path, $last_offset, $dir_length) != $directory) {
333
+					return $common_base_path;
334
+				}
335
+			}
336
+			$common_base_path .= $directory;
337
+			$last_offset      = $index + 1;
338
+		}
339
+		return substr($common_base_path, 0, -1);
340
+	}
341
+
342
+
343
+	/**
344
+	 * load and display a template
345
+	 *
346
+	 * @param bool|string $template_path    server path to the file to be loaded, including file name and extension
347
+	 * @param array       $template_args    an array of arguments to be extracted for use in the template
348
+	 * @param boolean     $return_string    whether to send output immediately to screen, or capture and return as a
349
+	 *                                      string
350
+	 * @param bool        $throw_exceptions if set to true, will throw an exception if the template is either
351
+	 *                                      not found or is not readable
352
+	 * @return string
353
+	 * @throws DomainException
354
+	 */
355
+	public static function display_template(
356
+		$template_path = false,
357
+		$template_args = [],
358
+		$return_string = false,
359
+		$throw_exceptions = false
360
+	) {
361
+
362
+		/**
363
+		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
364
+		 * modifications.  NOTE... modifying these things can cause breakage as most templates running through
365
+		 * the display_template method are templates we DON'T want modified (usually because of js
366
+		 * dependencies etc).  So unless you know what you are doing, do NOT filter templates or template args
367
+		 * using this.
368
+		 *
369
+		 * @since 4.6.0
370
+		 */
371
+		$template_path = (string) apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
372
+		$template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
373
+
374
+		// you gimme nuttin - YOU GET NUTTIN !!
375
+		if (! $template_path || ! is_readable($template_path)) {
376
+			// ignore whether template is accessible ?
377
+			if ($throw_exceptions) {
378
+				throw new DomainException(
379
+					esc_html__('Invalid, unreadable, or missing file.', 'event_espresso')
380
+				);
381
+			}
382
+			return '';
383
+		}
384
+		// if $template_args are not in an array, then make it so
385
+		if (! is_array($template_args) && ! is_object($template_args)) {
386
+			$template_args = [$template_args];
387
+		}
388
+		extract($template_args, EXTR_SKIP);
389
+
390
+		if ($return_string) {
391
+			// because we want to return a string, we are going to capture the output
392
+			ob_start();
393
+			include($template_path);
394
+			return ob_get_clean();
395
+		}
396
+		include($template_path);
397
+		return '';
398
+	}
399
+
400
+
401
+	/**
402
+	 * get_object_css_class - attempts to generate a css class based on the type of EE object passed
403
+	 *
404
+	 * @param EE_Base_Class $object the EE object the css class is being generated for
405
+	 * @param string        $prefix added to the beginning of the generated class
406
+	 * @param string        $suffix added to the end of the generated class
407
+	 * @return string
408
+	 * @throws EE_Error
409
+	 * @throws ReflectionException
410
+	 */
411
+	public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
412
+	{
413
+		// in the beginning...
414
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
415
+		// da muddle
416
+		$class = '';
417
+		// the end
418
+		$suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
419
+		// is the passed object an EE object ?
420
+		if ($object instanceof EE_Base_Class) {
421
+			// grab the exact type of object
422
+			$obj_class = get_class($object);
423
+			// depending on the type of object...
424
+			switch ($obj_class) {
425
+				// no specifics just yet...
426
+				default:
427
+					$class = strtolower(str_replace('_', '-', $obj_class));
428
+					$class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
429
+			}
430
+		}
431
+		return $prefix . $class . $suffix;
432
+	}
433
+
434
+
435
+	/**
436
+	 * EEH_Template::format_currency
437
+	 * This helper takes a raw float value and formats it according to the default config country currency settings, or
438
+	 * the country currency settings from the supplied country ISO code
439
+	 *
440
+	 * @param float   $amount       raw money value
441
+	 * @param boolean $return_raw   whether to return the formatted float value only with no currency sign or code
442
+	 * @param boolean $display_code whether to display the country code (USD). Default = TRUE
443
+	 * @param string  $CNT_ISO      2 letter ISO code for a country
444
+	 * @param string  $cur_code_span_class
445
+	 * @return string        the html output for the formatted money value
446
+	 */
447
+	public static function format_currency(
448
+		$amount = null,
449
+		$return_raw = false,
450
+		$display_code = true,
451
+		$CNT_ISO = '',
452
+		$cur_code_span_class = 'currency-code'
453
+	) {
454
+		// ensure amount was received
455
+		if ($amount === null) {
456
+			$msg = esc_html__('In order to format currency, an amount needs to be passed.', 'event_espresso');
457
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
458
+			return '';
459
+		}
460
+		// ensure amount is float
461
+		$amount  = (float) apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount);
462
+		$CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount);
463
+		// filter raw amount (allows 0.00 to be changed to "free" for example)
464
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
465
+		// still a number, or was amount converted to a string like "free" ?
466
+		if (! is_float($amount_formatted)) {
467
+			return esc_html($amount_formatted);
468
+		}
469
+		try {
470
+			// was a country ISO code passed ? if so generate currency config object for that country
471
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null;
472
+		} catch (Exception $e) {
473
+			// eat exception
474
+			$mny = null;
475
+		}
476
+		// verify results
477
+		if (! $mny instanceof EE_Currency_Config) {
478
+			// set default config country currency settings
479
+			$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
480
+				? EE_Registry::instance()->CFG->currency
481
+				: new EE_Currency_Config();
482
+		}
483
+		// format float
484
+		$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
485
+		// add formatting ?
486
+		if (! $return_raw) {
487
+			// add currency sign
488
+			if ($mny->sign_b4) {
489
+				if ($amount >= 0) {
490
+					$amount_formatted = $mny->sign . $amount_formatted;
491
+				} else {
492
+					$amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
493
+				}
494
+			} else {
495
+				$amount_formatted = $amount_formatted . $mny->sign;
496
+			}
497
+
498
+			// filter to allow global setting of display_code
499
+			$display_code = (bool) apply_filters(
500
+				'FHEE__EEH_Template__format_currency__display_code',
501
+				$display_code
502
+			);
503
+
504
+			// add currency code ?
505
+			$amount_formatted = $display_code
506
+				? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
507
+				: $amount_formatted;
508
+		}
509
+		// filter results
510
+		$amount_formatted = apply_filters(
511
+			'FHEE__EEH_Template__format_currency__amount_formatted',
512
+			$amount_formatted,
513
+			$mny,
514
+			$return_raw
515
+		);
516
+		// clean up vars
517
+		unset($mny);
518
+		// return formatted currency amount
519
+		return $amount_formatted;
520
+	}
521
+
522
+
523
+	/**
524
+	 * This function is used for outputting the localized label for a given status id in the schema requested (and
525
+	 * possibly plural).  The intended use of this function is only for cases where wanting a label outside of a
526
+	 * related status model or model object (i.e. in documentation etc.)
527
+	 *
528
+	 * @param string  $status_id  Status ID matching a registered status in the esp_status table.  If there is no
529
+	 *                            match, then 'Unknown' will be returned.
530
+	 * @param boolean $plural     Whether to return plural or not
531
+	 * @param string  $schema     'UPPER', 'lower', or 'Sentence'
532
+	 * @return string             The localized label for the status id.
533
+	 * @throws EE_Error
534
+	 */
535
+	public static function pretty_status($status_id, $plural = false, $schema = 'upper')
536
+	{
537
+		$status = EEM_Status::instance()->localized_status(
538
+			[$status_id => esc_html__('unknown', 'event_espresso')],
539
+			$plural,
540
+			$schema
541
+		);
542
+		return $status[ $status_id ];
543
+	}
544
+
545
+
546
+	/**
547
+	 * This helper just returns a button or link for the given parameters
548
+	 *
549
+	 * @param string $url   the url for the link, note that `esc_url` will be called on it
550
+	 * @param string $label What is the label you want displayed for the button
551
+	 * @param string $class what class is used for the button (defaults to 'button-primary')
552
+	 * @param string $icon
553
+	 * @param string $title
554
+	 * @return string the html output for the button
555
+	 */
556
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
557
+	{
558
+		$icon_html = '';
559
+		if (! empty($icon)) {
560
+			$dashicons = preg_split("(ee-icon |dashicons )", $icon);
561
+			$dashicons = array_filter($dashicons);
562
+			$count     = count($dashicons);
563
+			$icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
564
+			foreach ($dashicons as $dashicon) {
565
+				$type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
566
+				$icon_html .= '<span class="' . $type . $dashicon . '"></span>';
567
+			}
568
+			$icon_html .= $count > 1 ? '</span>' : '';
569
+		}
570
+		// sanitize & escape
571
+		$id    = sanitize_title_with_dashes($label);
572
+		$url   = esc_url_raw($url);
573
+		$class = esc_attr($class);
574
+		$title = esc_attr($title);
575
+		$label = esc_html($label);
576
+		return "<a id='{$id}' href='{$url}' class='{$class}' title='{$title}'>{$icon_html}{$label}</a>";
577
+	}
578
+
579
+
580
+	/**
581
+	 * This returns a generated link that will load the related help tab on admin pages.
582
+	 *
583
+	 * @param string      $help_tab_id the id for the connected help tab
584
+	 * @param bool|string $page        The page identifier for the page the help tab is on
585
+	 * @param bool|string $action      The action (route) for the admin page the help tab is on.
586
+	 * @param bool|string $icon_style  (optional) include css class for the style you want to use for the help icon.
587
+	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
588
+	 * @return string              generated link
589
+	 */
590
+	public static function get_help_tab_link(
591
+		$help_tab_id,
592
+		$page = false,
593
+		$action = false,
594
+		$icon_style = false,
595
+		$help_text = false
596
+	) {
597
+		$allowedtags = AllowedTags::getAllowedTags();
598
+		/** @var RequestInterface $request */
599
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
600
+		$page    = $page ?: $request->getRequestParam('page', '', 'key');
601
+		$action  = $action ?: $request->getRequestParam('action', 'default', 'key');
602
+
603
+
604
+		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
605
+		$icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
606
+		$help_text    = ! $help_text ? '' : $help_text;
607
+		return '<a id="'
608
+			   . esc_attr($help_tab_lnk)
609
+			   . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'
610
+			   . esc_attr($icon)
611
+			   . '" title="'
612
+			   . esc_attr__(
613
+				   'Click to open the \'Help\' tab for more information about this feature.',
614
+				   'event_espresso'
615
+			   )
616
+			   . '" > '
617
+			   . wp_kses($help_text, $allowedtags)
618
+			   . ' </a>';
619
+	}
620
+
621
+
622
+	/**
623
+	 * This is a helper method to generate a status legend for a given status array.
624
+	 * Note this will only work if the incoming statuses have a key in the EEM_Status->localized_status() methods
625
+	 * status_array.
626
+	 *
627
+	 * @param array  $status_array   array of statuses that will make up the legend. In format:
628
+	 *                               array(
629
+	 *                               'status_item' => 'status_name'
630
+	 *                               )
631
+	 * @param string $active_status  This is used to indicate what the active status is IF that is to be highlighted in
632
+	 *                               the legend.
633
+	 * @return string               html structure for status.
634
+	 * @throws EE_Error
635
+	 */
636
+	public static function status_legend($status_array, $active_status = '')
637
+	{
638
+		if (! is_array($status_array)) {
639
+			throw new EE_Error(
640
+				esc_html__(
641
+					'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
642
+					'event_espresso'
643
+				)
644
+			);
645
+		}
646
+
647
+		$content = '
648 648
             <div class="ee-list-table-legend-container">
649 649
                 <h4 class="status-legend-title">
650 650
                     ' . esc_html__('Status Legend', 'event_espresso') . '
651 651
                 </h4>
652 652
                 <dl class="ee-list-table-legend">';
653 653
 
654
-        foreach ($status_array as $item => $status) {
655
-            $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
656
-            $content      .= '
654
+		foreach ($status_array as $item => $status) {
655
+			$active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
656
+			$content      .= '
657 657
                     <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
658 658
                         <span class="' . esc_attr('ee-status-legend ee-status-legend-' . $status) . '"></span>
659 659
                         <span class="ee-legend-description">
660 660
                             ' . EEH_Template::pretty_status($status, false, 'sentence') . '
661 661
                         </span>
662 662
                     </dt>';
663
-        }
663
+		}
664 664
 
665
-        $content .= '
665
+		$content .= '
666 666
                 </dl>
667 667
             </div>
668 668
 ';
669
-        return $content;
670
-    }
671
-
672
-
673
-    /**
674
-     * Gets HTML for laying out a deeply-nested array (and objects) in a format
675
-     * that's nice for presenting in the wp admin
676
-     *
677
-     * @param mixed $data
678
-     * @return string
679
-     */
680
-    public static function layout_array_as_table($data)
681
-    {
682
-        if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
683
-            $data = (array) $data;
684
-        }
685
-        ob_start();
686
-        if (is_array($data)) {
687
-            if (EEH_Array::is_associative_array($data)) { ?>
669
+		return $content;
670
+	}
671
+
672
+
673
+	/**
674
+	 * Gets HTML for laying out a deeply-nested array (and objects) in a format
675
+	 * that's nice for presenting in the wp admin
676
+	 *
677
+	 * @param mixed $data
678
+	 * @return string
679
+	 */
680
+	public static function layout_array_as_table($data)
681
+	{
682
+		if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
683
+			$data = (array) $data;
684
+		}
685
+		ob_start();
686
+		if (is_array($data)) {
687
+			if (EEH_Array::is_associative_array($data)) { ?>
688 688
                 <table class="widefat">
689 689
                     <tbody>
690 690
                     <?php foreach ($data as $data_key => $data_values) { ?>
@@ -702,292 +702,292 @@  discard block
 block discarded – undo
702 702
             <?php } else { ?>
703 703
                 <ul>
704 704
                     <?php
705
-                    foreach ($data as $datum) {
706
-                        echo "<li>";
707
-                        echo self::layout_array_as_table($datum);
708
-                        echo "</li>";
709
-                    } ?>
705
+					foreach ($data as $datum) {
706
+						echo "<li>";
707
+						echo self::layout_array_as_table($datum);
708
+						echo "</li>";
709
+					} ?>
710 710
                 </ul>
711 711
             <?php }
712
-        } else {
713
-            // simple value
714
-            echo esc_html($data);
715
-        }
716
-        return ob_get_clean();
717
-    }
718
-
719
-
720
-    /**
721
-     * wrapper for self::get_paging_html() that simply echos the generated paging html
722
-     *
723
-     * @param        $total_items
724
-     * @param        $current
725
-     * @param        $per_page
726
-     * @param        $url
727
-     * @param bool   $show_num_field
728
-     * @param string $paged_arg_name
729
-     * @param array  $items_label
730
-     * @see   self:get_paging_html() for argument docs.
731
-     * @since 4.4.0
732
-     */
733
-    public static function paging_html(
734
-        $total_items,
735
-        $current,
736
-        $per_page,
737
-        $url,
738
-        $show_num_field = true,
739
-        $paged_arg_name = 'paged',
740
-        $items_label = []
741
-    ) {
742
-        echo self::get_paging_html(
743
-            $total_items,
744
-            $current,
745
-            $per_page,
746
-            $url,
747
-            $show_num_field,
748
-            $paged_arg_name,
749
-            $items_label
750
-        );
751
-    }
752
-
753
-
754
-    /**
755
-     * A method for generating paging similar to WP_List_Table
756
-     *
757
-     * @param integer $total_items      How many total items there are to page.
758
-     * @param integer $current          What the current page is.
759
-     * @param integer $per_page         How many items per page.
760
-     * @param string  $url              What the base url for page links is.
761
-     * @param boolean $show_num_field   Whether to show the input for changing page number.
762
-     * @param string  $paged_arg_name   The name of the key for the paged query argument.
763
-     * @param array   $items_label      An array of singular/plural values for the items label:
764
-     *                                  array(
765
-     *                                  'single' => 'item',
766
-     *                                  'plural' => 'items'
767
-     *                                  )
768
-     * @return  string
769
-     * @since    4.4.0
770
-     * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
771
-     */
772
-    public static function get_paging_html(
773
-        $total_items,
774
-        $current,
775
-        $per_page,
776
-        $url,
777
-        $show_num_field = true,
778
-        $paged_arg_name = 'paged',
779
-        $items_label = []
780
-    ) {
781
-        $page_links     = [];
782
-        $disable_first  = $disable_last = '';
783
-        $total_items    = (int) $total_items;
784
-        $per_page       = (int) $per_page;
785
-        $current        = (int) $current;
786
-        $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
787
-
788
-        // filter items_label
789
-        $items_label = apply_filters(
790
-            'FHEE__EEH_Template__get_paging_html__items_label',
791
-            $items_label
792
-        );
793
-
794
-        if (
795
-            empty($items_label)
796
-            || ! is_array($items_label)
797
-            || ! isset($items_label['single'])
798
-            || ! isset($items_label['plural'])
799
-        ) {
800
-            $items_label = [
801
-                'single' => esc_html__('1 item', 'event_espresso'),
802
-                'plural' => esc_html__('%s items', 'event_espresso'),
803
-            ];
804
-        } else {
805
-            $items_label = [
806
-                'single' => '1 ' . esc_html($items_label['single']),
807
-                'plural' => '%s ' . esc_html($items_label['plural']),
808
-            ];
809
-        }
810
-
811
-        $total_pages = ceil($total_items / $per_page);
812
-
813
-        if ($total_pages <= 1) {
814
-            return '';
815
-        }
816
-
817
-        $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
818
-
819
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
820
-
821
-        if ($current === 1) {
822
-            $disable_first = ' disabled';
823
-        }
824
-        if ($current == $total_pages) {
825
-            $disable_last = ' disabled';
826
-        }
827
-
828
-        $page_links[] = sprintf(
829
-            "<a class='%s' title='%s' href='%s'>%s</a>",
830
-            'first-page' . $disable_first,
831
-            esc_attr__('Go to the first page', 'event_espresso'),
832
-            esc_url_raw(remove_query_arg($paged_arg_name, $url)),
833
-            '&laquo;'
834
-        );
835
-
836
-        $page_links[] = sprintf(
837
-            '<a class="%s" title="%s" href="%s">%s</a>',
838
-            'prev-page' . $disable_first,
839
-            esc_attr__('Go to the previous page', 'event_espresso'),
840
-            esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
841
-            '&lsaquo;'
842
-        );
843
-
844
-        if (! $show_num_field) {
845
-            $html_current_page = $current;
846
-        } else {
847
-            $html_current_page = sprintf(
848
-                "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
849
-                esc_attr__('Current page', 'event_espresso'),
850
-                esc_attr($current),
851
-                strlen($total_pages)
852
-            );
853
-        }
854
-
855
-        $html_total_pages = sprintf(
856
-            '<span class="total-pages">%s</span>',
857
-            number_format_i18n($total_pages)
858
-        );
859
-        $page_links[]     = sprintf(
860
-            _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
861
-            $html_current_page,
862
-            $html_total_pages,
863
-            '<span class="paging-input">',
864
-            '</span>'
865
-        );
866
-
867
-        $page_links[] = sprintf(
868
-            '<a class="%s" title="%s" href="%s">%s</a>',
869
-            'next-page' . $disable_last,
870
-            esc_attr__('Go to the next page', 'event_espresso'),
871
-            esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
872
-            '&rsaquo;'
873
-        );
874
-
875
-        $page_links[] = sprintf(
876
-            '<a class="%s" title="%s" href="%s">%s</a>',
877
-            'last-page' . $disable_last,
878
-            esc_attr__('Go to the last page', 'event_espresso'),
879
-            esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
880
-            '&raquo;'
881
-        );
882
-
883
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
884
-        // set page class
885
-        if ($total_pages) {
886
-            $page_class = $total_pages < 2 ? ' one-page' : '';
887
-        } else {
888
-            $page_class = ' no-pages';
889
-        }
890
-
891
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
892
-    }
893
-
894
-
895
-    /**
896
-     * @param string $wrap_class
897
-     * @param string $wrap_id
898
-     * @return string
899
-     */
900
-    public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
901
-    {
902
-        $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
903
-        if (
904
-            ! $admin
905
-            && ! apply_filters(
906
-                'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
907
-                EE_Registry::instance()->CFG->admin->show_reg_footer
908
-            )
909
-        ) {
910
-            return '';
911
-        }
912
-        $tag        = $admin ? 'span' : 'div';
913
-        $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
914
-        $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
915
-        $attributes .= ! empty($wrap_class)
916
-            ? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
917
-            : ' class="powered-by-event-espresso-credit"';
918
-        $query_args = array_merge(
919
-            [
920
-                'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
921
-                'utm_source'   => 'powered_by_event_espresso',
922
-                'utm_medium'   => 'link',
923
-                'utm_campaign' => 'powered_by',
924
-            ],
925
-            $query_args
926
-        );
927
-        $powered_by = apply_filters(
928
-            'FHEE__EEH_Template__powered_by_event_espresso_text',
929
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
930
-        );
931
-        $url        = add_query_arg($query_args, 'https://eventespresso.com/');
932
-        $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
933
-        return (string) apply_filters(
934
-            'FHEE__EEH_Template__powered_by_event_espresso__html',
935
-            sprintf(
936
-                esc_html_x(
937
-                    '%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
938
-                    'Online event registration and ticketing powered by [link to eventespresso.com]',
939
-                    'event_espresso'
940
-                ),
941
-                "<{$tag}{$attributes}>",
942
-                "<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
943
-                $admin ? '' : '<br />'
944
-            ),
945
-            $wrap_class,
946
-            $wrap_id
947
-        );
948
-    }
949
-
950
-
951
-    /**
952
-     * @param string $image_name
953
-     * @return string|null
954
-     * @since   4.10.14.p
955
-     */
956
-    public static function getScreenshotUrl($image_name)
957
-    {
958
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
959
-    }
712
+		} else {
713
+			// simple value
714
+			echo esc_html($data);
715
+		}
716
+		return ob_get_clean();
717
+	}
718
+
719
+
720
+	/**
721
+	 * wrapper for self::get_paging_html() that simply echos the generated paging html
722
+	 *
723
+	 * @param        $total_items
724
+	 * @param        $current
725
+	 * @param        $per_page
726
+	 * @param        $url
727
+	 * @param bool   $show_num_field
728
+	 * @param string $paged_arg_name
729
+	 * @param array  $items_label
730
+	 * @see   self:get_paging_html() for argument docs.
731
+	 * @since 4.4.0
732
+	 */
733
+	public static function paging_html(
734
+		$total_items,
735
+		$current,
736
+		$per_page,
737
+		$url,
738
+		$show_num_field = true,
739
+		$paged_arg_name = 'paged',
740
+		$items_label = []
741
+	) {
742
+		echo self::get_paging_html(
743
+			$total_items,
744
+			$current,
745
+			$per_page,
746
+			$url,
747
+			$show_num_field,
748
+			$paged_arg_name,
749
+			$items_label
750
+		);
751
+	}
752
+
753
+
754
+	/**
755
+	 * A method for generating paging similar to WP_List_Table
756
+	 *
757
+	 * @param integer $total_items      How many total items there are to page.
758
+	 * @param integer $current          What the current page is.
759
+	 * @param integer $per_page         How many items per page.
760
+	 * @param string  $url              What the base url for page links is.
761
+	 * @param boolean $show_num_field   Whether to show the input for changing page number.
762
+	 * @param string  $paged_arg_name   The name of the key for the paged query argument.
763
+	 * @param array   $items_label      An array of singular/plural values for the items label:
764
+	 *                                  array(
765
+	 *                                  'single' => 'item',
766
+	 *                                  'plural' => 'items'
767
+	 *                                  )
768
+	 * @return  string
769
+	 * @since    4.4.0
770
+	 * @see      wp-admin/includes/class-wp-list-table.php WP_List_Table::pagination()
771
+	 */
772
+	public static function get_paging_html(
773
+		$total_items,
774
+		$current,
775
+		$per_page,
776
+		$url,
777
+		$show_num_field = true,
778
+		$paged_arg_name = 'paged',
779
+		$items_label = []
780
+	) {
781
+		$page_links     = [];
782
+		$disable_first  = $disable_last = '';
783
+		$total_items    = (int) $total_items;
784
+		$per_page       = (int) $per_page;
785
+		$current        = (int) $current;
786
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
787
+
788
+		// filter items_label
789
+		$items_label = apply_filters(
790
+			'FHEE__EEH_Template__get_paging_html__items_label',
791
+			$items_label
792
+		);
793
+
794
+		if (
795
+			empty($items_label)
796
+			|| ! is_array($items_label)
797
+			|| ! isset($items_label['single'])
798
+			|| ! isset($items_label['plural'])
799
+		) {
800
+			$items_label = [
801
+				'single' => esc_html__('1 item', 'event_espresso'),
802
+				'plural' => esc_html__('%s items', 'event_espresso'),
803
+			];
804
+		} else {
805
+			$items_label = [
806
+				'single' => '1 ' . esc_html($items_label['single']),
807
+				'plural' => '%s ' . esc_html($items_label['plural']),
808
+			];
809
+		}
810
+
811
+		$total_pages = ceil($total_items / $per_page);
812
+
813
+		if ($total_pages <= 1) {
814
+			return '';
815
+		}
816
+
817
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
818
+
819
+		$output = '<span class="displaying-num">' . $item_label . '</span>';
820
+
821
+		if ($current === 1) {
822
+			$disable_first = ' disabled';
823
+		}
824
+		if ($current == $total_pages) {
825
+			$disable_last = ' disabled';
826
+		}
827
+
828
+		$page_links[] = sprintf(
829
+			"<a class='%s' title='%s' href='%s'>%s</a>",
830
+			'first-page' . $disable_first,
831
+			esc_attr__('Go to the first page', 'event_espresso'),
832
+			esc_url_raw(remove_query_arg($paged_arg_name, $url)),
833
+			'&laquo;'
834
+		);
835
+
836
+		$page_links[] = sprintf(
837
+			'<a class="%s" title="%s" href="%s">%s</a>',
838
+			'prev-page' . $disable_first,
839
+			esc_attr__('Go to the previous page', 'event_espresso'),
840
+			esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
841
+			'&lsaquo;'
842
+		);
843
+
844
+		if (! $show_num_field) {
845
+			$html_current_page = $current;
846
+		} else {
847
+			$html_current_page = sprintf(
848
+				"<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
849
+				esc_attr__('Current page', 'event_espresso'),
850
+				esc_attr($current),
851
+				strlen($total_pages)
852
+			);
853
+		}
854
+
855
+		$html_total_pages = sprintf(
856
+			'<span class="total-pages">%s</span>',
857
+			number_format_i18n($total_pages)
858
+		);
859
+		$page_links[]     = sprintf(
860
+			_x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
861
+			$html_current_page,
862
+			$html_total_pages,
863
+			'<span class="paging-input">',
864
+			'</span>'
865
+		);
866
+
867
+		$page_links[] = sprintf(
868
+			'<a class="%s" title="%s" href="%s">%s</a>',
869
+			'next-page' . $disable_last,
870
+			esc_attr__('Go to the next page', 'event_espresso'),
871
+			esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
872
+			'&rsaquo;'
873
+		);
874
+
875
+		$page_links[] = sprintf(
876
+			'<a class="%s" title="%s" href="%s">%s</a>',
877
+			'last-page' . $disable_last,
878
+			esc_attr__('Go to the last page', 'event_espresso'),
879
+			esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
880
+			'&raquo;'
881
+		);
882
+
883
+		$output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
884
+		// set page class
885
+		if ($total_pages) {
886
+			$page_class = $total_pages < 2 ? ' one-page' : '';
887
+		} else {
888
+			$page_class = ' no-pages';
889
+		}
890
+
891
+		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
892
+	}
893
+
894
+
895
+	/**
896
+	 * @param string $wrap_class
897
+	 * @param string $wrap_id
898
+	 * @return string
899
+	 */
900
+	public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '', array $query_args = [])
901
+	{
902
+		$admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX);
903
+		if (
904
+			! $admin
905
+			&& ! apply_filters(
906
+				'FHEE__EEH_Template__powered_by_event_espresso__show_reg_footer',
907
+				EE_Registry::instance()->CFG->admin->show_reg_footer
908
+			)
909
+		) {
910
+			return '';
911
+		}
912
+		$tag        = $admin ? 'span' : 'div';
913
+		$attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : '';
914
+		$wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class;
915
+		$attributes .= ! empty($wrap_class)
916
+			? " class=\"{$wrap_class} powered-by-event-espresso-credit\""
917
+			: ' class="powered-by-event-espresso-credit"';
918
+		$query_args = array_merge(
919
+			[
920
+				'ap_id'        => EE_Registry::instance()->CFG->admin->affiliate_id(),
921
+				'utm_source'   => 'powered_by_event_espresso',
922
+				'utm_medium'   => 'link',
923
+				'utm_campaign' => 'powered_by',
924
+			],
925
+			$query_args
926
+		);
927
+		$powered_by = apply_filters(
928
+			'FHEE__EEH_Template__powered_by_event_espresso_text',
929
+			$admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
930
+		);
931
+		$url        = add_query_arg($query_args, 'https://eventespresso.com/');
932
+		$url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
933
+		return (string) apply_filters(
934
+			'FHEE__EEH_Template__powered_by_event_espresso__html',
935
+			sprintf(
936
+				esc_html_x(
937
+					'%3$s%1$sOnline event registration and ticketing powered by %2$s%3$s',
938
+					'Online event registration and ticketing powered by [link to eventespresso.com]',
939
+					'event_espresso'
940
+				),
941
+				"<{$tag}{$attributes}>",
942
+				"<a href=\"{$url}\" target=\"_blank\" rel=\"nofollow\">{$powered_by}</a></{$tag}>",
943
+				$admin ? '' : '<br />'
944
+			),
945
+			$wrap_class,
946
+			$wrap_id
947
+		);
948
+	}
949
+
950
+
951
+	/**
952
+	 * @param string $image_name
953
+	 * @return string|null
954
+	 * @since   4.10.14.p
955
+	 */
956
+	public static function getScreenshotUrl($image_name)
957
+	{
958
+		return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
959
+	}
960 960
 }
961 961
 
962 962
 
963 963
 if (! function_exists('espresso_pagination')) {
964
-    /**
965
-     *    espresso_pagination
966
-     *
967
-     * @access    public
968
-     * @return    void
969
-     */
970
-    function espresso_pagination()
971
-    {
972
-        global $wp_query;
973
-        $big        = 999999999; // need an unlikely integer
974
-        $pagination = paginate_links(
975
-            [
976
-                'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
977
-                'format'       => '?paged=%#%',
978
-                'current'      => max(1, get_query_var('paged')),
979
-                'total'        => $wp_query->max_num_pages,
980
-                'show_all'     => true,
981
-                'end_size'     => 10,
982
-                'mid_size'     => 6,
983
-                'prev_next'    => true,
984
-                'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
985
-                'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
986
-                'type'         => 'plain',
987
-                'add_args'     => false,
988
-                'add_fragment' => '',
989
-            ]
990
-        );
991
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
992
-    }
964
+	/**
965
+	 *    espresso_pagination
966
+	 *
967
+	 * @access    public
968
+	 * @return    void
969
+	 */
970
+	function espresso_pagination()
971
+	{
972
+		global $wp_query;
973
+		$big        = 999999999; // need an unlikely integer
974
+		$pagination = paginate_links(
975
+			[
976
+				'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
977
+				'format'       => '?paged=%#%',
978
+				'current'      => max(1, get_query_var('paged')),
979
+				'total'        => $wp_query->max_num_pages,
980
+				'show_all'     => true,
981
+				'end_size'     => 10,
982
+				'mid_size'     => 6,
983
+				'prev_next'    => true,
984
+				'prev_text'    => esc_html__('&lsaquo; PREV', 'event_espresso'),
985
+				'next_text'    => esc_html__('NEXT &rsaquo;', 'event_espresso'),
986
+				'type'         => 'plain',
987
+				'add_args'     => false,
988
+				'add_fragment' => '',
989
+			]
990
+		);
991
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
992
+	}
993 993
 }
994 994
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\core\services\request\RequestInterface;
7 7
 use EventEspresso\core\services\request\sanitizers\AllowedTags;
8 8
 
9
-if (! function_exists('espresso_get_template_part')) {
9
+if ( ! function_exists('espresso_get_template_part')) {
10 10
     /**
11 11
      * espresso_get_template_part
12 12
      * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 }
23 23
 
24 24
 
25
-if (! function_exists('espresso_get_object_css_class')) {
25
+if ( ! function_exists('espresso_get_object_css_class')) {
26 26
     /**
27 27
      * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
28 28
      *
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public static function load_espresso_theme_functions()
75 75
     {
76
-        if (! defined('EE_THEME_FUNCTIONS_LOADED')) {
77
-            if (is_readable(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php')) {
78
-                require_once(EE_PUBLIC . EE_Config::get_current_theme() . '/functions.php');
76
+        if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
77
+            if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php')) {
78
+                require_once(EE_PUBLIC.EE_Config::get_current_theme().'/functions.php');
79 79
             }
80 80
         }
81 81
     }
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
     public static function get_espresso_themes()
90 90
     {
91 91
         if (empty(EEH_Template::$_espresso_themes)) {
92
-            $espresso_themes = glob(EE_PUBLIC . '*', GLOB_ONLYDIR);
92
+            $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
93 93
             if (empty($espresso_themes)) {
94 94
                 return [];
95 95
             }
96 96
             if (($key = array_search('global_assets', $espresso_themes)) !== false) {
97
-                unset($espresso_themes[ $key ]);
97
+                unset($espresso_themes[$key]);
98 98
             }
99 99
             EEH_Template::$_espresso_themes = [];
100 100
             foreach ($espresso_themes as $espresso_theme) {
101
-                EEH_Template::$_espresso_themes[ basename($espresso_theme) ] = $espresso_theme;
101
+                EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
102 102
             }
103 103
         }
104 104
         return EEH_Template::$_espresso_themes;
@@ -214,10 +214,10 @@  discard block
 block discarded – undo
214 214
                 // get array of EE Custom Post Types
215 215
                 $EE_CPTs = $custom_post_types->getDefinitions();
216 216
                 // build template name based on request
217
-                if (isset($EE_CPTs[ $post_type ])) {
217
+                if (isset($EE_CPTs[$post_type])) {
218 218
                     $archive_or_single = is_archive() ? 'archive' : '';
219 219
                     $archive_or_single = is_single() ? 'single' : $archive_or_single;
220
-                    $templates         = $archive_or_single . '-' . $post_type . '.php';
220
+                    $templates         = $archive_or_single.'-'.$post_type.'.php';
221 221
                 }
222 222
             }
223 223
             // currently active EE template theme
@@ -226,18 +226,18 @@  discard block
 block discarded – undo
226 226
             // array of paths to folders that may contain templates
227 227
             $template_folder_paths = [
228 228
                 // first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
229
-                EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
229
+                EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
230 230
                 // then in the root of the /wp-content/uploads/espresso/templates/ folder
231 231
                 EVENT_ESPRESSO_TEMPLATE_DIR,
232 232
             ];
233 233
 
234 234
             // add core plugin folders for checking only if we're not $check_if_custom
235
-            if (! $check_if_custom) {
236
-                $core_paths            = [
235
+            if ( ! $check_if_custom) {
236
+                $core_paths = [
237 237
                     // in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
238
-                    EE_PUBLIC . $current_theme,
238
+                    EE_PUBLIC.$current_theme,
239 239
                     // in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
240
-                    EE_TEMPLATES . $current_theme,
240
+                    EE_TEMPLATES.$current_theme,
241 241
                     // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
242 242
                     EE_PLUGIN_DIR_PATH,
243 243
                 ];
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
                     );
273 273
                     if ($common_base_path !== '') {
274 274
                         // both paths have a common base, so just tack the filename onto our search path
275
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $file_name;
275
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
276 276
                     } else {
277 277
                         // no common base path, so let's just concatenate
278
-                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path) . $template;
278
+                        $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
279 279
                     }
280 280
                     // build up our template locations array by adding our resolved paths
281 281
                     $full_template_paths[] = $resolved_path;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
284 284
                 array_unshift($full_template_paths, $template);
285 285
                 // path to the directory of the current theme: /wp-content/themes/(current WP theme)/
286
-                array_unshift($full_template_paths, get_stylesheet_directory() . '/' . $file_name);
286
+                array_unshift($full_template_paths, get_stylesheet_directory().'/'.$file_name);
287 287
             }
288 288
             // filter final array of full template paths
289 289
             $full_template_paths = apply_filters(
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 }
335 335
             }
336 336
             $common_base_path .= $directory;
337
-            $last_offset      = $index + 1;
337
+            $last_offset = $index + 1;
338 338
         }
339 339
         return substr($common_base_path, 0, -1);
340 340
     }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
         $template_args = (array) apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
373 373
 
374 374
         // you gimme nuttin - YOU GET NUTTIN !!
375
-        if (! $template_path || ! is_readable($template_path)) {
375
+        if ( ! $template_path || ! is_readable($template_path)) {
376 376
             // ignore whether template is accessible ?
377 377
             if ($throw_exceptions) {
378 378
                 throw new DomainException(
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             return '';
383 383
         }
384 384
         // if $template_args are not in an array, then make it so
385
-        if (! is_array($template_args) && ! is_object($template_args)) {
385
+        if ( ! is_array($template_args) && ! is_object($template_args)) {
386 386
             $template_args = [$template_args];
387 387
         }
388 388
         extract($template_args, EXTR_SKIP);
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
     public static function get_object_css_class($object = null, $prefix = '', $suffix = '')
412 412
     {
413 413
         // in the beginning...
414
-        $prefix = ! empty($prefix) ? rtrim($prefix, '-') . '-' : '';
414
+        $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
415 415
         // da muddle
416 416
         $class = '';
417 417
         // the end
418
-        $suffix = ! empty($suffix) ? '-' . ltrim($suffix, '-') : '';
418
+        $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
419 419
         // is the passed object an EE object ?
420 420
         if ($object instanceof EE_Base_Class) {
421 421
             // grab the exact type of object
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
                 // no specifics just yet...
426 426
                 default:
427 427
                     $class = strtolower(str_replace('_', '-', $obj_class));
428
-                    $class .= method_exists($obj_class, 'name') ? '-' . sanitize_title($object->name()) : '';
428
+                    $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
429 429
             }
430 430
         }
431
-        return $prefix . $class . $suffix;
431
+        return $prefix.$class.$suffix;
432 432
     }
433 433
 
434 434
 
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
         // filter raw amount (allows 0.00 to be changed to "free" for example)
464 464
         $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
465 465
         // still a number, or was amount converted to a string like "free" ?
466
-        if (! is_float($amount_formatted)) {
466
+        if ( ! is_float($amount_formatted)) {
467 467
             return esc_html($amount_formatted);
468 468
         }
469 469
         try {
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
             $mny = null;
475 475
         }
476 476
         // verify results
477
-        if (! $mny instanceof EE_Currency_Config) {
477
+        if ( ! $mny instanceof EE_Currency_Config) {
478 478
             // set default config country currency settings
479 479
             $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config
480 480
                 ? EE_Registry::instance()->CFG->currency
@@ -483,16 +483,16 @@  discard block
 block discarded – undo
483 483
         // format float
484 484
         $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
485 485
         // add formatting ?
486
-        if (! $return_raw) {
486
+        if ( ! $return_raw) {
487 487
             // add currency sign
488 488
             if ($mny->sign_b4) {
489 489
                 if ($amount >= 0) {
490
-                    $amount_formatted = $mny->sign . $amount_formatted;
490
+                    $amount_formatted = $mny->sign.$amount_formatted;
491 491
                 } else {
492
-                    $amount_formatted = '-' . $mny->sign . str_replace('-', '', $amount_formatted);
492
+                    $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
493 493
                 }
494 494
             } else {
495
-                $amount_formatted = $amount_formatted . $mny->sign;
495
+                $amount_formatted = $amount_formatted.$mny->sign;
496 496
             }
497 497
 
498 498
             // filter to allow global setting of display_code
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 
504 504
             // add currency code ?
505 505
             $amount_formatted = $display_code
506
-                ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>'
506
+                ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>'
507 507
                 : $amount_formatted;
508 508
         }
509 509
         // filter results
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
             $plural,
540 540
             $schema
541 541
         );
542
-        return $status[ $status_id ];
542
+        return $status[$status_id];
543 543
     }
544 544
 
545 545
 
@@ -556,14 +556,14 @@  discard block
 block discarded – undo
556 556
     public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '')
557 557
     {
558 558
         $icon_html = '';
559
-        if (! empty($icon)) {
559
+        if ( ! empty($icon)) {
560 560
             $dashicons = preg_split("(ee-icon |dashicons )", $icon);
561 561
             $dashicons = array_filter($dashicons);
562 562
             $count     = count($dashicons);
563 563
             $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : '';
564 564
             foreach ($dashicons as $dashicon) {
565
-                $type      = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
566
-                $icon_html .= '<span class="' . $type . $dashicon . '"></span>';
565
+                $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons ';
566
+                $icon_html .= '<span class="'.$type.$dashicon.'"></span>';
567 567
             }
568 568
             $icon_html .= $count > 1 ? '</span>' : '';
569 569
         }
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
         $action  = $action ?: $request->getRequestParam('action', 'default', 'key');
602 602
 
603 603
 
604
-        $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
604
+        $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
605 605
         $icon         = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
606 606
         $help_text    = ! $help_text ? '' : $help_text;
607 607
         return '<a id="'
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
      */
636 636
     public static function status_legend($status_array, $active_status = '')
637 637
     {
638
-        if (! is_array($status_array)) {
638
+        if ( ! is_array($status_array)) {
639 639
             throw new EE_Error(
640 640
                 esc_html__(
641 641
                     'The EEH_Template::status_legend helper required the incoming status_array argument to be an array!',
@@ -647,17 +647,17 @@  discard block
 block discarded – undo
647 647
         $content = '
648 648
             <div class="ee-list-table-legend-container">
649 649
                 <h4 class="status-legend-title">
650
-                    ' . esc_html__('Status Legend', 'event_espresso') . '
650
+                    ' . esc_html__('Status Legend', 'event_espresso').'
651 651
                 </h4>
652 652
                 <dl class="ee-list-table-legend">';
653 653
 
654 654
         foreach ($status_array as $item => $status) {
655 655
             $active_class = $active_status == $status ? 'class="ee-is-active-status"' : '';
656
-            $content      .= '
657
-                    <dt id="' . esc_attr('ee-legend-item-tooltip-' . $item) . '" ' . $active_class . '>
658
-                        <span class="' . esc_attr('ee-status-legend ee-status-legend-' . $status) . '"></span>
656
+            $content .= '
657
+                    <dt id="' . esc_attr('ee-legend-item-tooltip-'.$item).'" '.$active_class.'>
658
+                        <span class="' . esc_attr('ee-status-legend ee-status-legend-'.$status).'"></span>
659 659
                         <span class="ee-legend-description">
660
-                            ' . EEH_Template::pretty_status($status, false, 'sentence') . '
660
+                            ' . EEH_Template::pretty_status($status, false, 'sentence').'
661 661
                         </span>
662 662
                     </dt>';
663 663
         }
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
             ];
804 804
         } else {
805 805
             $items_label = [
806
-                'single' => '1 ' . esc_html($items_label['single']),
807
-                'plural' => '%s ' . esc_html($items_label['plural']),
806
+                'single' => '1 '.esc_html($items_label['single']),
807
+                'plural' => '%s '.esc_html($items_label['plural']),
808 808
             ];
809 809
         }
810 810
 
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 
817 817
         $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
818 818
 
819
-        $output = '<span class="displaying-num">' . $item_label . '</span>';
819
+        $output = '<span class="displaying-num">'.$item_label.'</span>';
820 820
 
821 821
         if ($current === 1) {
822 822
             $disable_first = ' disabled';
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 
828 828
         $page_links[] = sprintf(
829 829
             "<a class='%s' title='%s' href='%s'>%s</a>",
830
-            'first-page' . $disable_first,
830
+            'first-page'.$disable_first,
831 831
             esc_attr__('Go to the first page', 'event_espresso'),
832 832
             esc_url_raw(remove_query_arg($paged_arg_name, $url)),
833 833
             '&laquo;'
@@ -835,13 +835,13 @@  discard block
 block discarded – undo
835 835
 
836 836
         $page_links[] = sprintf(
837 837
             '<a class="%s" title="%s" href="%s">%s</a>',
838
-            'prev-page' . $disable_first,
838
+            'prev-page'.$disable_first,
839 839
             esc_attr__('Go to the previous page', 'event_espresso'),
840 840
             esc_url_raw(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
841 841
             '&lsaquo;'
842 842
         );
843 843
 
844
-        if (! $show_num_field) {
844
+        if ( ! $show_num_field) {
845 845
             $html_current_page = $current;
846 846
         } else {
847 847
             $html_current_page = sprintf(
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
             '<span class="total-pages">%s</span>',
857 857
             number_format_i18n($total_pages)
858 858
         );
859
-        $page_links[]     = sprintf(
859
+        $page_links[] = sprintf(
860 860
             _x('%3$s%1$s of %2$s%4$s', 'paging', 'event_espresso'),
861 861
             $html_current_page,
862 862
             $html_total_pages,
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
         $page_links[] = sprintf(
868 868
             '<a class="%s" title="%s" href="%s">%s</a>',
869
-            'next-page' . $disable_last,
869
+            'next-page'.$disable_last,
870 870
             esc_attr__('Go to the next page', 'event_espresso'),
871 871
             esc_url_raw(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
872 872
             '&rsaquo;'
@@ -874,13 +874,13 @@  discard block
 block discarded – undo
874 874
 
875 875
         $page_links[] = sprintf(
876 876
             '<a class="%s" title="%s" href="%s">%s</a>',
877
-            'last-page' . $disable_last,
877
+            'last-page'.$disable_last,
878 878
             esc_attr__('Go to the last page', 'event_espresso'),
879 879
             esc_url_raw(add_query_arg($paged_arg_name, $total_pages, $url)),
880 880
             '&raquo;'
881 881
         );
882 882
 
883
-        $output .= "\n" . '<span class="pagination-links">' . join("\n", $page_links) . '</span>';
883
+        $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
884 884
         // set page class
885 885
         if ($total_pages) {
886 886
             $page_class = $total_pages < 2 ? ' one-page' : '';
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
             $page_class = ' no-pages';
889 889
         }
890 890
 
891
-        return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
891
+        return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
892 892
     }
893 893
 
894 894
 
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
         );
927 927
         $powered_by = apply_filters(
928 928
             'FHEE__EEH_Template__powered_by_event_espresso_text',
929
-            $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso'
929
+            $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'
930 930
         );
931 931
         $url        = add_query_arg($query_args, 'https://eventespresso.com/');
932 932
         $url        = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url);
@@ -955,12 +955,12 @@  discard block
 block discarded – undo
955 955
      */
956 956
     public static function getScreenshotUrl($image_name)
957 957
     {
958
-        return esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/screenshots/' . $image_name . '.jpg');
958
+        return esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/screenshots/'.$image_name.'.jpg');
959 959
     }
960 960
 }
961 961
 
962 962
 
963
-if (! function_exists('espresso_pagination')) {
963
+if ( ! function_exists('espresso_pagination')) {
964 964
     /**
965 965
      *    espresso_pagination
966 966
      *
@@ -988,6 +988,6 @@  discard block
 block discarded – undo
988 988
                 'add_fragment' => '',
989 989
             ]
990 990
         );
991
-        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">' . $pagination . '</div>' : '';
991
+        echo ! empty($pagination) ? '<div class="ee-pagination-dv ee-clear-float">'.$pagination.'</div>' : '';
992 992
     }
993 993
 }
994 994
\ No newline at end of file
Please login to merge, or discard this patch.
Invoice/templates/invoice_payment_details_content.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 $allowedtags = AllowedTags::getAllowedTags();
17 17
 ?>
18 18
 <div class="event-display-boxes">
19
-    <?php if (! empty($page_title)) { ?>
19
+    <?php if ( ! empty($page_title)) { ?>
20 20
         <h4 id="invoice_title" class="payment_type_title section-heading">
21 21
             <?php echo esc_html($page_title); ?>
22 22
         </h4>
23 23
     <?php }
24
-    if (! empty($invoice_url)) { ?>
24
+    if ( ! empty($invoice_url)) { ?>
25 25
         <p>
26 26
             <a href="<?php echo esc_url_raw($invoice_url); ?>"
27 27
                class="ee-button-lnk inline-button ee-invoice-lnk"
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                 <p class="instruct"><?php echo wpautop(wp_kses($page_confirmation_text, $allowedtags)); ?></p>
37 37
             </div>
38 38
         <?php }
39
-        if (! empty($page_extra_info)) { ?>
39
+        if ( ! empty($page_extra_info)) { ?>
40 40
             <div class="address-block">
41 41
                 <?php echo wpautop(wp_kses($page_extra_info, $allowedtags)); ?>
42 42
             </div>
Please login to merge, or discard this patch.
espresso_thank_you/templates/thank-you-page-payment-details.template.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 <div id="espresso-thank-you-page-payment-details-dv">
19 19
     <?php
20
-    if (! empty($payments)) { ?>
20
+	if (! empty($payments)) { ?>
21 21
         <table class="ee-table">
22 22
             <thead>
23 23
             <tr>
@@ -37,39 +37,39 @@  discard block
 block discarded – undo
37 37
             </thead>
38 38
             <tbody>
39 39
             <?php
40
-            foreach ($payments as $payment) {
41
-                echo wp_kses($payment, AllowedTags::getAllowedTags());
42
-            }
43
-            ?>
40
+			foreach ($payments as $payment) {
41
+				echo wp_kses($payment, AllowedTags::getAllowedTags());
42
+			}
43
+			?>
44 44
             </tbody>
45 45
         </table>
46 46
         <?php
47
-    } else {
48
-        if ($transaction->total()) {
49
-            echo apply_filters(
50
-                'FHEE__payment_overview_template__no_payments_made',
51
-                sprintf(
52
-                    esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
53
-                    '<p class="important-notice">',
54
-                    '</p>'
55
-                )
56
-            );
57
-            do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
58
-        } else {
59
-            echo apply_filters(
60
-                'FHEE__payment_overview_template__no_payment_required',
61
-                sprintf(
62
-                    esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
63
-                    '<p>',
64
-                    '</p>'
65
-                )
66
-            );
67
-            do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
68
-        }
69
-    }
70
-    echo wp_kses($gateway_content, AllowedTags::getAllowedTags());
71
-    do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
72
-    ?>
47
+	} else {
48
+		if ($transaction->total()) {
49
+			echo apply_filters(
50
+				'FHEE__payment_overview_template__no_payments_made',
51
+				sprintf(
52
+					esc_html__('%sNo payments towards this transaction have been received.%s', 'event_espresso'),
53
+					'<p class="important-notice">',
54
+					'</p>'
55
+				)
56
+			);
57
+			do_action('AHEE__thank_you_page_payment_details_template__no_payments_made', $transaction);
58
+		} else {
59
+			echo apply_filters(
60
+				'FHEE__payment_overview_template__no_payment_required',
61
+				sprintf(
62
+					esc_html__('%sNo payment is required for this transaction.%s', 'event_espresso'),
63
+					'<p>',
64
+					'</p>'
65
+				)
66
+			);
67
+			do_action('AHEE__thank_you_page_payment_details_template__no_payment_required');
68
+		}
69
+	}
70
+	echo wp_kses($gateway_content, AllowedTags::getAllowedTags());
71
+	do_action('AHEE__thank_you_page_payment_details_template__after_gateway_content', $gateway_content);
72
+	?>
73 73
 
74 74
     <br/>
75 75
     <?php do_action('AHEE__thank_you_page_payment_details_template__after_payment_details'); ?>
Please login to merge, or discard this patch.
templates/thank-you-page-registration-details.template.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
 
13 13
 <div class="ee-registration-details-dv">
14 14
     <?php
15
-    $registrations = $transaction->registrations();
16
-    $registrations = is_array($registrations) ? $registrations : [];
17
-    $reg_count     = count($registrations);
18
-    $reg_cntr      = 0;
19
-    $event_name    = '';
20
-    $wait_list     = false;
21
-    foreach ($registrations as $registration) {
22
-        if ($registration instanceof EE_Registration) {
23
-            if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
15
+	$registrations = $transaction->registrations();
16
+	$registrations = is_array($registrations) ? $registrations : [];
17
+	$reg_count     = count($registrations);
18
+	$reg_cntr      = 0;
19
+	$event_name    = '';
20
+	$wait_list     = false;
21
+	foreach ($registrations as $registration) {
22
+		if ($registration instanceof EE_Registration) {
23
+			if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
24 24
                 </tbody>
25 25
                 </table>
26 26
                 <?php
27
-            }
28
-            $reg_cntr++;
29
-            if ($event_name != $registration->event_name()) {
30
-                ?>
27
+			}
28
+			$reg_cntr++;
29
+			if ($event_name != $registration->event_name()) {
30
+				?>
31 31
                 <h5>
32 32
                     <span class="smaller-text grey-text">
33 33
                         <?php esc_html_e('for', 'event_espresso'); ?> :
@@ -50,25 +50,25 @@  discard block
 block discarded – undo
50 50
                 </thead>
51 51
                 <tbody>
52 52
                 <?php
53
-            }
54
-            if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
53
+			}
54
+			if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
55 55
                 <tr>
56 56
                     <td width="40%">
57 57
                         <?php
58
-                        if ($registration->attendee() instanceof EE_Attendee) {
59
-                            echo esc_html($registration->attendee()->full_name(true));
60
-                        }
61
-                        ?>
58
+						if ($registration->attendee() instanceof EE_Attendee) {
59
+							echo esc_html($registration->attendee()->full_name(true));
60
+						}
61
+						?>
62 62
                         <p class="tiny-text" style="margin: .75em 0 0;">
63 63
                             <?php
64
-                            if ($registration->count_question_groups()) {
65
-                                ?>
64
+							if ($registration->count_question_groups()) {
65
+								?>
66 66
                                 <a class="ee-icon-only-lnk"
67 67
                                    href="<?php echo esc_url_raw($registration->edit_attendee_information_url()); ?>"
68 68
                                    title="<?php esc_attr_e(
69
-                                       'Click here to edit Attendee Information',
70
-                                       'event_espresso'
71
-                                   ); ?>"
69
+									   'Click here to edit Attendee Information',
70
+									   'event_espresso'
71
+								   ); ?>"
72 72
                                 >
73 73
                                     <span class="ee-icon ee-icon-user-edit"></span>
74 74
                                     <?php esc_html_e('edit info', 'event_espresso'); ?>
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
                             <?php } ?>
77 77
                             <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk"
78 78
                                href="<?php echo add_query_arg(
79
-                                   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
80
-                                   EE_Registry::instance()->CFG->core->thank_you_page_url()
81
-                               ); ?>"
79
+								   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
80
+								   EE_Registry::instance()->CFG->core->thank_you_page_url()
81
+							   ); ?>"
82 82
                                title="<?php esc_attr_e(
83
-                                   'Click here to resend the Registration Confirmation email',
84
-                                   'event_espresso'
85
-                               ); ?>"
83
+								   'Click here to resend the Registration Confirmation email',
84
+								   'event_espresso'
85
+							   ); ?>"
86 86
                                rel="<?php echo esc_attr($registration->reg_url_link()); ?>"
87 87
                             >
88 88
                                 <span class="dashicons dashicons-email-alt"></span>
@@ -96,55 +96,55 @@  discard block
 block discarded – undo
96 96
                     <td width="35%" class="jst-left">
97 97
                         <?php $registration->e_pretty_status(true) ?>
98 98
                         <?php
99
-                        if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
100
-                            $wait_list = true;
101
-                        }
102
-                        ?>
99
+						if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
100
+							$wait_list = true;
101
+						}
102
+						?>
103 103
                     </td>
104 104
                 </tr>
105 105
                 <?php
106
-                do_action(
107
-                    'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
108
-                    $registration
109
-                );
110
-                $event_name = $registration->event_name();
111
-            }
112
-            if ($reg_cntr >= $reg_count) {
113
-                ?>
106
+				do_action(
107
+					'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
108
+					$registration
109
+				);
110
+				$event_name = $registration->event_name();
111
+			}
112
+			if ($reg_cntr >= $reg_count) {
113
+				?>
114 114
                 </tbody>
115 115
                 </table>
116 116
                 <?php
117
-            }
118
-        }
119
-    }
120
-    ?>
117
+			}
118
+		}
119
+	}
120
+	?>
121 121
     <?php if ($is_primary && $SPCO_attendee_information_url) { ?>
122 122
         <p class="small-text jst-rght">
123 123
             <a href='<?php echo esc_url_raw($SPCO_attendee_information_url) ?>'>
124 124
                 <?php esc_html_e(
125
-                    "Click here to edit All Attendee Information",
126
-                    'event_espresso'
127
-                ); ?>
125
+					"Click here to edit All Attendee Information",
126
+					'event_espresso'
127
+				); ?>
128 128
             </a>
129 129
         </p>
130 130
     <?php }
131
-    if ($wait_list) {
132
-        echo apply_filters(
133
-            'AFEE__thank_you_page_registration_details_template__wait_list_notice',
134
-            sprintf(
135
-                esc_html__(
136
-                    '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
137
-                    'event_espresso'
138
-                ),
139
-                '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
140
-                '</h6 ><p class="ee-wait-list-notice">',
141
-                '</p ><br />'
142
-            )
143
-        );
144
-    }
131
+	if ($wait_list) {
132
+		echo apply_filters(
133
+			'AFEE__thank_you_page_registration_details_template__wait_list_notice',
134
+			sprintf(
135
+				esc_html__(
136
+					'%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
137
+					'event_espresso'
138
+				),
139
+				'<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
140
+				'</h6 ><p class="ee-wait-list-notice">',
141
+				'</p ><br />'
142
+			)
143
+		);
144
+	}
145 145
 
146
-    do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
-    ?>
146
+	do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
+	?>
148 148
 
149 149
 </div>
150 150
 <!-- end of .registration-details -->
Please login to merge, or discard this patch.