Completed
Branch FEAT-7553-PayPal-Express-PM (0ca3c2)
by
unknown
71:02 queued 56:56
created
modules/ticket_selector_caff/EED_Ticket_Selector_Caff.module.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 	 * @return EED_Ticket_Selector_Caff
17 17
 	 */
18 18
 	public static function instance() {
19
-		return parent::get_instance( __CLASS__ );
19
+		return parent::get_instance(__CLASS__);
20 20
 	}
21 21
 
22 22
 
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks_admin() {
40
-		define( 'TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
41
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Ticket_Selector_Caff', 'template_settings_form' ), 10 );
42
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Ticket_Selector_Caff', 'update_template_settings' ), 10, 2 );
40
+		define('TICKET_SELECTOR_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
41
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Ticket_Selector_Caff', 'template_settings_form'), 10);
42
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Ticket_Selector_Caff', 'update_template_settings'), 10, 2);
43 43
 	}
44 44
 
45 45
 
46 46
 	//just required because of abstract declaration
47
-	public function run( $WP ) {
47
+	public function run($WP) {
48 48
 		$this->set_config();
49 49
 	}
50 50
 
51 51
 
52 52
 
53 53
 
54
-	protected function set_config(){
55
-		$this->set_config_section( 'template_settings' );
56
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
57
-		$this->set_config_name( 'EED_Ticket_Selector' );
54
+	protected function set_config() {
55
+		$this->set_config_section('template_settings');
56
+		$this->set_config_class('EE_Ticket_Selector_Config');
57
+		$this->set_config_name('EED_Ticket_Selector');
58 58
 	}
59 59
 
60 60
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 					'FHEE__EED_Ticket_Selector_Caff___ticket_selector_settings_form__form_subsections',
88 88
 					array(
89 89
 						'appearance_settings_hdr' 	=> new EE_Form_Section_HTML(
90
-							EEH_HTML::br(2) .
91
-							EEH_HTML::h2( __( 'Ticket Selector Template Settings', 'event_espresso' ))
90
+							EEH_HTML::br(2).
91
+							EEH_HTML::h2(__('Ticket Selector Template Settings', 'event_espresso'))
92 92
 						),
93 93
 						'appearance_settings' 			=> EED_Ticket_Selector_Caff::_ticket_selector_appearance_settings()
94 94
 					)
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 						array(
114 114
 							'show_ticket_details' => new EE_Yes_No_Input(
115 115
 								array(
116
-									'html_label_text' => __('Show Ticket Details?', 'event_espresso' ),
117
-									'html_help_text' => __( 'This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
118
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details )
116
+									'html_label_text' => __('Show Ticket Details?', 'event_espresso'),
117
+									'html_help_text' => __('This lets you choose whether the extra ticket details section is displayed with the ticket selector.', 'event_espresso'),
118
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details)
119 119
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_details
120 120
 										: true,
121 121
 									'display_html_label_text' => false
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 							),
124 124
 							'show_ticket_sale_columns' => new EE_Yes_No_Input(
125 125
 								array(
126
-									'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso' ),
127
-									'html_help_text' => __( 'This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
128
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns )
126
+									'html_label_text' => __('Show Ticket Sale Info?', 'event_espresso'),
127
+									'html_help_text' => __('This lets you indicate whether information about ticket sales is shown with ticket details in the ticket selector.', 'event_espresso'),
128
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns)
129 129
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_ticket_sale_columns
130 130
 										: true,
131 131
 									'display_html_label_text' => false
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
 							),
134 134
 							'show_expired_tickets' => new EE_Yes_No_Input(
135 135
 								array(
136
-									'html_label_text' => __( 'Show Expired Tickets?', 'event_espresso' ),
137
-									'html_help_text' => __( 'Indicate whether to show expired tickets in the ticket selector', 'event_espresso' ),
138
-									'default' => isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets )
136
+									'html_label_text' => __('Show Expired Tickets?', 'event_espresso'),
137
+									'html_help_text' => __('Indicate whether to show expired tickets in the ticket selector', 'event_espresso'),
138
+									'default' => isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets)
139 139
 										? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets
140 140
 										: true,
141 141
 									'display_html_label_text' => false
@@ -158,21 +158,21 @@  discard block
 block discarded – undo
158 158
 	 * @param array              $REQ incoming request
159 159
 	 * @return EE_Template_Config
160 160
 	 */
161
-	public static function update_template_settings( EE_Template_Config $CFG, $REQ ) {
162
-		if ( ! isset( $CFG->EED_Ticket_Selector ) ) {
161
+	public static function update_template_settings(EE_Template_Config $CFG, $REQ) {
162
+		if ( ! isset($CFG->EED_Ticket_Selector)) {
163 163
 			$CFG->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
164 164
 		}
165 165
 		try {
166 166
 			$ticket_selector_form = EED_Ticket_Selector_Caff::_ticket_selector_settings_form();
167 167
 
168 168
 			//check for form submission
169
-			if ( $ticket_selector_form->was_submitted() ) {
169
+			if ($ticket_selector_form->was_submitted()) {
170 170
 
171 171
 				//capture form data
172 172
 				$ticket_selector_form->receive_form_submission();
173 173
 
174 174
 				//validate form data
175
-				if ( $ticket_selector_form->is_valid() ) {
175
+				if ($ticket_selector_form->is_valid()) {
176 176
 
177 177
 					//grab validated data from form
178 178
 					$valid_data = $ticket_selector_form->valid_data();
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 					$CFG->EED_Ticket_Selector->show_ticket_details = $valid_data['appearance_settings']['show_ticket_details'];
183 183
 					$CFG->EED_Ticket_Selector->show_expired_tickets = $valid_data['appearance_settings']['show_expired_tickets'];
184 184
 				} else {
185
-					if ( $ticket_selector_form->submission_error_message() !== '' ) {
186
-						EE_Error::add_error( $ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
185
+					if ($ticket_selector_form->submission_error_message() !== '') {
186
+						EE_Error::add_error($ticket_selector_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
187 187
 					}
188 188
 				}
189 189
 
190 190
 			}
191
-		} catch( EE_Error $e ) {
191
+		} catch (EE_Error $e) {
192 192
 			$e->get_error();
193 193
 		}
194 194
 
Please login to merge, or discard this patch.
core/admin/templates/admin_details_wrapper_no_sidebar.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
 
22 22
 
23 23
         <div id="postbox-container-2" class="postbox-container">
24
-            <?php do_meta_boxes( $current_page, 'normal', NULL ); ?>
25
-            <?php do_meta_boxes( $current_page, 'advanced', NULL ); ?>
24
+            <?php do_meta_boxes($current_page, 'normal', NULL); ?>
25
+            <?php do_meta_boxes($current_page, 'advanced', NULL); ?>
26 26
         </div>
27 27
         <!-- postbox-container-2 -->
28 28
         <div class="clear"></div>
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@  discard block
 block discarded – undo
9 9
 
10 10
 $row = 1;
11 11
 $max = 1;
12
-$ticket_count = count( $tickets );
12
+$ticket_count = count($tickets);
13 13
 $ticket_status_display = '';
14
-if ( ! $ticket_count ) {
14
+if ( ! $ticket_count) {
15 15
 	return;
16 16
 }
17 17
 
18 18
 $required_ticket_sold_out = FALSE;
19
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector )
19
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
20 20
 	? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
21 21
 	: new EE_Ticket_Selector_Config();
22 22
 
23
-$tax_settings = isset ( EE_Registry::instance()->CFG->tax_settings )
23
+$tax_settings = isset (EE_Registry::instance()->CFG->tax_settings)
24 24
 	? EE_Registry::instance()->CFG->tax_settings
25 25
 	: new EE_Tax_Config();
26 26
 
@@ -29,22 +29,22 @@  discard block
 block discarded – undo
29 29
 
30 30
 ob_start();
31 31
 
32
-foreach ( $tickets as $TKT_ID => $ticket ) {
33
-	if ( $ticket instanceof EE_Ticket ) {
32
+foreach ($tickets as $TKT_ID => $ticket) {
33
+	if ($ticket instanceof EE_Ticket) {
34 34
 		$cols = 2;
35 35
 		$max = $ticket->max();
36 36
 		$min = 0;
37 37
 		$remaining = $ticket->remaining();
38
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
38
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
39 39
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
40
-			$max = min( $remaining, $max_atndz );
40
+			$max = min($remaining, $max_atndz);
41 41
 			// but... we also want to restrict the number of tickets by the ticket max setting,
42 42
 			// however, the max still can't be higher than what was just set above
43
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
43
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
44 44
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
45 45
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
46 46
 			// and if the ticket is required, then make sure that min qty is at least 1
47
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
47
+			$min = $ticket->required() ? max($min, 1) : $min;
48 48
 		} else {
49 49
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
50 50
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -56,41 +56,41 @@  discard block
 block discarded – undo
56 56
 		$taxable_tickets = $ticket->taxable() ? true : $taxable_tickets;
57 57
 		$ticket_bundle = FALSE;
58 58
 		// for ticket bundles, set min and max qty the same
59
-		if ( $ticket->min() !== 0 && $ticket->min() === $ticket->max() ) {
59
+		if ($ticket->min() !== 0 && $ticket->min() === $ticket->max()) {
60 60
 			$ticket_price *= $ticket->min();
61 61
 			$ticket_bundle = TRUE;
62 62
 		}
63
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
63
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
64 64
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
65 65
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
66 66
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
67 67
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
68 68
 		// check ticket status
69
-		switch ( $tkt_status ) {
69
+		switch ($tkt_status) {
70 70
 			// sold_out
71 71
 			case EE_Ticket::sold_out :
72
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
72
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
73 73
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
74 74
 			break;
75 75
 			// expired
76 76
 			case EE_Ticket::expired :
77
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
77
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
78 78
 				$status_class = 'ticket-sales-expired lt-grey-text';
79 79
 			break;
80 80
 			// archived
81 81
 			case EE_Ticket::archived :
82
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
82
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
83 83
 				$status_class = 'archived-ticket hidden';
84 84
 			break;
85 85
 			// pending
86 86
 			case EE_Ticket::pending :
87
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
87
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
88 88
 				$status_class = 'ticket-pending';
89 89
 			break;
90 90
 			// onsale
91 91
 			case EE_Ticket::onsale :
92 92
 			default :
93
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
93
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
94 94
 				$status_class = 'ticket-on-sale';
95 95
 			break;
96 96
 		}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}"
131 131
         );
132 132
 	?>
133
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
133
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
134 134
 		<?php
135 135
 		/**
136 136
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -142,24 +142,24 @@  discard block
 block discarded – undo
142 142
 		 *
143 143
 		 * @var string|bool
144 144
 		 */
145
-		if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
145
+		if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
146 146
 			echo $new_row_cells_content;
147 147
 			echo '</tr>';
148 148
 			continue;
149 149
 		}
150 150
 		?>
151 151
 					<td class="tckt-slctr-tbl-td-name">
152
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
153
-						<?php if ( $template_settings->show_ticket_details ) : ?>
154
-							<a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
155
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
152
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
153
+						<?php if ($template_settings->show_ticket_details) : ?>
154
+							<a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
155
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
156 156
 							</a>
157
-							<a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
158
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
157
+							<a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
158
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
159 159
 							</a>
160 160
 						<?php endif; //end show details check ?>
161
-					<?php if ( $ticket->required() ) { ?>
162
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
161
+					<?php if ($ticket->required()) { ?>
162
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
163 163
 					<?php } ?>
164 164
 					<?php
165 165
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -173,15 +173,15 @@  discard block
 block discarded – undo
173 173
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
174 174
 					?>
175 175
 					</td>
176
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) && $max_atndz > 1 ) { ?>
176
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE) && $max_atndz > 1) { ?>
177 177
 					<td class="tckt-slctr-tbl-td-price jst-rght"><?php
178
-						echo EEH_Template::format_currency( $ticket_price );
178
+						echo EEH_Template::format_currency($ticket_price);
179 179
 						echo $ticket->taxable() ? '<span class="taxable-tickets-asterisk grey-text">*</span>' : '';
180 180
 						?>&nbsp;<span class="smaller-text no-bold"><?php
181
-						if ( $ticket_bundle ) {
182
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
181
+						if ($ticket_bundle) {
182
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
183 183
 						} else {
184
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
184
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
185 185
 						}?></span>&nbsp;</td>
186 186
 						<?php $cols++; ?>
187 187
 					<?php } ?>
@@ -190,53 +190,53 @@  discard block
 block discarded – undo
190 190
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
191 191
 					$ticket_status_display = '';
192 192
 					// sold out or other status ?
193
-					if ( $tkt_status === EE_Ticket::sold_out || $remaining === 0 ) {
194
-						$ticket_status_display =  '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' )) . '</span>';
195
-					} else if ( $tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived ) {
193
+					if ($tkt_status === EE_Ticket::sold_out || $remaining === 0) {
194
+						$ticket_status_display = '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')).'</span>';
195
+					} else if ($tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived) {
196 196
 						$ticket_status_display = $ticket_status;
197
-					} else if ( $tkt_status === EE_Ticket::pending ) {
197
+					} else if ($tkt_status === EE_Ticket::pending) {
198 198
 						$ticket_status_display =
199 199
 					'<span class="ticket-pending-pg">
200 200
 						<span class="ticket-pending">'
201
-						. apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' ))
201
+						. apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso'))
202 202
 					. '</span><br/>
203 203
 						<span class="small-text">'
204
-						. $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) )
204
+						. $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format))
205 205
 					. '</span>
206 206
 					</span>';
207 207
 					// min qty purchasable is less than tickets available
208
-					} else if ( $ticket->min() > $remaining ) {
208
+					} else if ($ticket->min() > $remaining) {
209 209
 						$ticket_status_display = '
210 210
 					<div class="archived-ticket-pg">
211 211
 						<span class="archived-ticket small-text">'
212
-						 . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' ))
212
+						 . apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso'))
213 213
 					 . '</span><br/>
214 214
 					</div>';
215 215
 					// if only one attendee is allowed to register at a time
216
-					} else if ( $max_atndz  === 1 ) {
216
+					} else if ($max_atndz === 1) {
217 217
 						// display submit button since we have tickets available
218
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
218
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
219 219
 				?>
220
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?>  title=""/>
220
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?>  title=""/>
221 221
 			<?php
222 222
 						$hidden_input_qty = FALSE;
223 223
 
224
-					} else if ( $max_atndz  === 0 ) {
225
-						$ticket_status_display = '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
226
-					} elseif ( $max > 0 ) {
224
+					} else if ($max_atndz === 0) {
225
+						$ticket_status_display = '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
226
+					} elseif ($max > 0) {
227 227
 						// display submit button since we have tickets available
228
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
228
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
229 229
 
230 230
 				?>
231
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
231
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
232 232
 					<?php
233 233
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
234
-						if ( ! $ticket->required() && $min !== 0 ) {
234
+						if ( ! $ticket->required() && $min !== 0) {
235 235
 					?>
236 236
 						<option value="0">&nbsp;0&nbsp;</option>
237 237
 					<?php }
238 238
 						// offer ticket quantities from the min to the max
239
-						for ( $i = $min; $i <= $max; $i++) {
239
+						for ($i = $min; $i <= $max; $i++) {
240 240
 					?>
241 241
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
242 242
 					<?php } ?>
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 					}
248 248
 					echo $ticket_status_display;
249 249
 					// depending on group reg we need to change the format for qty
250
-					if ( $hidden_input_qty ) {
250
+					if ($hidden_input_qty) {
251 251
 					?>
252 252
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
253 253
 					<?php
@@ -257,33 +257,33 @@  discard block
 block discarded – undo
257 257
 
258 258
 					</td>
259 259
 				</tr>
260
-				<?php if ( $template_settings->show_ticket_details ) : ?>
261
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
260
+				<?php if ($template_settings->show_ticket_details) : ?>
261
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
262 262
 						<td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>" >
263 263
 							<div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
264 264
 
265 265
 								<section class="tckt-slctr-tkt-details-sctn">
266
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
266
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
267 267
 									<p><?php echo $ticket->description(); ?></p>
268 268
 
269
-									<?php if ( $ticket_price !== 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?>
269
+									<?php if ($ticket_price !== 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
270 270
 									<section class="tckt-slctr-tkt-price-sctn">
271
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
271
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
272 272
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
273 273
 											<table class="tckt-slctr-tkt-details-tbl">
274 274
 												<thead>
275 275
 													<tr>
276
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
277
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
278
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
276
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
277
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
278
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
279 279
 													</tr>
280 280
 												</thead>
281 281
 												<tbody>
282
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
282
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
283 283
 													<tr>
284
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
285
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
286
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
284
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
285
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
286
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
287 287
 													</tr>
288 288
 													<?php
289 289
 															$running_total = $ticket->base_price()->amount();
@@ -291,44 +291,44 @@  discard block
 block discarded – undo
291 291
 															$running_total = 0;
292 292
 														}
293 293
 														// now add price modifiers
294
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
294
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
295 295
 													<tr>
296
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
297
-													<?php if ( $price_mod->is_percent() ) { ?>
298
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
296
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
297
+													<?php if ($price_mod->is_percent()) { ?>
298
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
299 299
 														<?php
300
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
300
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
301 301
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
302 302
 														?>
303 303
 													<?php } else { ?>
304 304
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
305
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
305
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
306 306
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
307 307
 													<?php } ?>
308
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
308
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
309 309
 														<?php $running_total += $new_sub_total; ?>
310 310
 													</tr>
311 311
 												<?php } ?>
312
-												<?php if ( $ticket->taxable() ) { ?>
312
+												<?php if ($ticket->taxable()) { ?>
313 313
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
314 314
 													<tr>
315
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
316
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
315
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
316
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
317 317
 													</tr>
318 318
 
319
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
319
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
320 320
 													<tr>
321
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
322
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
323
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
324
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
321
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
322
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
323
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
324
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
325 325
 														<?php $running_total += $tax_amount; ?>
326 326
 													</tr>
327 327
 													<?php } ?>
328 328
 												<?php } ?>
329 329
 													<tr>
330
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
331
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
330
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
331
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
332 332
 													</tr>
333 333
 												</tbody>
334 334
 											</table>
@@ -338,106 +338,106 @@  discard block
 block discarded – undo
338 338
 									<?php } ?>
339 339
 
340 340
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
341
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
342
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
343
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
344
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
341
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
342
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
343
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
344
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
345 345
 									</section>
346 346
 									<br/>
347 347
 
348
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
348
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
349 349
 
350
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
350
+									<?php if ($ticket->min() && $ticket->max()) { ?>
351 351
 									<section class="tckt-slctr-tkt-quantities-sctn">
352
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
353
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
354
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
355
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
352
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
353
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
354
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
355
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
356 356
 										<?php //$max = min( $max, $max_atndz );?>
357
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
357
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
358 358
 									</section>
359 359
 									<br/>
360 360
 									<?php } ?>
361 361
 
362
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
362
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
363 363
 									<section class="tckt-slctr-tkt-uses-sctn">
364
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
364
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
365 365
 										<span class="drk-grey-text small-text no-bold"> - <?php
366 366
 											echo apply_filters(
367 367
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
368 368
 												sprintf(
369
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
369
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
370 370
 													'<br/>',
371 371
 													'<strong>',
372 372
 													'</strong>'
373 373
 												)
374 374
 											);
375 375
 											?></span><br/>
376
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
376
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
377 377
 									</section>
378 378
 									<?php } ?>
379 379
 
380 380
 									<?php
381
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
381
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
382 382
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
383
-									if ( ! empty( $datetimes )) { ?>
383
+									if ( ! empty($datetimes)) { ?>
384 384
 									<section class="tckt-slctr-tkt-datetimes-sctn">
385
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
386
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
385
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
386
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
387 387
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
388 388
 											<table class="tckt-slctr-tkt-details-tbl">
389 389
 												<thead>
390 390
 													<tr>
391 391
 														<th class="tckt-slctr-tkt-details-date-th">
392
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
392
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
393 393
 														</th>
394 394
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
395
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
395
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
396 396
 														</th>
397
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
397
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
398 398
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
399
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
399
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
400 400
 															</th>
401 401
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
402
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
402
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
403 403
 															</th>
404 404
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
405
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
405
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
406 406
 															</th>
407 407
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
408
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
408
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
409 409
 															</th>
410 410
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
411 411
 													</tr>
412 412
 												</thead>
413 413
 												<tbody>
414 414
 											<?php
415
-												foreach ( $datetimes as $datetime ) {
416
-													if ( $datetime instanceof EE_Datetime ) {
415
+												foreach ($datetimes as $datetime) {
416
+													if ($datetime instanceof EE_Datetime) {
417 417
 											?>
418 418
 
419 419
 												<tr>
420
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
420
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
421 421
 														<?php $datetime_name = $datetime->name(); ?>
422
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
423
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
422
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
423
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
424 424
 													</td>
425
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
426
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
425
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
426
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
427 427
 													</td>
428
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
429
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
428
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
429
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
430 430
 															<?php echo $ticket->sold(); ?>
431 431
 														</td>
432
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
433
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
432
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
433
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
434 434
 														</td>
435
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
435
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
436 436
 															<?php echo $datetime->sold(); ?>
437 437
 														</td>
438
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
439
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
440
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
438
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
439
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
440
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
441 441
 														</td>
442 442
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
443 443
 												</tr>
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 							</div>
456 456
 						</td>
457 457
 					</tr>
458
-				<?php endif;  //end template_settings->show_ticket_details check?>
458
+				<?php endif; //end template_settings->show_ticket_details check?>
459 459
 	<?php
460 460
 			$row++;
461 461
 		}
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 $ticket_row_html = ob_get_clean();
465 465
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
466 466
 $hide_ticket_selector = $ticket_count === 1 && $max_atndz === 1 && $ticket->is_free() ? true : false;
467
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
467
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
468 468
 // \EEH_Debug_Tools::printr( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ), 'display submit', __FILE__, __LINE__ );
469 469
 // EEH_Debug_Tools::printr( (string) $ticket_count, '$ticket_count', __FILE__, __LINE__ );
470 470
 // EEH_Debug_Tools::printr( (string) $max, '$max', __FILE__, __LINE__ );
@@ -479,20 +479,20 @@  discard block
 block discarded – undo
479 479
 * @param string '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
480 480
 * @param int $EVT_ID The Event ID
481 481
 */
482
-$anchor_id = apply_filters( 'FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-' . $EVT_ID, $EVT_ID );
483
-if ( ! $hide_ticket_selector ) {
482
+$anchor_id = apply_filters('FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-'.$EVT_ID, $EVT_ID);
483
+if ( ! $hide_ticket_selector) {
484 484
 ?>
485 485
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
486 486
 
487
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
487
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
488 488
 
489 489
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
490 490
 		<thead>
491 491
 			<tr>
492 492
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
493
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
493
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
494 494
 				</th>
495
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) && $max_atndz > 1 ) { ?>
495
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE) && $max_atndz > 1) { ?>
496 496
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
497 497
 					<?php
498 498
 						/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 						 * @param string 'Price' The translatable text to display in the table header for price
504 504
 						 * @param int $EVT_ID The Event ID
505 505
 						 */
506
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
506
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
507 507
 					?>
508 508
 				</th>
509 509
 				<?php } ?>
@@ -517,75 +517,75 @@  discard block
 block discarded – undo
517 517
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
518 518
 						* @param int $EVT_ID The Event ID
519 519
 						*/
520
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
520
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
521 521
 					?>
522 522
 				</th>
523 523
 			</tr>
524 524
 		</thead>
525 525
 		<tbody>
526
-			<?php echo $ticket_row_html;?>
526
+			<?php echo $ticket_row_html; ?>
527 527
 		</tbody>
528 528
 	</table>
529 529
 	<?php
530
-	if ( $taxable_tickets && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', true ) ) {
531
-		if ( $tax_settings->prices_displayed_including_taxes ) {
532
-			$ticket_price_includes_taxes = __( '* price includes taxes', 'event_espresso' );
530
+	if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) {
531
+		if ($tax_settings->prices_displayed_including_taxes) {
532
+			$ticket_price_includes_taxes = __('* price includes taxes', 'event_espresso');
533 533
 		} else {
534
-			$ticket_price_includes_taxes = __( '* price does not include taxes', 'event_espresso' );
534
+			$ticket_price_includes_taxes = __('* price does not include taxes', 'event_espresso');
535 535
 		}
536
-		echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>';
536
+		echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>';
537 537
 	}
538 538
 	?>
539 539
 
540 540
 	<input type="hidden" name="noheader" value="true" />
541
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>" />
541
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>" />
542 542
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
543 543
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
544 544
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
545 545
 
546 546
 <?php
547
-if ( $max_atndz > 0 ) {
547
+if ($max_atndz > 0) {
548 548
 	echo apply_filters(
549 549
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
550 550
 		''
551 551
 	);
552 552
 }
553
-if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) {
554
-	add_filter( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true' );
553
+if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
554
+	add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true');
555 555
 }
556
-do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
556
+do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
557 557
 ?>
558 558
 
559 559
 </div>
560
-<?php } else if ( isset( $TKT_ID ) ) { ?>
560
+<?php } else if (isset($TKT_ID)) { ?>
561 561
 
562 562
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
563 563
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
564 564
 <input type="hidden" name="noheader" value="true"/>
565
-<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>"/>
565
+<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>"/>
566 566
 <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>"/>
567 567
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
568 568
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
569 569
 <?php
570
-	if ( $ticket instanceof EE_Ticket ) {
571
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
570
+	if ($ticket instanceof EE_Ticket) {
571
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
572 572
 		$ticket_description = $ticket->description();
573
-		$ticket_description .= ! empty( $ticket_description )
574
-			? '<br />' . $ticket_status_display
573
+		$ticket_description .= ! empty($ticket_description)
574
+			? '<br />'.$ticket_status_display
575 575
 			: $ticket_status_display;
576
-		if ( ! strpos( $ticket_description, '<div' ) ) {
576
+		if ( ! strpos($ticket_description, '<div')) {
577 577
 			$ticket_description = "<p>{$ticket_description}</p>";
578 578
 		}
579 579
 ?>
580 580
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
581 581
 	<div class="no-tkt-slctr-ticket-content-dv">
582 582
 		<h5><?php echo $ticket->name(); ?></h5>
583
-		<?php if ( ! empty( $ticket_description ) ) { ?>
583
+		<?php if ( ! empty($ticket_description)) { ?>
584 584
 		<?php echo $ticket_description; ?>
585 585
 		<?php } ?>
586 586
 	</div>
587 587
 <?php
588
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
588
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
589 589
 	}
590 590
 }
591 591
 ?>
Please login to merge, or discard this patch.
core/admin/PostShortcodeTracking.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
      * @param  int $ID
260 260
      * @param      $shortcode_class
261 261
      * @param      $shortcode_posts
262
-     * @param      $page_for_posts
262
+     * @param      string $page_for_posts
263 263
      * @param bool $update_post_shortcodes
264 264
      * @return bool
265 265
      */
Please login to merge, or discard this patch.
Indentation   +445 added lines, -445 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\admin;
3 3
 
4 4
 if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
5
+	exit( 'No direct script access allowed' );
6 6
 }
7 7
 
8 8
 
@@ -19,450 +19,450 @@  discard block
 block discarded – undo
19 19
 class PostShortcodeTracking
20 20
 {
21 21
 
22
-    /**
23
-     * set_hooks_admin
24
-     *
25
-     * @access    public
26
-     */
27
-    public static function set_hooks_admin()
28
-    {
29
-        add_action(
30
-            'save_post',
31
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
32
-            100,
33
-            2
34
-        );
35
-        add_action(
36
-            'delete_post',
37
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
38
-            100,
39
-            1
40
-        );
41
-        add_action(
42
-            'add_option_page_for_posts',
43
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
44
-            100,
45
-            2
46
-        );
47
-        add_action(
48
-            'update_option',
49
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
50
-            100,
51
-            3
52
-        );
53
-        add_action(
54
-            'delete_option',
55
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
56
-            100,
57
-            1
58
-        );
59
-    }
60
-
61
-
62
-
63
-    /**
64
-     *    parse_post_content_on_save
65
-     *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
66
-     *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before
67
-     *    the_content() runs. this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the
68
-     *    shortcodes are actually used on
69
-     *
70
-     * @access    public
71
-     * @param int      $post_ID
72
-     * @param \WP_Post $post
73
-     * @return    void
74
-     */
75
-    public static function parse_post_content_on_save( $post_ID, $post )
76
-    {
77
-        // if the post is trashed, then let's remove our post shortcode tracking
78
-        if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
-            PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
80
-            return;
81
-        }
82
-        // default post types
83
-        $post_types = array( 'post' => 0, 'page' => 1 );
84
-        // add CPTs
85
-        $CPTs = \EE_Register_CPTs::get_CPTs();
86
-        $post_types = array_merge( $post_types, $CPTs );
87
-        // for default or CPT posts...
88
-        if ( isset( $post_types[ $post->post_type ] ) ) {
89
-            // post on frontpage ?
90
-            $page_for_posts = \EE_Config::get_page_for_posts();
91
-            if ( $post->post_name === $page_for_posts ) {
92
-                PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
93
-                return;
94
-            }
95
-            // array of shortcodes indexed by post name
96
-            \EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
97
-                ? \EE_Registry::CFG()->core->post_shortcodes
98
-                : array();
99
-            // whether to proceed with update
100
-            $update_post_shortcodes = false;
101
-            // empty both arrays
102
-            \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
103
-            // check that posts page is already being tracked
104
-            if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
105
-                // if not, then ensure that it is properly added
106
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
107
-            }
108
-            // loop thru shortcodes
109
-            foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
110
-                // convert to UPPERCASE to get actual shortcode
111
-                $EES_Shortcode = strtoupper( $EES_Shortcode );
112
-                // is the shortcode in the post_content ?
113
-                if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
114
-                    // map shortcode to post names and post IDs
115
-                    \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
116
-                    // and add this shortcode to the tracking for the blog page
117
-                    PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
-                        $post_ID );
119
-                    $update_post_shortcodes = true;
120
-                } else {
121
-                    // shortcode is not present in post content, so check if we were tracking it previously
122
-                    // stop tracking if shortcode is not used in this specific post
123
-                    if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
125
-                        $update_post_shortcodes = true;
126
-                    }
127
-                    // make sure that something is set for the shortcode posts (even though we may remove this)
128
-                    $shortcode_posts = isset(
129
-                        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
130
-                    )
131
-                        ? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
132
-                        : array();
133
-                    // and stop tracking for this shortcode on the blog page if it is not used
134
-                    $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
135
-                        $post_ID,
136
-                        $EES_Shortcode,
137
-                        $shortcode_posts,
138
-                        $page_for_posts,
139
-                        $update_post_shortcodes
140
-                    )
141
-                        ? true
142
-                        : $update_post_shortcodes;
143
-                }
144
-            }
145
-            if ( $update_post_shortcodes ) {
146
-                PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
147
-            }
148
-        }
149
-    }
150
-
151
-
152
-
153
-    /**
154
-     * set_post_shortcodes_for_posts_page (plz note: shortcodes is plural)
155
-     * called when updating the WordPress Posts Page,
156
-     * and adds shortcode tracking for the Posts Page, for all shortcodes currently tracked on individual posts
157
-     *
158
-     * @access protected
159
-     * @param  string $page_for_posts
160
-     * @return void
161
-     */
162
-    protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
163
-    {
164
-        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
165
-        // loop thru shortcodes
166
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
-            foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
-                PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
169
-            }
170
-        }
171
-        PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
172
-    }
173
-
174
-
175
-
176
-    /**
177
-     * set_post_shortcode_for_posts_page (plz note: shortcode is singular)
178
-     * adds Posts Page shortcode tracking for the supplied shortcode for an individual post
179
-     *
180
-     * @access protected
181
-     * @param  string $page_for_posts
182
-     * @param         $EES_Shortcode
183
-     * @param         $post_ID
184
-     */
185
-    protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
186
-    {
187
-        // critical page shortcodes that we do NOT want added to the Posts page (blog)
188
-        $critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189
-        // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
-        if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
191
-            return;
192
-        }
193
-        // add shortcode to "Posts page" tracking
194
-        if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
195
-            // make sure tracking is in form of an array
196
-            if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
-                    \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
199
-                );
200
-            }
201
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
202
-        } else {
203
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
204
-        }
205
-    }
206
-
207
-
208
-
209
-    /**
210
-     * unset_post_shortcodes_on_delete
211
-     *
212
-     * @access protected
213
-     * @param  int $ID
214
-     * @return void
215
-     */
216
-    public static function unset_post_shortcodes_on_delete( $ID )
217
-    {
218
-        $update_post_shortcodes = false;
219
-        // post on frontpage ?
220
-        $page_for_posts = \EE_Config::get_page_for_posts();
221
-        // looking for any references to this post
222
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
223
-            // is this the "Posts Page" (blog) ?
224
-            if ( $post_name === $page_for_posts ) {
225
-                // loop thru shortcodes registered for the posts page
226
-                foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
227
-                    $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228
-                        $ID,
229
-                        $shortcode_class,
230
-                        $shortcode_posts,
231
-                        $page_for_posts,
232
-                        $update_post_shortcodes
233
-                    )
234
-                        ? true
235
-                        : $update_post_shortcodes;
236
-                }
237
-            } else {
238
-                // loop thru shortcodes registered for each page
239
-                foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
240
-                    // if this is page is being deleted, then don't track any post shortcodes for it
241
-                    if ( $post_ID === $ID ) {
242
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
243
-                        $update_post_shortcodes = true;
244
-                    }
245
-                }
246
-            }
247
-        }
248
-        if ( $update_post_shortcodes ) {
249
-            PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
250
-        }
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * unset_post_shortcodes_on_delete
257
-     *
258
-     * @access protected
259
-     * @param  int $ID
260
-     * @param      $shortcode_class
261
-     * @param      $shortcode_posts
262
-     * @param      $page_for_posts
263
-     * @param bool $update_post_shortcodes
264
-     * @return bool
265
-     */
266
-    protected static function unset_posts_page_shortcode_for_post(
267
-        $ID,
268
-        $shortcode_class,
269
-        $shortcode_posts,
270
-        $page_for_posts,
271
-        $update_post_shortcodes = false
272
-    ) {
273
-        // make sure that an array of post IDs is being tracked for each  shortcode
274
-        if ( ! is_array( $shortcode_posts ) ) {
275
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
276
-                $shortcode_posts => true,
277
-            );
278
-            $update_post_shortcodes = true;
279
-        }
280
-        // now if the ID of the post being deleted is in the $shortcode_posts array
281
-        if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
283
-            $update_post_shortcodes = true;
284
-        }
285
-        // if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
-        if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
288
-            $update_post_shortcodes = true;
289
-        }
290
-        return $update_post_shortcodes;
291
-    }
292
-
293
-
294
-
295
-    /**
296
-     *    update_post_shortcodes
297
-     *
298
-     * @access    public
299
-     * @param $page_for_posts
300
-     * @return    void
301
-     */
302
-    public static function update_post_shortcodes( $page_for_posts = '' )
303
-    {
304
-        // make sure page_for_posts is set
305
-        $page_for_posts = ! empty( $page_for_posts )
306
-            ? $page_for_posts
307
-            : \EE_Config::get_page_for_posts();
308
-        // allow others to mess stuff up :D
309
-        do_action(
310
-            'AHEE__\EventEspresso\core\admin\PostShortcodeTracking__update_post_shortcodes',
311
-            \EE_Config::instance()->core->post_shortcodes,
312
-            $page_for_posts
313
-        );
314
-        // keep old hookpoint for now, will deprecate later
315
-        do_action(
316
-            'AHEE__EE_Config__update_post_shortcodes',
317
-            \EE_Config::instance()->core->post_shortcodes,
318
-            $page_for_posts
319
-        );
320
-        // verify that post_shortcodes is set
321
-        \EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
-                                                        && is_array( \EE_Config::instance()->core->post_shortcodes )
323
-            ? \EE_Config::instance()->core->post_shortcodes
324
-            : array();
325
-        // cycle thru post_shortcodes
326
-        foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
327
-            // are there any shortcodes to track ?
328
-            if ( ! empty( $shortcodes ) ) {
329
-                // skip the posts page, because we want all shortcodes registered for it
330
-                if ( $post_name === $page_for_posts ) {
331
-                    continue;
332
-                }
333
-                // loop thru list of tracked shortcodes
334
-                foreach ( $shortcodes as $shortcode => $post_id ) {
335
-                    // make sure post still exists
336
-                    $post = get_post( $post_id );
337
-                    // check that the post name matches what we have saved
338
-                    if ( $post && $post->post_name === $post_name ) {
339
-                        // if so, then break before hitting the unset below
340
-                        continue;
341
-                    }
342
-                    // we don't like missing posts around here >:(
343
-                    unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
344
-                }
345
-            } else {
346
-                // you got no shortcodes to keep track of !
347
-                unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
348
-            }
349
-        }
350
-        // critical page shortcodes that we do NOT want added to the Posts page (blog)
351
-        $critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
-        $critical_shortcodes = array_flip( $critical_shortcodes );
353
-        foreach ( $critical_shortcodes as $critical_shortcode ) {
354
-            unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
355
-        }
356
-        //only show errors
357
-        \EE_Config::instance()->update_espresso_config();
358
-    }
359
-
360
-
361
-
362
-    /**
363
-     * reset_page_for_posts_on_initial_set
364
-     * if an admin is on the WP Reading Settings page and sets the option for "Posts page",
365
-     * when it had previously been unset,
366
-     * then we need to attribute any actively used shortcodes to the new blog page
367
-     *
368
-     * @access public
369
-     * @param  string $option
370
-     * @param  string $value
371
-     * @return void
372
-     */
373
-    public static function reset_page_for_posts_on_initial_set( $option, $value )
374
-    {
375
-        PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
376
-    }
377
-
378
-
379
-
380
-    /**
381
-     *    reset_page_for_posts_on_change
382
-     *    if an admin is on the WP Reading Settings page and changes the option for "Posts page",
383
-     * then we need to attribute any actively used shortcodes for the previous blog page to the new blog page
384
-     *
385
-     * @access public
386
-     * @param  string $option
387
-     * @param  string $old_value
388
-     * @param  string $value
389
-     * @return void
390
-     */
391
-    public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
392
-    {
393
-        if ( $option === 'page_for_posts' ) {
394
-            global $wpdb;
395
-            $table = $wpdb->posts;
396
-            $SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
-            $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
399
-        }
400
-    }
401
-
402
-
403
-
404
-    /**
405
-     * reset_page_for_posts_on_delete
406
-     * if an admin deletes a page designated as the WP "Posts page",
407
-     * then we need to attribute any actively used shortcodes for that blog page to a generic 'posts' page
408
-     *
409
-     * @access public
410
-     * @param  string $option
411
-     * @return void
412
-     */
413
-    public static function reset_page_for_posts_on_delete( $option )
414
-    {
415
-        if ( $option === 'page_for_posts' ) {
416
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
417
-        }
418
-    }
419
-
420
-
421
-
422
-    /**
423
-     * @param array|string $shortcodes
424
-     * @param bool         $index_results if passing more than one shortcode for the $shortcodes parameter above,
425
-     *                                    then setting this to true, will return as associative array indexed by
426
-     *                                    the shortcodes. If false, then the returned array will be unindexed
427
-     * @return array
428
-     */
429
-    public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
430
-    {
431
-        $post_ids = array();
432
-        if ( is_array( $shortcodes ) ) {
433
-            foreach ( $shortcodes as $shortcode ) {
434
-                $new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435
-                    $shortcode,
436
-                    $index_results
437
-                );
438
-                foreach ( $new_post_ids as $new_post_id ) {
439
-                    if ( $index_results ) {
440
-                        $post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
441
-                    } else {
442
-                        $post_ids[ $new_post_id ] = $new_post_id;
443
-                    }
444
-                }
445
-            }
446
-        } else {
447
-            $shortcode = strtoupper( $shortcodes );
448
-            $shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449
-            $page_for_posts = \EE_Config::get_page_for_posts();
450
-            // looking for any references to this post
451
-            foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
452
-                // if this is the "Posts Page" (blog), then skip it
453
-                if ( $post_name === $page_for_posts ) {
454
-                    continue;
455
-                }
456
-                // loop thru shortcodes registered for each page, and grab post id for matches
457
-                foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
-                    if ( $post_shortcode === $shortcode ) {
459
-                        $post_ids[ $post_ID ] = $post_ID;
460
-                    }
461
-                }
462
-            }
463
-        }
464
-        return $post_ids;
465
-    }
22
+	/**
23
+	 * set_hooks_admin
24
+	 *
25
+	 * @access    public
26
+	 */
27
+	public static function set_hooks_admin()
28
+	{
29
+		add_action(
30
+			'save_post',
31
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
32
+			100,
33
+			2
34
+		);
35
+		add_action(
36
+			'delete_post',
37
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
38
+			100,
39
+			1
40
+		);
41
+		add_action(
42
+			'add_option_page_for_posts',
43
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
44
+			100,
45
+			2
46
+		);
47
+		add_action(
48
+			'update_option',
49
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
50
+			100,
51
+			3
52
+		);
53
+		add_action(
54
+			'delete_option',
55
+			array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
56
+			100,
57
+			1
58
+		);
59
+	}
60
+
61
+
62
+
63
+	/**
64
+	 *    parse_post_content_on_save
65
+	 *    any time a post is saved, we need to check for any EE shortcodes that may be embedded in the content,
66
+	 *    and then track what posts those shortcodes are on, so that we can initialize shortcodes well before
67
+	 *    the_content() runs. this allows us to do things like enqueue scripts for shortcodes ONLY on the pages the
68
+	 *    shortcodes are actually used on
69
+	 *
70
+	 * @access    public
71
+	 * @param int      $post_ID
72
+	 * @param \WP_Post $post
73
+	 * @return    void
74
+	 */
75
+	public static function parse_post_content_on_save( $post_ID, $post )
76
+	{
77
+		// if the post is trashed, then let's remove our post shortcode tracking
78
+		if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
+			PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
80
+			return;
81
+		}
82
+		// default post types
83
+		$post_types = array( 'post' => 0, 'page' => 1 );
84
+		// add CPTs
85
+		$CPTs = \EE_Register_CPTs::get_CPTs();
86
+		$post_types = array_merge( $post_types, $CPTs );
87
+		// for default or CPT posts...
88
+		if ( isset( $post_types[ $post->post_type ] ) ) {
89
+			// post on frontpage ?
90
+			$page_for_posts = \EE_Config::get_page_for_posts();
91
+			if ( $post->post_name === $page_for_posts ) {
92
+				PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
93
+				return;
94
+			}
95
+			// array of shortcodes indexed by post name
96
+			\EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
97
+				? \EE_Registry::CFG()->core->post_shortcodes
98
+				: array();
99
+			// whether to proceed with update
100
+			$update_post_shortcodes = false;
101
+			// empty both arrays
102
+			\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
103
+			// check that posts page is already being tracked
104
+			if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
105
+				// if not, then ensure that it is properly added
106
+				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
107
+			}
108
+			// loop thru shortcodes
109
+			foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
110
+				// convert to UPPERCASE to get actual shortcode
111
+				$EES_Shortcode = strtoupper( $EES_Shortcode );
112
+				// is the shortcode in the post_content ?
113
+				if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
114
+					// map shortcode to post names and post IDs
115
+					\EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
116
+					// and add this shortcode to the tracking for the blog page
117
+					PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
+						$post_ID );
119
+					$update_post_shortcodes = true;
120
+				} else {
121
+					// shortcode is not present in post content, so check if we were tracking it previously
122
+					// stop tracking if shortcode is not used in this specific post
123
+					if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
+						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
125
+						$update_post_shortcodes = true;
126
+					}
127
+					// make sure that something is set for the shortcode posts (even though we may remove this)
128
+					$shortcode_posts = isset(
129
+						\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
130
+					)
131
+						? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
132
+						: array();
133
+					// and stop tracking for this shortcode on the blog page if it is not used
134
+					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
135
+						$post_ID,
136
+						$EES_Shortcode,
137
+						$shortcode_posts,
138
+						$page_for_posts,
139
+						$update_post_shortcodes
140
+					)
141
+						? true
142
+						: $update_post_shortcodes;
143
+				}
144
+			}
145
+			if ( $update_post_shortcodes ) {
146
+				PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
147
+			}
148
+		}
149
+	}
150
+
151
+
152
+
153
+	/**
154
+	 * set_post_shortcodes_for_posts_page (plz note: shortcodes is plural)
155
+	 * called when updating the WordPress Posts Page,
156
+	 * and adds shortcode tracking for the Posts Page, for all shortcodes currently tracked on individual posts
157
+	 *
158
+	 * @access protected
159
+	 * @param  string $page_for_posts
160
+	 * @return void
161
+	 */
162
+	protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
163
+	{
164
+		\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
165
+		// loop thru shortcodes
166
+		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
+			foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
+				PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
169
+			}
170
+		}
171
+		PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
172
+	}
173
+
174
+
175
+
176
+	/**
177
+	 * set_post_shortcode_for_posts_page (plz note: shortcode is singular)
178
+	 * adds Posts Page shortcode tracking for the supplied shortcode for an individual post
179
+	 *
180
+	 * @access protected
181
+	 * @param  string $page_for_posts
182
+	 * @param         $EES_Shortcode
183
+	 * @param         $post_ID
184
+	 */
185
+	protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
186
+	{
187
+		// critical page shortcodes that we do NOT want added to the Posts page (blog)
188
+		$critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189
+		// if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
+		if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
191
+			return;
192
+		}
193
+		// add shortcode to "Posts page" tracking
194
+		if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
195
+			// make sure tracking is in form of an array
196
+			if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
+				\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
+					\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
199
+				);
200
+			}
201
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
202
+		} else {
203
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
204
+		}
205
+	}
206
+
207
+
208
+
209
+	/**
210
+	 * unset_post_shortcodes_on_delete
211
+	 *
212
+	 * @access protected
213
+	 * @param  int $ID
214
+	 * @return void
215
+	 */
216
+	public static function unset_post_shortcodes_on_delete( $ID )
217
+	{
218
+		$update_post_shortcodes = false;
219
+		// post on frontpage ?
220
+		$page_for_posts = \EE_Config::get_page_for_posts();
221
+		// looking for any references to this post
222
+		foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
223
+			// is this the "Posts Page" (blog) ?
224
+			if ( $post_name === $page_for_posts ) {
225
+				// loop thru shortcodes registered for the posts page
226
+				foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
227
+					$update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228
+						$ID,
229
+						$shortcode_class,
230
+						$shortcode_posts,
231
+						$page_for_posts,
232
+						$update_post_shortcodes
233
+					)
234
+						? true
235
+						: $update_post_shortcodes;
236
+				}
237
+			} else {
238
+				// loop thru shortcodes registered for each page
239
+				foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
240
+					// if this is page is being deleted, then don't track any post shortcodes for it
241
+					if ( $post_ID === $ID ) {
242
+						unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
243
+						$update_post_shortcodes = true;
244
+					}
245
+				}
246
+			}
247
+		}
248
+		if ( $update_post_shortcodes ) {
249
+			PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
250
+		}
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * unset_post_shortcodes_on_delete
257
+	 *
258
+	 * @access protected
259
+	 * @param  int $ID
260
+	 * @param      $shortcode_class
261
+	 * @param      $shortcode_posts
262
+	 * @param      $page_for_posts
263
+	 * @param bool $update_post_shortcodes
264
+	 * @return bool
265
+	 */
266
+	protected static function unset_posts_page_shortcode_for_post(
267
+		$ID,
268
+		$shortcode_class,
269
+		$shortcode_posts,
270
+		$page_for_posts,
271
+		$update_post_shortcodes = false
272
+	) {
273
+		// make sure that an array of post IDs is being tracked for each  shortcode
274
+		if ( ! is_array( $shortcode_posts ) ) {
275
+			\EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
276
+				$shortcode_posts => true,
277
+			);
278
+			$update_post_shortcodes = true;
279
+		}
280
+		// now if the ID of the post being deleted is in the $shortcode_posts array
281
+		if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
+			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
283
+			$update_post_shortcodes = true;
284
+		}
285
+		// if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
+		if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
+			unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
288
+			$update_post_shortcodes = true;
289
+		}
290
+		return $update_post_shortcodes;
291
+	}
292
+
293
+
294
+
295
+	/**
296
+	 *    update_post_shortcodes
297
+	 *
298
+	 * @access    public
299
+	 * @param $page_for_posts
300
+	 * @return    void
301
+	 */
302
+	public static function update_post_shortcodes( $page_for_posts = '' )
303
+	{
304
+		// make sure page_for_posts is set
305
+		$page_for_posts = ! empty( $page_for_posts )
306
+			? $page_for_posts
307
+			: \EE_Config::get_page_for_posts();
308
+		// allow others to mess stuff up :D
309
+		do_action(
310
+			'AHEE__\EventEspresso\core\admin\PostShortcodeTracking__update_post_shortcodes',
311
+			\EE_Config::instance()->core->post_shortcodes,
312
+			$page_for_posts
313
+		);
314
+		// keep old hookpoint for now, will deprecate later
315
+		do_action(
316
+			'AHEE__EE_Config__update_post_shortcodes',
317
+			\EE_Config::instance()->core->post_shortcodes,
318
+			$page_for_posts
319
+		);
320
+		// verify that post_shortcodes is set
321
+		\EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
+														&& is_array( \EE_Config::instance()->core->post_shortcodes )
323
+			? \EE_Config::instance()->core->post_shortcodes
324
+			: array();
325
+		// cycle thru post_shortcodes
326
+		foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
327
+			// are there any shortcodes to track ?
328
+			if ( ! empty( $shortcodes ) ) {
329
+				// skip the posts page, because we want all shortcodes registered for it
330
+				if ( $post_name === $page_for_posts ) {
331
+					continue;
332
+				}
333
+				// loop thru list of tracked shortcodes
334
+				foreach ( $shortcodes as $shortcode => $post_id ) {
335
+					// make sure post still exists
336
+					$post = get_post( $post_id );
337
+					// check that the post name matches what we have saved
338
+					if ( $post && $post->post_name === $post_name ) {
339
+						// if so, then break before hitting the unset below
340
+						continue;
341
+					}
342
+					// we don't like missing posts around here >:(
343
+					unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
344
+				}
345
+			} else {
346
+				// you got no shortcodes to keep track of !
347
+				unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
348
+			}
349
+		}
350
+		// critical page shortcodes that we do NOT want added to the Posts page (blog)
351
+		$critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
+		$critical_shortcodes = array_flip( $critical_shortcodes );
353
+		foreach ( $critical_shortcodes as $critical_shortcode ) {
354
+			unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
355
+		}
356
+		//only show errors
357
+		\EE_Config::instance()->update_espresso_config();
358
+	}
359
+
360
+
361
+
362
+	/**
363
+	 * reset_page_for_posts_on_initial_set
364
+	 * if an admin is on the WP Reading Settings page and sets the option for "Posts page",
365
+	 * when it had previously been unset,
366
+	 * then we need to attribute any actively used shortcodes to the new blog page
367
+	 *
368
+	 * @access public
369
+	 * @param  string $option
370
+	 * @param  string $value
371
+	 * @return void
372
+	 */
373
+	public static function reset_page_for_posts_on_initial_set( $option, $value )
374
+	{
375
+		PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
376
+	}
377
+
378
+
379
+
380
+	/**
381
+	 *    reset_page_for_posts_on_change
382
+	 *    if an admin is on the WP Reading Settings page and changes the option for "Posts page",
383
+	 * then we need to attribute any actively used shortcodes for the previous blog page to the new blog page
384
+	 *
385
+	 * @access public
386
+	 * @param  string $option
387
+	 * @param  string $old_value
388
+	 * @param  string $value
389
+	 * @return void
390
+	 */
391
+	public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
392
+	{
393
+		if ( $option === 'page_for_posts' ) {
394
+			global $wpdb;
395
+			$table = $wpdb->posts;
396
+			$SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
+			$new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
399
+		}
400
+	}
401
+
402
+
403
+
404
+	/**
405
+	 * reset_page_for_posts_on_delete
406
+	 * if an admin deletes a page designated as the WP "Posts page",
407
+	 * then we need to attribute any actively used shortcodes for that blog page to a generic 'posts' page
408
+	 *
409
+	 * @access public
410
+	 * @param  string $option
411
+	 * @return void
412
+	 */
413
+	public static function reset_page_for_posts_on_delete( $option )
414
+	{
415
+		if ( $option === 'page_for_posts' ) {
416
+			PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
417
+		}
418
+	}
419
+
420
+
421
+
422
+	/**
423
+	 * @param array|string $shortcodes
424
+	 * @param bool         $index_results if passing more than one shortcode for the $shortcodes parameter above,
425
+	 *                                    then setting this to true, will return as associative array indexed by
426
+	 *                                    the shortcodes. If false, then the returned array will be unindexed
427
+	 * @return array
428
+	 */
429
+	public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
430
+	{
431
+		$post_ids = array();
432
+		if ( is_array( $shortcodes ) ) {
433
+			foreach ( $shortcodes as $shortcode ) {
434
+				$new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435
+					$shortcode,
436
+					$index_results
437
+				);
438
+				foreach ( $new_post_ids as $new_post_id ) {
439
+					if ( $index_results ) {
440
+						$post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
441
+					} else {
442
+						$post_ids[ $new_post_id ] = $new_post_id;
443
+					}
444
+				}
445
+			}
446
+		} else {
447
+			$shortcode = strtoupper( $shortcodes );
448
+			$shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449
+			$page_for_posts = \EE_Config::get_page_for_posts();
450
+			// looking for any references to this post
451
+			foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
452
+				// if this is the "Posts Page" (blog), then skip it
453
+				if ( $post_name === $page_for_posts ) {
454
+					continue;
455
+				}
456
+				// loop thru shortcodes registered for each page, and grab post id for matches
457
+				foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
+					if ( $post_shortcode === $shortcode ) {
459
+						$post_ids[ $post_ID ] = $post_ID;
460
+					}
461
+				}
462
+			}
463
+		}
464
+		return $post_ids;
465
+	}
466 466
 
467 467
 
468 468
 
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\admin;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-    exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+    exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,31 +28,31 @@  discard block
 block discarded – undo
28 28
     {
29 29
         add_action(
30 30
             'save_post',
31
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save' ),
31
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'parse_post_content_on_save'),
32 32
             100,
33 33
             2
34 34
         );
35 35
         add_action(
36 36
             'delete_post',
37
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete' ),
37
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'unset_post_shortcodes_on_delete'),
38 38
             100,
39 39
             1
40 40
         );
41 41
         add_action(
42 42
             'add_option_page_for_posts',
43
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set' ),
43
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_initial_set'),
44 44
             100,
45 45
             2
46 46
         );
47 47
         add_action(
48 48
             'update_option',
49
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change' ),
49
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_change'),
50 50
             100,
51 51
             3
52 52
         );
53 53
         add_action(
54 54
             'delete_option',
55
-            array( 'EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete' ),
55
+            array('EventEspresso\core\admin\PostShortcodeTracking', 'reset_page_for_posts_on_delete'),
56 56
             100,
57 57
             1
58 58
         );
@@ -72,63 +72,63 @@  discard block
 block discarded – undo
72 72
      * @param \WP_Post $post
73 73
      * @return    void
74 74
      */
75
-    public static function parse_post_content_on_save( $post_ID, $post )
75
+    public static function parse_post_content_on_save($post_ID, $post)
76 76
     {
77 77
         // if the post is trashed, then let's remove our post shortcode tracking
78
-        if ( $post instanceof \WP_Post && $post->post_status === 'trash' ) {
79
-            PostShortcodeTracking::unset_post_shortcodes_on_delete( $post_ID );
78
+        if ($post instanceof \WP_Post && $post->post_status === 'trash') {
79
+            PostShortcodeTracking::unset_post_shortcodes_on_delete($post_ID);
80 80
             return;
81 81
         }
82 82
         // default post types
83
-        $post_types = array( 'post' => 0, 'page' => 1 );
83
+        $post_types = array('post' => 0, 'page' => 1);
84 84
         // add CPTs
85 85
         $CPTs = \EE_Register_CPTs::get_CPTs();
86
-        $post_types = array_merge( $post_types, $CPTs );
86
+        $post_types = array_merge($post_types, $CPTs);
87 87
         // for default or CPT posts...
88
-        if ( isset( $post_types[ $post->post_type ] ) ) {
88
+        if (isset($post_types[$post->post_type])) {
89 89
             // post on frontpage ?
90 90
             $page_for_posts = \EE_Config::get_page_for_posts();
91
-            if ( $post->post_name === $page_for_posts ) {
92
-                PostShortcodeTracking::set_post_shortcodes_for_posts_page( $page_for_posts );
91
+            if ($post->post_name === $page_for_posts) {
92
+                PostShortcodeTracking::set_post_shortcodes_for_posts_page($page_for_posts);
93 93
                 return;
94 94
             }
95 95
             // array of shortcodes indexed by post name
96
-            \EE_Registry::CFG()->core->post_shortcodes = isset( \EE_Registry::CFG()->core->post_shortcodes )
96
+            \EE_Registry::CFG()->core->post_shortcodes = isset(\EE_Registry::CFG()->core->post_shortcodes)
97 97
                 ? \EE_Registry::CFG()->core->post_shortcodes
98 98
                 : array();
99 99
             // whether to proceed with update
100 100
             $update_post_shortcodes = false;
101 101
             // empty both arrays
102
-            \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ] = array();
102
+            \EE_Registry::CFG()->core->post_shortcodes[$post->post_name] = array();
103 103
             // check that posts page is already being tracked
104
-            if ( ! isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] ) ) {
104
+            if ( ! isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts])) {
105 105
                 // if not, then ensure that it is properly added
106
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
106
+                \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
107 107
             }
108 108
             // loop thru shortcodes
109
-            foreach ( \EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir ) {
109
+            foreach (\EE_Registry::instance()->shortcodes as $EES_Shortcode => $shortcode_dir) {
110 110
                 // convert to UPPERCASE to get actual shortcode
111
-                $EES_Shortcode = strtoupper( $EES_Shortcode );
111
+                $EES_Shortcode = strtoupper($EES_Shortcode);
112 112
                 // is the shortcode in the post_content ?
113
-                if ( strpos( $post->post_content, $EES_Shortcode ) !== false ) {
113
+                if (strpos($post->post_content, $EES_Shortcode) !== false) {
114 114
                     // map shortcode to post names and post IDs
115
-                    \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] = $post_ID;
115
+                    \EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode] = $post_ID;
116 116
                     // and add this shortcode to the tracking for the blog page
117
-                    PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode,
118
-                        $post_ID );
117
+                    PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode,
118
+                        $post_ID);
119 119
                     $update_post_shortcodes = true;
120 120
                 } else {
121 121
                     // shortcode is not present in post content, so check if we were tracking it previously
122 122
                     // stop tracking if shortcode is not used in this specific post
123
-                    if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] ) ) {
124
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post->post_name ][ $EES_Shortcode ] );
123
+                    if (isset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode])) {
124
+                        unset(\EE_Registry::CFG()->core->post_shortcodes[$post->post_name][$EES_Shortcode]);
125 125
                         $update_post_shortcodes = true;
126 126
                     }
127 127
                     // make sure that something is set for the shortcode posts (even though we may remove this)
128 128
                     $shortcode_posts = isset(
129
-                        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
129
+                        \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
130 130
                     )
131
-                        ? \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ]
131
+                        ? \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode]
132 132
                         : array();
133 133
                     // and stop tracking for this shortcode on the blog page if it is not used
134 134
                     $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
                         : $update_post_shortcodes;
143 143
                 }
144 144
             }
145
-            if ( $update_post_shortcodes ) {
146
-                PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
145
+            if ($update_post_shortcodes) {
146
+                PostShortcodeTracking::update_post_shortcodes($page_for_posts);
147 147
             }
148 148
         }
149 149
     }
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
      * @param  string $page_for_posts
160 160
      * @return void
161 161
      */
162
-    protected static function set_post_shortcodes_for_posts_page( $page_for_posts )
162
+    protected static function set_post_shortcodes_for_posts_page($page_for_posts)
163 163
     {
164
-        \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ] = array();
164
+        \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts] = array();
165 165
         // loop thru shortcodes
166
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
167
-            foreach ( $post_shortcodes as $EES_Shortcode => $post_ID ) {
168
-                PostShortcodeTracking::set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID );
166
+        foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
167
+            foreach ($post_shortcodes as $EES_Shortcode => $post_ID) {
168
+                PostShortcodeTracking::set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID);
169 169
             }
170 170
         }
171
-        PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
171
+        PostShortcodeTracking::update_post_shortcodes($page_for_posts);
172 172
     }
173 173
 
174 174
 
@@ -182,25 +182,25 @@  discard block
 block discarded – undo
182 182
      * @param         $EES_Shortcode
183 183
      * @param         $post_ID
184 184
      */
185
-    protected static function set_post_shortcode_for_posts_page( $page_for_posts, $EES_Shortcode, $post_ID )
185
+    protected static function set_post_shortcode_for_posts_page($page_for_posts, $EES_Shortcode, $post_ID)
186 186
     {
187 187
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
188 188
         $critical_shortcodes = \EE_Registry::CFG()->core->get_critical_pages_shortcodes_array();
189 189
         // if the shortcode is NOT one of the critical page shortcodes like ESPRESSO_TXN_PAGE
190
-        if ( in_array( $EES_Shortcode, $critical_shortcodes ) ) {
190
+        if (in_array($EES_Shortcode, $critical_shortcodes)) {
191 191
             return;
192 192
         }
193 193
         // add shortcode to "Posts page" tracking
194
-        if ( isset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
194
+        if (isset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
195 195
             // make sure tracking is in form of an array
196
-            if ( ! is_array( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] ) ) {
197
-                \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array(
198
-                    \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] => true,
196
+            if ( ! is_array(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode])) {
197
+                \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array(
198
+                    \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] => true,
199 199
                 );
200 200
             }
201
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] += array( $post_ID => true );
201
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] += array($post_ID => true);
202 202
         } else {
203
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $EES_Shortcode ] = array( $post_ID => true );
203
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$EES_Shortcode] = array($post_ID => true);
204 204
         }
205 205
     }
206 206
 
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
      * @param  int $ID
214 214
      * @return void
215 215
      */
216
-    public static function unset_post_shortcodes_on_delete( $ID )
216
+    public static function unset_post_shortcodes_on_delete($ID)
217 217
     {
218 218
         $update_post_shortcodes = false;
219 219
         // post on frontpage ?
220 220
         $page_for_posts = \EE_Config::get_page_for_posts();
221 221
         // looking for any references to this post
222
-        foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
222
+        foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
223 223
             // is this the "Posts Page" (blog) ?
224
-            if ( $post_name === $page_for_posts ) {
224
+            if ($post_name === $page_for_posts) {
225 225
                 // loop thru shortcodes registered for the posts page
226
-                foreach ( $post_shortcodes as $shortcode_class => $shortcode_posts ) {
226
+                foreach ($post_shortcodes as $shortcode_class => $shortcode_posts) {
227 227
                     $update_post_shortcodes = PostShortcodeTracking::unset_posts_page_shortcode_for_post(
228 228
                         $ID,
229 229
                         $shortcode_class,
@@ -236,17 +236,17 @@  discard block
 block discarded – undo
236 236
                 }
237 237
             } else {
238 238
                 // loop thru shortcodes registered for each page
239
-                foreach ( $post_shortcodes as $shortcode_class => $post_ID ) {
239
+                foreach ($post_shortcodes as $shortcode_class => $post_ID) {
240 240
                     // if this is page is being deleted, then don't track any post shortcodes for it
241
-                    if ( $post_ID === $ID ) {
242
-                        unset( \EE_Registry::CFG()->core->post_shortcodes[ $post_name ] );
241
+                    if ($post_ID === $ID) {
242
+                        unset(\EE_Registry::CFG()->core->post_shortcodes[$post_name]);
243 243
                         $update_post_shortcodes = true;
244 244
                     }
245 245
                 }
246 246
             }
247 247
         }
248
-        if ( $update_post_shortcodes ) {
249
-            PostShortcodeTracking::update_post_shortcodes( $page_for_posts );
248
+        if ($update_post_shortcodes) {
249
+            PostShortcodeTracking::update_post_shortcodes($page_for_posts);
250 250
         }
251 251
     }
252 252
 
@@ -271,20 +271,20 @@  discard block
 block discarded – undo
271 271
         $update_post_shortcodes = false
272 272
     ) {
273 273
         // make sure that an array of post IDs is being tracked for each  shortcode
274
-        if ( ! is_array( $shortcode_posts ) ) {
275
-            \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] = array(
274
+        if ( ! is_array($shortcode_posts)) {
275
+            \EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class] = array(
276 276
                 $shortcode_posts => true,
277 277
             );
278 278
             $update_post_shortcodes = true;
279 279
         }
280 280
         // now if the ID of the post being deleted is in the $shortcode_posts array
281
-        if ( is_array( $shortcode_posts ) && isset( $shortcode_posts[ $ID ] ) ) {
282
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ][ $ID ] );
281
+        if (is_array($shortcode_posts) && isset($shortcode_posts[$ID])) {
282
+            unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class][$ID]);
283 283
             $update_post_shortcodes = true;
284 284
         }
285 285
         // if nothing is registered for that shortcode anymore, then delete the shortcode altogether
286
-        if ( empty( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] ) ) {
287
-            unset( \EE_Registry::CFG()->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] );
286
+        if (empty(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class])) {
287
+            unset(\EE_Registry::CFG()->core->post_shortcodes[$page_for_posts][$shortcode_class]);
288 288
             $update_post_shortcodes = true;
289 289
         }
290 290
         return $update_post_shortcodes;
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
      * @param $page_for_posts
300 300
      * @return    void
301 301
      */
302
-    public static function update_post_shortcodes( $page_for_posts = '' )
302
+    public static function update_post_shortcodes($page_for_posts = '')
303 303
     {
304 304
         // make sure page_for_posts is set
305
-        $page_for_posts = ! empty( $page_for_posts )
305
+        $page_for_posts = ! empty($page_for_posts)
306 306
             ? $page_for_posts
307 307
             : \EE_Config::get_page_for_posts();
308 308
         // allow others to mess stuff up :D
@@ -318,40 +318,40 @@  discard block
 block discarded – undo
318 318
             $page_for_posts
319 319
         );
320 320
         // verify that post_shortcodes is set
321
-        \EE_Config::instance()->core->post_shortcodes = isset( \EE_Config::instance()->core->post_shortcodes )
322
-                                                        && is_array( \EE_Config::instance()->core->post_shortcodes )
321
+        \EE_Config::instance()->core->post_shortcodes = isset(\EE_Config::instance()->core->post_shortcodes)
322
+                                                        && is_array(\EE_Config::instance()->core->post_shortcodes)
323 323
             ? \EE_Config::instance()->core->post_shortcodes
324 324
             : array();
325 325
         // cycle thru post_shortcodes
326
-        foreach ( \EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes ) {
326
+        foreach (\EE_Config::instance()->core->post_shortcodes as $post_name => $shortcodes) {
327 327
             // are there any shortcodes to track ?
328
-            if ( ! empty( $shortcodes ) ) {
328
+            if ( ! empty($shortcodes)) {
329 329
                 // skip the posts page, because we want all shortcodes registered for it
330
-                if ( $post_name === $page_for_posts ) {
330
+                if ($post_name === $page_for_posts) {
331 331
                     continue;
332 332
                 }
333 333
                 // loop thru list of tracked shortcodes
334
-                foreach ( $shortcodes as $shortcode => $post_id ) {
334
+                foreach ($shortcodes as $shortcode => $post_id) {
335 335
                     // make sure post still exists
336
-                    $post = get_post( $post_id );
336
+                    $post = get_post($post_id);
337 337
                     // check that the post name matches what we have saved
338
-                    if ( $post && $post->post_name === $post_name ) {
338
+                    if ($post && $post->post_name === $post_name) {
339 339
                         // if so, then break before hitting the unset below
340 340
                         continue;
341 341
                     }
342 342
                     // we don't like missing posts around here >:(
343
-                    unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
343
+                    unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
344 344
                 }
345 345
             } else {
346 346
                 // you got no shortcodes to keep track of !
347
-                unset( \EE_Config::instance()->core->post_shortcodes[ $post_name ] );
347
+                unset(\EE_Config::instance()->core->post_shortcodes[$post_name]);
348 348
             }
349 349
         }
350 350
         // critical page shortcodes that we do NOT want added to the Posts page (blog)
351 351
         $critical_shortcodes = \EE_Config::instance()->core->get_critical_pages_shortcodes_array();
352
-        $critical_shortcodes = array_flip( $critical_shortcodes );
353
-        foreach ( $critical_shortcodes as $critical_shortcode ) {
354
-            unset( \EE_Config::instance()->core->post_shortcodes[ $page_for_posts ][ $critical_shortcode ] );
352
+        $critical_shortcodes = array_flip($critical_shortcodes);
353
+        foreach ($critical_shortcodes as $critical_shortcode) {
354
+            unset(\EE_Config::instance()->core->post_shortcodes[$page_for_posts][$critical_shortcode]);
355 355
         }
356 356
         //only show errors
357 357
         \EE_Config::instance()->update_espresso_config();
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
      * @param  string $value
371 371
      * @return void
372 372
      */
373
-    public static function reset_page_for_posts_on_initial_set( $option, $value )
373
+    public static function reset_page_for_posts_on_initial_set($option, $value)
374 374
     {
375
-        PostShortcodeTracking::reset_page_for_posts_on_change( $option, '', $value );
375
+        PostShortcodeTracking::reset_page_for_posts_on_change($option, '', $value);
376 376
     }
377 377
 
378 378
 
@@ -388,14 +388,14 @@  discard block
 block discarded – undo
388 388
      * @param  string $value
389 389
      * @return void
390 390
      */
391
-    public static function reset_page_for_posts_on_change( $option, $old_value = '', $value = '' )
391
+    public static function reset_page_for_posts_on_change($option, $old_value = '', $value = '')
392 392
     {
393
-        if ( $option === 'page_for_posts' ) {
393
+        if ($option === 'page_for_posts') {
394 394
             global $wpdb;
395 395
             $table = $wpdb->posts;
396 396
             $SQL = "SELECT post_name from $table WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d";
397
-            $new_page_for_posts = $value ? $wpdb->get_var( $wpdb->prepare( $SQL, $value ) ) : 'posts';
398
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( $new_page_for_posts );
397
+            $new_page_for_posts = $value ? $wpdb->get_var($wpdb->prepare($SQL, $value)) : 'posts';
398
+            PostShortcodeTracking::set_post_shortcodes_for_posts_page($new_page_for_posts);
399 399
         }
400 400
     }
401 401
 
@@ -410,10 +410,10 @@  discard block
 block discarded – undo
410 410
      * @param  string $option
411 411
      * @return void
412 412
      */
413
-    public static function reset_page_for_posts_on_delete( $option )
413
+    public static function reset_page_for_posts_on_delete($option)
414 414
     {
415
-        if ( $option === 'page_for_posts' ) {
416
-            PostShortcodeTracking::set_post_shortcodes_for_posts_page( 'posts' );
415
+        if ($option === 'page_for_posts') {
416
+            PostShortcodeTracking::set_post_shortcodes_for_posts_page('posts');
417 417
         }
418 418
     }
419 419
 
@@ -426,37 +426,37 @@  discard block
 block discarded – undo
426 426
      *                                    the shortcodes. If false, then the returned array will be unindexed
427 427
      * @return array
428 428
      */
429
-    public static function get_post_ids_for_shortcode( $shortcodes, $index_results = true )
429
+    public static function get_post_ids_for_shortcode($shortcodes, $index_results = true)
430 430
     {
431 431
         $post_ids = array();
432
-        if ( is_array( $shortcodes ) ) {
433
-            foreach ( $shortcodes as $shortcode ) {
432
+        if (is_array($shortcodes)) {
433
+            foreach ($shortcodes as $shortcode) {
434 434
                 $new_post_ids = PostShortcodeTracking::get_post_ids_for_shortcode(
435 435
                     $shortcode,
436 436
                     $index_results
437 437
                 );
438
-                foreach ( $new_post_ids as $new_post_id ) {
439
-                    if ( $index_results ) {
440
-                        $post_ids[ $shortcode ][ $new_post_id ] = $new_post_id;
438
+                foreach ($new_post_ids as $new_post_id) {
439
+                    if ($index_results) {
440
+                        $post_ids[$shortcode][$new_post_id] = $new_post_id;
441 441
                     } else {
442
-                        $post_ids[ $new_post_id ] = $new_post_id;
442
+                        $post_ids[$new_post_id] = $new_post_id;
443 443
                     }
444 444
                 }
445 445
             }
446 446
         } else {
447
-            $shortcode = strtoupper( $shortcodes );
448
-            $shortcode = strpos( $shortcode, 'ESPRESSO_' ) !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
447
+            $shortcode = strtoupper($shortcodes);
448
+            $shortcode = strpos($shortcode, 'ESPRESSO_') !== 0 ? "ESPRESSO_{$shortcode}" : $shortcode;
449 449
             $page_for_posts = \EE_Config::get_page_for_posts();
450 450
             // looking for any references to this post
451
-            foreach ( \EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes ) {
451
+            foreach (\EE_Registry::CFG()->core->post_shortcodes as $post_name => $post_shortcodes) {
452 452
                 // if this is the "Posts Page" (blog), then skip it
453
-                if ( $post_name === $page_for_posts ) {
453
+                if ($post_name === $page_for_posts) {
454 454
                     continue;
455 455
                 }
456 456
                 // loop thru shortcodes registered for each page, and grab post id for matches
457
-                foreach ( (array) $post_shortcodes as $post_shortcode => $post_ID ) {
458
-                    if ( $post_shortcode === $shortcode ) {
459
-                        $post_ids[ $post_ID ] = $post_ID;
457
+                foreach ((array) $post_shortcodes as $post_shortcode => $post_ID) {
458
+                    if ($post_shortcode === $shortcode) {
459
+                        $post_ids[$post_ID] = $post_ID;
460 460
                     }
461 461
                 }
462 462
             }
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/countries_settings.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <div class="padding">
7 7
 
8
-	<h2 class="ee-admin-settings-hdr"><?php _e('Countries and States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_select_info');?></h2>
8
+	<h2 class="ee-admin-settings-hdr"><?php _e('Countries and States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_select_info'); ?></h2>
9 9
 	<table class="form-table">
10 10
 		<tbody>
11
-        <?php echo EEH_Form_Fields::generate_form_input( $countries ); ?>
11
+        <?php echo EEH_Form_Fields::generate_form_input($countries); ?>
12 12
 		</tbody>
13 13
 	</table>
14 14
 	<br/>
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
         <?php _e('The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.', 'event_espresso'); ?>
17 17
 	</p>
18 18
 	<div id="country-details-settings-dv">
19
-		<h2 class="ee-admin-settings-hdr"><?php _e('Country Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_details_info');?></h2>
19
+		<h2 class="ee-admin-settings-hdr"><?php _e('Country Details', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_details_info'); ?></h2>
20 20
 		<div id="country-details-dv"><?php  echo $country_details_settings; ?></div>
21 21
 	</div>
22 22
 
23 23
 	<div id="country-states-settings-dv">
24
-		<h2 class="ee-admin-settings-hdr"><?php _e( 'States/Provinces', 'event_espresso' );?> <?php echo EEH_Template::get_help_tab_link('country_states_info');?></h2>
24
+		<h2 class="ee-admin-settings-hdr"><?php _e('States/Provinces', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('country_states_info'); ?></h2>
25 25
 		<div id="country-states-dv"><?php  echo $country_states_settings; ?></div>
26 26
 	</div>
27 27
 
Please login to merge, or discard this patch.
admin_pages/general_settings/templates/admin_option_settings.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 ?>
7 7
 <div class="padding">
8 8
 
9
-	<?php do_action( 'AHEE__admin_option_settings__template__before', $template_args ); ?>
9
+	<?php do_action('AHEE__admin_option_settings__template__before', $template_args); ?>
10 10
 
11 11
 	<?php /* @todo put back once we have a dashboard widget to use
12 12
 	<h2 class="ee-admin-settings-hdr">
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	</table>
72 72
 <?php endif; */ ?>
73 73
 
74
-	<?php if ( EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'display_admin_settings_options_promote_and_affiliate' ) ) : ?>
74
+	<?php if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'display_admin_settings_options_promote_and_affiliate')) : ?>
75 75
 		<h2 class="ee-admin-settings-hdr">
76 76
 			<?php _e('Promote Event Espresso', 'event_espresso'); ?> <span id="affiliate_info"><?php echo EEH_Template::get_help_tab_link('affiliate_info'); ?></span>
77 77
 		</h2>
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 						</label>
87 87
 					</th>
88 88
 					<td>
89
-						<?php echo EEH_Form_Fields::select_input('show_reg_footer', $values, $show_reg_footer ); ?>
89
+						<?php echo EEH_Form_Fields::select_input('show_reg_footer', $values, $show_reg_footer); ?>
90 90
 					</td>
91 91
 				</tr>
92 92
 
93 93
 				<tr>
94 94
 					<th>
95 95
                         <label for="affiliate_id">
96
-                        <?php printf( __('Event Espresso %sAffiliate%s ID', 'event_espresso'), '<a href="http://eventespresso.com/affiliates/" target="_blank">', '</a>' ); ?>
96
+                        <?php printf(__('Event Espresso %sAffiliate%s ID', 'event_espresso'), '<a href="http://eventespresso.com/affiliates/" target="_blank">', '</a>'); ?>
97 97
                         </label>
98 98
                     </th>
99 99
 					<td>
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 					</label>
124 124
 				</th>
125 125
 				<td>
126
-					<?php echo EEH_Form_Fields::select_input('help_tour_activation', $values, $help_tour_activation ); ?>
126
+					<?php echo EEH_Form_Fields::select_input('help_tour_activation', $values, $help_tour_activation); ?>
127 127
 				</td>
128 128
 			</tr>
129 129
 		</tbody>
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.14.rc.007' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.14.rc.007');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.