Completed
Branch BUG-9961-paypal-pro-items (52e78c)
by
unknown
49:07 queued 32:43
created
strategies/normalization/EE_Many_Valued_Normalization.strategy.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base{
9
+class EE_Many_Valued_Normalization extends EE_Normalization_Strategy_Base {
10 10
 	protected $_individual_item_normalization_strategy = array();
11 11
 	/**
12 12
 	 *
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 	 * @return array
24 24
 	 */
25 25
 	public function normalize($value_to_normalize) {
26
-		if ( is_array( $value_to_normalize )){
26
+		if (is_array($value_to_normalize)) {
27 27
 			$items_to_normalize = $value_to_normalize;
28
-		} else if( $value_to_normalize !== NULL ){
29
-			$items_to_normalize = array( $value_to_normalize );
28
+		} else if ($value_to_normalize !== NULL) {
29
+			$items_to_normalize = array($value_to_normalize);
30 30
 		} else {
31 31
 			$items_to_normalize = array();
32 32
 		}
33 33
 		$normalized_array_value = array();
34
-		foreach( $items_to_normalize as $key => $individual_item ){
35
-			$normalized_array_value[ $key ] = $this->normalize_one( $individual_item );
34
+		foreach ($items_to_normalize as $key => $individual_item) {
35
+			$normalized_array_value[$key] = $this->normalize_one($individual_item);
36 36
 		}
37 37
 		return $normalized_array_value;
38 38
 	}
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param string $individual_value_to_normalize but definitely NOT an array
43 43
 	 * @return mixed
44 44
 	 */
45
-	public function normalize_one( $individual_value_to_normalize ) {
46
-		return $this->_individual_item_normalization_strategy->normalize( $individual_value_to_normalize );
45
+	public function normalize_one($individual_value_to_normalize) {
46
+		return $this->_individual_item_normalization_strategy->normalize($individual_value_to_normalize);
47 47
 	}
48 48
 
49 49
 	/**
@@ -51,16 +51,16 @@  discard block
 block discarded – undo
51 51
 	 * @param array $normalized_values
52 52
 	 * @return string[]
53 53
 	 */
54
-	public function unnormalize( $normalized_values ) {
55
-		if( $normalized_values === null ) {
54
+	public function unnormalize($normalized_values) {
55
+		if ($normalized_values === null) {
56 56
 			$normalized_values = array();
57 57
 		}
58
-		if( ! is_array( $normalized_values ) ){
59
-			$normalized_values = array( $normalized_values );
58
+		if ( ! is_array($normalized_values)) {
59
+			$normalized_values = array($normalized_values);
60 60
 		}
61 61
 		$non_normal_values = array();
62
-		foreach( $normalized_values as $key => $value ) {
63
-			$non_normal_values[ $key ] = $this->unnormalize_one( $value );
62
+		foreach ($normalized_values as $key => $value) {
63
+			$non_normal_values[$key] = $this->unnormalize_one($value);
64 64
 		}
65 65
 		return $non_normal_values;
66 66
 	}
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 * @param mixed $individual_value_to_unnormalize but certainly NOT an array
71 71
 	 * @return string
72 72
 	 */
73
-	public function unnormalize_one( $individual_value_to_unnormalize ) {
74
-		return $this->_individual_item_normalization_strategy->unnormalize( $individual_value_to_unnormalize );
73
+	public function unnormalize_one($individual_value_to_unnormalize) {
74
+		return $this->_individual_item_normalization_strategy->unnormalize($individual_value_to_unnormalize);
75 75
 	}
76 76
 }
77 77
 
Please login to merge, or discard this patch.
core/admin/templates/espresso_ratings_request_content.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<p><?php _e( 'We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso' ); ?></p>
3
-	<p><?php _e( 'Rate it five stars today!', 'event_espresso' ); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
-	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e( 'Rate It!', 'event_espresso' ); ?></a></p>
2
+	<p><?php _e('We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso'); ?></p>
3
+	<p><?php _e('Rate it five stars today!', 'event_espresso'); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
+	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e('Rate It!', 'event_espresso'); ?></a></p>
5 5
 </div>
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 	/**
46
-	* max attendees that can register for event at one time
47
-	*
48
-	* @access private
49
-	* @var int
50
-	*/
46
+	 * max attendees that can register for event at one time
47
+	 *
48
+	 * @access private
49
+	 * @var int
50
+	 */
51 51
 	private static $_max_atndz = EE_INF;
52 52
 
53 53
 
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
220
-			                     . '</a> ';
219
+								 . __( 'Embed', 'event_espresso' )
220
+								 . '</a> ';
221 221
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
222 222
 			$iframe_string = esc_html(
223 223
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * 	@return array|boolean
528 528
 	 */
529 529
 	public function process_ticket_selections() {
530
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
530
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
531 531
 		// check nonce
532 532
 		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
533 533
 			EE_Error::add_error(
@@ -921,11 +921,11 @@  discard block
 block discarded – undo
921 921
 
922 922
 
923 923
 	/**
924
-	* 	load js
925
-	*
926
-	* 	@access 		public
927
-	* 	@return 		void
928
-	*/
924
+	 * 	load js
925
+	 *
926
+	 * 	@access 		public
927
+	 * 	@return 		void
928
+	 */
929 929
 	public static function load_tckt_slctr_assets() {
930 930
 		// add some style
931 931
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
 	 * @return EED_Ticket_Selector
66 66
 	 */
67 67
 	public static function instance() {
68
-		return parent::get_instance( __CLASS__ );
68
+		return parent::get_instance(__CLASS__);
69 69
 	}
70 70
 
71 71
 
72 72
 
73
-	protected function set_config(){
74
-		$this->set_config_section( 'template_settings' );
75
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
76
-		$this->set_config_name( 'EED_Ticket_Selector' );
73
+	protected function set_config() {
74
+		$this->set_config_section('template_settings');
75
+		$this->set_config_class('EE_Ticket_Selector_Config');
76
+		$this->set_config_name('EED_Ticket_Selector');
77 77
 	}
78 78
 
79 79
 
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public static function set_hooks() {
90 90
 		// routing
91
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
92
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
93
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
91
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
92
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
93
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
94 94
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
95
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
95
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
96 96
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
97 97
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
98
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
98
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
99 99
 	}
100 100
 
101 101
 
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	 *  @return 	void
108 108
 	 */
109 109
 	public static function set_hooks_admin() {
110
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
110
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
111 111
 		//add button for iframe code to event editor.
112
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
113
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
112
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
113
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
114 114
 	}
115 115
 
116 116
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 	 *  @return 	void
123 123
 	 */
124 124
 	public static function set_definitions() {
125
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
126
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
125
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
126
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
127 127
 
128 128
 		//if config is not set, initialize
129 129
 		//If config is not set, set it.
130
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
130
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
131 131
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
132 132
 		}
133
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
133
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
134 134
 	}
135 135
 
136 136
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * 	@param	object 			$WP
142 142
 	 * 	@return 	void
143 143
 	 */
144
-	public function run( $WP ) {}
144
+	public function run($WP) {}
145 145
 
146 146
 
147 147
 	/**
@@ -153,23 +153,23 @@  discard block
 block discarded – undo
153 153
 	public function ticket_selector_iframe() {
154 154
 		self::$_in_iframe = true;
155 155
 		/** @type EEM_Event $EEM_Event */
156
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
156
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
157 157
 		$event = $EEM_Event->get_one_by_ID(
158
-			EE_Registry::instance()->REQ->get( 'event', 0 )
158
+			EE_Registry::instance()->REQ->get('event', 0)
159 159
 		);
160
-		EE_Registry::instance()->REQ->set_espresso_page( true );
161
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
160
+		EE_Registry::instance()->REQ->set_espresso_page(true);
161
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
162 162
 		$template_args['css'] = apply_filters(
163 163
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
164 164
 			array(
165
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
166
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
167
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
168
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
165
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
166
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
167
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
168
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
169 169
 			)
170 170
 		);
171
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
172
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
171
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
172
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
173 173
 		$template_args['eei18n'] = apply_filters(
174 174
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
175 175
 			EE_Registry::localize_i18n_js_strings()
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 		$template_args['js'] = apply_filters(
178 178
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
179 179
 			array(
180
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
181
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
182
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
180
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
181
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
182
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
183 183
 			)
184 184
 		);
185
-		$template_args[ 'notices' ] = EEH_Template::display_template(
186
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
185
+		$template_args['notices'] = EEH_Template::display_template(
186
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
187 187
 			array(),
188 188
 			true
189 189
 		);
190 190
 		EEH_Template::display_template(
191
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
191
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
192 192
 			$template_args
193 193
 		);
194 194
 		exit;
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return string The new html string for the permalink area.
209 209
 	 */
210
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
210
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
211 211
 		//make sure this is ONLY when editing and the event id has been set.
212
-		if ( ! empty( $id ) ) {
213
-			$post = get_post( $id );
212
+		if ( ! empty($id)) {
213
+			$post = get_post($id);
214 214
 			//if NOT event then let's get out.
215
-			if ( $post->post_type !== 'espresso_events' ) {
215
+			if ($post->post_type !== 'espresso_events') {
216 216
 				return $permalink_string;
217 217
 			}
218 218
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
219
-			                     . __( 'Embed', 'event_espresso' )
219
+			                     . __('Embed', 'event_espresso')
220 220
 			                     . '</a> ';
221
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
221
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
222 222
 			$iframe_string = esc_html(
223
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
223
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
224 224
 			);
225 225
 			$permalink_string .= '
226 226
 <div id="js-ts-iframe" style="display:none">
227 227
 	<div style="width:100%; height: 500px;">
228
-		' . $iframe_string . '
228
+		' . $iframe_string.'
229 229
 	</div>
230 230
 </div>';
231 231
 		}
@@ -244,22 +244,22 @@  discard block
 block discarded – undo
244 244
 	 * @param 	mixed $event
245 245
 	 * @return 	bool
246 246
 	 */
247
-	protected static function set_event( $event = null ) {
248
-		if( $event === null ) {
247
+	protected static function set_event($event = null) {
248
+		if ($event === null) {
249 249
 			global $post;
250 250
 			$event = $post;
251 251
 		}
252
-		if ( $event instanceof EE_Event ) {
252
+		if ($event instanceof EE_Event) {
253 253
 			self::$_event = $event;
254
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
254
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
255 255
 			self::$_event = $event->EE_Event;
256
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
257
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
256
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
257
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
258 258
 			self::$_event = $event->EE_Event;
259 259
 		} else {
260
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
261
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
262
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
260
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
261
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
262
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
263 263
 			return false;
264 264
 		}
265 265
 		return true;
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @param 	bool 	$view_details
279 279
 	 * @return 	string
280 280
 	 */
281
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
281
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
282 282
 		// reset filter for displaying submit button
283
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
283
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
284 284
 		// poke and prod incoming event till it tells us what it is
285
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
285
+		if ( ! EED_Ticket_Selector::set_event($event)) {
286 286
 			return false;
287 287
 		}
288 288
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 			&& (
294 294
 				! self::$_event->display_ticket_selector()
295 295
 				|| $view_details
296
-				|| post_password_required( $event_post )
296
+				|| post_password_required($event_post)
297 297
 				|| (
298 298
 					$_event_active_status != EE_Datetime::active
299 299
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -311,34 +311,34 @@  discard block
 block discarded – undo
311 311
 		$template_args = array();
312 312
 		$template_args['event_status'] = $_event_active_status;
313 313
 
314
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
315
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
314
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
315
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
316 316
 
317 317
 		$template_args['EVT_ID'] = self::$_event->ID();
318 318
 		$template_args['event'] = self::$_event;
319 319
 
320 320
 		// is the event expired ?
321 321
 		$template_args['event_is_expired'] = self::$_event->is_expired();
322
-		if ( $template_args['event_is_expired'] ) {
323
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
322
+		if ($template_args['event_is_expired']) {
323
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
324 324
 		}
325 325
 
326 326
 		$ticket_query_args = array(
327
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
328
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
327
+			array('Datetime.EVT_ID' => self::$_event->ID()),
328
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
329 329
 		);
330 330
 
331
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
331
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
332 332
 			//use the correct applicable time query depending on what version of core is being run.
333
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
334
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
333
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
334
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
335 335
 		}
336 336
 
337 337
 		// get all tickets for this event ordered by the datetime
338
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
338
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
339 339
 
340
-		if ( count( $template_args['tickets'] ) < 1 ) {
341
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
340
+		if (count($template_args['tickets']) < 1) {
341
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
342 342
 		}
343 343
 
344 344
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
@@ -347,36 +347,36 @@  discard block
 block discarded – undo
347 347
 			self::$_event->additional_limit()
348 348
 		);
349 349
 		$template_args['max_atndz'] = \EED_Ticket_Selector::$_max_atndz;
350
-		if ( $template_args['max_atndz'] < 1 ) {
351
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
352
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
353
-				$sales_closed_msg .=  sprintf(
354
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
350
+		if ($template_args['max_atndz'] < 1) {
351
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
352
+			if (current_user_can('edit_post', self::$_event->ID())) {
353
+				$sales_closed_msg .= sprintf(
354
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
355 355
 					'<div class="ee-attention" style="text-align: left;"><b>',
356 356
 					'</b><br />',
357
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
357
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
358 358
 					'</a></span></div>'
359 359
 				);
360 360
 			}
361
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
361
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
362 362
 		}
363 363
 
364
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
365
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
364
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
365
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
366 366
 
367 367
 		// redirecting to another site for registration ??
368 368
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
369 369
 		// set up the form (but not for the admin)
370
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
370
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
371 371
 		// if not redirecting to another site for registration
372
-		if ( ! $external_url ) {
372
+		if ( ! $external_url) {
373 373
 			// then display the ticket selector
374
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
374
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
375 375
 		} else {
376 376
 			// if not we still need to trigger the display of the submit button
377
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
377
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
378 378
 			//display notice to admin that registration is external
379
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
379
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
380 380
 		}
381 381
 		// submit button and form close tag
382 382
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -396,25 +396,25 @@  discard block
 block discarded – undo
396 396
 	 * @param 		string $external_url
397 397
 	 * @return 		string
398 398
 	 */
399
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
399
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
400 400
 		// if redirecting, we don't need any anything else
401
-		if ( $external_url ) {
402
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
403
-			$query_args = EEH_URL::get_query_string( $external_url );
404
-			foreach ( $query_args as $query_arg => $value ) {
405
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
401
+		if ($external_url) {
402
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
403
+			$query_args = EEH_URL::get_query_string($external_url);
404
+			foreach ($query_args as $query_arg => $value) {
405
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
406 406
 			}
407 407
 			return $html;
408 408
 		}
409
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
410
-		if ( ! $checkout_url ) {
411
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
409
+		$checkout_url = EEH_Event_View::event_link_url($ID);
410
+		if ( ! $checkout_url) {
411
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
412 412
 		}
413 413
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
414
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
415
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
414
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
415
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
416 416
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
417
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
417
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
418 418
 		return $html;
419 419
 	}
420 420
 
@@ -429,18 +429,18 @@  discard block
 block discarded – undo
429 429
 	 * 	@return		string
430 430
 	 */
431 431
 	public static function display_ticket_selector_submit() {
432
-		if ( ! is_admin() ) {
433
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
432
+		if ( ! is_admin()) {
433
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
434 434
 				$btn_text = apply_filters(
435 435
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
436
-					__('Register Now', 'event_espresso' ),
436
+					__('Register Now', 'event_espresso'),
437 437
 					EED_Ticket_Selector::$_event
438 438
 				);
439 439
 				$external_url = EED_Ticket_Selector::$_event->external_url();
440
-				$html = '<input id="ticket-selector-submit-'. EED_Ticket_Selector::$_event->ID() .'-btn"';
440
+				$html = '<input id="ticket-selector-submit-'.EED_Ticket_Selector::$_event->ID().'-btn"';
441 441
 				$html .= ' class="ticket-selector-submit-btn ';
442
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
443
-				$html .= ' type="submit" value="' . $btn_text . '" />';
442
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
443
+				$html .= ' type="submit" value="'.$btn_text.'" />';
444 444
 				$html .= apply_filters(
445 445
 					'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
446 446
 					'',
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 				);
449 449
 				$html .= '<div class="clear"><br/></div></form>';
450 450
 				return $html;
451
-			} else if ( is_archive() ) {
452
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
451
+			} else if (is_archive()) {
452
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
453 453
 			} else if (
454 454
 				EED_Ticket_Selector::$_event instanceof EE_Event
455 455
 				// if $_max_atndz === 1 (ie: a "Dude Where's my Ticket Selector?" type event)
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 				$html = apply_filters(
462 462
 					'FHEE__EE_Ticket_Selector__no_ticket_selector_submit',
463 463
 					sprintf(
464
-						__( '%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso' ),
464
+						__('%1$s"%2$s" is currently sold out. Please check back again later, as spots may become available.%3$s', 'event_espresso'),
465 465
 						'<p class="no-ticket-selector-msg important-notice">',
466 466
 						EED_Ticket_Selector::$_event->name(),
467 467
 						'</p>'
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
 	 * 	@return		string
504 504
 	 */
505 505
 	public static function display_view_details_btn() {
506
-		if ( ! self::$_event->get_permalink() ) {
507
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
506
+		if ( ! self::$_event->get_permalink()) {
507
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
508 508
 		}
509
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
510
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
511
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
512
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
509
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
510
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
511
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
512
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
513 513
 		$view_details_btn .= '<div class="clear"><br/></div>';
514 514
 		$view_details_btn .= '</form>';
515 515
 		return $view_details_btn;
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
 	 * 	@return array|boolean
528 528
 	 */
529 529
 	public function process_ticket_selections() {
530
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
530
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
531 531
 		// check nonce
532
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
532
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
533 533
 			EE_Error::add_error(
534
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
534
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
535 535
 				__FILE__, __FUNCTION__, __LINE__
536 536
 			);
537 537
 			return FALSE;
@@ -545,16 +545,16 @@  discard block
 block discarded – undo
545 545
 
546 546
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
547 547
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
548
-		EE_Registry::instance()->load_core( 'Session' );
548
+		EE_Registry::instance()->load_core('Session');
549 549
 		// unless otherwise requested, clear the session
550
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
551
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
550
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
551
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
552 552
 		}
553 553
 		//d( EE_Registry::instance()->SSN );
554 554
 
555
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
556 556
 		// do we have an event id?
557
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
557
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
558 558
 			// validate/sanitize data
559 559
 			$valid = self::_validate_post_data();
560 560
 
@@ -564,41 +564,41 @@  discard block
 block discarded – undo
564 564
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
565 565
 
566 566
 			//check total tickets ordered vs max number of attendees that can register
567
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
567
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
568 568
 
569 569
 				// ordering too many tickets !!!
570 570
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
571
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
571
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
572 572
 				// dev only message
573 573
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
574
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
575
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
574
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
575
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
576 576
 			} else {
577 577
 
578 578
 				// all data appears to be valid
579 579
 				$tckts_slctd = FALSE;
580 580
 				$success = TRUE;
581 581
 				// load cart
582
-				EE_Registry::instance()->load_core( 'Cart' );
582
+				EE_Registry::instance()->load_core('Cart');
583 583
 
584 584
 				// cycle thru the number of data rows sent from the event listing
585
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
585
+				for ($x = 0; $x < $valid['rows']; $x++) {
586 586
 					// does this row actually contain a ticket quantity?
587
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
587
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
588 588
 						// YES we have a ticket quantity
589 589
 						$tckts_slctd = TRUE;
590 590
 						//						d( $valid['ticket_obj'][$x] );
591
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
591
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
592 592
 							// then add ticket to cart
593
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
593
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
594 594
 							$success = ! $ticket_added ? FALSE : $success;
595
-							if ( EE_Error::has_error() ) {
595
+							if (EE_Error::has_error()) {
596 596
 								break;
597 597
 							}
598 598
 						} else {
599 599
 							// nothing added to cart retrieved
600 600
 							EE_Error::add_error(
601
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
601
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
602 602
 								__FILE__, __FUNCTION__, __LINE__
603 603
 							);
604 604
 						}
@@ -607,45 +607,45 @@  discard block
 block discarded – undo
607 607
 				//d( EE_Registry::instance()->CART );
608 608
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
609 609
 
610
-				if ( $tckts_slctd ) {
611
-					if ( $success ) {
612
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
610
+				if ($tckts_slctd) {
611
+					if ($success) {
612
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
613 613
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
614
-						EE_Registry::instance()->CART->save_cart( FALSE );
614
+						EE_Registry::instance()->CART->save_cart(FALSE);
615 615
 						EE_Registry::instance()->SSN->update();
616 616
 						//d( EE_Registry::instance()->CART );
617 617
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
618 618
 						// just return TRUE for registrations being made from admin
619
-						if ( is_admin() ) {
619
+						if (is_admin()) {
620 620
 							return TRUE;
621 621
 						}
622
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
622
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
623 623
 						exit();
624 624
 
625 625
 					} else {
626
-						if ( ! EE_Error::has_error() ) {
626
+						if ( ! EE_Error::has_error()) {
627 627
 							// nothing added to cart
628
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
628
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
629 629
 						}
630 630
 					}
631 631
 
632 632
 				} else {
633 633
 					// no ticket quantities were selected
634
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
634
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
635 635
 				}
636 636
 			}
637 637
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
638 638
 			// at this point, just return if registration is being made from admin
639
-			if ( is_admin() ) {
639
+			if (is_admin()) {
640 640
 				return FALSE;
641 641
 			}
642
-			if ( $valid['return_url'] ) {
643
-				EE_Error::get_notices( FALSE, TRUE );
644
-				wp_safe_redirect( $valid['return_url'] );
642
+			if ($valid['return_url']) {
643
+				EE_Error::get_notices(FALSE, TRUE);
644
+				wp_safe_redirect($valid['return_url']);
645 645
 				exit();
646
-			} elseif ( isset( $event_to_add['id'] )) {
647
-				EE_Error::get_notices( FALSE, TRUE );
648
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
646
+			} elseif (isset($event_to_add['id'])) {
647
+				EE_Error::get_notices(FALSE, TRUE);
648
+				wp_safe_redirect(get_permalink($event_to_add['id']));
649 649
 				exit();
650 650
 			} else {
651 651
 				echo EE_Error::get_notices();
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 		} else {
655 655
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
656 656
 			EE_Error::add_error(
657
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
657
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
658 658
 				__FILE__, __FUNCTION__, __LINE__
659 659
 			);
660 660
 		}
@@ -672,18 +672,18 @@  discard block
 block discarded – undo
672 672
 	 * @return        array  or FALSE
673 673
 	 */
674 674
 	private static function _validate_post_data() {
675
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
675
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
676 676
 
677 677
 		// start with an empty array()
678 678
 		$valid_data = array();
679 679
 		//		d( $_POST );
680 680
 		//if event id is valid
681
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
682
-		if ( $id ) {
681
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
682
+		if ($id) {
683 683
 			// grab valid id
684 684
 			$valid_data['id'] = $id;
685 685
 			// grab and sanitize return-url
686
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
686
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
687 687
 			// array of other form names
688 688
 			$inputs_to_clean = array(
689 689
 				'event_id' => 'tkt-slctr-event-id',
@@ -696,22 +696,22 @@  discard block
 block discarded – undo
696 696
 			// let's track the total number of tickets ordered.'
697 697
 			$valid_data['total_tickets'] = 0;
698 698
 			// cycle through $inputs_to_clean array
699
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
699
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
700 700
 				// check for POST data
701
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
701
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
702 702
 					// grab value
703
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
703
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
704 704
 					switch ($what) {
705 705
 
706 706
 						// integers
707 707
 						case 'event_id':
708
-							$valid_data[$what] = absint( $input_value );
708
+							$valid_data[$what] = absint($input_value);
709 709
 							// get event via the event id we put in the form
710
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
710
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
711 711
 							break;
712 712
 						case 'rows':
713 713
 						case 'max_atndz':
714
-							$valid_data[$what] = absint( $input_value );
714
+							$valid_data[$what] = absint($input_value);
715 715
 							break;
716 716
 
717 717
 						// arrays of integers
@@ -719,27 +719,27 @@  discard block
 block discarded – undo
719 719
 							//							d( $input_value );
720 720
 							$row_qty = $input_value;
721 721
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
722
-							if( ! is_array( $row_qty )) {
722
+							if ( ! is_array($row_qty)) {
723 723
 								// get number of rows
724
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
724
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
725 725
 								//								d( $rows );
726 726
 								// explode ints by the dash
727
-								$row_qty = explode( '-', $row_qty );
728
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
729
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
730
-								$row_qty = array( $row => $qty );
727
+								$row_qty = explode('-', $row_qty);
728
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
729
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
730
+								$row_qty = array($row => $qty);
731 731
 								//								 d( $row_qty );
732
-								for( $x = 1; $x <= $rows; $x++ ) {
733
-									if ( ! isset( $row_qty[$x] )) {
732
+								for ($x = 1; $x <= $rows; $x++) {
733
+									if ( ! isset($row_qty[$x])) {
734 734
 										$row_qty[$x] = 0;
735 735
 									}
736 736
 								}
737 737
 							}
738
-							ksort( $row_qty );
738
+							ksort($row_qty);
739 739
 							//							 d( $row_qty );
740 740
 							// cycle thru values
741
-							foreach ( $row_qty as $qty ) {
742
-								$qty = absint( $qty );
741
+							foreach ($row_qty as $qty) {
742
+								$qty = absint($qty);
743 743
 								// sanitize as integers
744 744
 								$valid_data[$what][] = $qty;
745 745
 								$valid_data['total_tickets'] += $qty;
@@ -750,19 +750,19 @@  discard block
 block discarded – undo
750 750
 						case 'ticket_id':
751 751
 							$value_array = array();
752 752
 							// cycle thru values
753
-							foreach ( $input_value as $key=>$value ) {
753
+							foreach ($input_value as $key=>$value) {
754 754
 								// allow only numbers, letters,  spaces, commas and dashes
755
-								$value_array[ $key ] = wp_strip_all_tags( $value );
755
+								$value_array[$key] = wp_strip_all_tags($value);
756 756
 								// get ticket via the ticket id we put in the form
757
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
758
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
757
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
758
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
759 759
 							}
760
-							$valid_data[ $what ] = $value_array;
760
+							$valid_data[$what] = $value_array;
761 761
 							break;
762 762
 
763 763
 						case 'return_url' :
764 764
 							// grab and sanitize return-url
765
-							$valid_data[$what] = esc_url_raw( $input_value );
765
+							$valid_data[$what] = esc_url_raw($input_value);
766 766
 							break;
767 767
 
768 768
 					} 	// end switch $what
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 			} 	// end foreach $inputs_to_clean
771 771
 
772 772
 		} else {
773
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
773
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
774 774
 			return FALSE;
775 775
 		}
776 776
 
@@ -788,28 +788,28 @@  discard block
 block discarded – undo
788 788
 	 * @param int       $qty
789 789
 	 * @return TRUE on success, FALSE on fail
790 790
 	 */
791
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
792
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
791
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
792
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
793 793
 		// get the number of spaces left for this datetime ticket
794
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
794
+		$available_spaces = self::_ticket_datetime_availability($ticket);
795 795
 		// compare available spaces against the number of tickets being purchased
796
-		if ( $available_spaces >= $qty ) {
796
+		if ($available_spaces >= $qty) {
797 797
 			// allow addons to prevent a ticket from being added to cart
798
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
798
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
799 799
 				return false;
800 800
 			}
801 801
 			// add event to cart
802
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
803
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
802
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
803
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
804 804
 				return true;
805 805
 			} else {
806 806
 				return false;
807 807
 			}
808 808
 		} else {
809 809
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
810
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
810
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
811 811
 			// greedy greedy greedy eh?
812
-			if ( $available_spaces > 0 ) {
812
+			if ($available_spaces > 0) {
813 813
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
814 814
 				EE_Error::add_error(
815 815
 					sprintf(
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 					__FILE__, __FUNCTION__, __LINE__
826 826
 				);
827 827
 			} else {
828
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
828
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
829 829
 			}
830 830
 			return false;
831 831
 		}
@@ -843,22 +843,22 @@  discard block
 block discarded – undo
843 843
 	 * @param 	bool         $get_original_ticket_spaces
844 844
 	 * @return 	int
845 845
 	 */
846
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
846
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
847 847
 		// if the $_available_spaces array has not been set up yet...
848
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
849
-				self::_set_initial_ticket_datetime_availability( $ticket );
848
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
849
+				self::_set_initial_ticket_datetime_availability($ticket);
850 850
 		}
851 851
 		$available_spaces = $ticket->qty() - $ticket->sold();
852
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
852
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
853 853
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
854
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
854
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
855 855
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
856
-				if ( $get_original_ticket_spaces ) {
856
+				if ($get_original_ticket_spaces) {
857 857
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
858
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
858
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
859 859
 				} else {
860 860
 					// we want the updated ticket availability as stored in the "datetimes" array
861
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
861
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
862 862
 				}
863 863
 			}
864 864
 		}
@@ -874,23 +874,23 @@  discard block
 block discarded – undo
874 874
 	 * @param 	EE_Ticket $ticket
875 875
 	 * @return 	int
876 876
 	 */
877
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
877
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
878 878
 		// first, get all of the datetimes that are available to this ticket
879 879
 		$datetimes = $ticket->get_many_related(
880 880
 			'Datetime',
881
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
881
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
882 882
 		);
883
-		if ( ! empty( $datetimes )) {
883
+		if ( ! empty($datetimes)) {
884 884
 			// now loop thru all of the datetimes
885
-			foreach ( $datetimes as $datetime  ) {
886
-				if ( $datetime instanceof EE_Datetime ) {
885
+			foreach ($datetimes as $datetime) {
886
+				if ($datetime instanceof EE_Datetime) {
887 887
 					// the number of spaces available for the datetime without considering individual ticket quantities
888 888
 					$spaces_remaining = $datetime->spaces_remaining();
889 889
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
890
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
890
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
891 891
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
892 892
 					// else just take the datetime spaces remaining, and assign to the datetimes array
893
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
893
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
894 894
 				}
895 895
 			}
896 896
 		}
@@ -906,12 +906,12 @@  discard block
 block discarded – undo
906 906
 	 * @param 	int   $qty
907 907
 	 * @return 	int
908 908
 	 */
909
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
910
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
909
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
910
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
911 911
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
912
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
912
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
913 913
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
914
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
914
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
915 915
 			}
916 916
 		}
917 917
 	}
@@ -928,8 +928,8 @@  discard block
 block discarded – undo
928 928
 	*/
929 929
 	public static function load_tckt_slctr_assets() {
930 930
 		// add some style
931
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
932
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
931
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
932
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
933 933
 			wp_enqueue_style('ticket_selector');
934 934
 			// make it dance
935 935
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
 
944 944
 	public static function load_tckt_slctr_assets_admin() {
945 945
 		//iframe button js on admin event editor page
946
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
947
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
948
-			wp_enqueue_script( 'ticket_selector_embed' );
946
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
947
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
948
+			wp_enqueue_script('ticket_selector_embed');
949 949
 		}
950 950
 	}
951 951
 
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 1 patch
Spacing   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -8,34 +8,34 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector )
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)
19 19
 	? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector
20 20
 	: new EE_Ticket_Selector_Config();
21 21
 
22 22
 ob_start();
23 23
 
24
-foreach ( $tickets as $TKT_ID => $ticket ) {
25
-	if ( $ticket instanceof EE_Ticket ) {
24
+foreach ($tickets as $TKT_ID => $ticket) {
25
+	if ($ticket instanceof EE_Ticket) {
26 26
 		$max = $ticket->max();
27 27
 		$min = 0;
28 28
 		$remaining = $ticket->remaining();
29
-		if ( $ticket->is_on_sale() && $ticket->is_remaining() ) {
29
+		if ($ticket->is_on_sale() && $ticket->is_remaining()) {
30 30
 			// offer the number of $tickets_remaining or $max_atndz, whichever is smaller
31
-			$max = min( $remaining, $max_atndz );
31
+			$max = min($remaining, $max_atndz);
32 32
 			// but... we also want to restrict the number of tickets by the ticket max setting,
33 33
 			// however, the max still can't be higher than what was just set above
34
-			$max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max;
34
+			$max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max;
35 35
 			// and we also want to restrict the minimum number of tickets by the ticket min setting
36 36
 			$min = $ticket->min() > 0 ? $ticket->min() : 0;
37 37
 			// and if the ticket is required, then make sure that min qty is at least 1
38
-			$min = $ticket->required() ? max( $min, 1 ) : $min;
38
+			$min = $ticket->required() ? max($min, 1) : $min;
39 39
 		} else {
40 40
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
41 41
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
@@ -44,41 +44,41 @@  discard block
 block discarded – undo
44 44
 		$ticket_price = $ticket->get_ticket_total_with_taxes();
45 45
 		$ticket_bundle = FALSE;
46 46
 		// for ticket bundles, set min and max qty the same
47
-		if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) {
47
+		if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) {
48 48
 			$ticket_price = $ticket_price * $ticket->min();
49 49
 			$ticket_bundle = TRUE;
50 50
 		}
51
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
51
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
52 52
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
53 53
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
54 54
 		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status();
55 55
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
56 56
 		// check ticket status
57
-		switch ( $tkt_status ) {
57
+		switch ($tkt_status) {
58 58
 			// sold_out
59 59
 			case EE_Ticket::sold_out :
60
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>';
60
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>';
61 61
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
62 62
 			break;
63 63
 			// expired
64 64
 			case EE_Ticket::expired :
65
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>';
65
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>';
66 66
 				$status_class = 'ticket-sales-expired lt-grey-text';
67 67
 			break;
68 68
 			// archived
69 69
 			case EE_Ticket::archived :
70
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>';
70
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>';
71 71
 				$status_class = 'archived-ticket hidden';
72 72
 			break;
73 73
 			// pending
74 74
 			case EE_Ticket::pending :
75
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>';
75
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>';
76 76
 				$status_class = 'ticket-pending';
77 77
 			break;
78 78
 			// onsale
79 79
 			case EE_Ticket::onsale :
80 80
 			default :
81
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>';
81
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>';
82 82
 				$status_class = 'ticket-on-sale';
83 83
 			break;
84 84
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}"
119 119
         );
120 120
 	?>
121
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
121
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
122 122
 		<?php
123 123
 		/**
124 124
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -130,24 +130,24 @@  discard block
 block discarded – undo
130 130
 		 *
131 131
 		 * @var string|bool
132 132
 		 */
133
-		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 ) ) ) {
133
+		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))) {
134 134
 			echo $new_row_cells_content;
135 135
 			echo '</tr>';
136 136
 			continue;
137 137
 		}
138 138
 		?>
139 139
 					<td class="tckt-slctr-tbl-td-name">
140
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
141
-						<?php if ( $template_settings->show_ticket_details ) : ?>
142
-							<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' )) ); ?>">
143
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
140
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
141
+						<?php if ($template_settings->show_ticket_details) : ?>
142
+							<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'))); ?>">
143
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
144 144
 							</a>
145
-							<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;">
146
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
145
+							<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;">
146
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
147 147
 							</a>
148 148
 						<?php endif; //end show details check ?>
149
-					<?php if ( $ticket->required() ) { ?>
150
-						<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>
149
+					<?php if ($ticket->required()) { ?>
150
+						<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>
151 151
 					<?php } ?>
152 152
 					<?php
153 153
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -161,63 +161,63 @@  discard block
 block discarded – undo
161 161
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
162 162
 					?>
163 163
 					</td>
164
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
165
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
166
-						if ( $ticket_bundle ) {
167
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
164
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
165
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
166
+						if ($ticket_bundle) {
167
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
168 168
 						} else {
169
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
169
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
170 170
 						}?></span>&nbsp;</td>
171 171
 					<?php } ?>
172 172
 					<td class="tckt-slctr-tbl-td-qty cntr">
173 173
 					<?php
174 174
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
175 175
 					// sold out or other status ?
176
-					if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) {
176
+					if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) {
177 177
 					?>
178
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
178
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
179 179
 					<?php
180
-					} else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) {
180
+					} else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) {
181 181
 						echo $ticket_status;
182
-					} else if ( $tkt_status == EE_Ticket::pending ) {
182
+					} else if ($tkt_status == EE_Ticket::pending) {
183 183
 					?>
184 184
 					<div class="ticket-pending-pg">
185
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
186
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
185
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
186
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
187 187
 					</div>
188 188
 					<?php
189 189
 					// min qty purchasable is less than tickets available
190
-					} else if ( $ticket->min() > $remaining ) {
190
+					} else if ($ticket->min() > $remaining) {
191 191
 					?>
192 192
 					<div class="archived-ticket-pg">
193
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
193
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
194 194
 					</div>
195 195
 					<?php
196 196
 					// if only one attendee is allowed to register at a time
197
-					} else if ( $max_atndz  == 1 ) {
197
+					} else if ($max_atndz == 1) {
198 198
 						// display submit button since we have tickets available
199
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
199
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
200 200
 				?>
201
-					<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=""/>
201
+					<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=""/>
202 202
 			<?php
203 203
 						$hidden_input_qty = FALSE;
204 204
 
205
-					} else if ( $max_atndz  == 0 ) {
206
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
207
-					} elseif ( $max > 0 ) {
205
+					} else if ($max_atndz == 0) {
206
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
207
+					} elseif ($max > 0) {
208 208
 						// display submit button since we have tickets available
209
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
209
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
210 210
 
211 211
 				?>
212
-					<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="">
212
+					<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="">
213 213
 					<?php
214 214
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
215
-						if ( ! $ticket->required() && $min !== 0 ) {
215
+						if ( ! $ticket->required() && $min !== 0) {
216 216
 					?>
217 217
 						<option value="0">&nbsp;0&nbsp;</option>
218 218
 					<?php }
219 219
 						// offer ticket quantities from the min to the max
220
-						for ( $i = $min; $i <= $max; $i++) {
220
+						for ($i = $min; $i <= $max; $i++) {
221 221
 					?>
222 222
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
223 223
 					<?php } ?>
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 					}
229 229
 					// depending on group reg we need to change the format for qty
230
-					if ( $hidden_input_qty ) {
230
+					if ($hidden_input_qty) {
231 231
 					?>
232 232
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
233 233
 					<?php
@@ -237,33 +237,33 @@  discard block
 block discarded – undo
237 237
 
238 238
 					</td>
239 239
 				</tr>
240
-				<?php if ( $template_settings->show_ticket_details ) : ?>
241
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
240
+				<?php if ($template_settings->show_ticket_details) : ?>
241
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
242 242
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
243 243
 							<div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
244 244
 
245 245
 								<section class="tckt-slctr-tkt-details-sctn">
246
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
246
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
247 247
 									<p><?php echo $ticket->description(); ?></p>
248 248
 
249
-									<?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
249
+									<?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
250 250
 									<section class="tckt-slctr-tkt-price-sctn">
251
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
251
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
252 252
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
253 253
 											<table class="tckt-slctr-tkt-details-tbl">
254 254
 												<thead>
255 255
 													<tr>
256
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
257
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
258
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
256
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
257
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
258
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
259 259
 													</tr>
260 260
 												</thead>
261 261
 												<tbody>
262
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
262
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
263 263
 													<tr>
264
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
265
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
266
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
264
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
265
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
266
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
267 267
 													</tr>
268 268
 													<?php
269 269
 															$running_total = $ticket->base_price()->amount();
@@ -271,44 +271,44 @@  discard block
 block discarded – undo
271 271
 															$running_total = 0;
272 272
 														}
273 273
 														// now add price modifiers
274
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
274
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
275 275
 													<tr>
276
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
277
-													<?php if ( $price_mod->is_percent() ) { ?>
278
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
276
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
277
+													<?php if ($price_mod->is_percent()) { ?>
278
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
279 279
 														<?php
280
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
280
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
281 281
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
282 282
 														?>
283 283
 													<?php } else { ?>
284 284
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
285
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
285
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
286 286
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
287 287
 													<?php } ?>
288
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
288
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
289 289
 														<?php $running_total += $new_sub_total; ?>
290 290
 													</tr>
291 291
 												<?php } ?>
292
-												<?php if ( $ticket->taxable() ) { ?>
292
+												<?php if ($ticket->taxable()) { ?>
293 293
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
294 294
 													<tr>
295
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
296
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
295
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
296
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
297 297
 													</tr>
298 298
 
299
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
299
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
300 300
 													<tr>
301
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
302
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
303
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
304
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
301
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
302
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
303
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
304
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
305 305
 														<?php $running_total += $tax_amount; ?>
306 306
 													</tr>
307 307
 													<?php } ?>
308 308
 												<?php } ?>
309 309
 													<tr>
310
-														<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>
311
-														<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>
310
+														<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>
311
+														<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>
312 312
 													</tr>
313 313
 												</tbody>
314 314
 											</table>
@@ -318,106 +318,106 @@  discard block
 block discarded – undo
318 318
 									<?php } ?>
319 319
 
320 320
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
321
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
322
-										<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/>
323
-										<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/>
324
-										<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/>
321
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
322
+										<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/>
323
+										<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/>
324
+										<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/>
325 325
 									</section>
326 326
 									<br/>
327 327
 
328
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
328
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
329 329
 
330
-									<?php if ( $ticket->min() &&$ticket->max() ) { ?>
330
+									<?php if ($ticket->min() && $ticket->max()) { ?>
331 331
 									<section class="tckt-slctr-tkt-quantities-sctn">
332
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
333
-										<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/>
334
-										<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; ?>
335
-										<?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/>
332
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
333
+										<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/>
334
+										<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; ?>
335
+										<?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/>
336 336
 										<?php //$max = min( $max, $max_atndz );?>
337
-										<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/>
337
+										<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/>
338 338
 									</section>
339 339
 									<br/>
340 340
 									<?php } ?>
341 341
 
342
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
342
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
343 343
 									<section class="tckt-slctr-tkt-uses-sctn">
344
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
344
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
345 345
 										<span class="drk-grey-text small-text no-bold"> - <?php
346 346
 											echo apply_filters(
347 347
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
348 348
 												sprintf(
349
-													__( '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' ),
349
+													__('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'),
350 350
 													'<br/>',
351 351
 													'<strong>',
352 352
 													'</strong>'
353 353
 												)
354 354
 											);
355 355
 											?></span><br/>
356
-										<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/>
356
+										<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/>
357 357
 									</section>
358 358
 									<?php } ?>
359 359
 
360 360
 									<?php
361
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
361
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
362 362
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
363
-									if ( ! empty( $datetimes )) { ?>
363
+									if ( ! empty($datetimes)) { ?>
364 364
 									<section class="tckt-slctr-tkt-datetimes-sctn">
365
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
366
-										<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>
365
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
366
+										<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>
367 367
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
368 368
 											<table class="tckt-slctr-tkt-details-tbl">
369 369
 												<thead>
370 370
 													<tr>
371 371
 														<th class="tckt-slctr-tkt-details-date-th">
372
-															<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>
372
+															<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>
373 373
 														</th>
374 374
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
375
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
375
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
376 376
 														</th>
377
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
377
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
378 378
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
379
-																<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>
379
+																<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>
380 380
 															</th>
381 381
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
382
-																<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>
382
+																<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>
383 383
 															</th>
384 384
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
385
-																<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>
385
+																<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>
386 386
 															</th>
387 387
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
388
-																<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>
388
+																<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>
389 389
 															</th>
390 390
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
391 391
 													</tr>
392 392
 												</thead>
393 393
 												<tbody>
394 394
 											<?php
395
-												foreach ( $datetimes as $datetime ) {
396
-													if ( $datetime instanceof EE_Datetime ) {
395
+												foreach ($datetimes as $datetime) {
396
+													if ($datetime instanceof EE_Datetime) {
397 397
 											?>
398 398
 
399 399
 												<tr>
400
-													<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">
400
+													<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">
401 401
 														<?php $datetime_name = $datetime->name(); ?>
402
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
403
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
402
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
403
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
404 404
 													</td>
405
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
406
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
405
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
406
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
407 407
 													</td>
408
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
409
-														<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">
408
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
409
+														<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">
410 410
 															<?php echo $ticket->sold(); ?>
411 411
 														</td>
412
-														<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">
413
-															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?>
412
+														<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">
413
+															<?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?>
414 414
 														</td>
415
-														<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">
415
+														<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">
416 416
 															<?php echo $datetime->sold(); ?>
417 417
 														</td>
418
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
419
-														<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">
420
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
418
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
419
+														<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">
420
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
421 421
 														</td>
422 422
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
423 423
 												</tr>
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 							</div>
436 436
 						</td>
437 437
 					</tr>
438
-				<?php endif;  //end template_settings->show_ticket_details check?>
438
+				<?php endif; //end template_settings->show_ticket_details check?>
439 439
 	<?php
440 440
 			$row++;
441 441
 		}
@@ -444,32 +444,32 @@  discard block
 block discarded – undo
444 444
 $ticket_row_html = ob_get_clean();
445 445
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
446 446
 $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false;
447
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
447
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
448 448
 // EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
449 449
 // EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
450 450
 // EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
451 451
 //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ );
452 452
 remove_filter(
453 453
 	'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
454
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
454
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
455 455
 );
456 456
 remove_filter(
457 457
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
458
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
458
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
459 459
 );
460
-if ( ! $hide_ticket_selector ) {
460
+if ( ! $hide_ticket_selector) {
461 461
 ?>
462 462
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
463 463
 
464
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
464
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
465 465
 
466 466
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
467 467
 		<thead>
468 468
 			<tr>
469 469
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
470
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
470
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
471 471
 				</th>
472
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
472
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
473 473
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
474 474
 					<?php
475 475
 						/**
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 						 * @param string 'Price' The translatable text to display in the table header for price
481 481
 						 * @param int $EVT_ID The Event ID
482 482
 						 */
483
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
483
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
484 484
 					?>
485 485
 				</th>
486 486
 				<?php } ?>
@@ -494,24 +494,24 @@  discard block
 block discarded – undo
494 494
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
495 495
 						* @param int $EVT_ID The Event ID
496 496
 						*/
497
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
497
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
498 498
 					?>
499 499
 				</th>
500 500
 			</tr>
501 501
 		</thead>
502 502
 		<tbody>
503
-			<?php echo $ticket_row_html;?>
503
+			<?php echo $ticket_row_html; ?>
504 504
 		</tbody>
505 505
 	</table>
506 506
 
507 507
 	<input type="hidden" name="noheader" value="true" />
508
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
508
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
509 509
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
510 510
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
511 511
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
512 512
 
513 513
 <?php
514
-if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
514
+if ($max_atndz > 0 && ! $hide_ticket_selector) {
515 515
 	echo apply_filters(
516 516
 		'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
517 517
 		''
@@ -519,10 +519,10 @@  discard block
 block discarded – undo
519 519
 }
520 520
 ?>
521 521
 
522
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
522
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
523 523
 
524 524
 </div>
525
-<?php } else if ( isset( $TKT_ID ) ) { ?>
525
+<?php } else if (isset($TKT_ID)) { ?>
526 526
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
527 527
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
528 528
 <input type="hidden" name="noheader" value="true"/>
@@ -531,27 +531,27 @@  discard block
 block discarded – undo
531 531
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
532 532
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
533 533
 <?php
534
-	if ( $ticket instanceof EE_Ticket ) {
535
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
534
+	if ($ticket instanceof EE_Ticket) {
535
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
536 536
 		$ticket_description = $ticket->description();
537 537
 ?>
538 538
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
539 539
 	<div class="no-tkt-slctr-ticket-content-dv">
540 540
 		<h5><?php echo $ticket->name(); ?></h5>
541
-		<?php if ( ! empty( $ticket_description ) ) { ?>
541
+		<?php if ( ! empty($ticket_description)) { ?>
542 542
 		<p><?php echo $ticket_description; ?></p>
543 543
 		<?php } ?>
544 544
 	</div>
545 545
 <?php
546 546
 		add_filter(
547 547
 			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
548
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
548
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
549 549
 		);
550 550
 		add_filter(
551 551
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
552
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
552
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
553 553
 		);
554
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
554
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
555 555
 	}
556 556
 }
557 557
 ?>
Please login to merge, or discard this patch.
core/exceptions/SendMessageException.php 1 patch
Spacing   +3 added lines, -3 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\exceptions;
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
 
@@ -15,5 +15,5 @@  discard block
 block discarded – undo
15 15
  * @author        Darren Ethier
16 16
  * @since         4.9.11.rc.001
17 17
  */
18
-class SendMessageException extends \RuntimeException  {}
18
+class SendMessageException extends \RuntimeException {}
19 19
 // End of file SendMessageException.php
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/business/EE_Registration_Processor.class.php 1 patch
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 use EventEspresso\core\domain\entities\RegUrlLink;
4 4
 use EventEspresso\core\domain\services\registration\CreateRegistrationService;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
7
-EE_Registry::instance()->load_class( 'Processor_Base' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
7
+EE_Registry::instance()->load_class('Processor_Base');
8 8
 
9 9
 /**
10 10
  * Class EE_Registration_Processor
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public static function instance() {
68 68
 		// check if class object is instantiated
69
-		if ( ! self::$_instance instanceof EE_Registration_Processor ) {
69
+		if ( ! self::$_instance instanceof EE_Registration_Processor) {
70 70
 			self::$_instance = new self();
71 71
 		}
72 72
 		return self::$_instance;
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 	 * @param int $REG_ID
87 87
 	 * @return string
88 88
 	 */
89
-	public function old_reg_status( $REG_ID ) {
90
-		return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null;
89
+	public function old_reg_status($REG_ID) {
90
+		return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null;
91 91
 	}
92 92
 
93 93
 
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	 * @param int $REG_ID
97 97
 	 * @param string $old_reg_status
98 98
 	 */
99
-	public function set_old_reg_status( $REG_ID, $old_reg_status ) {
99
+	public function set_old_reg_status($REG_ID, $old_reg_status) {
100 100
 		// only set the first time
101
-		if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) {
102
-			$this->_old_reg_status[ $REG_ID ] = $old_reg_status;
101
+		if ( ! isset($this->_old_reg_status[$REG_ID])) {
102
+			$this->_old_reg_status[$REG_ID] = $old_reg_status;
103 103
 		}
104 104
 	}
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 * @param int $REG_ID
110 110
 	 * @return string
111 111
 	 */
112
-	public function new_reg_status( $REG_ID ) {
113
-		return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null;
112
+	public function new_reg_status($REG_ID) {
113
+		return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null;
114 114
 	}
115 115
 
116 116
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @param int $REG_ID
120 120
 	 * @param string $new_reg_status
121 121
 	 */
122
-	public function set_new_reg_status( $REG_ID, $new_reg_status ) {
123
-		$this->_new_reg_status[ $REG_ID ] = $new_reg_status;
122
+	public function set_new_reg_status($REG_ID, $new_reg_status) {
123
+		$this->_new_reg_status[$REG_ID] = $new_reg_status;
124 124
 	}
125 125
 
126 126
 
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 	 * @param int $REG_ID
132 132
 	 * @return bool
133 133
 	 */
134
-	public function reg_status_updated( $REG_ID ) {
135
-		return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false;
134
+	public function reg_status_updated($REG_ID) {
135
+		return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false;
136 136
 	}
137 137
 
138 138
 
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	 * @param \EE_Registration $registration
142 142
 	 * @throws \EE_Error
143 143
 	 */
144
-	public function update_registration_status_and_trigger_notifications( \EE_Registration $registration ) {
145
-		$this->toggle_incomplete_registration_status_to_default( $registration, false );
146
-		$this->toggle_registration_status_for_default_approved_events( $registration, false );
147
-		$this->toggle_registration_status_if_no_monies_owing( $registration, false );
144
+	public function update_registration_status_and_trigger_notifications(\EE_Registration $registration) {
145
+		$this->toggle_incomplete_registration_status_to_default($registration, false);
146
+		$this->toggle_registration_status_for_default_approved_events($registration, false);
147
+		$this->toggle_registration_status_if_no_monies_owing($registration, false);
148 148
 		$registration->save();
149 149
 		// trigger notifications
150
-		$this->trigger_registration_update_notifications( $registration );
150
+		$this->trigger_registration_update_notifications($registration);
151 151
 	}
152 152
 
153 153
 
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
 	 * @return boolean
163 163
 	 * @throws \EE_Error
164 164
 	 */
165
-	public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) {
165
+	public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) {
166 166
 		// set initial REG_Status
167
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
167
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
168 168
 		// set incoming REG_Status
169
-		$this->set_new_reg_status( $registration->ID(), $new_reg_status );
169
+		$this->set_new_reg_status($registration->ID(), $new_reg_status);
170 170
 		// toggle reg status but only if it has changed and the user can do so
171 171
 		if (
172
-			$this->reg_status_updated( $registration->ID() ) &&
173
-			EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() )
172
+			$this->reg_status_updated($registration->ID()) &&
173
+			EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID())
174 174
 		) {
175 175
 			// change status to new value
176
-			if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) ) && $save ) {
176
+			if ($registration->set_status($this->new_reg_status($registration->ID())) && $save) {
177 177
 				$registration->save();
178 178
 			}
179 179
 			return TRUE;
@@ -193,30 +193,30 @@  discard block
 block discarded – undo
193 193
 	 * @return void
194 194
 	 * @throws \EE_Error
195 195
 	 */
196
-	public function toggle_incomplete_registration_status_to_default( EE_Registration $registration, $save = TRUE ) {
196
+	public function toggle_incomplete_registration_status_to_default(EE_Registration $registration, $save = TRUE) {
197 197
 		$existing_reg_status = $registration->status_ID();
198 198
 		// set initial REG_Status
199
-		$this->set_old_reg_status( $registration->ID(), $existing_reg_status );
199
+		$this->set_old_reg_status($registration->ID(), $existing_reg_status);
200 200
 		// is the registration currently incomplete ?
201
-		if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) {
201
+		if ($registration->status_ID() === EEM_Registration::status_id_incomplete) {
202 202
 			// grab default reg status for the event, if set
203 203
 			$event_default_registration_status = $registration->event()->default_registration_status();
204 204
 			// if no default reg status is set for the event, then use the global value
205
-			$STS_ID = ! empty( $event_default_registration_status )
205
+			$STS_ID = ! empty($event_default_registration_status)
206 206
 				? $event_default_registration_status
207 207
 				: EE_Registry::instance()->CFG->registration->default_STS_ID;
208 208
 			// if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered
209 209
 			$STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID;
210 210
 			// set incoming REG_Status
211
-			$this->set_new_reg_status( $registration->ID(), $STS_ID );
212
-			$registration->set_status( $STS_ID );
213
-			if ( $save ) {
211
+			$this->set_new_reg_status($registration->ID(), $STS_ID);
212
+			$registration->set_status($STS_ID);
213
+			if ($save) {
214 214
 				$registration->save();
215 215
 			}
216 216
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
217
-			if ( ! EE_Processor_Base::$IPN ) {
217
+			if ( ! EE_Processor_Base::$IPN) {
218 218
 				// otherwise, send out notifications
219
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
219
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
220 220
 			}
221 221
 			// DEBUG LOG
222 222
 			//$this->log(
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 	 * @return boolean
242 242
 	 * @throws \EE_Error
243 243
 	 */
244
-	public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) {
244
+	public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) {
245 245
 		$reg_status = $registration->status_ID();
246 246
 		// set initial REG_Status
247
-		$this->set_old_reg_status( $registration->ID(), $reg_status );
247
+		$this->set_old_reg_status($registration->ID(), $reg_status);
248 248
 		// if not already, toggle reg status to approved IF the event default reg status is approved
249 249
 		// ( as long as the registration wasn't cancelled or declined at some point )
250 250
 		if (
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 			$registration->event()->default_registration_status() === EEM_Registration::status_id_approved
255 255
 		) {
256 256
 			// set incoming REG_Status
257
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
257
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
258 258
 			// toggle status to approved
259
-			$registration->set_status( EEM_Registration::status_id_approved );
260
-			if ( $save ) {
259
+			$registration->set_status(EEM_Registration::status_id_approved);
260
+			if ($save) {
261 261
 				$registration->save();
262 262
 			}
263 263
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
264
-			if ( ! EE_Processor_Base::$IPN ) {
264
+			if ( ! EE_Processor_Base::$IPN) {
265 265
 				// otherwise, send out notifications
266
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
266
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
267 267
 			}
268 268
 			// DEBUG LOG
269 269
 			//$this->log(
@@ -291,19 +291,19 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 * @throws \EE_Error
293 293
 	 */
294
-	public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) {
294
+	public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) {
295 295
 		// set initial REG_Status
296
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
296
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
297 297
 		//EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ );
298 298
 		// was a payment just made ?
299 299
 		if (
300
-			isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) &&
301
-			$additional_details[ 'payment_updates' ] &&
302
-			$additional_details[ 'last_payment' ] instanceof EE_Payment
300
+			isset($additional_details['payment_updates'], $additional_details['last_payment']) &&
301
+			$additional_details['payment_updates'] &&
302
+			$additional_details['last_payment'] instanceof EE_Payment
303 303
 		) {
304
-			$payment = $additional_details[ 'last_payment' ];
304
+			$payment = $additional_details['last_payment'];
305 305
 			$total_paid = 0;
306
-			foreach ( self::$_amount_paid as $reg => $amount_paid ) {
306
+			foreach (self::$_amount_paid as $reg => $amount_paid) {
307 307
 				$total_paid += $amount_paid;
308 308
 			}
309 309
 		} else {
@@ -327,30 +327,30 @@  discard block
 block discarded – undo
327 327
 					$registration->transaction()->is_completed() ||
328 328
 					$registration->transaction()->is_overpaid() ||
329 329
 					$registration->transaction()->is_free() ||
330
-					apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration )
330
+					apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration)
331 331
 				) || (
332 332
 					$payment instanceof EE_Payment &&
333 333
 					$payment->is_approved() &&
334 334
 					// this specific registration has not yet been paid for
335
-					! isset( self::$_amount_paid[ $registration->ID() ] ) &&
335
+					! isset(self::$_amount_paid[$registration->ID()]) &&
336 336
 					// payment amount, less what we have already attributed to other registrations, is greater than this reg's final price
337 337
 					$payment->amount() - $total_paid >= $registration->final_price()
338 338
 				)
339 339
 			)
340 340
 		) {
341 341
 			// mark as paid
342
-			self::$_amount_paid[ $registration->ID() ] = $registration->final_price();
342
+			self::$_amount_paid[$registration->ID()] = $registration->final_price();
343 343
 			// track new REG_Status
344
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
344
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
345 345
 			// toggle status to approved
346
-			$registration->set_status( EEM_Registration::status_id_approved );
347
-			if ( $save ) {
346
+			$registration->set_status(EEM_Registration::status_id_approved);
347
+			if ($save) {
348 348
 				$registration->save();
349 349
 			}
350 350
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
351
-			if ( ! EE_Processor_Base::$IPN ) {
351
+			if ( ! EE_Processor_Base::$IPN) {
352 352
 				// otherwise, send out notifications
353
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
353
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
354 354
 			}
355 355
 			// DEBUG LOG
356 356
 			//$this->log(
@@ -376,27 +376,27 @@  discard block
 block discarded – undo
376 376
 	 * @param array 	$additional_details
377 377
 	 * @return void
378 378
 	 */
379
-	public function trigger_registration_update_notifications( $registration, $additional_details = array() ) {
379
+	public function trigger_registration_update_notifications($registration, $additional_details = array()) {
380 380
 		try {
381
-			if ( ! $registration instanceof EE_Registration ) {
382
-				throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) );
381
+			if ( ! $registration instanceof EE_Registration) {
382
+				throw new EE_Error(__('An invalid registration was received.', 'event_espresso'));
383 383
 			}
384
-			EE_Registry::instance()->load_helper( 'Debug_Tools' );
384
+			EE_Registry::instance()->load_helper('Debug_Tools');
385 385
 			EEH_Debug_Tools::log(
386 386
 				__CLASS__,
387 387
 				__FUNCTION__,
388 388
 				__LINE__,
389
-				array( $registration->transaction(), $additional_details ),
389
+				array($registration->transaction(), $additional_details),
390 390
 				false,
391
-				'EE_Transaction: ' . $registration->transaction()->ID()
391
+				'EE_Transaction: '.$registration->transaction()->ID()
392 392
 			);
393 393
 			do_action(
394 394
 				'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
395 395
 				$registration,
396 396
 				$additional_details
397 397
 			);
398
-		} catch( Exception $e ) {
399
-			EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() );
398
+		} catch (Exception $e) {
399
+			EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine());
400 400
 		}
401 401
 	}
402 402
 
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 	 * @return bool
411 411
 	 * @throws \EE_Error
412 412
 	 */
413
-	public function update_registration_after_checkout_or_payment(  EE_Registration $registration, $additional_details = array() ) {
413
+	public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) {
414 414
 		// set initial REG_Status
415
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
415
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
416 416
 
417 417
 		// if the registration status gets updated, then save the registration
418 418
 		if (
419
-			$this->toggle_registration_status_for_default_approved_events( $registration, false )
420
-			|| $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details )
419
+			$this->toggle_registration_status_for_default_approved_events($registration, false)
420
+			|| $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details)
421 421
 		) {
422 422
 			$registration->save();
423 423
 		}
424 424
 
425 425
 		// set new  REG_Status
426
-		$this->set_new_reg_status( $registration->ID(), $registration->status_ID() );
427
-		return $this->reg_status_updated( $registration->ID() )
428
-		       && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved
426
+		$this->set_new_reg_status($registration->ID(), $registration->status_ID());
427
+		return $this->reg_status_updated($registration->ID())
428
+		       && $this->new_reg_status($registration->ID()) === EEM_Registration::status_id_approved
429 429
 			? true
430 430
 			: false;
431 431
 	}
@@ -441,20 +441,20 @@  discard block
 block discarded – undo
441 441
 	 * @return void
442 442
 	 * @throws \EE_Error
443 443
 	 */
444
-	public function update_registration_final_prices( $transaction, $save_regs = true ) {
445
-		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() );
446
-		foreach( $transaction->registrations() as $registration ) {
444
+	public function update_registration_final_prices($transaction, $save_regs = true) {
445
+		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
446
+		foreach ($transaction->registrations() as $registration) {
447 447
 			/** @var EE_Line_Item $line_item */
448
-			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration );
449
-			if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) {
450
-				$registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] );
451
-				if( $save_regs ) {
448
+			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration);
449
+			if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) {
450
+				$registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]);
451
+				if ($save_regs) {
452 452
 					$registration->save();
453 453
 				}
454 454
 			}
455 455
 		}
456 456
 		//and make sure there's no rounding problem
457
-		$this->fix_reg_final_price_rounding_issue( $transaction );
457
+		$this->fix_reg_final_price_rounding_issue($transaction);
458 458
 	}
459 459
 
460 460
 
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 	 * @return boolean success verifying that there is NO difference after this method is done
475 475
 	 * @throws \EE_Error
476 476
 	 */
477
-	public function fix_reg_final_price_rounding_issue( $transaction ) {
477
+	public function fix_reg_final_price_rounding_issue($transaction) {
478 478
 		$reg_final_price_sum = EEM_Registration::instance()->sum(
479 479
 			array(
480 480
 				array(
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 			),
484 484
 			'REG_final_price'
485 485
 		);
486
-		$diff =  $transaction->total() - (float) $reg_final_price_sum;
486
+		$diff = $transaction->total() - (float) $reg_final_price_sum;
487 487
 		//ok then, just grab one of the registrations
488
-		if( $diff !== 0 ) {
488
+		if ($diff !== 0) {
489 489
 			$a_reg = EEM_Registration::instance()->get_one(
490 490
 					array(
491 491
 						array(
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 					));
495 495
 			$success = $a_reg instanceof EE_Registration
496 496
 				? $a_reg->save(
497
-					array( 'REG_final_price' => $a_reg->final_price() + $diff )
497
+					array('REG_final_price' => $a_reg->final_price() + $diff)
498 498
 				)
499 499
 				: false;
500 500
 			return $success ? true : false;
@@ -519,13 +519,13 @@  discard block
 block discarded – undo
519 519
 		$update_reg = true
520 520
 	) {
521 521
 		// these reg statuses should not be considered in any calculations involving monies owing
522
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses
522
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses
523 523
 			: EEM_Registration::closed_reg_statuses();
524
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
524
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses)) {
525 525
 			return false;
526 526
 		}
527 527
 		$registration->set_final_price(0);
528
-		if ( $update_reg ) {
528
+		if ($update_reg) {
529 529
 			$registration->save();
530 530
 		}
531 531
 		return true;
@@ -548,23 +548,23 @@  discard block
 block discarded – undo
548 548
 		$update_reg = true
549 549
 	) {
550 550
 		// these reg statuses should not be considered in any calculations involving monies owing
551
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses
551
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses
552 552
 			: EEM_Registration::closed_reg_statuses();
553
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
553
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
554 554
 			return false;
555 555
 		}
556 556
 		$ticket = $registration->ticket();
557
-		if ( ! $ticket instanceof EE_Ticket ) {
557
+		if ( ! $ticket instanceof EE_Ticket) {
558 558
 			throw new EE_Error(
559 559
 				sprintf(
560
-					__( 'The Ticket for Registration %1$d was not found or is invalid.',
561
-						'event_espresso' ),
560
+					__('The Ticket for Registration %1$d was not found or is invalid.',
561
+						'event_espresso'),
562 562
 					$registration->ticket_ID()
563 563
 				)
564 564
 			);
565 565
 		}
566
-		$registration->set_final_price( $ticket->price() );
567
-		if ( $update_reg ) {
566
+		$registration->set_final_price($ticket->price());
567
+		if ($update_reg) {
568 568
 			$registration->save();
569 569
 		}
570 570
 		return true;
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		$total_ticket_count = 1
603 603
 	) {
604 604
 		EE_Error::doing_it_wrong(
605
-			__CLASS__ . '::' . __FUNCTION__,
605
+			__CLASS__.'::'.__FUNCTION__,
606 606
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
607 607
 				'\EventEspresso\core\domain\services\registration\CreateRegistrationService::create()'),
608 608
 			'4.9.1',
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 	public function generate_reg_url_link($att_nmbr, $item)
646 646
 	{
647 647
 		EE_Error::doing_it_wrong(
648
-			__CLASS__ . '::' . __FUNCTION__,
648
+			__CLASS__.'::'.__FUNCTION__,
649 649
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
650 650
 				'EventEspresso\core\domain\entities\RegUrlLink'),
651 651
 			'4.9.1',
@@ -665,11 +665,11 @@  discard block
 block discarded – undo
665 665
 	 * @return string
666 666
 	 * @throws \EE_Error
667 667
 	 */
668
-	public function generate_reg_code( EE_Registration $registration ) {
668
+	public function generate_reg_code(EE_Registration $registration) {
669 669
 		EE_Error::doing_it_wrong(
670
-			__CLASS__ . '::' . __FUNCTION__,
670
+			__CLASS__.'::'.__FUNCTION__,
671 671
 			sprintf(
672
-				__( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ),
672
+				__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
673 673
 				'EventEspresso\core\domain\entities\RegCode'
674 674
 			),
675 675
 			'4.9.1',
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 		return apply_filters(
679 679
 			'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code',
680 680
 			new RegCode(
681
-				RegUrlLink::fromRegistration( $registration ),
681
+				RegUrlLink::fromRegistration($registration),
682 682
 				$registration->transaction(),
683 683
 				$registration->ticket()
684 684
 			),
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Queue.lib.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use \EventEspresso\core\exceptions\SendMessageException;
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
 /**
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @param \EE_Message_Repository       $message_repository
78 78
 	 */
79
-	public function __construct( EE_Message_Repository $message_repository ) {
80
-		$this->_batch_count        = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 );
79
+	public function __construct(EE_Message_Repository $message_repository) {
80
+		$this->_batch_count        = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50);
81 81
 		$this->_rate_limit         = $this->get_rate_limit();
82 82
 		$this->_message_repository = $message_repository;
83 83
 	}
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	 *                                 use the messenger send method but typically is based on preview data.
97 97
 	 * @return bool          Whether the message was successfully added to the repository or not.
98 98
 	 */
99
-	public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) {
99
+	public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) {
100 100
 		$data['preview'] = $preview;
101 101
 		$data['test_send'] = $test_send;
102
-		return $this->_message_repository->add( $message, $data );
102
+		return $this->_message_repository->add($message, $data);
103 103
 	}
104 104
 
105 105
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 	 * @param bool          $persist    This flag indicates whether to attempt to delete the object from the db as well.
112 112
 	 * @return bool
113 113
 	 */
114
-	public function remove( EE_Message $message, $persist = false ) {
115
-		if ( $persist && $this->_message_repository->current() !== $message ) {
114
+	public function remove(EE_Message $message, $persist = false) {
115
+		if ($persist && $this->_message_repository->current() !== $message) {
116 116
 			//get pointer on right message
117
-			if ( $this->_message_repository->has( $message ) ) {
117
+			if ($this->_message_repository->has($message)) {
118 118
 				$this->_message_repository->rewind();
119
-				while( $this->_message_repository->valid() ) {
120
-					if ( $this->_message_repository->current() === $message ) {
119
+				while ($this->_message_repository->valid()) {
120
+					if ($this->_message_repository->current() === $message) {
121 121
 						break;
122 122
 					}
123 123
 					$this->_message_repository->next();
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 				return false;
127 127
 			}
128 128
 		}
129
-		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove( $message );
129
+		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove($message);
130 130
 	}
131 131
 
132 132
 
@@ -166,29 +166,29 @@  discard block
 block discarded – undo
166 166
 	 * @return bool  true if successfully retrieved batch, false no batch ready.
167 167
 	 */
168 168
 	public function get_batch_to_generate() {
169
-		if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) {
169
+		if ($this->is_locked(EE_Messages_Queue::action_generating)) {
170 170
 			return false;
171 171
 		}
172 172
 
173 173
 		//lock batch generation to prevent race conditions.
174
-		$this->lock_queue( EE_Messages_Queue::action_generating );
174
+		$this->lock_queue(EE_Messages_Queue::action_generating);
175 175
 
176 176
 		$query_args = array(
177 177
 			// key 0 = where conditions
178
-			0 => array( 'STS_ID' => EEM_Message::status_incomplete ),
178
+			0 => array('STS_ID' => EEM_Message::status_incomplete),
179 179
 			'order_by' => $this->_get_priority_orderby(),
180 180
 			'limit' => $this->_batch_count
181 181
 		);
182
-		$messages = EEM_Message::instance()->get_all( $query_args );
182
+		$messages = EEM_Message::instance()->get_all($query_args);
183 183
 
184
-		if ( ! $messages ) {
184
+		if ( ! $messages) {
185 185
 			return false; //nothing to generate
186 186
 		}
187 187
 
188
-		foreach ( $messages as $message ) {
189
-			if ( $message instanceof EE_Message ) {
188
+		foreach ($messages as $message) {
189
+			if ($message instanceof EE_Message) {
190 190
 				$data = $message->all_extra_meta_array();
191
-				$this->add( $message, $data );
191
+				$this->add($message, $data);
192 192
 			}
193 193
 		}
194 194
 		return true;
@@ -211,34 +211,34 @@  discard block
 block discarded – undo
211 211
 	 *               to assist with notifying user.
212 212
 	 */
213 213
 	public function get_to_send_batch_and_send() {
214
-		if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) {
214
+		if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) {
215 215
 			return false;
216 216
 		}
217 217
 
218
-		$this->lock_queue( EE_Messages_Queue::action_sending );
218
+		$this->lock_queue(EE_Messages_Queue::action_sending);
219 219
 
220 220
 		$batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit;
221 221
 
222 222
 		$query_args = array(
223 223
 			// key 0 = where conditions
224
-			0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ),
224
+			0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())),
225 225
 			'order_by' => $this->_get_priority_orderby(),
226 226
 			'limit' => $batch
227 227
 		);
228 228
 
229
-		$messages_to_send = EEM_Message::instance()->get_all( $query_args );
229
+		$messages_to_send = EEM_Message::instance()->get_all($query_args);
230 230
 
231 231
 
232 232
 		//any to send?
233
-		if ( ! $messages_to_send ) {
234
-			$this->unlock_queue( EE_Messages_Queue::action_sending );
233
+		if ( ! $messages_to_send) {
234
+			$this->unlock_queue(EE_Messages_Queue::action_sending);
235 235
 			return false;
236 236
 		}
237 237
 
238 238
 		//add to queue.
239
-		foreach ( $messages_to_send as $message ) {
240
-			if ( $message instanceof EE_Message ) {
241
-				$this->add( $message );
239
+		foreach ($messages_to_send as $message) {
240
+			if ($message instanceof EE_Message) {
241
+				$this->add($message);
242 242
 			}
243 243
 		}
244 244
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 		$this->execute();
247 247
 
248 248
 		//release lock
249
-		$this->unlock_queue( EE_Messages_Queue::action_sending );
249
+		$this->unlock_queue(EE_Messages_Queue::action_sending);
250 250
 		return true;
251 251
 	}
252 252
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	 *
259 259
 	 * @param   string  $type   The type of queue being locked.
260 260
 	 */
261
-	public function lock_queue( $type = EE_Messages_Queue::action_generating ) {
262
-		set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) );
261
+	public function lock_queue($type = EE_Messages_Queue::action_generating) {
262
+		set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type));
263 263
 	}
264 264
 
265 265
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @param   string  $type   The type of queue being unlocked.
272 272
 	 */
273
-	public function unlock_queue( $type = EE_Messages_Queue::action_generating ) {
274
-		delete_transient( $this->_get_lock_key( $type ) );
273
+	public function unlock_queue($type = EE_Messages_Queue::action_generating) {
274
+		delete_transient($this->_get_lock_key($type));
275 275
 	}
276 276
 
277 277
 
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 	 * @param string $type  The type of lock.
283 283
 	 * @return string
284 284
 	 */
285
-	protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) {
286
-		return '_ee_lock_' . $type;
285
+	protected function _get_lock_key($type = EE_Messages_Queue::action_generating) {
286
+		return '_ee_lock_'.$type;
287 287
 	}
288 288
 
289 289
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	 * @param string $type  The type of lock
295 295
 	 * @return int   time to expiry in seconds.
296 296
 	 */
297
-	protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) {
298
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type );
297
+	protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) {
298
+		return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type);
299 299
 	}
300 300
 
301 301
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @return int
314 314
 	 */
315 315
 	protected function _get_rate_limit_expiry() {
316
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS );
316
+		return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS);
317 317
 	}
318 318
 
319 319
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @return int
325 325
 	 */
326 326
 	protected function _default_rate_limit() {
327
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 );
327
+		return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200);
328 328
 	}
329 329
 
330 330
 
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 	 * @param  string $type The type of lock being checked for.
351 351
 	 * @return bool
352 352
 	 */
353
-	public function is_locked( $type = EE_Messages_Queue::action_generating ) {
353
+	public function is_locked($type = EE_Messages_Queue::action_generating) {
354 354
 		/**
355 355
 		 * This filters the default is_locked behaviour.
356 356
 		 */
357 357
 		$is_locked = filter_var(
358 358
 			apply_filters(
359 359
 				'FHEE__EE_Messages_Queue__is_locked',
360
-				get_transient( $this->_get_lock_key( $type ) ),
360
+				get_transient($this->_get_lock_key($type)),
361 361
 				$this
362 362
 			),
363 363
 			FILTER_VALIDATE_BOOLEAN
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		 *            Also implemented here because messages processed on the same request should not have any locks applied.
369 369
 		 */
370 370
 		if (
371
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
371
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
372 372
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
373 373
 		) {
374 374
 			$is_locked = false;
@@ -390,9 +390,9 @@  discard block
 block discarded – undo
390 390
 	 * @return int
391 391
 	 */
392 392
 	public function get_rate_limit() {
393
-		if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) {
393
+		if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) {
394 394
 			$rate_limit = $this->_default_rate_limit();
395
-			set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() );
395
+			set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key());
396 396
 		}
397 397
 		return $rate_limit;
398 398
 	}
@@ -404,12 +404,12 @@  discard block
 block discarded – undo
404 404
 	 * This updates existing rate limit with the new limit which is the old minus the batch.
405 405
 	 * @param int $batch_completed  This sets the new rate limit based on the given batch that was completed.
406 406
 	 */
407
-	public function set_rate_limit( $batch_completed ) {
407
+	public function set_rate_limit($batch_completed) {
408 408
 		//first get the most up to date rate limit (in case its expired and reset)
409 409
 		$rate_limit = $this->get_rate_limit();
410 410
 		$new_limit = $rate_limit - $batch_completed;
411 411
 		//updating the transient option directly to avoid resetting the expiry.
412
-		update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit );
412
+		update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit);
413 413
 	}
414 414
 
415 415
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @param string $task This indicates what type of request is going to be initiated.
423 423
 	 * @param int    $priority  This indicates the priority that triggers initiating the request.
424 424
 	 */
425
-	public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) {
425
+	public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) {
426 426
 		//determine what status is matched with the priority as part of the trigger conditions.
427 427
 		$status = $task == 'generate'
428 428
 			? EEM_Message::status_incomplete
@@ -442,19 +442,19 @@  discard block
 block discarded – undo
442 442
 		 *   the same request.
443 443
 		 */
444 444
 		if (
445
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
445
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
446 446
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
447 447
 		) {
448
-			$messages_processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
449
-			if ( $messages_processor instanceof EE_Messages_Processor ) {
450
-				return $messages_processor->process_immediately_from_queue( $this );
448
+			$messages_processor = EE_Registry::instance()->load_lib('Messages_Processor');
449
+			if ($messages_processor instanceof EE_Messages_Processor) {
450
+				return $messages_processor->process_immediately_from_queue($this);
451 451
 			}
452 452
 			//if we get here then that means the messages processor couldn't be loaded so messages will just remain
453 453
 			//queued for manual triggering by end user.
454 454
 		}
455 455
 
456
-		if ( $this->_message_repository->count_by_priority_and_status( $priority, $status ) ) {
457
-			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task );
456
+		if ($this->_message_repository->count_by_priority_and_status($priority, $status)) {
457
+			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task);
458 458
 		}
459 459
 	}
460 460
 
@@ -479,53 +479,53 @@  discard block
 block discarded – undo
479 479
 	 *                    Also, if the messenger is an request type messenger (or a preview),
480 480
 	 * 					  its entirely possible that the messenger will exit before
481 481
 	 */
482
-	public function execute( $save = true, $sending_messenger = null, $by_priority = false ) {
482
+	public function execute($save = true, $sending_messenger = null, $by_priority = false) {
483 483
 		$messages_sent = 0;
484 484
 		$this->_did_hook = array();
485 485
 		$this->_message_repository->rewind();
486 486
 
487
-		while ( $this->_message_repository->valid() ) {
487
+		while ($this->_message_repository->valid()) {
488 488
 			$error_messages = array();
489 489
 			/** @type EE_Message $message */
490 490
 			$message = $this->_message_repository->current();
491 491
 			//only process things that are queued for sending
492
-			if ( ! in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) {
492
+			if ( ! in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) {
493 493
 				$this->_message_repository->next();
494 494
 				continue;
495 495
 			}
496 496
 			//if $by_priority is set and does not match then continue;
497
-			if ( $by_priority && $by_priority != $message->priority() ) {
497
+			if ($by_priority && $by_priority != $message->priority()) {
498 498
 				$this->_message_repository->next();
499 499
 				continue;
500 500
 			}
501 501
 			//error checking
502
-			if ( ! $message->valid_messenger() ) {
502
+			if ( ! $message->valid_messenger()) {
503 503
 				$error_messages[] = sprintf(
504
-					__( 'The %s messenger is not active at time of sending.', 'event_espresso' ),
504
+					__('The %s messenger is not active at time of sending.', 'event_espresso'),
505 505
 					$message->messenger()
506 506
 				);
507 507
 			}
508
-			if ( ! $message->valid_message_type() ) {
508
+			if ( ! $message->valid_message_type()) {
509 509
 				$error_messages[] = sprintf(
510
-					__( 'The %s message type is not active at the time of sending.', 'event_espresso' ),
510
+					__('The %s message type is not active at the time of sending.', 'event_espresso'),
511 511
 					$message->message_type()
512 512
 				);
513 513
 			}
514 514
 			// if there was supposed to be a sending messenger for this message, but it was invalid/inactive,
515 515
 			// then it will instead be an EE_Error object, so let's check for that
516
-			if ( $sending_messenger instanceof EE_Error ) {
516
+			if ($sending_messenger instanceof EE_Error) {
517 517
 				$error_messages[] = $sending_messenger->getMessage();
518 518
 			}
519 519
 			// if there are no errors, then let's process the message
520
-			if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) {
520
+			if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) {
521 521
 				$messages_sent++;
522 522
 			}
523
-			$this->_set_error_message( $message, $error_messages );
523
+			$this->_set_error_message($message, $error_messages);
524 524
 			//add modified time
525
-			$message->set_modified( time() );
525
+			$message->set_modified(time());
526 526
 			$this->_message_repository->next();
527 527
 		}
528
-		if ( $save ) {
528
+		if ($save) {
529 529
 			$this->save();
530 530
 		}
531 531
 		return $messages_sent;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * @param mixed 	 $sending_messenger (optional)
541 541
 	 * @return bool
542 542
 	 */
543
-	protected function _process_message( EE_Message $message, $sending_messenger = null ) {
543
+	protected function _process_message(EE_Message $message, $sending_messenger = null) {
544 544
 		// these *should* have been validated in the execute() method above
545 545
 		$messenger = $message->messenger_object();
546 546
 		$message_type = $message->message_type_object();
@@ -550,20 +550,20 @@  discard block
 block discarded – undo
550 550
 			&& $messenger instanceof EE_messenger
551 551
 			&& $sending_messenger->name != $messenger->name
552 552
 		) {
553
-			$messenger->do_secondary_messenger_hooks( $sending_messenger->name );
553
+			$messenger->do_secondary_messenger_hooks($sending_messenger->name);
554 554
 			$messenger = $sending_messenger;
555 555
 		}
556 556
 		// send using messenger, but double check objects
557
-		if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) {
557
+		if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) {
558 558
 			//set hook for message type (but only if not using another messenger to send).
559
-			if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) {
560
-				$message_type->do_messenger_hooks( $messenger );
561
-				$this->_did_hook[ $message_type->name ] = 1;
559
+			if ( ! isset($this->_did_hook[$message_type->name])) {
560
+				$message_type->do_messenger_hooks($messenger);
561
+				$this->_did_hook[$message_type->name] = 1;
562 562
 			}
563 563
 			//if preview then use preview method
564 564
 			return $this->_message_repository->is_preview()
565
-				? $this->_do_preview( $message, $messenger, $message_type, $this->_message_repository->is_test_send() )
566
-				: $this->_do_send( $message, $messenger, $message_type );
565
+				? $this->_do_preview($message, $messenger, $message_type, $this->_message_repository->is_test_send())
566
+				: $this->_do_send($message, $messenger, $message_type);
567 567
 		}
568 568
 		return false;
569 569
 	}
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
 	 * @param array $status  Stati to check for in queue
582 582
 	 * @return int  Count of EE_Message's matching the given status.
583 583
 	 */
584
-	public function count_STS_in_queue( $status ) {
584
+	public function count_STS_in_queue($status) {
585 585
 		$count = 0;
586
-		$status = is_array( $status ) ? $status : array( $status );
586
+		$status = is_array($status) ? $status : array($status);
587 587
 		$this->_message_repository->rewind();
588
-		foreach( $this->_message_repository as $message ) {
589
-			if ( in_array( $message->STS_ID(), $status ) ) {
588
+		foreach ($this->_message_repository as $message) {
589
+			if (in_array($message->STS_ID(), $status)) {
590 590
 				$count++;
591 591
 			}
592 592
 		}
@@ -603,15 +603,15 @@  discard block
 block discarded – undo
603 603
 	 * @param $test_send
604 604
 	 * @return bool   true means all went well, false means, not so much.
605 605
 	 */
606
-	protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) {
607
-		if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) {
608
-			if ( ! $test_send ) {
609
-				$message->set_content( $preview );
606
+	protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) {
607
+		if ($preview = $messenger->get_preview($message, $message_type, $test_send)) {
608
+			if ( ! $test_send) {
609
+				$message->set_content($preview);
610 610
 			}
611
-			$message->set_STS_ID( EEM_Message::status_sent );
611
+			$message->set_STS_ID(EEM_Message::status_sent);
612 612
 			return true;
613 613
 		} else {
614
-			$message->set_STS_ID( EEM_Message::status_failed );
614
+			$message->set_STS_ID(EEM_Message::status_failed);
615 615
 			return false;
616 616
 		}
617 617
 	}
@@ -633,18 +633,18 @@  discard block
 block discarded – undo
633 633
 	 *
634 634
 	 * @return bool true means all went well, false means, not so much.
635 635
 	 */
636
-	protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) {
636
+	protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) {
637 637
 		try {
638
-			if ( $messenger->send_message( $message, $message_type ) ) {
639
-				$message->set_STS_ID( EEM_Message::status_sent );
638
+			if ($messenger->send_message($message, $message_type)) {
639
+				$message->set_STS_ID(EEM_Message::status_sent);
640 640
 				return true;
641 641
 			} else {
642
-				$message->set_STS_ID( EEM_Message::status_retry );
642
+				$message->set_STS_ID(EEM_Message::status_retry);
643 643
 				return false;
644 644
 			}
645
-		} catch( SendMessageException $e ) {
646
-			$message->set_STS_ID( EEM_Message::status_failed );
647
-			$message->set_error_message( $e->getMessage() );
645
+		} catch (SendMessageException $e) {
646
+			$message->set_STS_ID(EEM_Message::status_failed);
647
+			$message->set_error_message($e->getMessage());
648 648
 			return false;
649 649
 		}
650 650
 	}
@@ -658,21 +658,21 @@  discard block
 block discarded – undo
658 658
 	 * @param EE_Message $message
659 659
 	 * @param array      $error_messages the response from the messenger.
660 660
 	 */
661
-	protected function _set_error_message( EE_Message $message, $error_messages ) {
661
+	protected function _set_error_message(EE_Message $message, $error_messages) {
662 662
 		$error_messages = (array) $error_messages;
663
-		if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) {
663
+		if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) {
664 664
 			$notices = EE_Error::has_notices();
665
-			$error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' );
666
-			if ( $notices === 1 ) {
665
+			$error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso');
666
+			if ($notices === 1) {
667 667
 				$notices = EE_Error::get_vanilla_notices();
668
-				$notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array();
669
-				$error_messages[] = implode( "\n", $notices['errors'] );
668
+				$notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array();
669
+				$error_messages[] = implode("\n", $notices['errors']);
670 670
 			}
671 671
 		}
672
-		if ( count( $error_messages ) > 0 ) {
673
-			$msg = __( 'Message was not executed successfully.', 'event_espresso' );
674
-			$msg = $msg . "\n" . implode( "\n", $error_messages );
675
-			$message->set_error_message( $msg );
672
+		if (count($error_messages) > 0) {
673
+			$msg = __('Message was not executed successfully.', 'event_espresso');
674
+			$msg = $msg."\n".implode("\n", $error_messages);
675
+			$message->set_error_message($msg);
676 676
 		}
677 677
 	}
678 678
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_messenger.lib.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 use \EventEspresso\core\exceptions\SendMessageException;
3 3
 
4
-if (!defined('EVENT_ESPRESSO_VERSION') )
4
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
5 5
 	exit('NO direct script access allowed');
6 6
 
7 7
 /**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 * @return void
280 280
 	 */
281 281
 	public function enqueue_scripts_styles() {
282
-		do_action( 'AHEE__EE_messenger__enqueue_scripts_styles');
282
+		do_action('AHEE__EE_messenger__enqueue_scripts_styles');
283 283
 	}
284 284
 
285 285
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
 		$this->_supports_labels->template_variation_description = __('These are different styles to choose from for the selected template structure.  Usually these affect things like font style, color, borders etc.  In some cases the styles will also make minor layout changes.');
351 351
 
352
-		$this->_supports_labels = apply_filters( 'FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this );
352
+		$this->_supports_labels = apply_filters('FHEE__EE_messenger___set_supports_labels_defaults___supports_labels', $this->_supports_labels, $this);
353 353
 	}
354 354
 
355 355
 
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
 	 * @return stdClass
365 365
 	 */
366 366
 	public function get_supports_labels() {
367
-		if ( empty( $this->_supports_labels->template_pack ) || empty( $this->_supports_labels->template_variation) ) {
367
+		if (empty($this->_supports_labels->template_pack) || empty($this->_supports_labels->template_variation)) {
368 368
 			$this->_set_supports_labels_defaults();
369 369
 		}
370
-		return apply_filters( 'FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this );
370
+		return apply_filters('FHEE__EE_messenger__get_supports_labels', $this->_supports_labels, $this);
371 371
 	}
372 372
 
373 373
 
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 	 *
388 388
 	 * @return string                    path or url for the requested variation.
389 389
 	 */
390
-	public function get_variation( EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE ) {
390
+	public function get_variation(EE_Messages_Template_Pack $pack, $message_type_name, $url = FALSE, $type = 'main', $variation = 'default', $skip_filters = FALSE) {
391 391
 		$this->_tmp_pack = $pack;
392
-		$variation_path = apply_filters( 'EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters );
393
-		$variation_path = empty( $variation_path ) ? $this->_tmp_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ) : $variation_path;
392
+		$variation_path = apply_filters('EE_messenger__get_variation__variation', false, $pack, $this->name, $message_type_name, $url, $type, $variation, $skip_filters);
393
+		$variation_path = empty($variation_path) ? $this->_tmp_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters) : $variation_path;
394 394
 		return $variation_path;
395 395
 
396 396
 	}
@@ -408,13 +408,13 @@  discard block
 block discarded – undo
408 408
 	 * @return array
409 409
 	 */
410 410
 	public function get_default_message_types() {
411
-		$class = get_class( $this );
411
+		$class = get_class($this);
412 412
 
413 413
 		//messenger specific filter
414
-		$default_types = apply_filters( 'FHEE__' . $class . '__get_default_message_types__default_types', $this->_default_message_types, $this );
414
+		$default_types = apply_filters('FHEE__'.$class.'__get_default_message_types__default_types', $this->_default_message_types, $this);
415 415
 
416 416
 		//all messengers filter
417
-		$default_types = apply_filters( 'FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this );
417
+		$default_types = apply_filters('FHEE__EE_messenger__get_default_message_types__default_types', $default_types, $this);
418 418
 		return $default_types;
419 419
 	}
420 420
 
@@ -429,14 +429,14 @@  discard block
 block discarded – undo
429 429
 	 * @return array
430 430
 	 */
431 431
 	public function get_valid_message_types() {
432
-		$class = get_class( $this );
432
+		$class = get_class($this);
433 433
 
434 434
 		//messenger specific filter
435 435
 		//messenger specific filter
436
-		$valid_types = apply_filters( 'FHEE__' . $class . '__get_valid_message_types__valid_types', $this->_valid_message_types, $this );
436
+		$valid_types = apply_filters('FHEE__'.$class.'__get_valid_message_types__valid_types', $this->_valid_message_types, $this);
437 437
 
438 438
 		//all messengers filter
439
-		$valid_types = apply_filters( 'FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this );
439
+		$valid_types = apply_filters('FHEE__EE_messenger__get_valid_message_types__valid_types', $valid_types, $this);
440 440
 		return $valid_types;
441 441
 	}
442 442
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 * @access public
451 451
 	 * @param array $new_config Whatever is put in here will reset the _validator_config property
452 452
 	 */
453
-	public function set_validator_config( $new_config ) {
453
+	public function set_validator_config($new_config) {
454 454
 		$this->_validator_config = $new_config;
455 455
 	}
456 456
 
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
 	public function get_validator_config() {
467 467
 		$class = get_class($this);
468 468
 
469
-		$config = apply_filters( 'FHEE__' . $class . '__get_validator_config', $this->_validator_config, $this );
470
-		$config = apply_filters( 'FHEE__EE_messenger__get_validator_config', $config, $this );
469
+		$config = apply_filters('FHEE__'.$class.'__get_validator_config', $this->_validator_config, $this);
470
+		$config = apply_filters('FHEE__EE_messenger__get_validator_config', $config, $this);
471 471
 		return $config;
472 472
 	}
473 473
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 * @access public
485 485
 	 * @return string content for page
486 486
 	 */
487
-	public function get_messenger_admin_page_content( $page, $action = null, $extra = array(), $message_types = array() ) {
488
-		return $this->_get_admin_page_content( $page, $action, $extra, $message_types );
487
+	public function get_messenger_admin_page_content($page, $action = null, $extra = array(), $message_types = array()) {
488
+		return $this->_get_admin_page_content($page, $action, $extra, $message_types);
489 489
 	}
490 490
 
491 491
 
@@ -495,20 +495,20 @@  discard block
 block discarded – undo
495 495
 	 * @param array $extra
496 496
 	 * @return mixed|string
497 497
 	 */
498
-	protected function _get_admin_content_events_edit( $message_types, $extra ) {
498
+	protected function _get_admin_content_events_edit($message_types, $extra) {
499 499
 		//defaults
500 500
 		$template_args = array();
501 501
 		$selector_rows = '';
502 502
 
503 503
 		//we don't need message types here so we're just going to ignore. we do, however, expect the event id here. The event id is needed to provide a link to setup a custom template for this event.
504
-		$event_id = isset( $extra['event'] ) ? $extra['event'] : NULL;
504
+		$event_id = isset($extra['event']) ? $extra['event'] : NULL;
505 505
 
506
-		$template_wrapper_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
507
-		$template_row_path = EE_LIBRARIES . 'messages/messenger/admin_templates/event_switcher_row.template.php';
506
+		$template_wrapper_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_wrapper.template.php';
507
+		$template_row_path = EE_LIBRARIES.'messages/messenger/admin_templates/event_switcher_row.template.php';
508 508
 
509 509
 		//array of template objects for global and custom (non-trashed) (but remember just for this messenger!)
510 510
 		$global_templates = EEM_Message_Template_Group::instance()->get_all(
511
-			array( array( 'MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true ) )
511
+			array(array('MTP_messenger' => $this->name, 'MTP_is_global' => true, 'MTP_is_active' => true))
512 512
 		);
513 513
 		$templates_for_event = EEM_Message_Template_Group::instance()->get_all_custom_templates_by_event(
514 514
 			$event_id,
@@ -517,55 +517,55 @@  discard block
 block discarded – undo
517 517
 				'MTP_is_active' => true
518 518
 			)
519 519
 		);
520
-		$templates_for_event = !empty( $templates_for_event ) ? $templates_for_event : array();
520
+		$templates_for_event = ! empty($templates_for_event) ? $templates_for_event : array();
521 521
 
522 522
 		//so we need to setup the rows for the selectors and we use the global mtpgs (cause those will the active message template groups)
523
-		foreach ( $global_templates as $mtpgID => $mtpg ) {
524
-			if ( $mtpg instanceof EE_Message_Template_Group ) {
523
+		foreach ($global_templates as $mtpgID => $mtpg) {
524
+			if ($mtpg instanceof EE_Message_Template_Group) {
525 525
 				//verify this message type is supposed to show on this page
526 526
 				$mtp_obj = $mtpg->message_type_obj();
527
-				if ( ! $mtp_obj instanceof EE_message_type ) {
527
+				if ( ! $mtp_obj instanceof EE_message_type) {
528 528
 					continue;
529 529
 				}
530
-				$mtp_obj->admin_registered_pages = (array)$mtp_obj->admin_registered_pages;
531
-				if ( ! in_array( 'events_edit', $mtp_obj->admin_registered_pages ) ) {
530
+				$mtp_obj->admin_registered_pages = (array) $mtp_obj->admin_registered_pages;
531
+				if ( ! in_array('events_edit', $mtp_obj->admin_registered_pages)) {
532 532
 					continue;
533 533
 				}
534 534
 				$select_values = array();
535
-				$select_values[ $mtpgID ] = __( 'Global', 'event_espresso' );
536
-				$default_value = array_key_exists( $mtpgID, $templates_for_event ) && ! $mtpg->get( 'MTP_is_override' ) ? $mtpgID : null;
535
+				$select_values[$mtpgID] = __('Global', 'event_espresso');
536
+				$default_value = array_key_exists($mtpgID, $templates_for_event) && ! $mtpg->get('MTP_is_override') ? $mtpgID : null;
537 537
 				//if the override has been set for the global template, then that means even if there are custom templates already created we ignore them because of the set override.
538
-				if ( ! $mtpg->get( 'MTP_is_override' ) ) {
538
+				if ( ! $mtpg->get('MTP_is_override')) {
539 539
 					//any custom templates for this message type?
540
-					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt( $this->name, $mtpg->message_type() );
541
-					foreach ( $custom_templates as $cmtpgID => $cmtpg ) {
542
-						$select_values[ $cmtpgID ] = $cmtpg->name();
543
-						$default_value = array_key_exists( $cmtpgID, $templates_for_event ) ? $cmtpgID : $default_value;
540
+					$custom_templates = EEM_Message_Template_Group::instance()->get_custom_message_template_by_m_and_mt($this->name, $mtpg->message_type());
541
+					foreach ($custom_templates as $cmtpgID => $cmtpg) {
542
+						$select_values[$cmtpgID] = $cmtpg->name();
543
+						$default_value = array_key_exists($cmtpgID, $templates_for_event) ? $cmtpgID : $default_value;
544 544
 					}
545 545
 				}
546 546
 				//if there is no $default_value then we set it as the global
547
-				$default_value = empty( $default_value ) ? $mtpgID : $default_value;
548
-				$edit_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value ), admin_url( 'admin.php' ) );
549
-				$create_url = EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value ), admin_url( 'admin.php' ) );
550
-				$st_args[ 'mt_name' ] = ucwords( $mtp_obj->label[ 'singular' ] );
551
-				$st_args[ 'mt_slug' ] = $mtpg->message_type();
552
-				$st_args[ 'messenger_slug' ] = $this->name;
553
-				$st_args[ 'selector' ] = EEH_Form_Fields::select_input( 'event_message_templates_relation[' . $mtpgID . ']', $select_values, $default_value, 'data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '"', 'message-template-selector' );
547
+				$default_value = empty($default_value) ? $mtpgID : $default_value;
548
+				$edit_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'edit_message_template', 'id' => $default_value), admin_url('admin.php'));
549
+				$create_url = EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_messages', 'action' => 'add_new_message_template', 'GRP_ID' => $default_value), admin_url('admin.php'));
550
+				$st_args['mt_name'] = ucwords($mtp_obj->label['singular']);
551
+				$st_args['mt_slug'] = $mtpg->message_type();
552
+				$st_args['messenger_slug'] = $this->name;
553
+				$st_args['selector'] = EEH_Form_Fields::select_input('event_message_templates_relation['.$mtpgID.']', $select_values, $default_value, 'data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'"', 'message-template-selector');
554 554
 				//note that  message template group that has override_all_custom set will remove the ability to set a custom message template based off of the global (and that also in turn overrides any other custom templates).
555
-				$st_args[ 'create_button' ] = $mtpg->get( 'MTP_is_override' ) ? '' : '<a data-messenger="' . $this->name . '" data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $create_url . '" class="button button-small create-mtpg-button">' . __( 'Create New Custom', 'event_espresso' ) . '</a>';
556
-				$st_args[ 'create_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ? $st_args[ 'create_button' ] : '';
557
-				$st_args[ 'edit_button' ] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID ) ? '<a data-messagetype="' . $mtpg->message_type() . '" data-grpid="' . $default_value . '" target="_blank" href="' . $edit_url . '" class="button button-small edit-mtpg-button">' . __( 'Edit', 'event_espresso' ) . '</a>' : '';
558
-				$selector_rows .= EEH_Template::display_template( $template_row_path, $st_args, true );
555
+				$st_args['create_button'] = $mtpg->get('MTP_is_override') ? '' : '<a data-messenger="'.$this->name.'" data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$create_url.'" class="button button-small create-mtpg-button">'.__('Create New Custom', 'event_espresso').'</a>';
556
+				$st_args['create_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template') ? $st_args['create_button'] : '';
557
+				$st_args['edit_button'] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $mtpgID) ? '<a data-messagetype="'.$mtpg->message_type().'" data-grpid="'.$default_value.'" target="_blank" href="'.$edit_url.'" class="button button-small edit-mtpg-button">'.__('Edit', 'event_espresso').'</a>' : '';
558
+				$selector_rows .= EEH_Template::display_template($template_row_path, $st_args, true);
559 559
 			}
560 560
 		}
561 561
 
562 562
 		//if no selectors present then get out.
563
-		if ( empty( $selector_rows ) ) {
563
+		if (empty($selector_rows)) {
564 564
 			return '';
565 565
 		}
566 566
 
567 567
 		$template_args['selector_rows'] = $selector_rows;
568
-		return EEH_Template::display_template( $template_wrapper_path, $template_args, TRUE );
568
+		return EEH_Template::display_template($template_wrapper_path, $template_args, TRUE);
569 569
 	}
570 570
 
571 571
 
@@ -580,8 +580,8 @@  discard block
 block discarded – undo
580 580
 	 * @return array $this->_template_fields
581 581
 	 */
582 582
 	public function get_template_fields() {
583
-		$template_fields = apply_filters( 'FHEE__' . get_class($this) . '__get_template_fields', $this->_template_fields, $this );
584
-		$template_fields = apply_filters( 'FHEE__EE_messenger__get_template_fields', $template_fields, $this );
583
+		$template_fields = apply_filters('FHEE__'.get_class($this).'__get_template_fields', $this->_template_fields, $this);
584
+		$template_fields = apply_filters('FHEE__EE_messenger__get_template_fields', $template_fields, $this);
585 585
 		return $template_fields;
586 586
 	}
587 587
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 	 * @param mixed $value
596 596
 	 */
597 597
 	protected function _set_template_value($item, $value) {
598
-		if ( array_key_exists($item, $this->_template_fields) ) {
599
-			$prop = '_' . $item;
600
-			$this->{$prop}= $value;
598
+		if (array_key_exists($item, $this->_template_fields)) {
599
+			$prop = '_'.$item;
600
+			$this->{$prop} = $value;
601 601
 		}
602 602
 	}
603 603
 
@@ -615,18 +615,18 @@  discard block
 block discarded – undo
615 615
 	 *
616 616
 	 * @throws SendMessageException
617 617
 	 */
618
-	final public function send_message( $message, EE_message_type $message_type ) {
618
+	final public function send_message($message, EE_message_type $message_type) {
619 619
 		try {
620
-			$this->_validate_and_setup( $message );
620
+			$this->_validate_and_setup($message);
621 621
 			$this->_incoming_message_type = $message_type;
622 622
 			$response = $this->_send_message();
623
-			if ( $response instanceof WP_Error ) {
624
-				EE_Error::add_error( $response->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
623
+			if ($response instanceof WP_Error) {
624
+				EE_Error::add_error($response->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
625 625
 				$response = false;
626 626
 			}
627
-		} catch ( \Exception $e ) {
627
+		} catch (\Exception $e) {
628 628
 			//convert to an instance of SendMessageException
629
-			throw new SendMessageException( $e->getMessage() );
629
+			throw new SendMessageException($e->getMessage());
630 630
 		}
631 631
 		return $response;
632 632
 	}
@@ -640,28 +640,28 @@  discard block
 block discarded – undo
640 640
 	 * @param  bool   $send    true we will actually use the _send method (for test sends). FALSE we just return preview
641 641
 	 * @return string          return the message html content
642 642
 	 */
643
-	public function get_preview( EE_Message $message, EE_message_type $message_type, $send = false ) {
644
-		$this->_validate_and_setup( $message );
643
+	public function get_preview(EE_Message $message, EE_message_type $message_type, $send = false) {
644
+		$this->_validate_and_setup($message);
645 645
 
646 646
 		$this->_incoming_message_type = $message_type;
647 647
 
648
-		if ( $send ) {
648
+		if ($send) {
649 649
 			//are we overriding any existing template fields?
650 650
 			$settings = $this->get_existing_test_settings();
651
-			if ( ! empty( $settings ) ) {
652
-				foreach ( $settings as $field => $value ) {
653
-					$this->_set_template_value( $field, $value );
651
+			if ( ! empty($settings)) {
652
+				foreach ($settings as $field => $value) {
653
+					$this->_set_template_value($field, $value);
654 654
 				}
655 655
 			}
656 656
 		}
657 657
 
658 658
 		//enqueue preview js so that any links/buttons on the page are disabled.
659
-		if ( ! $send ) {
659
+		if ( ! $send) {
660 660
 			// the below may seem like duplication.  However, typically if a messenger enqueues scripts/styles,
661 661
 			// it deregisters all existing wp scripts and styles first.  So the second hook ensures our previewer still gets setup.
662
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
663
-			add_action( 'wp_enqueue_scripts', array( $this, 'add_preview_script' ), 10 );
664
-			add_action( 'AHEE__EE_messenger__enqueue_scripts_styles', array( $this, 'add_preview_script' ), 10 );
662
+			add_action('admin_enqueue_scripts', array($this, 'add_preview_script'), 10);
663
+			add_action('wp_enqueue_scripts', array($this, 'add_preview_script'), 10);
664
+			add_action('AHEE__EE_messenger__enqueue_scripts_styles', array($this, 'add_preview_script'), 10);
665 665
 		}
666 666
 
667 667
 		return $send ? $this->_send_message() : $this->_preview();
@@ -679,10 +679,10 @@  discard block
 block discarded – undo
679 679
 	 */
680 680
 	public function add_preview_script() {
681 681
 		//error message
682
-		EE_Registry::$i18n_js_strings[ 'links_disabled' ] = __( 'All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso' );
683
-		wp_register_script( 'ee-messages-preview-js', EE_LIBRARIES_URL . 'messages/messenger/assets/js/ee-messages-preview.js', array( 'jquery' ), EVENT_ESPRESSO_VERSION, true );
684
-		wp_localize_script( 'ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings );
685
-		wp_enqueue_script( 'ee-messages-preview-js' );
682
+		EE_Registry::$i18n_js_strings['links_disabled'] = __('All the links on this page have been disabled because this is a generated preview message for the purpose of ensuring layout, style, and content setup.  To test generated links, you must trigger an actual message notification.', 'event_espresso');
683
+		wp_register_script('ee-messages-preview-js', EE_LIBRARIES_URL.'messages/messenger/assets/js/ee-messages-preview.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
684
+		wp_localize_script('ee-messages-preview-js', 'eei18n', EE_Registry::$i18n_js_strings);
685
+		wp_enqueue_script('ee-messages-preview-js');
686 686
 	}
687 687
 
688 688
 
@@ -693,13 +693,13 @@  discard block
 block discarded – undo
693 693
 	 * @param  EE_Message $message
694 694
 	 * @throws EE_Error
695 695
 	 */
696
-	protected function _validate_and_setup( EE_Message $message ) {
696
+	protected function _validate_and_setup(EE_Message $message) {
697 697
 		$template_pack = $message->get_template_pack();
698 698
 		$variation = $message->get_template_pack_variation();
699 699
 
700 700
 		//verify we have the required template pack value on the $message object.
701
-		if ( ! $template_pack instanceof EE_Messages_Template_Pack ) {
702
-			throw new EE_Error( __('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso' ) );
701
+		if ( ! $template_pack instanceof EE_Messages_Template_Pack) {
702
+			throw new EE_Error(__('Incoming $message object must have an EE_Messages_Template_Pack object available.', 'event_espresso'));
703 703
 		}
704 704
 
705 705
 		$this->_tmp_pack = $template_pack;
@@ -708,11 +708,11 @@  discard block
 block discarded – undo
708 708
 
709 709
 		$template_fields = $this->get_template_fields();
710 710
 
711
-		foreach ( $template_fields as $template => $value ) {
712
-			if ( $template !== 'extra' ) {
713
-				$column_value = $message->get_field_or_extra_meta( 'MSG_' . $template );
711
+		foreach ($template_fields as $template => $value) {
712
+			if ($template !== 'extra') {
713
+				$column_value = $message->get_field_or_extra_meta('MSG_'.$template);
714 714
 				$message_template_value = $column_value ? $column_value : null;
715
-				$this->_set_template_value( $template, $message_template_value );
715
+				$this->_set_template_value($template, $message_template_value);
716 716
 			}
717 717
 		}
718 718
 	}
@@ -727,19 +727,19 @@  discard block
 block discarded – undo
727 727
 	 * @return string
728 728
 	 * @throws \EE_Error
729 729
 	 */
730
-	protected function _get_main_template( $preview = FALSE ) {
730
+	protected function _get_main_template($preview = FALSE) {
731 731
 		$type = $preview ? 'preview' : 'main';
732 732
 
733
-		$wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, $type );
733
+		$wrapper_template = $this->_tmp_pack->get_wrapper($this->name, $type);
734 734
 
735 735
 		//check file exists and is readable
736
-		if ( !is_readable( $wrapper_template ) )
737
-			throw new EE_Error( sprintf( __('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso' ), ucwords($this->label['singular']) , $wrapper_template ) );
736
+		if ( ! is_readable($wrapper_template))
737
+			throw new EE_Error(sprintf(__('Unable to access the template file for the %s messenger main content wrapper.  The location being attempted is %s.', 'event_espresso'), ucwords($this->label['singular']), $wrapper_template));
738 738
 
739 739
 		//add message type to template args
740 740
 		$this->_template_args['message_type'] = $this->_incoming_message_type;
741 741
 
742
-		return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE );
742
+		return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE);
743 743
 	}
744 744
 
745 745
 
@@ -775,9 +775,9 @@  discard block
 block discarded – undo
775 775
 	 */
776 776
 	public function get_existing_test_settings() {
777 777
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
778
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
778
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
779 779
 		$settings = $Message_Resource_Manager->get_active_messengers_option();
780
-		return isset( $settings[ $this->name ]['test_settings'] ) ? $settings[ $this->name ]['test_settings'] : array();
780
+		return isset($settings[$this->name]['test_settings']) ? $settings[$this->name]['test_settings'] : array();
781 781
 	}
782 782
 
783 783
 
@@ -789,12 +789,12 @@  discard block
 block discarded – undo
789 789
 	 * @param $settings
790 790
 	 * @return bool success/fail
791 791
 	 */
792
-	public function set_existing_test_settings( $settings ) {
792
+	public function set_existing_test_settings($settings) {
793 793
 		/** @var EE_Message_Resource_Manager $Message_Resource_Manager */
794
-		$Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
794
+		$Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
795 795
 		$existing = $Message_Resource_Manager->get_active_messengers_option();
796
-		$existing[ $this->name ]['test_settings'] = $settings;
797
-		return $Message_Resource_Manager->update_active_messengers_option( $existing );
796
+		$existing[$this->name]['test_settings'] = $settings;
797
+		return $Message_Resource_Manager->update_active_messengers_option($existing);
798 798
 	}
799 799
 
800 800
 
@@ -807,21 +807,21 @@  discard block
 block discarded – undo
807 807
 	 * @param string $field The field to retrieve the label for
808 808
 	 * @return string        	  The label
809 809
 	 */
810
-	public function get_field_label( $field ) {
810
+	public function get_field_label($field) {
811 811
 		//first let's see if the field requests is in the top level array.
812
-		if ( isset( $this->_template_fields[$field] ) && !empty( $this->_template_fields[$field]['label'] ) )
812
+		if (isset($this->_template_fields[$field]) && ! empty($this->_template_fields[$field]['label']))
813 813
 			return $this->_template[$field]['label'];
814 814
 
815 815
 		//nope so let's look in the extra array to see if it's there HOWEVER if the field exists as a top level index in the extra array then we know the label is in the 'main' index.
816
-		if ( isset( $this->_template_fields['extra'] ) && !empty( $this->_template_fields['extra'][$field] ) && !empty( $this->_template_fields['extra'][$field]['main']['label'] )  )
816
+		if (isset($this->_template_fields['extra']) && ! empty($this->_template_fields['extra'][$field]) && ! empty($this->_template_fields['extra'][$field]['main']['label']))
817 817
 			return $this->_template_fields['extra'][$field]['main']['label'];
818 818
 
819 819
 		//now it's possible this field may just be existing in any of the extra array items.
820
-		if ( !empty( $this->_template_fields['extra'] ) && is_array( $this->_template_fields['extra'] ) ) {
821
-			foreach ( $this->_template_fields['extra'] as $main_field => $subfields ) {
822
-				if ( !is_array( $subfields ) )
820
+		if ( ! empty($this->_template_fields['extra']) && is_array($this->_template_fields['extra'])) {
821
+			foreach ($this->_template_fields['extra'] as $main_field => $subfields) {
822
+				if ( ! is_array($subfields))
823 823
 					continue;
824
-				if ( isset( $subfields[$field] ) && !empty( $subfields[$field]['label'] ) )
824
+				if (isset($subfields[$field]) && ! empty($subfields[$field]['label']))
825 825
 					return $subfields[$field]['label'];
826 826
 			}
827 827
 		}
@@ -842,7 +842,7 @@  discard block
 block discarded – undo
842 842
 	 *
843 843
 	 * @return void
844 844
 	 */
845
-	public function do_secondary_messenger_hooks( $sending_messenger_name ) {
845
+	public function do_secondary_messenger_hooks($sending_messenger_name) {
846 846
 		return;
847 847
 	}
848 848
 
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1321,7 +1321,7 @@  discard block
 block discarded – undo
1321 1321
 	 * This just returns whatever is set as the _event object property
1322 1322
 	 *
1323 1323
 	 * //todo this will become obsolete once the models are in place
1324
-	 * @return object
1324
+	 * @return EE_Event
1325 1325
 	 */
1326 1326
 	public function get_event_object() {
1327 1327
 		return $this->_cpt_model_obj;
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
 
2199 2199
 
2200 2200
 	/**
2201
-	 * @return mixed
2201
+	 * @return string
2202 2202
 	 */
2203 2203
 	protected function _category_details_content() {
2204 2204
 		$editor_args['category_desc'] = array(
Please login to merge, or discard this patch.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -829,11 +829,11 @@  discard block
 block discarded – undo
829 829
 		if ( ! empty( $id ) ) {
830 830
 			$post = get_post( $id );
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
833
-			           . '</a> ';
832
+					   . esc_html__( 'Shortcode', 'event_espresso' )
833
+					   . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835
-			           . $post->ID
836
-			           . ']">';
835
+					   . $post->ID
836
+					   . ']">';
837 837
 		}
838 838
 		return $return;
839 839
 	}
@@ -1045,8 +1045,8 @@  discard block
 block discarded – undo
1045 1045
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1046 1046
 			if ( ! empty( $dtt['DTT_ID'] ) ) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1048
+								  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
+								  ->get_one_by_ID( $dtt['DTT_ID'] );
1050 1050
 				$DTM->set_date_format( $incoming_date_formats[0] );
1051 1051
 				$DTM->set_time_format( $incoming_date_formats[1] );
1052 1052
 				foreach ( $datetime_values as $field => $value ) {
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146 1146
 					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1147
-					                  && ! $TKT->get(
1147
+									  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150 1150
 					$TKT->set_date_format( $incoming_date_formats[0] );
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		$first_datetime = reset( $times );
1455 1455
 		//do we get related tickets?
1456 1456
 		if ( $first_datetime instanceof EE_Datetime
1457
-		     && $first_datetime->ID() !== 0
1457
+			 && $first_datetime->ID() !== 0
1458 1458
 		) {
1459 1459
 			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1460 1460
 			$template_args['time'] = $first_datetime;
@@ -1529,7 +1529,7 @@  discard block
 block discarded – undo
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530 1530
 			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531 1531
 			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1532
+									 && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534 1534
 			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1535 1535
 				: ' disabled=disabled',
@@ -1695,8 +1695,8 @@  discard block
 block discarded – undo
1695 1695
 			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696 1696
 			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697 1697
 			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1698
+							->setTime( 23, 59, 59 )
1699
+							->format( implode( ' ', $start_formats ) );
1700 1700
 			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1701 1701
 		}
1702 1702
 		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
@@ -1716,7 +1716,7 @@  discard block
 block discarded – undo
1716 1716
 		}
1717 1717
 		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718 1718
 			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1719
+				 && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
@@ -2213,13 +2213,13 @@  discard block
 block discarded – undo
2213 2213
 	protected function _template_settings() {
2214 2214
 		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216
-		                                       . EVENTS_ASSETS_URL
2217
-		                                       . DS
2218
-		                                       . 'images'
2219
-		                                       . DS
2220
-		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
-		                                       . '" />';
2216
+											   . EVENTS_ASSETS_URL
2217
+											   . DS
2218
+											   . 'images'
2219
+											   . DS
2220
+											   . 'caffeinated_template_features.jpg" alt="'
2221
+											   . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2222
+											   . '" />';
2223 2223
 		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
Please login to merge, or discard this patch.
Spacing   +591 added lines, -591 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'NO direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		);
64 64
 		add_action(
65 65
 			'AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object',
66
-			array( $this, 'verify_event_edit' )
66
+			array($this, 'verify_event_edit')
67 67
 		);
68 68
 	}
69 69
 
@@ -79,22 +79,22 @@  discard block
 block discarded – undo
79 79
 		$this->_admin_page_title = EVENTS_LABEL;
80 80
 		$this->_labels = array(
81 81
 			'buttons'      => array(
82
-				'add'             => esc_html__( 'Add New Event', 'event_espresso' ),
83
-				'edit'            => esc_html__( 'Edit Event', 'event_espresso' ),
84
-				'delete'          => esc_html__( 'Delete Event', 'event_espresso' ),
85
-				'add_category'    => esc_html__( 'Add New Category', 'event_espresso' ),
86
-				'edit_category'   => esc_html__( 'Edit Category', 'event_espresso' ),
87
-				'delete_category' => esc_html__( 'Delete Category', 'event_espresso' ),
82
+				'add'             => esc_html__('Add New Event', 'event_espresso'),
83
+				'edit'            => esc_html__('Edit Event', 'event_espresso'),
84
+				'delete'          => esc_html__('Delete Event', 'event_espresso'),
85
+				'add_category'    => esc_html__('Add New Category', 'event_espresso'),
86
+				'edit_category'   => esc_html__('Edit Category', 'event_espresso'),
87
+				'delete_category' => esc_html__('Delete Category', 'event_espresso'),
88 88
 			),
89 89
 			'editor_title' => array(
90
-				'espresso_events' => esc_html__( 'Enter event title here', 'event_espresso' ),
90
+				'espresso_events' => esc_html__('Enter event title here', 'event_espresso'),
91 91
 			),
92 92
 			'publishbox'   => array(
93
-				'create_new'        => esc_html__( 'Save New Event', 'event_espresso' ),
94
-				'edit'              => esc_html__( 'Update Event', 'event_espresso' ),
95
-				'add_category'      => esc_html__( 'Save New Category', 'event_espresso' ),
96
-				'edit_category'     => esc_html__( 'Update Category', 'event_espresso' ),
97
-				'template_settings' => esc_html__( 'Update Settings', 'event_espresso' ),
93
+				'create_new'        => esc_html__('Save New Event', 'event_espresso'),
94
+				'edit'              => esc_html__('Update Event', 'event_espresso'),
95
+				'add_category'      => esc_html__('Save New Category', 'event_espresso'),
96
+				'edit_category'     => esc_html__('Update Category', 'event_espresso'),
97
+				'template_settings' => esc_html__('Update Settings', 'event_espresso'),
98 98
 			),
99 99
 		);
100 100
 	}
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 		//load formatter helper
106 106
 		//load field generator helper
107 107
 		//is there a evt_id in the request?
108
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] )
108
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID'])
109 109
 			? $this->_req_data['EVT_ID'] : 0;
110
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
110
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
111 111
 		$this->_page_routes = array(
112 112
 			'default'                       => array(
113 113
 				'func'       => '_events_overview_list_table',
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
 			),
131 131
 			'trash_event'                   => array(
132 132
 				'func'       => '_trash_or_restore_event',
133
-				'args'       => array( 'event_status' => 'trash' ),
133
+				'args'       => array('event_status' => 'trash'),
134 134
 				'capability' => 'ee_delete_event',
135 135
 				'obj_id'     => $evt_id,
136 136
 				'noheader'   => true,
137 137
 			),
138 138
 			'trash_events'                  => array(
139 139
 				'func'       => '_trash_or_restore_events',
140
-				'args'       => array( 'event_status' => 'trash' ),
140
+				'args'       => array('event_status' => 'trash'),
141 141
 				'capability' => 'ee_delete_events',
142 142
 				'noheader'   => true,
143 143
 			),
144 144
 			'restore_event'                 => array(
145 145
 				'func'       => '_trash_or_restore_event',
146
-				'args'       => array( 'event_status' => 'draft' ),
146
+				'args'       => array('event_status' => 'draft'),
147 147
 				'capability' => 'ee_delete_event',
148 148
 				'obj_id'     => $evt_id,
149 149
 				'noheader'   => true,
150 150
 			),
151 151
 			'restore_events'                => array(
152 152
 				'func'       => '_trash_or_restore_events',
153
-				'args'       => array( 'event_status' => 'draft' ),
153
+				'args'       => array('event_status' => 'draft'),
154 154
 				'capability' => 'ee_delete_events',
155 155
 				'noheader'   => true,
156 156
 			),
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 			'add_category'                  => array(
187 187
 				'func'       => '_category_details',
188 188
 				'capability' => 'ee_edit_event_category',
189
-				'args'       => array( 'add' ),
189
+				'args'       => array('add'),
190 190
 			),
191 191
 			'edit_category'                 => array(
192 192
 				'func'       => '_category_details',
193 193
 				'capability' => 'ee_edit_event_category',
194
-				'args'       => array( 'edit' ),
194
+				'args'       => array('edit'),
195 195
 			),
196 196
 			'delete_categories'             => array(
197 197
 				'func'       => '_delete_categories',
@@ -205,13 +205,13 @@  discard block
 block discarded – undo
205 205
 			),
206 206
 			'insert_category' => array(
207 207
 				'func'       => '_insert_or_update_category',
208
-				'args'       => array( 'new_category' => true ),
208
+				'args'       => array('new_category' => true),
209 209
 				'capability' => 'ee_edit_event_category',
210 210
 				'noheader'   => true,
211 211
 			),
212 212
 			'update_category' => array(
213 213
 				'func'       => '_insert_or_update_category',
214
-				'args'       => array( 'new_category' => false ),
214
+				'args'       => array('new_category' => false),
215 215
 				'capability' => 'ee_edit_event_category',
216 216
 				'noheader'   => true,
217 217
 			),
@@ -228,29 +228,29 @@  discard block
 block discarded – undo
228 228
 		$this->_page_config = array(
229 229
 			'default'                => array(
230 230
 				'nav'           => array(
231
-					'label' => esc_html__( 'Overview', 'event_espresso' ),
231
+					'label' => esc_html__('Overview', 'event_espresso'),
232 232
 					'order' => 10,
233 233
 				),
234 234
 				'list_table'    => 'Events_Admin_List_Table',
235 235
 				'help_tabs'     => array(
236 236
 					'events_overview_help_tab'                       => array(
237
-						'title'    => esc_html__( 'Events Overview', 'event_espresso' ),
237
+						'title'    => esc_html__('Events Overview', 'event_espresso'),
238 238
 						'filename' => 'events_overview',
239 239
 					),
240 240
 					'events_overview_table_column_headings_help_tab' => array(
241
-						'title'    => esc_html__( 'Events Overview Table Column Headings', 'event_espresso' ),
241
+						'title'    => esc_html__('Events Overview Table Column Headings', 'event_espresso'),
242 242
 						'filename' => 'events_overview_table_column_headings',
243 243
 					),
244 244
 					'events_overview_filters_help_tab'               => array(
245
-						'title'    => esc_html__( 'Events Overview Filters', 'event_espresso' ),
245
+						'title'    => esc_html__('Events Overview Filters', 'event_espresso'),
246 246
 						'filename' => 'events_overview_filters',
247 247
 					),
248 248
 					'events_overview_view_help_tab'                  => array(
249
-						'title'    => esc_html__( 'Events Overview Views', 'event_espresso' ),
249
+						'title'    => esc_html__('Events Overview Views', 'event_espresso'),
250 250
 						'filename' => 'events_overview_views',
251 251
 					),
252 252
 					'events_overview_other_help_tab'                 => array(
253
-						'title'    => esc_html__( 'Events Overview Other', 'event_espresso' ),
253
+						'title'    => esc_html__('Events Overview Other', 'event_espresso'),
254 254
 						'filename' => 'events_overview_other',
255 255
 					),
256 256
 				),
@@ -265,218 +265,218 @@  discard block
 block discarded – undo
265 265
 			),
266 266
 			'create_new'             => array(
267 267
 				'nav'           => array(
268
-					'label'      => esc_html__( 'Add Event', 'event_espresso' ),
268
+					'label'      => esc_html__('Add Event', 'event_espresso'),
269 269
 					'order'      => 5,
270 270
 					'persistent' => false,
271 271
 				),
272
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
272
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
273 273
 				'help_tabs'     => array(
274 274
 					'event_editor_help_tab'                            => array(
275
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
275
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
276 276
 						'filename' => 'event_editor',
277 277
 					),
278 278
 					'event_editor_title_richtexteditor_help_tab'       => array(
279
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
279
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
280 280
 						'filename' => 'event_editor_title_richtexteditor',
281 281
 					),
282 282
 					'event_editor_venue_details_help_tab'              => array(
283
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
283
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
284 284
 						'filename' => 'event_editor_venue_details',
285 285
 					),
286 286
 					'event_editor_event_datetimes_help_tab'            => array(
287
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
287
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
288 288
 						'filename' => 'event_editor_event_datetimes',
289 289
 					),
290 290
 					'event_editor_event_tickets_help_tab'              => array(
291
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
291
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
292 292
 						'filename' => 'event_editor_event_tickets',
293 293
 					),
294 294
 					'event_editor_event_registration_options_help_tab' => array(
295
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
295
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
296 296
 						'filename' => 'event_editor_event_registration_options',
297 297
 					),
298 298
 					'event_editor_tags_categories_help_tab'            => array(
299
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
299
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
300 300
 						'filename' => 'event_editor_tags_categories',
301 301
 					),
302 302
 					'event_editor_questions_registrants_help_tab'      => array(
303
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
303
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
304 304
 						'filename' => 'event_editor_questions_registrants',
305 305
 					),
306 306
 					'event_editor_save_new_event_help_tab'             => array(
307
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
307
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
308 308
 						'filename' => 'event_editor_save_new_event',
309 309
 					),
310 310
 					'event_editor_other_help_tab'                      => array(
311
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
311
+						'title'    => esc_html__('Event Other', 'event_espresso'),
312 312
 						'filename' => 'event_editor_other',
313 313
 					),
314 314
 				),
315 315
 				'help_tour'     => array(
316 316
 					'Event_Editor_Help_Tour',
317 317
 				),
318
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
318
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
319 319
 				'require_nonce' => false,
320 320
 			),
321 321
 			'edit'                   => array(
322 322
 				'nav'           => array(
323
-					'label'      => esc_html__( 'Edit Event', 'event_espresso' ),
323
+					'label'      => esc_html__('Edit Event', 'event_espresso'),
324 324
 					'order'      => 5,
325 325
 					'persistent' => false,
326
-					'url'        => isset( $this->_req_data['post'] )
326
+					'url'        => isset($this->_req_data['post'])
327 327
 						? EE_Admin_Page::add_query_args_and_nonce(
328
-							array( 'post' => $this->_req_data['post'], 'action' => 'edit' ),
328
+							array('post' => $this->_req_data['post'], 'action' => 'edit'),
329 329
 							$this->_current_page_view_url
330 330
 						)
331 331
 						: $this->_admin_base_url,
332 332
 				),
333
-				'metaboxes'     => array( '_register_event_editor_meta_boxes' ),
333
+				'metaboxes'     => array('_register_event_editor_meta_boxes'),
334 334
 				'help_tabs'     => array(
335 335
 					'event_editor_help_tab'                            => array(
336
-						'title'    => esc_html__( 'Event Editor', 'event_espresso' ),
336
+						'title'    => esc_html__('Event Editor', 'event_espresso'),
337 337
 						'filename' => 'event_editor',
338 338
 					),
339 339
 					'event_editor_title_richtexteditor_help_tab'       => array(
340
-						'title'    => esc_html__( 'Event Title & Rich Text Editor', 'event_espresso' ),
340
+						'title'    => esc_html__('Event Title & Rich Text Editor', 'event_espresso'),
341 341
 						'filename' => 'event_editor_title_richtexteditor',
342 342
 					),
343 343
 					'event_editor_venue_details_help_tab'              => array(
344
-						'title'    => esc_html__( 'Event Venue Details', 'event_espresso' ),
344
+						'title'    => esc_html__('Event Venue Details', 'event_espresso'),
345 345
 						'filename' => 'event_editor_venue_details',
346 346
 					),
347 347
 					'event_editor_event_datetimes_help_tab'            => array(
348
-						'title'    => esc_html__( 'Event Datetimes', 'event_espresso' ),
348
+						'title'    => esc_html__('Event Datetimes', 'event_espresso'),
349 349
 						'filename' => 'event_editor_event_datetimes',
350 350
 					),
351 351
 					'event_editor_event_tickets_help_tab'              => array(
352
-						'title'    => esc_html__( 'Event Tickets', 'event_espresso' ),
352
+						'title'    => esc_html__('Event Tickets', 'event_espresso'),
353 353
 						'filename' => 'event_editor_event_tickets',
354 354
 					),
355 355
 					'event_editor_event_registration_options_help_tab' => array(
356
-						'title'    => esc_html__( 'Event Registration Options', 'event_espresso' ),
356
+						'title'    => esc_html__('Event Registration Options', 'event_espresso'),
357 357
 						'filename' => 'event_editor_event_registration_options',
358 358
 					),
359 359
 					'event_editor_tags_categories_help_tab'            => array(
360
-						'title'    => esc_html__( 'Event Tags & Categories', 'event_espresso' ),
360
+						'title'    => esc_html__('Event Tags & Categories', 'event_espresso'),
361 361
 						'filename' => 'event_editor_tags_categories',
362 362
 					),
363 363
 					'event_editor_questions_registrants_help_tab'      => array(
364
-						'title'    => esc_html__( 'Questions for Registrants', 'event_espresso' ),
364
+						'title'    => esc_html__('Questions for Registrants', 'event_espresso'),
365 365
 						'filename' => 'event_editor_questions_registrants',
366 366
 					),
367 367
 					'event_editor_save_new_event_help_tab'             => array(
368
-						'title'    => esc_html__( 'Save New Event', 'event_espresso' ),
368
+						'title'    => esc_html__('Save New Event', 'event_espresso'),
369 369
 						'filename' => 'event_editor_save_new_event',
370 370
 					),
371 371
 					'event_editor_other_help_tab'                      => array(
372
-						'title'    => esc_html__( 'Event Other', 'event_espresso' ),
372
+						'title'    => esc_html__('Event Other', 'event_espresso'),
373 373
 						'filename' => 'event_editor_other',
374 374
 					),
375 375
 				),
376 376
 				/*'help_tour' => array(
377 377
 					'Event_Edit_Help_Tour'
378 378
 				),*/
379
-				'qtips'         => array( 'EE_Event_Editor_Decaf_Tips' ),
379
+				'qtips'         => array('EE_Event_Editor_Decaf_Tips'),
380 380
 				'require_nonce' => false,
381 381
 			),
382 382
 			'default_event_settings' => array(
383 383
 				'nav'           => array(
384
-					'label' => esc_html__( 'Default Settings', 'event_espresso' ),
384
+					'label' => esc_html__('Default Settings', 'event_espresso'),
385 385
 					'order' => 40,
386 386
 				),
387
-				'metaboxes'     => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
387
+				'metaboxes'     => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
388 388
 				'labels'        => array(
389
-					'publishbox' => esc_html__( 'Update Settings', 'event_espresso' ),
389
+					'publishbox' => esc_html__('Update Settings', 'event_espresso'),
390 390
 				),
391 391
 				'help_tabs'     => array(
392 392
 					'default_settings_help_tab'        => array(
393
-						'title'    => esc_html__( 'Default Event Settings', 'event_espresso' ),
393
+						'title'    => esc_html__('Default Event Settings', 'event_espresso'),
394 394
 						'filename' => 'events_default_settings',
395 395
 					),
396 396
 					'default_settings_status_help_tab' => array(
397
-						'title'    => esc_html__( 'Default Registration Status', 'event_espresso' ),
397
+						'title'    => esc_html__('Default Registration Status', 'event_espresso'),
398 398
 						'filename' => 'events_default_settings_status',
399 399
 					),
400 400
 				),
401
-				'help_tour'     => array( 'Event_Default_Settings_Help_Tour' ),
401
+				'help_tour'     => array('Event_Default_Settings_Help_Tour'),
402 402
 				'require_nonce' => false,
403 403
 			),
404 404
 			//template settings
405 405
 			'template_settings'      => array(
406 406
 				'nav'           => array(
407
-					'label' => esc_html__( 'Templates', 'event_espresso' ),
407
+					'label' => esc_html__('Templates', 'event_espresso'),
408 408
 					'order' => 30,
409 409
 				),
410 410
 				'metaboxes'     => $this->_default_espresso_metaboxes,
411 411
 				'help_tabs'     => array(
412 412
 					'general_settings_templates_help_tab' => array(
413
-						'title'    => esc_html__( 'Templates', 'event_espresso' ),
413
+						'title'    => esc_html__('Templates', 'event_espresso'),
414 414
 						'filename' => 'general_settings_templates',
415 415
 					),
416 416
 				),
417
-				'help_tour'     => array( 'Templates_Help_Tour' ),
417
+				'help_tour'     => array('Templates_Help_Tour'),
418 418
 				'require_nonce' => false,
419 419
 			),
420 420
 			//event category stuff
421 421
 			'add_category'           => array(
422 422
 				'nav'           => array(
423
-					'label'      => esc_html__( 'Add Category', 'event_espresso' ),
423
+					'label'      => esc_html__('Add Category', 'event_espresso'),
424 424
 					'order'      => 15,
425 425
 					'persistent' => false,
426 426
 				),
427 427
 				'help_tabs'     => array(
428 428
 					'add_category_help_tab' => array(
429
-						'title'    => esc_html__( 'Add New Event Category', 'event_espresso' ),
429
+						'title'    => esc_html__('Add New Event Category', 'event_espresso'),
430 430
 						'filename' => 'events_add_category',
431 431
 					),
432 432
 				),
433
-				'help_tour'     => array( 'Event_Add_Category_Help_Tour' ),
434
-				'metaboxes'     => array( '_publish_post_box' ),
433
+				'help_tour'     => array('Event_Add_Category_Help_Tour'),
434
+				'metaboxes'     => array('_publish_post_box'),
435 435
 				'require_nonce' => false,
436 436
 			),
437 437
 			'edit_category'          => array(
438 438
 				'nav'           => array(
439
-					'label'      => esc_html__( 'Edit Category', 'event_espresso' ),
439
+					'label'      => esc_html__('Edit Category', 'event_espresso'),
440 440
 					'order'      => 15,
441 441
 					'persistent' => false,
442
-					'url'        => isset( $this->_req_data['EVT_CAT_ID'] )
442
+					'url'        => isset($this->_req_data['EVT_CAT_ID'])
443 443
 						? add_query_arg(
444
-							array( 'EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ),
444
+							array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']),
445 445
 							$this->_current_page_view_url
446 446
 						)
447 447
 						: $this->_admin_base_url,
448 448
 				),
449 449
 				'help_tabs'     => array(
450 450
 					'edit_category_help_tab' => array(
451
-						'title'    => esc_html__( 'Edit Event Category', 'event_espresso' ),
451
+						'title'    => esc_html__('Edit Event Category', 'event_espresso'),
452 452
 						'filename' => 'events_edit_category',
453 453
 					),
454 454
 				),
455 455
 				/*'help_tour' => array('Event_Edit_Category_Help_Tour'),*/
456
-				'metaboxes'     => array( '_publish_post_box' ),
456
+				'metaboxes'     => array('_publish_post_box'),
457 457
 				'require_nonce' => false,
458 458
 			),
459 459
 			'category_list'          => array(
460 460
 				'nav'           => array(
461
-					'label' => esc_html__( 'Categories', 'event_espresso' ),
461
+					'label' => esc_html__('Categories', 'event_espresso'),
462 462
 					'order' => 20,
463 463
 				),
464 464
 				'list_table'    => 'Event_Categories_Admin_List_Table',
465 465
 				'help_tabs'     => array(
466 466
 					'events_categories_help_tab'                       => array(
467
-						'title'    => esc_html__( 'Event Categories', 'event_espresso' ),
467
+						'title'    => esc_html__('Event Categories', 'event_espresso'),
468 468
 						'filename' => 'events_categories',
469 469
 					),
470 470
 					'events_categories_table_column_headings_help_tab' => array(
471
-						'title'    => esc_html__( 'Event Categories Table Column Headings', 'event_espresso' ),
471
+						'title'    => esc_html__('Event Categories Table Column Headings', 'event_espresso'),
472 472
 						'filename' => 'events_categories_table_column_headings',
473 473
 					),
474 474
 					'events_categories_view_help_tab'                  => array(
475
-						'title'    => esc_html__( 'Event Categories Views', 'event_espresso' ),
475
+						'title'    => esc_html__('Event Categories Views', 'event_espresso'),
476 476
 						'filename' => 'events_categories_views',
477 477
 					),
478 478
 					'events_categories_other_help_tab'                 => array(
479
-						'title'    => esc_html__( 'Event Categories Other', 'event_espresso' ),
479
+						'title'    => esc_html__('Event Categories Other', 'event_espresso'),
480 480
 						'filename' => 'events_categories_other',
481 481
 					),
482 482
 				),
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 	protected function _add_screen_options_category_list() {
507 507
 		$page_title = $this->_admin_page_title;
508
-		$this->_admin_page_title = esc_html__( 'Categories', 'event_espresso' );
508
+		$this->_admin_page_title = esc_html__('Categories', 'event_espresso');
509 509
 		$this->_per_page_screen_option();
510 510
 		$this->_admin_page_title = $page_title;
511 511
 	}
@@ -521,20 +521,20 @@  discard block
 block discarded – undo
521 521
 	public function load_scripts_styles() {
522 522
 		wp_register_style(
523 523
 			'events-admin-css',
524
-			EVENTS_ASSETS_URL . 'events-admin-page.css',
524
+			EVENTS_ASSETS_URL.'events-admin-page.css',
525 525
 			array(),
526 526
 			EVENT_ESPRESSO_VERSION
527 527
 		);
528
-		wp_register_style( 'ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
529
-		wp_enqueue_style( 'events-admin-css' );
530
-		wp_enqueue_style( 'ee-cat-admin' );
528
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
529
+		wp_enqueue_style('events-admin-css');
530
+		wp_enqueue_style('ee-cat-admin');
531 531
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
532 532
 		//registers for all views
533 533
 		//scripts
534 534
 		wp_register_script(
535 535
 			'event_editor_js',
536
-			EVENTS_ASSETS_URL . 'event_editor.js',
537
-			array( 'ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon' ),
536
+			EVENTS_ASSETS_URL.'event_editor.js',
537
+			array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'),
538 538
 			EVENT_ESPRESSO_VERSION,
539 539
 			true
540 540
 		);
@@ -560,22 +560,22 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function load_scripts_styles_edit() {
562 562
 		//styles
563
-		wp_enqueue_style( 'espresso-ui-theme' );
563
+		wp_enqueue_style('espresso-ui-theme');
564 564
 		wp_register_style(
565 565
 			'event-editor-css',
566
-			EVENTS_ASSETS_URL . 'event-editor.css',
567
-			array( 'ee-admin-css' ),
566
+			EVENTS_ASSETS_URL.'event-editor.css',
567
+			array('ee-admin-css'),
568 568
 			EVENT_ESPRESSO_VERSION
569 569
 		);
570
-		wp_enqueue_style( 'event-editor-css' );
570
+		wp_enqueue_style('event-editor-css');
571 571
 		//scripts
572 572
 		wp_register_script(
573 573
 			'event-datetime-metabox',
574
-			EVENTS_ASSETS_URL . 'event-datetime-metabox.js',
575
-			array( 'event_editor_js', 'ee-datepicker' ),
574
+			EVENTS_ASSETS_URL.'event-datetime-metabox.js',
575
+			array('event_editor_js', 'ee-datepicker'),
576 576
 			EVENT_ESPRESSO_VERSION
577 577
 		);
578
-		wp_enqueue_script( 'event-datetime-metabox' );
578
+		wp_enqueue_script('event-datetime-metabox');
579 579
 	}
580 580
 
581 581
 
@@ -595,10 +595,10 @@  discard block
 block discarded – undo
595 595
 		$this->_views = array(
596 596
 			'all' => array(
597 597
 				'slug'        => 'all',
598
-				'label'       => esc_html__( 'All', 'event_espresso' ),
598
+				'label'       => esc_html__('All', 'event_espresso'),
599 599
 				'count'       => 0,
600 600
 				'bulk_action' => array(
601
-					'delete_categories' => esc_html__( 'Delete Permanently', 'event_espresso' ),
601
+					'delete_categories' => esc_html__('Delete Permanently', 'event_espresso'),
602 602
 				),
603 603
 			),
604 604
 		);
@@ -634,14 +634,14 @@  discard block
 block discarded – undo
634 634
 	 * @access public
635 635
 	 * @return void
636 636
 	 */
637
-	public function verify_event_edit( $event = null ) {
637
+	public function verify_event_edit($event = null) {
638 638
 		// no event?
639
-		if ( empty( $event ) ) {
639
+		if (empty($event)) {
640 640
 			// set event
641 641
 			$event = $this->_cpt_model_obj;
642 642
 		}
643 643
 		// STILL no event?
644
-		if ( empty ( $event ) ) {
644
+		if (empty ($event)) {
645 645
 			return;
646 646
 		}
647 647
 		$orig_status = $event->status();
@@ -655,32 +655,32 @@  discard block
 block discarded – undo
655 655
 			return;
656 656
 		}
657 657
 		//made it here so it IS active... next check that any of the tickets are sold.
658
-		if ( $event->is_sold_out( true ) ) {
659
-			if ( $orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status ) {
658
+		if ($event->is_sold_out(true)) {
659
+			if ($orig_status !== EEM_Event::sold_out && $event->status() !== $orig_status) {
660 660
 				EE_Error::add_attention(
661 661
 					sprintf(
662 662
 						esc_html__(
663 663
 							'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.',
664 664
 							'event_espresso'
665 665
 						),
666
-						EEH_Template::pretty_status( EEM_Event::sold_out, false, 'sentence' )
666
+						EEH_Template::pretty_status(EEM_Event::sold_out, false, 'sentence')
667 667
 					)
668 668
 				);
669 669
 			}
670 670
 			return;
671
-		} else if ( $orig_status === EEM_Event::sold_out ) {
671
+		} else if ($orig_status === EEM_Event::sold_out) {
672 672
 			EE_Error::add_attention(
673 673
 				sprintf(
674 674
 					esc_html__(
675 675
 						'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
676 676
 						'event_espresso'
677 677
 					),
678
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
678
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
679 679
 				)
680 680
 			);
681 681
 		}
682 682
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
683
-		if ( ! $event->tickets_on_sale() ) {
683
+		if ( ! $event->tickets_on_sale()) {
684 684
 			return;
685 685
 		}
686 686
 		//made it here so show warning
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	 */
699 699
 	protected function _edit_event_warning() {
700 700
 		// we don't want to add warnings during these requests
701
-		if ( isset( $this->_req_data['action'] ) && $this->_req_data['action'] === 'editpost' ) {
701
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] === 'editpost') {
702 702
 			return;
703 703
 		}
704 704
 		EE_Error::add_attention(
@@ -715,29 +715,29 @@  discard block
 block discarded – undo
715 715
 		$this->_views = array(
716 716
 			'all'   => array(
717 717
 				'slug'        => 'all',
718
-				'label'       => esc_html__( 'View All Events', 'event_espresso' ),
718
+				'label'       => esc_html__('View All Events', 'event_espresso'),
719 719
 				'count'       => 0,
720 720
 				'bulk_action' => array(
721
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
721
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
722 722
 				),
723 723
 			),
724 724
 			'draft' => array(
725 725
 				'slug'        => 'draft',
726
-				'label'       => esc_html__( 'Draft', 'event_espresso' ),
726
+				'label'       => esc_html__('Draft', 'event_espresso'),
727 727
 				'count'       => 0,
728 728
 				'bulk_action' => array(
729
-					'trash_events' => esc_html__( 'Move to Trash', 'event_espresso' ),
729
+					'trash_events' => esc_html__('Move to Trash', 'event_espresso'),
730 730
 				),
731 731
 			),
732 732
 		);
733
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
733
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
734 734
 			$this->_views['trash'] = array(
735 735
 				'slug'        => 'trash',
736
-				'label'       => esc_html__( 'Trash', 'event_espresso' ),
736
+				'label'       => esc_html__('Trash', 'event_espresso'),
737 737
 				'count'       => 0,
738 738
 				'bulk_action' => array(
739
-					'restore_events' => esc_html__( 'Restore From Trash', 'event_espresso' ),
740
-					'delete_events'  => esc_html__( 'Delete Permanently', 'event_espresso' ),
739
+					'restore_events' => esc_html__('Restore From Trash', 'event_espresso'),
740
+					'delete_events'  => esc_html__('Delete Permanently', 'event_espresso'),
741 741
 				),
742 742
 			);
743 743
 		}
@@ -752,50 +752,50 @@  discard block
 block discarded – undo
752 752
 		$items = array(
753 753
 			'view_details'   => array(
754 754
 				'class' => 'dashicons dashicons-search',
755
-				'desc'  => esc_html__( 'View Event', 'event_espresso' ),
755
+				'desc'  => esc_html__('View Event', 'event_espresso'),
756 756
 			),
757 757
 			'edit_event'     => array(
758 758
 				'class' => 'ee-icon ee-icon-calendar-edit',
759
-				'desc'  => esc_html__( 'Edit Event Details', 'event_espresso' ),
759
+				'desc'  => esc_html__('Edit Event Details', 'event_espresso'),
760 760
 			),
761 761
 			'view_attendees' => array(
762 762
 				'class' => 'dashicons dashicons-groups',
763
-				'desc'  => esc_html__( 'View Registrations for Event', 'event_espresso' ),
763
+				'desc'  => esc_html__('View Registrations for Event', 'event_espresso'),
764 764
 			),
765 765
 		);
766
-		$items = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
766
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
767 767
 		$statuses = array(
768 768
 			'sold_out_status'  => array(
769
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
770
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::sold_out, false, 'sentence' ),
769
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
770
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::sold_out, false, 'sentence'),
771 771
 			),
772 772
 			'active_status'    => array(
773
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
774
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::active, false, 'sentence' ),
773
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
774
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::active, false, 'sentence'),
775 775
 			),
776 776
 			'upcoming_status'  => array(
777
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
778
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::upcoming, false, 'sentence' ),
777
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
778
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::upcoming, false, 'sentence'),
779 779
 			),
780 780
 			'postponed_status' => array(
781
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
782
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::postponed, false, 'sentence' ),
781
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
782
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::postponed, false, 'sentence'),
783 783
 			),
784 784
 			'cancelled_status' => array(
785
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
786
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::cancelled, false, 'sentence' ),
785
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
786
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::cancelled, false, 'sentence'),
787 787
 			),
788 788
 			'expired_status'   => array(
789
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
790
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::expired, false, 'sentence' ),
789
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
790
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::expired, false, 'sentence'),
791 791
 			),
792 792
 			'inactive_status'  => array(
793
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
794
-				'desc'  => EEH_Template::pretty_status( EE_Datetime::inactive, false, 'sentence' ),
793
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
794
+				'desc'  => EEH_Template::pretty_status(EE_Datetime::inactive, false, 'sentence'),
795 795
 			),
796 796
 		);
797
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
798
-		return array_merge( $items, $statuses );
797
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
798
+		return array_merge($items, $statuses);
799 799
 	}
800 800
 
801 801
 
@@ -806,8 +806,8 @@  discard block
 block discarded – undo
806 806
 	 * @return EEM_Event
807 807
 	 */
808 808
 	private function _event_model() {
809
-		if ( ! $this->_event_model instanceof EEM_Event ) {
810
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
809
+		if ( ! $this->_event_model instanceof EEM_Event) {
810
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
811 811
 		}
812 812
 		return $this->_event_model;
813 813
 	}
@@ -824,12 +824,12 @@  discard block
 block discarded – undo
824 824
 	 * @param  string $new_slug  what the slug is
825 825
 	 * @return string            The new html string for the permalink area
826 826
 	 */
827
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
827
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
828 828
 		//make sure this is only when editing
829
-		if ( ! empty( $id ) ) {
830
-			$post = get_post( $id );
829
+		if ( ! empty($id)) {
830
+			$post = get_post($id);
831 831
 			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'
832
-			           . esc_html__( 'Shortcode', 'event_espresso' )
832
+			           . esc_html__('Shortcode', 'event_espresso')
833 833
 			           . '</a> ';
834 834
 			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='
835 835
 			           . $post->ID
@@ -848,14 +848,14 @@  discard block
 block discarded – undo
848 848
 	 * @return void
849 849
 	 */
850 850
 	protected function _events_overview_list_table() {
851
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
851
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
852 852
 		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(
853
-			get_post_type_archive_link( 'espresso_events' ),
854
-			esc_html__( "View Event Archive Page", "event_espresso" ),
853
+			get_post_type_archive_link('espresso_events'),
854
+			esc_html__("View Event Archive Page", "event_espresso"),
855 855
 			'button'
856 856
 		);
857
-		$this->_template_args['after_list_table'] .= $this->_display_legend( $this->_event_legend_items() );
858
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
857
+		$this->_template_args['after_list_table'] .= $this->_display_legend($this->_event_legend_items());
858
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
859 859
 				'create_new',
860 860
 				'add',
861 861
 				array(),
@@ -881,48 +881,48 @@  discard block
 block discarded – undo
881 881
 	 * @param string $post_id
882 882
 	 * @param object $post
883 883
 	 */
884
-	protected function _insert_update_cpt_item( $post_id, $post ) {
885
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
884
+	protected function _insert_update_cpt_item($post_id, $post) {
885
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
886 886
 			//get out we're not processing an event save.
887 887
 			return;
888 888
 		}
889 889
 		$event_values = array(
890
-			'EVT_display_desc'                => ! empty( $this->_req_data['display_desc'] ) ? 1 : 0,
891
-			'EVT_display_ticket_selector'     => ! empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
890
+			'EVT_display_desc'                => ! empty($this->_req_data['display_desc']) ? 1 : 0,
891
+			'EVT_display_ticket_selector'     => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
892 892
 			'EVT_additional_limit'            => min(
893
-				apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
894
-				! empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : null
893
+				apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
894
+				! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : null
895 895
 			),
896
-			'EVT_default_registration_status' => ! empty( $this->_req_data['EVT_default_registration_status'] )
896
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status'])
897 897
 				? $this->_req_data['EVT_default_registration_status']
898 898
 				: EE_Registry::instance()->CFG->registration->default_STS_ID,
899
-			'EVT_member_only'                 => ! empty( $this->_req_data['member_only'] ) ? 1 : 0,
900
-			'EVT_allow_overflow'              => ! empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
901
-			'EVT_timezone_string'             => ! empty( $this->_req_data['timezone_string'] )
899
+			'EVT_member_only'                 => ! empty($this->_req_data['member_only']) ? 1 : 0,
900
+			'EVT_allow_overflow'              => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
901
+			'EVT_timezone_string'             => ! empty($this->_req_data['timezone_string'])
902 902
 				? $this->_req_data['timezone_string'] : null,
903
-			'EVT_external_URL'                => ! empty( $this->_req_data['externalURL'] )
903
+			'EVT_external_URL'                => ! empty($this->_req_data['externalURL'])
904 904
 				? $this->_req_data['externalURL'] : null,
905
-			'EVT_phone'                       => ! empty( $this->_req_data['event_phone'] )
905
+			'EVT_phone'                       => ! empty($this->_req_data['event_phone'])
906 906
 				? $this->_req_data['event_phone'] : null,
907 907
 		);
908 908
 		//update event
909
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
909
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
910 910
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
911
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
912
-		$event = $this->_event_model()->get_one( array( $get_one_where ) );
911
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
912
+		$event = $this->_event_model()->get_one(array($get_one_where));
913 913
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
914 914
 		$event_update_callbacks = apply_filters(
915 915
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
916
-			array( array( $this, '_default_venue_update' ), array( $this, '_default_tickets_update' ) )
916
+			array(array($this, '_default_venue_update'), array($this, '_default_tickets_update'))
917 917
 		);
918 918
 		$att_success = true;
919
-		foreach ( $event_update_callbacks as $e_callback ) {
920
-			$_succ = call_user_func_array( $e_callback, array( $event, $this->_req_data ) );
919
+		foreach ($event_update_callbacks as $e_callback) {
920
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
921 921
 			$att_success = ! $att_success ? $att_success
922 922
 				: $_succ; //if ANY of these updates fail then we want the appropriate global error message
923 923
 		}
924 924
 		//any errors?
925
-		if ( $success && false === $att_success ) {
925
+		if ($success && false === $att_success) {
926 926
 			EE_Error::add_error(
927 927
 				esc_html__(
928 928
 					'Event Details saved successfully but something went wrong with saving attachments.',
@@ -932,9 +932,9 @@  discard block
 block discarded – undo
932 932
 				__FUNCTION__,
933 933
 				__LINE__
934 934
 			);
935
-		} else if ( $success === false ) {
935
+		} else if ($success === false) {
936 936
 			EE_Error::add_error(
937
-				esc_html__( 'Event Details did not save successfully.', 'event_espresso' ),
937
+				esc_html__('Event Details did not save successfully.', 'event_espresso'),
938 938
 				__FILE__,
939 939
 				__FUNCTION__,
940 940
 				__LINE__
@@ -949,14 +949,14 @@  discard block
 block discarded – undo
949 949
 	 * @param int $post_id
950 950
 	 * @param int $revision_id
951 951
 	 */
952
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
952
+	protected function _restore_cpt_item($post_id, $revision_id) {
953 953
 		//copy existing event meta to new post
954
-		$post_evt = $this->_event_model()->get_one_by_ID( $post_id );
955
-		if ( $post_evt instanceof EE_Event ) {
954
+		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
955
+		if ($post_evt instanceof EE_Event) {
956 956
 			//meta revision restore
957
-			$post_evt->restore_revision( $revision_id );
957
+			$post_evt->restore_revision($revision_id);
958 958
 			//related objs restore
959
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
959
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
960 960
 		}
961 961
 	}
962 962
 
@@ -969,49 +969,49 @@  discard block
 block discarded – undo
969 969
 	 * @param  array     $data   The request data from the form
970 970
 	 * @return bool           Success or fail.
971 971
 	 */
972
-	protected function _default_venue_update( \EE_Event $evtobj, $data ) {
973
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
974
-		$venue_model = EE_Registry::instance()->load_model( 'Venue' );
972
+	protected function _default_venue_update(\EE_Event $evtobj, $data) {
973
+		require_once(EE_MODELS.'EEM_Venue.model.php');
974
+		$venue_model = EE_Registry::instance()->load_model('Venue');
975 975
 		$rows_affected = null;
976
-		$venue_id = ! empty( $data['venue_id'] ) ? $data['venue_id'] : null;
976
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null;
977 977
 		// very important.  If we don't have a venue name...
978 978
 		// then we'll get out because not necessary to create empty venue
979
-		if ( empty( $data['venue_title'] ) ) {
979
+		if (empty($data['venue_title'])) {
980 980
 			return false;
981 981
 		}
982 982
 		$venue_array = array(
983
-			'VNU_wp_user'         => $evtobj->get( 'EVT_wp_user' ),
984
-			'VNU_name'            => ! empty( $data['venue_title'] ) ? $data['venue_title'] : null,
985
-			'VNU_desc'            => ! empty( $data['venue_description'] ) ? $data['venue_description'] : null,
986
-			'VNU_identifier'      => ! empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : null,
987
-			'VNU_short_desc'      => ! empty( $data['venue_short_description'] ) ? $data['venue_short_description']
983
+			'VNU_wp_user'         => $evtobj->get('EVT_wp_user'),
984
+			'VNU_name'            => ! empty($data['venue_title']) ? $data['venue_title'] : null,
985
+			'VNU_desc'            => ! empty($data['venue_description']) ? $data['venue_description'] : null,
986
+			'VNU_identifier'      => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : null,
987
+			'VNU_short_desc'      => ! empty($data['venue_short_description']) ? $data['venue_short_description']
988 988
 				: null,
989
-			'VNU_address'         => ! empty( $data['address'] ) ? $data['address'] : null,
990
-			'VNU_address2'        => ! empty( $data['address2'] ) ? $data['address2'] : null,
991
-			'VNU_city'            => ! empty( $data['city'] ) ? $data['city'] : null,
992
-			'STA_ID'              => ! empty( $data['state'] ) ? $data['state'] : null,
993
-			'CNT_ISO'             => ! empty( $data['countries'] ) ? $data['countries'] : null,
994
-			'VNU_zip'             => ! empty( $data['zip'] ) ? $data['zip'] : null,
995
-			'VNU_phone'           => ! empty( $data['venue_phone'] ) ? $data['venue_phone'] : null,
996
-			'VNU_capacity'        => ! empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : null,
997
-			'VNU_url'             => ! empty( $data['venue_url'] ) ? $data['venue_url'] : null,
998
-			'VNU_virtual_phone'   => ! empty( $data['virtual_phone'] ) ? $data['virtual_phone'] : null,
999
-			'VNU_virtual_url'     => ! empty( $data['virtual_url'] ) ? $data['virtual_url'] : null,
1000
-			'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
989
+			'VNU_address'         => ! empty($data['address']) ? $data['address'] : null,
990
+			'VNU_address2'        => ! empty($data['address2']) ? $data['address2'] : null,
991
+			'VNU_city'            => ! empty($data['city']) ? $data['city'] : null,
992
+			'STA_ID'              => ! empty($data['state']) ? $data['state'] : null,
993
+			'CNT_ISO'             => ! empty($data['countries']) ? $data['countries'] : null,
994
+			'VNU_zip'             => ! empty($data['zip']) ? $data['zip'] : null,
995
+			'VNU_phone'           => ! empty($data['venue_phone']) ? $data['venue_phone'] : null,
996
+			'VNU_capacity'        => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : null,
997
+			'VNU_url'             => ! empty($data['venue_url']) ? $data['venue_url'] : null,
998
+			'VNU_virtual_phone'   => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : null,
999
+			'VNU_virtual_url'     => ! empty($data['virtual_url']) ? $data['virtual_url'] : null,
1000
+			'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
1001 1001
 			'status'              => 'publish',
1002 1002
 		);
1003 1003
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
1004
-		if ( ! empty( $venue_id ) ) {
1005
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
1006
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
1004
+		if ( ! empty($venue_id)) {
1005
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
1006
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
1007 1007
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
1008
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1008
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1009 1009
 			return $rows_affected > 0 ? true : false;
1010 1010
 		} else {
1011 1011
 			//we insert the venue
1012
-			$venue_id = $venue_model->insert( $venue_array );
1013
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
1014
-			return ! empty( $venue_id ) ? true : false;
1012
+			$venue_id = $venue_model->insert($venue_array);
1013
+			$evtobj->_add_relation_to($venue_id, 'Venue');
1014
+			return ! empty($venue_id) ? true : false;
1015 1015
 		}
1016 1016
 		//when we have the ancestor come in it's already been handled by the revision save.
1017 1017
 	}
@@ -1025,51 +1025,51 @@  discard block
 block discarded – undo
1025 1025
 	 * @param  array    $data   The request data from the form
1026 1026
 	 * @return array
1027 1027
 	 */
1028
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
1028
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
1029 1029
 		$success = true;
1030 1030
 		$saved_dtt = null;
1031 1031
 		$saved_tickets = array();
1032
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1033
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
1032
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
1033
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
1034 1034
 			//trim all values to ensure any excess whitespace is removed.
1035
-			$dtt = array_map( 'trim', $dtt );
1036
-			$dtt['DTT_EVT_end'] = isset( $dtt['DTT_EVT_end'] ) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end']
1035
+			$dtt = array_map('trim', $dtt);
1036
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end']
1037 1037
 				: $dtt['DTT_EVT_start'];
1038 1038
 			$datetime_values = array(
1039
-				'DTT_ID'        => ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : null,
1039
+				'DTT_ID'        => ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : null,
1040 1040
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
1041 1041
 				'DTT_EVT_end'   => $dtt['DTT_EVT_end'],
1042
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
1042
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
1043 1043
 				'DTT_order'     => $row,
1044 1044
 			);
1045 1045
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
1046
-			if ( ! empty( $dtt['DTT_ID'] ) ) {
1046
+			if ( ! empty($dtt['DTT_ID'])) {
1047 1047
 				$DTM = EE_Registry::instance()
1048
-				                  ->load_model( 'Datetime', array( $evtobj->get_timezone() ) )
1049
-				                  ->get_one_by_ID( $dtt['DTT_ID'] );
1050
-				$DTM->set_date_format( $incoming_date_formats[0] );
1051
-				$DTM->set_time_format( $incoming_date_formats[1] );
1052
-				foreach ( $datetime_values as $field => $value ) {
1053
-					$DTM->set( $field, $value );
1048
+				                  ->load_model('Datetime', array($evtobj->get_timezone()))
1049
+				                  ->get_one_by_ID($dtt['DTT_ID']);
1050
+				$DTM->set_date_format($incoming_date_formats[0]);
1051
+				$DTM->set_time_format($incoming_date_formats[1]);
1052
+				foreach ($datetime_values as $field => $value) {
1053
+					$DTM->set($field, $value);
1054 1054
 				}
1055 1055
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
1056
-				$saved_dtts[ $DTM->ID() ] = $DTM;
1056
+				$saved_dtts[$DTM->ID()] = $DTM;
1057 1057
 			} else {
1058
-				$DTM = EE_Registry::instance()->load_class( 'Datetime', array( $datetime_values ), false, false );
1059
-				$DTM->set_date_format( $incoming_date_formats[0] );
1060
-				$DTM->set_time_format( $incoming_date_formats[1] );
1061
-				$DTM->set_timezone( $evtobj->get_timezone() );
1062
-				foreach ( $datetime_values as $field => $value ) {
1063
-					$DTM->set( $field, $value );
1058
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), false, false);
1059
+				$DTM->set_date_format($incoming_date_formats[0]);
1060
+				$DTM->set_time_format($incoming_date_formats[1]);
1061
+				$DTM->set_timezone($evtobj->get_timezone());
1062
+				foreach ($datetime_values as $field => $value) {
1063
+					$DTM->set($field, $value);
1064 1064
 				}
1065 1065
 			}
1066 1066
 			$DTM->save();
1067
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
1067
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
1068 1068
 			//load DTT helper
1069 1069
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1070
-			if ( $DTT->get_raw( 'DTT_EVT_start' ) > $DTT->get_raw( 'DTT_EVT_end' ) ) {
1071
-				$DTT->set( 'DTT_EVT_end', $DTT->get( 'DTT_EVT_start' ) );
1072
-				$DTT = EEH_DTT_Helper::date_time_add( $DTT, 'DTT_EVT_end', 'days' );
1070
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
1071
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
1072
+				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
1073 1073
 				$DTT->save();
1074 1074
 			}
1075 1075
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
@@ -1080,20 +1080,20 @@  discard block
 block discarded – undo
1080 1080
 		}
1081 1081
 		//no dtts get deleted so we don't do any of that logic here.
1082 1082
 		//update tickets next
1083
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode( ',', $data['ticket_IDs'] ) : array();
1084
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1085
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
1083
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1084
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1085
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1086 1086
 			$update_prices = false;
1087
-			$ticket_price = isset( $data['edit_prices'][ $row ][1]['PRC_amount'] )
1088
-				? $data['edit_prices'][ $row ][1]['PRC_amount'] : 0;
1087
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount'])
1088
+				? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1089 1089
 			// trim inputs to ensure any excess whitespace is removed.
1090
-			$tkt = array_map( 'trim', $tkt );
1091
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1090
+			$tkt = array_map('trim', $tkt);
1091
+			if (empty($tkt['TKT_start_date'])) {
1092 1092
 				//let's use now in the set timezone.
1093
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1094
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1093
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1094
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1095 1095
 			}
1096
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1096
+			if (empty($tkt['TKT_end_date'])) {
1097 1097
 				//use the start date of the first datetime
1098 1098
 				$dtt = $evtobj->first_datetime();
1099 1099
 				$tkt['TKT_end_date'] = $dtt->start_date_and_time(
@@ -1102,22 +1102,22 @@  discard block
 block discarded – undo
1102 1102
 				);
1103 1103
 			}
1104 1104
 			$TKT_values = array(
1105
-				'TKT_ID'          => ! empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : null,
1106
-				'TTM_ID'          => ! empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1107
-				'TKT_name'        => ! empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1108
-				'TKT_description' => ! empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1105
+				'TKT_ID'          => ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : null,
1106
+				'TTM_ID'          => ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1107
+				'TKT_name'        => ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1108
+				'TKT_description' => ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1109 1109
 				'TKT_start_date'  => $tkt['TKT_start_date'],
1110 1110
 				'TKT_end_date'    => $tkt['TKT_end_date'],
1111
-				'TKT_qty'         => ! isset( $tkt['TKT_qty'] ) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
-				'TKT_uses'        => ! isset( $tkt['TKT_uses'] ) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
-				'TKT_min'         => empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1114
-				'TKT_max'         => empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1111
+				'TKT_qty'         => ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1112
+				'TKT_uses'        => ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1113
+				'TKT_min'         => empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1114
+				'TKT_max'         => empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1115 1115
 				'TKT_row'         => $row,
1116
-				'TKT_order'       => isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1116
+				'TKT_order'       => isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1117 1117
 				'TKT_price'       => $ticket_price,
1118 1118
 			);
1119 1119
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1120
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1120
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1121 1121
 				$TKT_values['TKT_ID'] = 0;
1122 1122
 				$TKT_values['TKT_is_default'] = 0;
1123 1123
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1126,110 +1126,110 @@  discard block
 block discarded – undo
1126 1126
 			//if we have a TKT_ID then we need to get that existing TKT_obj and update it
1127 1127
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1128 1128
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1129
-			if ( ! empty( $tkt['TKT_ID'] ) ) {
1129
+			if ( ! empty($tkt['TKT_ID'])) {
1130 1130
 				$TKT = EE_Registry::instance()
1131
-						->load_model( 'Ticket', array( $evtobj->get_timezone() ) )
1132
-						->get_one_by_ID( $tkt['TKT_ID'] );
1133
-				if ( $TKT instanceof EE_Ticket ) {
1131
+						->load_model('Ticket', array($evtobj->get_timezone()))
1132
+						->get_one_by_ID($tkt['TKT_ID']);
1133
+				if ($TKT instanceof EE_Ticket) {
1134 1134
 					$ticket_sold = $TKT->count_related(
1135 1135
 						'Registration',
1136 1136
 						array(
1137 1137
 							array(
1138 1138
 								'STS_ID' => array(
1139 1139
 									'NOT IN',
1140
-									array( EEM_Registration::status_id_incomplete ),
1140
+									array(EEM_Registration::status_id_incomplete),
1141 1141
 								),
1142 1142
 							),
1143 1143
 						)
1144 1144
 					) > 0 ? true : false;
1145 1145
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1146
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' )
1146
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price')
1147 1147
 					                  && ! $TKT->get(
1148 1148
 						'TKT_deleted'
1149 1149
 					) ? true : false;
1150
-					$TKT->set_date_format( $incoming_date_formats[0] );
1151
-					$TKT->set_time_format( $incoming_date_formats[1] );
1150
+					$TKT->set_date_format($incoming_date_formats[0]);
1151
+					$TKT->set_time_format($incoming_date_formats[1]);
1152 1152
 					//set new values
1153
-					foreach ( $TKT_values as $field => $value ) {
1154
-						if ( $field == 'TKT_qty' ) {
1155
-							$TKT->set_qty( $value );
1153
+					foreach ($TKT_values as $field => $value) {
1154
+						if ($field == 'TKT_qty') {
1155
+							$TKT->set_qty($value);
1156 1156
 						} else {
1157
-							$TKT->set( $field, $value );
1157
+							$TKT->set($field, $value);
1158 1158
 						}
1159 1159
 					}
1160 1160
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1161
-					if ( $create_new_TKT ) {
1161
+					if ($create_new_TKT) {
1162 1162
 						//archive the old ticket first
1163
-						$TKT->set( 'TKT_deleted', 1 );
1163
+						$TKT->set('TKT_deleted', 1);
1164 1164
 						$TKT->save();
1165 1165
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1166
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1166
+						$saved_tickets[$TKT->ID()] = $TKT;
1167 1167
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1168 1168
 						$TKT = clone $TKT;
1169
-						$TKT->set( 'TKT_ID', 0 );
1170
-						$TKT->set( 'TKT_deleted', 0 );
1171
-						$TKT->set( 'TKT_price', $ticket_price );
1172
-						$TKT->set( 'TKT_sold', 0 );
1169
+						$TKT->set('TKT_ID', 0);
1170
+						$TKT->set('TKT_deleted', 0);
1171
+						$TKT->set('TKT_price', $ticket_price);
1172
+						$TKT->set('TKT_sold', 0);
1173 1173
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1174 1174
 						$update_prices = true;
1175 1175
 					}
1176 1176
 					//make sure price is set if it hasn't been already
1177
-					$TKT->set( 'TKT_price', $ticket_price );
1177
+					$TKT->set('TKT_price', $ticket_price);
1178 1178
 				}
1179 1179
 			} else {
1180 1180
 				//no TKT_id so a new TKT
1181 1181
 				$TKT_values['TKT_price'] = $ticket_price;
1182
-				$TKT = EE_Registry::instance()->load_class( 'Ticket', array( $TKT_values ), false, false );
1183
-				if ( $TKT instanceof EE_Ticket ) {
1182
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), false, false);
1183
+				if ($TKT instanceof EE_Ticket) {
1184 1184
 					//need to reset values to properly account for the date formats
1185
-					$TKT->set_date_format( $incoming_date_formats[0] );
1186
-					$TKT->set_time_format( $incoming_date_formats[1] );
1187
-					$TKT->set_timezone( $evtobj->get_timezone() );
1185
+					$TKT->set_date_format($incoming_date_formats[0]);
1186
+					$TKT->set_time_format($incoming_date_formats[1]);
1187
+					$TKT->set_timezone($evtobj->get_timezone());
1188 1188
 					//set new values
1189
-					foreach ( $TKT_values as $field => $value ) {
1190
-						if ( $field == 'TKT_qty' ) {
1191
-							$TKT->set_qty( $value );
1189
+					foreach ($TKT_values as $field => $value) {
1190
+						if ($field == 'TKT_qty') {
1191
+							$TKT->set_qty($value);
1192 1192
 						} else {
1193
-							$TKT->set( $field, $value );
1193
+							$TKT->set($field, $value);
1194 1194
 						}
1195 1195
 					}
1196 1196
 					$update_prices = true;
1197 1197
 				}
1198 1198
 			}
1199 1199
 			// cap ticket qty by datetime reg limits
1200
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1200
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1201 1201
 			//update ticket.
1202 1202
 			$TKT->save();
1203 1203
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1204
-			if ( $TKT->get_raw( 'TKT_start_date' ) > $TKT->get_raw( 'TKT_end_date' ) ) {
1205
-				$TKT->set( 'TKT_end_date', $TKT->get( 'TKT_start_date' ) );
1206
-				$TKT = EEH_DTT_Helper::date_time_add( $TKT, 'TKT_end_date', 'days' );
1204
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1205
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1206
+				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1207 1207
 				$TKT->save();
1208 1208
 			}
1209 1209
 			//initially let's add the ticket to the dtt
1210
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1211
-			$saved_tickets[ $TKT->ID() ] = $TKT;
1210
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1211
+			$saved_tickets[$TKT->ID()] = $TKT;
1212 1212
 			//add prices to ticket
1213
-			$this->_add_prices_to_ticket( $data['edit_prices'][ $row ], $TKT, $update_prices );
1213
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1214 1214
 		}
1215 1215
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1216
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1218
-		foreach ( $tickets_removed as $id ) {
1219
-			$id = absint( $id );
1216
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1217
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1218
+		foreach ($tickets_removed as $id) {
1219
+			$id = absint($id);
1220 1220
 			//get the ticket for this id
1221
-			$tkt_to_remove = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $id );
1221
+			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
1222 1222
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1223
-			$dtts = $tkt_to_remove->get_many_related( 'Datetime' );
1224
-			foreach ( $dtts as $dtt ) {
1225
-				$tkt_to_remove->_remove_relation_to( $dtt, 'Datetime' );
1223
+			$dtts = $tkt_to_remove->get_many_related('Datetime');
1224
+			foreach ($dtts as $dtt) {
1225
+				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1226 1226
 			}
1227 1227
 			//need to do the same for prices (except these prices can also be deleted because again, tickets can only be trashed if they don't have any TKTs sold (otherwise they are just archived))
1228
-			$tkt_to_remove->delete_related_permanently( 'Price' );
1228
+			$tkt_to_remove->delete_related_permanently('Price');
1229 1229
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1230 1230
 			$tkt_to_remove->delete_permanently();
1231 1231
 		}
1232
-		return array( $saved_dtt, $saved_tickets );
1232
+		return array($saved_dtt, $saved_tickets);
1233 1233
 	}
1234 1234
 
1235 1235
 
@@ -1246,29 +1246,29 @@  discard block
 block discarded – undo
1246 1246
 	 * @param bool      $new_prices Whether attach existing incoming prices or create new ones.
1247 1247
 	 * @return  void
1248 1248
 	 */
1249
-	private function _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = false ) {
1250
-		foreach ( $prices as $row => $prc ) {
1249
+	private function _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = false) {
1250
+		foreach ($prices as $row => $prc) {
1251 1251
 			$PRC_values = array(
1252
-				'PRC_ID'         => ! empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : null,
1253
-				'PRT_ID'         => ! empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : null,
1254
-				'PRC_amount'     => ! empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1255
-				'PRC_name'       => ! empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1256
-				'PRC_desc'       => ! empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1252
+				'PRC_ID'         => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : null,
1253
+				'PRT_ID'         => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : null,
1254
+				'PRC_amount'     => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1255
+				'PRC_name'       => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1256
+				'PRC_desc'       => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1257 1257
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1258 1258
 				'PRC_order'      => $row,
1259 1259
 			);
1260
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1260
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1261 1261
 				$PRC_values['PRC_ID'] = 0;
1262
-				$PRC = EE_Registry::instance()->load_class( 'Price', array( $PRC_values ), false, false );
1262
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), false, false);
1263 1263
 			} else {
1264
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1264
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1265 1265
 				//update this price with new values
1266
-				foreach ( $PRC_values as $field => $newprc ) {
1267
-					$PRC->set( $field, $newprc );
1266
+				foreach ($PRC_values as $field => $newprc) {
1267
+					$PRC->set($field, $newprc);
1268 1268
 				}
1269 1269
 				$PRC->save();
1270 1270
 			}
1271
-			$ticket->_add_relation_to( $PRC, 'Price' );
1271
+			$ticket->_add_relation_to($PRC, 'Price');
1272 1272
 		}
1273 1273
 	}
1274 1274
 
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
 	private function _generate_publish_box_extra_content() {
1301 1301
 		//load formatter helper
1302 1302
 		//args for getting related registrations
1303
-		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1303
+		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1304 1304
 		$not_approved_query_args = array(
1305 1305
 			array(
1306 1306
 				'REG_deleted' => 0,
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1372 1372
 		// load template
1373 1373
 		EEH_Template::display_template(
1374
-			EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php',
1374
+			EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php',
1375 1375
 			$publish_box_extra_args
1376 1376
 		);
1377 1377
 	}
@@ -1405,16 +1405,16 @@  discard block
 block discarded – undo
1405 1405
 		$this->verify_cpt_object();
1406 1406
 		add_meta_box(
1407 1407
 			'espresso_event_editor_tickets',
1408
-			esc_html__( 'Event Datetime & Ticket', 'event_espresso' ),
1409
-			array( $this, 'ticket_metabox' ),
1408
+			esc_html__('Event Datetime & Ticket', 'event_espresso'),
1409
+			array($this, 'ticket_metabox'),
1410 1410
 			$this->page_slug,
1411 1411
 			'normal',
1412 1412
 			'high'
1413 1413
 		);
1414 1414
 		add_meta_box(
1415 1415
 			'espresso_event_editor_event_options',
1416
-			esc_html__( 'Event Registration Options', 'event_espresso' ),
1417
-			array( $this, 'registration_options_meta_box' ),
1416
+			esc_html__('Event Registration Options', 'event_espresso'),
1417
+			array($this, 'registration_options_meta_box'),
1418 1418
 			$this->page_slug,
1419 1419
 			'side',
1420 1420
 			'default'
@@ -1442,65 +1442,65 @@  discard block
 block discarded – undo
1442 1442
 			'trash_icon'               => 'ee-lock-icon',
1443 1443
 			'disabled'                 => '',
1444 1444
 		);
1445
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : null;
1446
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1445
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : null;
1446
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1447 1447
 		/**
1448 1448
 		 * 1. Start with retrieving Datetimes
1449 1449
 		 * 2. Fore each datetime get related tickets
1450 1450
 		 * 3. For each ticket get related prices
1451 1451
 		 */
1452
-		$times = EE_Registry::instance()->load_model( 'Datetime' )->get_all_event_dates( $event_id );
1452
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1453 1453
 		/** @type EE_Datetime $first_datetime */
1454
-		$first_datetime = reset( $times );
1454
+		$first_datetime = reset($times);
1455 1455
 		//do we get related tickets?
1456
-		if ( $first_datetime instanceof EE_Datetime
1456
+		if ($first_datetime instanceof EE_Datetime
1457 1457
 		     && $first_datetime->ID() !== 0
1458 1458
 		) {
1459
-			$existing_datetime_ids[] = $first_datetime->get( 'DTT_ID' );
1459
+			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1460 1460
 			$template_args['time'] = $first_datetime;
1461 1461
 			$related_tickets = $first_datetime->tickets(
1462 1462
 				array(
1463
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1463
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1464 1464
 					'default_where_conditions' => 'none',
1465 1465
 				)
1466 1466
 			);
1467
-			if ( ! empty( $related_tickets ) ) {
1468
-				$template_args['total_ticket_rows'] = count( $related_tickets );
1467
+			if ( ! empty($related_tickets)) {
1468
+				$template_args['total_ticket_rows'] = count($related_tickets);
1469 1469
 				$row = 0;
1470
-				foreach ( $related_tickets as $ticket ) {
1471
-					$existing_ticket_ids[] = $ticket->get( 'TKT_ID' );
1472
-					$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket, false, $row );
1470
+				foreach ($related_tickets as $ticket) {
1471
+					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1472
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, false, $row);
1473 1473
 					$row++;
1474 1474
 				}
1475 1475
 			} else {
1476 1476
 				$template_args['total_ticket_rows'] = 1;
1477 1477
 				/** @type EE_Ticket $ticket */
1478
-				$ticket = EE_Registry::instance()->load_model( 'Ticket' )->create_default_object();
1479
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1478
+				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1479
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1480 1480
 			}
1481 1481
 		} else {
1482 1482
 			$template_args['time'] = $times[0];
1483 1483
 			/** @type EE_Ticket $ticket */
1484
-			$ticket = EE_Registry::instance()->load_model( 'Ticket' )->get_all_default_tickets();
1485
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1484
+			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1485
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1486 1486
 			// NOTE: we're just sending the first default row
1487 1487
 			// (decaf can't manage default tickets so this should be sufficient);
1488 1488
 		}
1489 1489
 		$template_args['event_datetime_help_link'] = $this->_get_help_tab_link(
1490 1490
 			'event_editor_event_datetimes_help_tab'
1491 1491
 		);
1492
-		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link( 'ticket_options_info' );
1493
-		$template_args['existing_datetime_ids'] = implode( ',', $existing_datetime_ids );
1494
-		$template_args['existing_ticket_ids'] = implode( ',', $existing_ticket_ids );
1492
+		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1493
+		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1494
+		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1495 1495
 		$template_args['ticket_js_structure'] = $this->_get_ticket_row(
1496
-			EE_Registry::instance()->load_model( 'Ticket' )->create_default_object(),
1496
+			EE_Registry::instance()->load_model('Ticket')->create_default_object(),
1497 1497
 			true
1498 1498
 		);
1499 1499
 		$template = apply_filters(
1500 1500
 			'FHEE__Events_Admin_Page__ticket_metabox__template',
1501
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php'
1501
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php'
1502 1502
 		);
1503
-		EEH_Template::display_template( $template, $template_args );
1503
+		EEH_Template::display_template($template, $template_args);
1504 1504
 	}
1505 1505
 
1506 1506
 
@@ -1514,74 +1514,74 @@  discard block
 block discarded – undo
1514 1514
 	 * @param int        $row
1515 1515
 	 * @return string generated html for the ticket row.
1516 1516
 	 */
1517
-	private function _get_ticket_row( $ticket, $skeleton = false, $row = 0 ) {
1517
+	private function _get_ticket_row($ticket, $skeleton = false, $row = 0) {
1518 1518
 		$template_args = array(
1519
-			'tkt_status_class'    => ' tkt-status-' . $ticket->ticket_status(),
1519
+			'tkt_status_class'    => ' tkt-status-'.$ticket->ticket_status(),
1520 1520
 			'tkt_archive_class'   => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived'
1521 1521
 				: '',
1522 1522
 			'ticketrow'           => $skeleton ? 'TICKETNUM' : $row,
1523
-			'TKT_ID'              => $ticket->get( 'TKT_ID' ),
1524
-			'TKT_name'            => $ticket->get( 'TKT_name' ),
1525
-			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date( 'TKT_start_date', 'Y-m-d h:i a' ),
1526
-			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date( 'TKT_end_date', 'Y-m-d h:i a' ),
1527
-			'TKT_is_default'      => $ticket->get( 'TKT_is_default' ),
1528
-			'TKT_qty'             => $ticket->get_pretty( 'TKT_qty', 'input' ),
1523
+			'TKT_ID'              => $ticket->get('TKT_ID'),
1524
+			'TKT_name'            => $ticket->get('TKT_name'),
1525
+			'TKT_start_date'      => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1526
+			'TKT_end_date'        => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1527
+			'TKT_is_default'      => $ticket->get('TKT_is_default'),
1528
+			'TKT_qty'             => $ticket->get_pretty('TKT_qty', 'input'),
1529 1529
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1530
-			'TKT_sold'            => $skeleton ? 0 : $ticket->get( 'TKT_sold' ),
1531
-			'trash_icon'          => ( $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) )
1532
-			                         && ( ! empty( $ticket ) && $ticket->get( 'TKT_sold' ) === 0 )
1530
+			'TKT_sold'            => $skeleton ? 0 : $ticket->get('TKT_sold'),
1531
+			'trash_icon'          => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')))
1532
+			                         && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0)
1533 1533
 				? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1534
-			'disabled'            => $skeleton || ( ! empty( $ticket ) && ! $ticket->get( 'TKT_deleted' ) ) ? ''
1534
+			'disabled'            => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? ''
1535 1535
 				: ' disabled=disabled',
1536 1536
 		);
1537 1537
 		$price = $ticket->ID() !== 0
1538
-			? $ticket->get_first_related( 'Price', array( 'default_where_conditions' => 'none' ) )
1539
-			: EE_Registry::instance()->load_model( 'Price' )->create_default_object();
1538
+			? $ticket->get_first_related('Price', array('default_where_conditions' => 'none'))
1539
+			: EE_Registry::instance()->load_model('Price')->create_default_object();
1540 1540
 		$price_args = array(
1541 1541
 			'price_currency_symbol' => EE_Registry::instance()->CFG->currency->sign,
1542
-			'PRC_amount'            => $price->get( 'PRC_amount' ),
1543
-			'PRT_ID'                => $price->get( 'PRT_ID' ),
1544
-			'PRC_ID'                => $price->get( 'PRC_ID' ),
1545
-			'PRC_is_default'        => $price->get( 'PRC_is_default' ),
1542
+			'PRC_amount'            => $price->get('PRC_amount'),
1543
+			'PRT_ID'                => $price->get('PRT_ID'),
1544
+			'PRC_ID'                => $price->get('PRC_ID'),
1545
+			'PRC_is_default'        => $price->get('PRC_is_default'),
1546 1546
 		);
1547 1547
 		//make sure we have default start and end dates if skeleton
1548 1548
 		//handle rows that should NOT be empty
1549
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1549
+		if (empty($template_args['TKT_start_date'])) {
1550 1550
 			//if empty then the start date will be now.
1551
-			$template_args['TKT_start_date'] = date( 'Y-m-d h:i a', current_time( 'timestamp' ) );
1551
+			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1552 1552
 		}
1553
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1553
+		if (empty($template_args['TKT_end_date'])) {
1554 1554
 			//get the earliest datetime (if present);
1555 1555
 			$earliest_dtt = $this->_cpt_model_obj->ID() > 0
1556 1556
 				? $this->_cpt_model_obj->get_first_related(
1557 1557
 					'Datetime',
1558
-					array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) )
1558
+					array('order_by' => array('DTT_EVT_start' => 'ASC'))
1559 1559
 				)
1560 1560
 				: null;
1561
-			if ( ! empty( $earliest_dtt ) ) {
1562
-				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime( 'DTT_EVT_start', 'Y-m-d', 'h:i a' );
1561
+			if ( ! empty($earliest_dtt)) {
1562
+				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1563 1563
 			} else {
1564 1564
 				$template_args['TKT_end_date'] = date(
1565 1565
 					'Y-m-d h:i a',
1566
-					mktime( 0, 0, 0, date( "m" ), date( "d" ) + 7, date( "Y" ) )
1566
+					mktime(0, 0, 0, date("m"), date("d") + 7, date("Y"))
1567 1567
 				);
1568 1568
 			}
1569 1569
 		}
1570
-		$template_args = array_merge( $template_args, $price_args );
1570
+		$template_args = array_merge($template_args, $price_args);
1571 1571
 		$template = apply_filters(
1572 1572
 			'FHEE__Events_Admin_Page__get_ticket_row__template',
1573
-			EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php',
1573
+			EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php',
1574 1574
 			$ticket
1575 1575
 		);
1576
-		return EEH_Template::display_template( $template, $template_args, true );
1576
+		return EEH_Template::display_template($template, $template_args, true);
1577 1577
 	}
1578 1578
 
1579 1579
 
1580 1580
 
1581 1581
 	public function registration_options_meta_box() {
1582 1582
 		$yes_no_values = array(
1583
-			array( 'id' => true, 'text' => esc_html__( 'Yes', 'event_espresso' ) ),
1584
-			array( 'id' => false, 'text' => esc_html__( 'No', 'event_espresso' ) ),
1583
+			array('id' => true, 'text' => esc_html__('Yes', 'event_espresso')),
1584
+			array('id' => false, 'text' => esc_html__('No', 'event_espresso')),
1585 1585
 		);
1586 1586
 		$default_reg_status_values = EEM_Registration::reg_status_array(
1587 1587
 			array(
@@ -1593,7 +1593,7 @@  discard block
 block discarded – undo
1593 1593
 		);
1594 1594
 		//$template_args['is_active_select'] = EEH_Form_Fields::select_input('is_active', $yes_no_values, $this->_cpt_model_obj->is_active());
1595 1595
 		$template_args['_event'] = $this->_cpt_model_obj;
1596
-		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status( false );
1596
+		$template_args['active_status'] = $this->_cpt_model_obj->pretty_active_status(false);
1597 1597
 		$template_args['additional_limit'] = $this->_cpt_model_obj->additional_limit();
1598 1598
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input(
1599 1599
 			'default_reg_status',
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
 			$default_reg_status_values
1622 1622
 		);
1623 1623
 		EEH_Template::display_template(
1624
-			EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php',
1624
+			EVENTS_TEMPLATE_PATH.'event_registration_options.template.php',
1625 1625
 			$template_args
1626 1626
 		);
1627 1627
 	}
@@ -1640,97 +1640,97 @@  discard block
 block discarded – undo
1640 1640
 	 *                           that match the given _view and paging parameters.
1641 1641
 	 * @return array an array of event objects.
1642 1642
 	 */
1643
-	public function get_events( $per_page = 10, $current_page = 1, $count = false ) {
1643
+	public function get_events($per_page = 10, $current_page = 1, $count = false) {
1644 1644
 		$EEME = $this->_event_model();
1645
-		$offset = ( $current_page - 1 ) * $per_page;
1646
-		$limit = $count ? null : $offset . ',' . $per_page;
1647
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : "DESC";
1649
-		if ( isset( $this->_req_data['month_range'] ) ) {
1650
-			$pieces = explode( ' ', $this->_req_data['month_range'], 3 );
1651
-			$month_r = ! empty( $pieces[0] ) ? date( 'm', strtotime( $pieces[0] ) ) : '';
1652
-			$year_r = ! empty( $pieces[1] ) ? $pieces[1] : '';
1645
+		$offset = ($current_page - 1) * $per_page;
1646
+		$limit = $count ? null : $offset.','.$per_page;
1647
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1648
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1649
+		if (isset($this->_req_data['month_range'])) {
1650
+			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1651
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1652
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1653 1653
 		}
1654 1654
 		$where = array();
1655
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : null;
1655
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : null;
1656 1656
 		//determine what post_status our condition will have for the query.
1657
-		switch ( $status ) {
1657
+		switch ($status) {
1658 1658
 			case 'month' :
1659 1659
 			case 'today' :
1660 1660
 			case null :
1661 1661
 			case 'all' :
1662 1662
 				break;
1663 1663
 			case 'draft' :
1664
-				$where['status'] = array( 'IN', array( 'draft', 'auto-draft' ) );
1664
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1665 1665
 				break;
1666 1666
 			default :
1667 1667
 				$where['status'] = $status;
1668 1668
 		}
1669 1669
 		//categories?
1670
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0
1670
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0
1671 1671
 			? $this->_req_data['EVT_CAT'] : null;
1672
-		if ( ! empty ( $category ) ) {
1672
+		if ( ! empty ($category)) {
1673 1673
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1674 1674
 			$where['Term_Taxonomy.term_id'] = $category;
1675 1675
 		}
1676 1676
 		//date where conditions
1677
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1678
-		if ( isset( $this->_req_data['month_range'] ) && $this->_req_data['month_range'] != '' ) {
1677
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1678
+		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1679 1679
 			$DateTime = new DateTime(
1680
-				$year_r . '-' . $month_r . '-01 00:00:00',
1681
-				new DateTimeZone( EEM_Datetime::instance()->get_timezone() )
1680
+				$year_r.'-'.$month_r.'-01 00:00:00',
1681
+				new DateTimeZone(EEM_Datetime::instance()->get_timezone())
1682 1682
 			);
1683
-			$start = $DateTime->format( implode( ' ', $start_formats ) );
1684
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format( 't' ) )->setTime( 23, 59, 59 )->format(
1685
-				implode( ' ', $start_formats )
1683
+			$start = $DateTime->format(implode(' ', $start_formats));
1684
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(
1685
+				implode(' ', $start_formats)
1686 1686
 			);
1687
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1688
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'today' ) {
1689
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1690
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1691
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1692
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1693
-		} else if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] == 'month' ) {
1694
-			$now = date( 'Y-m-01' );
1695
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1696
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1697
-			$end = $DateTime->setDate( date( 'Y' ), date( 'm' ), $DateTime->format( 't' ) )
1698
-			                ->setTime( 23, 59, 59 )
1699
-			                ->format( implode( ' ', $start_formats ) );
1700
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1687
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1688
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1689
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1690
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1691
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1692
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1693
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1694
+			$now = date('Y-m-01');
1695
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1696
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1697
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))
1698
+			                ->setTime(23, 59, 59)
1699
+			                ->format(implode(' ', $start_formats));
1700
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1701 1701
 		}
1702
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1702
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1703 1703
 			$where['EVT_wp_user'] = get_current_user_id();
1704 1704
 		} else {
1705
-			if ( ! isset( $where['status'] ) ) {
1706
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1705
+			if ( ! isset($where['status'])) {
1706
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1707 1707
 					$where['OR'] = array(
1708
-						'status*restrict_private' => array( '!=', 'private' ),
1708
+						'status*restrict_private' => array('!=', 'private'),
1709 1709
 						'AND'                     => array(
1710
-							'status*inclusive' => array( '=', 'private' ),
1710
+							'status*inclusive' => array('=', 'private'),
1711 1711
 							'EVT_wp_user'      => get_current_user_id(),
1712 1712
 						),
1713 1713
 					);
1714 1714
 				}
1715 1715
 			}
1716 1716
 		}
1717
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1718
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
-			     && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' )
1717
+		if (isset($this->_req_data['EVT_wp_user'])) {
1718
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id()
1719
+			     && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')
1720 1720
 			) {
1721 1721
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1722 1722
 			}
1723 1723
 		}
1724 1724
 		//search query handling
1725
-		if ( isset( $this->_req_data['s'] ) ) {
1726
-			$search_string = '%' . $this->_req_data['s'] . '%';
1725
+		if (isset($this->_req_data['s'])) {
1726
+			$search_string = '%'.$this->_req_data['s'].'%';
1727 1727
 			$where['OR'] = array(
1728
-				'EVT_name'       => array( 'LIKE', $search_string ),
1729
-				'EVT_desc'       => array( 'LIKE', $search_string ),
1730
-				'EVT_short_desc' => array( 'LIKE', $search_string ),
1728
+				'EVT_name'       => array('LIKE', $search_string),
1729
+				'EVT_desc'       => array('LIKE', $search_string),
1730
+				'EVT_short_desc' => array('LIKE', $search_string),
1731 1731
 			);
1732 1732
 		}
1733
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1733
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1734 1734
 		$query_params = apply_filters(
1735 1735
 			'FHEE__Events_Admin_Page__get_events__query_params',
1736 1736
 			array(
@@ -1743,23 +1743,23 @@  discard block
 block discarded – undo
1743 1743
 			$this->_req_data
1744 1744
 		);
1745 1745
 		//let's first check if we have special requests coming in.
1746
-		if ( isset( $this->_req_data['active_status'] ) ) {
1747
-			switch ( $this->_req_data['active_status'] ) {
1746
+		if (isset($this->_req_data['active_status'])) {
1747
+			switch ($this->_req_data['active_status']) {
1748 1748
 				case 'upcoming' :
1749
-					return $EEME->get_upcoming_events( $query_params, $count );
1749
+					return $EEME->get_upcoming_events($query_params, $count);
1750 1750
 					break;
1751 1751
 				case 'expired' :
1752
-					return $EEME->get_expired_events( $query_params, $count );
1752
+					return $EEME->get_expired_events($query_params, $count);
1753 1753
 					break;
1754 1754
 				case 'active' :
1755
-					return $EEME->get_active_events( $query_params, $count );
1755
+					return $EEME->get_active_events($query_params, $count);
1756 1756
 					break;
1757 1757
 				case 'inactive' :
1758
-					return $EEME->get_inactive_events( $query_params, $count );
1758
+					return $EEME->get_inactive_events($query_params, $count);
1759 1759
 					break;
1760 1760
 			}
1761 1761
 		}
1762
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1762
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1763 1763
 		return $events;
1764 1764
 	}
1765 1765
 
@@ -1770,9 +1770,9 @@  discard block
 block discarded – undo
1770 1770
 	 *
1771 1771
 	 * @param string $post_id
1772 1772
 	 */
1773
-	public function trash_cpt_item( $post_id ) {
1773
+	public function trash_cpt_item($post_id) {
1774 1774
 		$this->_req_data['EVT_ID'] = $post_id;
1775
-		$this->_trash_or_restore_event( 'trash', false );
1775
+		$this->_trash_or_restore_event('trash', false);
1776 1776
 	}
1777 1777
 
1778 1778
 
@@ -1780,9 +1780,9 @@  discard block
 block discarded – undo
1780 1780
 	/**
1781 1781
 	 * @param string $post_id
1782 1782
 	 */
1783
-	public function restore_cpt_item( $post_id ) {
1783
+	public function restore_cpt_item($post_id) {
1784 1784
 		$this->_req_data['EVT_ID'] = $post_id;
1785
-		$this->_trash_or_restore_event( 'draft', false );
1785
+		$this->_trash_or_restore_event('draft', false);
1786 1786
 	}
1787 1787
 
1788 1788
 
@@ -1790,9 +1790,9 @@  discard block
 block discarded – undo
1790 1790
 	/**
1791 1791
 	 * @param string $post_id
1792 1792
 	 */
1793
-	public function delete_cpt_item( $post_id ) {
1793
+	public function delete_cpt_item($post_id) {
1794 1794
 		$this->_req_data['EVT_ID'] = $post_id;
1795
-		$this->_delete_event( false );
1795
+		$this->_delete_event(false);
1796 1796
 	}
1797 1797
 
1798 1798
 
@@ -1804,23 +1804,23 @@  discard block
 block discarded – undo
1804 1804
 	 * @param  string $event_status
1805 1805
 	 * @param bool    $redirect_after
1806 1806
 	 */
1807
-	protected function _trash_or_restore_event( $event_status = 'trash', $redirect_after = true ) {
1807
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = true) {
1808 1808
 		//determine the event id and set to array.
1809
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : false;
1809
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : false;
1810 1810
 		// loop thru events
1811
-		if ( $EVT_ID ) {
1811
+		if ($EVT_ID) {
1812 1812
 			// clean status
1813
-			$event_status = sanitize_key( $event_status );
1813
+			$event_status = sanitize_key($event_status);
1814 1814
 			// grab status
1815
-			if ( ! empty( $event_status ) ) {
1816
-				$success = $this->_change_event_status( $EVT_ID, $event_status );
1815
+			if ( ! empty($event_status)) {
1816
+				$success = $this->_change_event_status($EVT_ID, $event_status);
1817 1817
 			} else {
1818 1818
 				$success = false;
1819 1819
 				$msg = esc_html__(
1820 1820
 					'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1821 1821
 					'event_espresso'
1822 1822
 				);
1823
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1823
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1824 1824
 			}
1825 1825
 		} else {
1826 1826
 			$success = false;
@@ -1828,11 +1828,11 @@  discard block
 block discarded – undo
1828 1828
 				'An error occurred. The event could not be moved to the trash because a valid event ID was not not supplied.',
1829 1829
 				'event_espresso'
1830 1830
 			);
1831
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1831
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1832 1832
 		}
1833 1833
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1834
-		if ( $redirect_after ) {
1835
-			$this->_redirect_after_action( $success, 'Event', $action, array( 'action' => 'default' ) );
1834
+		if ($redirect_after) {
1835
+			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1836 1836
 		}
1837 1837
 	}
1838 1838
 
@@ -1845,18 +1845,18 @@  discard block
 block discarded – undo
1845 1845
 	 * @param  string $event_status
1846 1846
 	 * @return void
1847 1847
 	 */
1848
-	protected function _trash_or_restore_events( $event_status = 'trash' ) {
1848
+	protected function _trash_or_restore_events($event_status = 'trash') {
1849 1849
 		// clean status
1850
-		$event_status = sanitize_key( $event_status );
1850
+		$event_status = sanitize_key($event_status);
1851 1851
 		// grab status
1852
-		if ( ! empty( $event_status ) ) {
1852
+		if ( ! empty($event_status)) {
1853 1853
 			$success = true;
1854 1854
 			//determine the event id and set to array.
1855
-			$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
1855
+			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1856 1856
 			// loop thru events
1857
-			foreach ( $EVT_IDs as $EVT_ID ) {
1858
-				if ( $EVT_ID = absint( $EVT_ID ) ) {
1859
-					$results = $this->_change_event_status( $EVT_ID, $event_status );
1857
+			foreach ($EVT_IDs as $EVT_ID) {
1858
+				if ($EVT_ID = absint($EVT_ID)) {
1859
+					$results = $this->_change_event_status($EVT_ID, $event_status);
1860 1860
 					$success = $results !== false ? $success : false;
1861 1861
 				} else {
1862 1862
 					$msg = sprintf(
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 						),
1867 1867
 						$EVT_ID
1868 1868
 					);
1869
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1869
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1870 1870
 					$success = false;
1871 1871
 				}
1872 1872
 			}
@@ -1876,12 +1876,12 @@  discard block
 block discarded – undo
1876 1876
 				'An error occurred. The event could not be moved to the trash because a valid event status was not not supplied.',
1877 1877
 				'event_espresso'
1878 1878
 			);
1879
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1879
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1880 1880
 		}
1881 1881
 		// in order to force a pluralized result message we need to send back a success status greater than 1
1882 1882
 		$success = $success ? 2 : false;
1883 1883
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1884
-		$this->_redirect_after_action( $success, 'Events', $action, array( 'action' => 'default' ) );
1884
+		$this->_redirect_after_action($success, 'Events', $action, array('action' => 'default'));
1885 1885
 	}
1886 1886
 
1887 1887
 
@@ -1894,30 +1894,30 @@  discard block
 block discarded – undo
1894 1894
 	 * @param  string $event_status
1895 1895
 	 * @return bool
1896 1896
 	 */
1897
-	private function _change_event_status( $EVT_ID = 0, $event_status = '' ) {
1897
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1898 1898
 		// grab event id
1899
-		if ( ! $EVT_ID ) {
1899
+		if ( ! $EVT_ID) {
1900 1900
 			$msg = esc_html__(
1901 1901
 				'An error occurred. No Event ID or an invalid Event ID was received.',
1902 1902
 				'event_espresso'
1903 1903
 			);
1904
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1904
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1905 1905
 			return false;
1906 1906
 		}
1907
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1907
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1908 1908
 		// clean status
1909
-		$event_status = sanitize_key( $event_status );
1909
+		$event_status = sanitize_key($event_status);
1910 1910
 		// grab status
1911
-		if ( empty( $event_status ) ) {
1911
+		if (empty($event_status)) {
1912 1912
 			$msg = esc_html__(
1913 1913
 				'An error occurred. No Event Status or an invalid Event Status was received.',
1914 1914
 				'event_espresso'
1915 1915
 			);
1916
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1916
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1917 1917
 			return false;
1918 1918
 		}
1919 1919
 		// was event trashed or restored ?
1920
-		switch ( $event_status ) {
1920
+		switch ($event_status) {
1921 1921
 			case 'draft' :
1922 1922
 				$action = 'restored from the trash';
1923 1923
 				$hook = 'AHEE_event_restored_from_trash';
@@ -1931,15 +1931,15 @@  discard block
 block discarded – undo
1931 1931
 				$hook = false;
1932 1932
 		}
1933 1933
 		//use class to change status
1934
-		$this->_cpt_model_obj->set_status( $event_status );
1934
+		$this->_cpt_model_obj->set_status($event_status);
1935 1935
 		$success = $this->_cpt_model_obj->save();
1936
-		if ( $success === false ) {
1937
-			$msg = sprintf( esc_html__( 'An error occurred. The event could not be %s.', 'event_espresso' ), $action );
1938
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1936
+		if ($success === false) {
1937
+			$msg = sprintf(esc_html__('An error occurred. The event could not be %s.', 'event_espresso'), $action);
1938
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1939 1939
 			return false;
1940 1940
 		}
1941
-		if ( $hook ) {
1942
-			do_action( $hook );
1941
+		if ($hook) {
1942
+			do_action($hook);
1943 1943
 		}
1944 1944
 		return true;
1945 1945
 	}
@@ -1952,34 +1952,34 @@  discard block
 block discarded – undo
1952 1952
 	 * @access protected
1953 1953
 	 * @param bool $redirect_after
1954 1954
 	 */
1955
-	protected function _delete_event( $redirect_after = true ) {
1955
+	protected function _delete_event($redirect_after = true) {
1956 1956
 		//determine the event id and set to array.
1957
-		$EVT_ID = isset( $this->_req_data['EVT_ID'] ) ? absint( $this->_req_data['EVT_ID'] ) : null;
1958
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1957
+		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : null;
1958
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1959 1959
 		// loop thru events
1960
-		if ( $EVT_ID ) {
1961
-			$success = $this->_permanently_delete_event( $EVT_ID );
1960
+		if ($EVT_ID) {
1961
+			$success = $this->_permanently_delete_event($EVT_ID);
1962 1962
 			// get list of events with no prices
1963
-			$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1963
+			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1964 1964
 			// remove this event from the list of events with no prices
1965
-			if ( isset( $espresso_no_ticket_prices[ $EVT_ID ] ) ) {
1966
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1965
+			if (isset($espresso_no_ticket_prices[$EVT_ID])) {
1966
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1967 1967
 			}
1968
-			update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
1968
+			update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
1969 1969
 		} else {
1970 1970
 			$success = false;
1971 1971
 			$msg = esc_html__(
1972 1972
 				'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
1973 1973
 				'event_espresso'
1974 1974
 			);
1975
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1975
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1976 1976
 		}
1977
-		if ( $redirect_after ) {
1977
+		if ($redirect_after) {
1978 1978
 			$this->_redirect_after_action(
1979 1979
 				$success,
1980 1980
 				'Event',
1981 1981
 				'deleted',
1982
-				array( 'action' => 'default', 'status' => 'trash' )
1982
+				array('action' => 'default', 'status' => 'trash')
1983 1983
 			);
1984 1984
 		}
1985 1985
 	}
@@ -1995,30 +1995,30 @@  discard block
 block discarded – undo
1995 1995
 	protected function _delete_events() {
1996 1996
 		$success = true;
1997 1997
 		// get list of events with no prices
1998
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', array() );
1998
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1999 1999
 		//determine the event id and set to array.
2000
-		$EVT_IDs = isset( $this->_req_data['EVT_IDs'] ) ? (array) $this->_req_data['EVT_IDs'] : array();
2000
+		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
2001 2001
 		// loop thru events
2002
-		foreach ( $EVT_IDs as $EVT_ID ) {
2003
-			$EVT_ID = absint( $EVT_ID );
2004
-			if ( $EVT_ID ) {
2005
-				$results = $this->_permanently_delete_event( $EVT_ID );
2002
+		foreach ($EVT_IDs as $EVT_ID) {
2003
+			$EVT_ID = absint($EVT_ID);
2004
+			if ($EVT_ID) {
2005
+				$results = $this->_permanently_delete_event($EVT_ID);
2006 2006
 				$success = $results !== false ? $success : false;
2007 2007
 				// remove this event from the list of events with no prices
2008
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
2008
+				unset($espresso_no_ticket_prices[$EVT_ID]);
2009 2009
 			} else {
2010 2010
 				$success = false;
2011 2011
 				$msg = esc_html__(
2012 2012
 					'An error occurred. An event could not be deleted because a valid event ID was not not supplied.',
2013 2013
 					'event_espresso'
2014 2014
 				);
2015
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2015
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2016 2016
 			}
2017 2017
 		}
2018
-		update_option( 'ee_no_ticket_prices', $espresso_no_ticket_prices );
2018
+		update_option('ee_no_ticket_prices', $espresso_no_ticket_prices);
2019 2019
 		// in order to force a pluralized result message we need to send back a success status greater than 1
2020 2020
 		$success = $success ? 2 : false;
2021
-		$this->_redirect_after_action( $success, 'Events', 'deleted', array( 'action' => 'default' ) );
2021
+		$this->_redirect_after_action($success, 'Events', 'deleted', array('action' => 'default'));
2022 2022
 	}
2023 2023
 
2024 2024
 
@@ -2030,70 +2030,70 @@  discard block
 block discarded – undo
2030 2030
 	 * @param  int $EVT_ID
2031 2031
 	 * @return bool
2032 2032
 	 */
2033
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
2033
+	private function _permanently_delete_event($EVT_ID = 0) {
2034 2034
 		// grab event id
2035
-		if ( ! $EVT_ID ) {
2035
+		if ( ! $EVT_ID) {
2036 2036
 			$msg = esc_html__(
2037 2037
 				'An error occurred. No Event ID or an invalid Event ID was received.',
2038 2038
 				'event_espresso'
2039 2039
 			);
2040
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2040
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2041 2041
 			return false;
2042 2042
 		}
2043 2043
 		if (
2044 2044
 			! $this->_cpt_model_obj instanceof EE_Event
2045 2045
 			|| $this->_cpt_model_obj->ID() !== $EVT_ID
2046 2046
 		) {
2047
-			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
2047
+			$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
2048 2048
 		}
2049
-		if ( ! $this->_cpt_model_obj instanceof EE_Event ) {
2049
+		if ( ! $this->_cpt_model_obj instanceof EE_Event) {
2050 2050
 			return false;
2051 2051
 		}
2052 2052
 		//need to delete related tickets and prices first.
2053
-		$datetimes = $this->_cpt_model_obj->get_many_related( 'Datetime' );
2054
-		foreach ( $datetimes as $datetime ) {
2055
-			$this->_cpt_model_obj->_remove_relation_to( $datetime, 'Datetime' );
2056
-			$tickets = $datetime->get_many_related( 'Ticket' );
2057
-			foreach ( $tickets as $ticket ) {
2058
-				$ticket->_remove_relation_to( $datetime, 'Datetime' );
2059
-				$ticket->delete_related_permanently( 'Price' );
2053
+		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
2054
+		foreach ($datetimes as $datetime) {
2055
+			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
2056
+			$tickets = $datetime->get_many_related('Ticket');
2057
+			foreach ($tickets as $ticket) {
2058
+				$ticket->_remove_relation_to($datetime, 'Datetime');
2059
+				$ticket->delete_related_permanently('Price');
2060 2060
 				$ticket->delete_permanently();
2061 2061
 			}
2062 2062
 			$datetime->delete();
2063 2063
 		}
2064 2064
 		//what about related venues or terms?
2065
-		$venues = $this->_cpt_model_obj->get_many_related( 'Venue' );
2066
-		foreach ( $venues as $venue ) {
2067
-			$this->_cpt_model_obj->_remove_relation_to( $venue, 'Venue' );
2065
+		$venues = $this->_cpt_model_obj->get_many_related('Venue');
2066
+		foreach ($venues as $venue) {
2067
+			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
2068 2068
 		}
2069 2069
 		//any attached question groups?
2070
-		$question_groups = $this->_cpt_model_obj->get_many_related( 'Question_Group' );
2071
-		if ( ! empty( $question_groups ) ) {
2072
-			foreach ( $question_groups as $question_group ) {
2073
-				$this->_cpt_model_obj->_remove_relation_to( $question_group, 'Question_Group' );
2070
+		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
2071
+		if ( ! empty($question_groups)) {
2072
+			foreach ($question_groups as $question_group) {
2073
+				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
2074 2074
 			}
2075 2075
 		}
2076 2076
 		//Message Template Groups
2077
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
2077
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
2078 2078
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
2079 2079
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
2080
-		foreach ( $term_taxonomies as $term_taxonomy ) {
2081
-			$this->_cpt_model_obj->remove_relation_to_term_taxonomy( $term_taxonomy );
2080
+		foreach ($term_taxonomies as $term_taxonomy) {
2081
+			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
2082 2082
 		}
2083 2083
 		$success = $this->_cpt_model_obj->delete_permanently();
2084 2084
 		// did it all go as planned ?
2085
-		if ( $success ) {
2086
-			$msg = sprintf( esc_html__( 'Event ID # %d has been deleted.', 'event_espresso' ), $EVT_ID );
2087
-			EE_Error::add_success( $msg );
2085
+		if ($success) {
2086
+			$msg = sprintf(esc_html__('Event ID # %d has been deleted.', 'event_espresso'), $EVT_ID);
2087
+			EE_Error::add_success($msg);
2088 2088
 		} else {
2089 2089
 			$msg = sprintf(
2090
-				esc_html__( 'An error occurred. Event ID # %d could not be deleted.', 'event_espresso' ),
2090
+				esc_html__('An error occurred. Event ID # %d could not be deleted.', 'event_espresso'),
2091 2091
 				$EVT_ID
2092 2092
 			);
2093
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2093
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2094 2094
 			return false;
2095 2095
 		}
2096
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
2096
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
2097 2097
 		return true;
2098 2098
 	}
2099 2099
 
@@ -2106,7 +2106,7 @@  discard block
 block discarded – undo
2106 2106
 	 * @return int
2107 2107
 	 */
2108 2108
 	public function total_events() {
2109
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
2109
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
2110 2110
 		return $count;
2111 2111
 	}
2112 2112
 
@@ -2120,9 +2120,9 @@  discard block
 block discarded – undo
2120 2120
 	 */
2121 2121
 	public function total_events_draft() {
2122 2122
 		$where = array(
2123
-			'status' => array( 'IN', array( 'draft', 'auto-draft' ) ),
2123
+			'status' => array('IN', array('draft', 'auto-draft')),
2124 2124
 		);
2125
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2125
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2126 2126
 		return $count;
2127 2127
 	}
2128 2128
 
@@ -2138,7 +2138,7 @@  discard block
 block discarded – undo
2138 2138
 		$where = array(
2139 2139
 			'status' => 'trash',
2140 2140
 		);
2141
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2141
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2142 2142
 		return $count;
2143 2143
 	}
2144 2144
 
@@ -2169,12 +2169,12 @@  discard block
 block discarded – undo
2169 2169
 			EE_Registry::instance()->CFG->registration->default_STS_ID,
2170 2170
 			$this->_template_args['reg_status_array']
2171 2171
 		)
2172
-			? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID )
2172
+			? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID)
2173 2173
 			: EEM_Registration::status_id_pending_payment;
2174
-		$this->_set_add_edit_form_tags( 'update_default_event_settings' );
2175
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
2174
+		$this->_set_add_edit_form_tags('update_default_event_settings');
2175
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
2176 2176
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
2177
-			EVENTS_TEMPLATE_PATH . 'event_settings.template.php',
2177
+			EVENTS_TEMPLATE_PATH.'event_settings.template.php',
2178 2178
 			$this->_template_args,
2179 2179
 			true
2180 2180
 		);
@@ -2190,8 +2190,8 @@  discard block
 block discarded – undo
2190 2190
 	 * @return void
2191 2191
 	 */
2192 2192
 	protected function _update_default_event_settings() {
2193
-		EE_Config::instance()->registration->default_STS_ID = isset( $this->_req_data['default_reg_status'] )
2194
-			? sanitize_text_field( $this->_req_data['default_reg_status'] )
2193
+		EE_Config::instance()->registration->default_STS_ID = isset($this->_req_data['default_reg_status'])
2194
+			? sanitize_text_field($this->_req_data['default_reg_status'])
2195 2195
 			: EEM_Registration::status_id_pending_payment;
2196 2196
 		$what = 'Default Event Settings';
2197 2197
 		$success = $this->_update_espresso_configuration(
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 			__FUNCTION__,
2202 2202
 			__LINE__
2203 2203
 		);
2204
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default_event_settings' ) );
2204
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default_event_settings'));
2205 2205
 	}
2206 2206
 
2207 2207
 
@@ -2211,20 +2211,20 @@  discard block
 block discarded – undo
2211 2211
 
2212 2212
 
2213 2213
 	protected function _template_settings() {
2214
-		$this->_admin_page_title = esc_html__( 'Template Settings (Preview)', 'event_espresso' );
2214
+		$this->_admin_page_title = esc_html__('Template Settings (Preview)', 'event_espresso');
2215 2215
 		$this->_template_args['preview_img'] = '<img src="'
2216 2216
 		                                       . EVENTS_ASSETS_URL
2217 2217
 		                                       . DS
2218 2218
 		                                       . 'images'
2219 2219
 		                                       . DS
2220 2220
 		                                       . 'caffeinated_template_features.jpg" alt="'
2221
-		                                       . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' )
2221
+		                                       . esc_attr__('Template Settings Preview screenshot', 'event_espresso')
2222 2222
 		                                       . '" />';
2223
-		$this->_template_args['preview_text'] = '<strong>' . esc_html__(
2223
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__(
2224 2224
 				'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.',
2225 2225
 				'event_espresso'
2226
-			) . '</strong>';
2227
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2226
+			).'</strong>';
2227
+		$this->display_admin_caf_preview_page('template_settings_tab');
2228 2228
 	}
2229 2229
 
2230 2230
 
@@ -2236,18 +2236,18 @@  discard block
 block discarded – undo
2236 2236
 	 * @return void
2237 2237
 	 */
2238 2238
 	private function _set_category_object() {
2239
-		if ( isset( $this->_category->id ) && ! empty( $this->_category->id ) ) {
2239
+		if (isset($this->_category->id) && ! empty($this->_category->id)) {
2240 2240
 			return;
2241 2241
 		} //already have the category object so get out.
2242 2242
 		//set default category object
2243 2243
 		$this->_set_empty_category_object();
2244 2244
 		//only set if we've got an id
2245
-		if ( ! isset( $this->_req_data['EVT_CAT_ID'] ) ) {
2245
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2246 2246
 			return;
2247 2247
 		}
2248
-		$category_id = absint( $this->_req_data['EVT_CAT_ID'] );
2249
-		$term = get_term( $category_id, 'espresso_event_categories' );
2250
-		if ( ! empty( $term ) ) {
2248
+		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2249
+		$term = get_term($category_id, 'espresso_event_categories');
2250
+		if ( ! empty($term)) {
2251 2251
 			$this->_category->category_name = $term->name;
2252 2252
 			$this->_category->category_identifier = $term->slug;
2253 2253
 			$this->_category->category_desc = $term->description;
@@ -2267,9 +2267,9 @@  discard block
 block discarded – undo
2267 2267
 
2268 2268
 
2269 2269
 	protected function _category_list_table() {
2270
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2271
-		$this->_search_btn_label = esc_html__( 'Categories', 'event_espresso' );
2272
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
2270
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2271
+		$this->_search_btn_label = esc_html__('Categories', 'event_espresso');
2272
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
2273 2273
 				'add_category',
2274 2274
 				'add_category',
2275 2275
 				array(),
@@ -2283,20 +2283,20 @@  discard block
 block discarded – undo
2283 2283
 	/**
2284 2284
 	 * @param $view
2285 2285
 	 */
2286
-	protected function _category_details( $view ) {
2286
+	protected function _category_details($view) {
2287 2287
 		//load formatter helper
2288 2288
 		//load field generator helper
2289 2289
 		$route = $view == 'edit' ? 'update_category' : 'insert_category';
2290
-		$this->_set_add_edit_form_tags( $route );
2290
+		$this->_set_add_edit_form_tags($route);
2291 2291
 		$this->_set_category_object();
2292
-		$id = ! empty( $this->_category->id ) ? $this->_category->id : '';
2292
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2293 2293
 		$delete_action = 'delete_category';
2294 2294
 		//custom redirect
2295 2295
 		$redirect = EE_Admin_Page::add_query_args_and_nonce(
2296
-			array( 'action' => 'category_list' ),
2296
+			array('action' => 'category_list'),
2297 2297
 			$this->_admin_base_url
2298 2298
 		);
2299
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2299
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2300 2300
 		//take care of contents
2301 2301
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
2302 2302
 		$this->display_admin_page_with_sidebar();
@@ -2310,21 +2310,21 @@  discard block
 block discarded – undo
2310 2310
 	protected function _category_details_content() {
2311 2311
 		$editor_args['category_desc'] = array(
2312 2312
 			'type'          => 'wp_editor',
2313
-			'value'         => EEH_Formatter::admin_format_content( $this->_category->category_desc ),
2313
+			'value'         => EEH_Formatter::admin_format_content($this->_category->category_desc),
2314 2314
 			'class'         => 'my_editor_custom',
2315
-			'wpeditor_args' => array( 'media_buttons' => false ),
2315
+			'wpeditor_args' => array('media_buttons' => false),
2316 2316
 		);
2317
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2317
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2318 2318
 		$all_terms = get_terms(
2319
-			array( 'espresso_event_categories' ),
2320
-			array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) )
2319
+			array('espresso_event_categories'),
2320
+			array('hide_empty' => 0, 'exclude' => array($this->_category->id))
2321 2321
 		);
2322 2322
 		//setup category select for term parents.
2323 2323
 		$category_select_values[] = array(
2324
-			'text' => esc_html__( 'No Parent', 'event_espresso' ),
2324
+			'text' => esc_html__('No Parent', 'event_espresso'),
2325 2325
 			'id'   => 0,
2326 2326
 		);
2327
-		foreach ( $all_terms as $term ) {
2327
+		foreach ($all_terms as $term) {
2328 2328
 			$category_select_values[] = array(
2329 2329
 				'text' => $term->name,
2330 2330
 				'id'   => $term->term_id,
@@ -2338,28 +2338,28 @@  discard block
 block discarded – undo
2338 2338
 		$template_args = array(
2339 2339
 			'category'                 => $this->_category,
2340 2340
 			'category_select'          => $category_select,
2341
-			'unique_id_info_help_link' => $this->_get_help_tab_link( 'unique_id_info' ),
2341
+			'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'),
2342 2342
 			'category_desc_editor'     => $_wp_editor['category_desc']['field'],
2343 2343
 			'disable'                  => '',
2344 2344
 			'disabled_message'         => false,
2345 2345
 		);
2346
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2347
-		return EEH_Template::display_template( $template, $template_args, true );
2346
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2347
+		return EEH_Template::display_template($template, $template_args, true);
2348 2348
 	}
2349 2349
 
2350 2350
 
2351 2351
 
2352 2352
 	protected function _delete_categories() {
2353
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID']
2353
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID']
2354 2354
 			: (array) $this->_req_data['category_id'];
2355
-		foreach ( $cat_ids as $cat_id ) {
2356
-			$this->_delete_category( $cat_id );
2355
+		foreach ($cat_ids as $cat_id) {
2356
+			$this->_delete_category($cat_id);
2357 2357
 		}
2358 2358
 		//doesn't matter what page we're coming from... we're going to the same place after delete.
2359 2359
 		$query_args = array(
2360 2360
 			'action' => 'category_list',
2361 2361
 		);
2362
-		$this->_redirect_after_action( 0, '', '', $query_args );
2362
+		$this->_redirect_after_action(0, '', '', $query_args);
2363 2363
 	}
2364 2364
 
2365 2365
 
@@ -2367,9 +2367,9 @@  discard block
 block discarded – undo
2367 2367
 	/**
2368 2368
 	 * @param $cat_id
2369 2369
 	 */
2370
-	protected function _delete_category( $cat_id ) {
2371
-		$cat_id = absint( $cat_id );
2372
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2370
+	protected function _delete_category($cat_id) {
2371
+		$cat_id = absint($cat_id);
2372
+		wp_delete_term($cat_id, 'espresso_event_categories');
2373 2373
 	}
2374 2374
 
2375 2375
 
@@ -2377,18 +2377,18 @@  discard block
 block discarded – undo
2377 2377
 	/**
2378 2378
 	 * @param $new_category
2379 2379
 	 */
2380
-	protected function _insert_or_update_category( $new_category ) {
2381
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( true );
2380
+	protected function _insert_or_update_category($new_category) {
2381
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true);
2382 2382
 		$success = 0; //we already have a success message so lets not send another.
2383
-		if ( $cat_id ) {
2383
+		if ($cat_id) {
2384 2384
 			$query_args = array(
2385 2385
 				'action'     => 'edit_category',
2386 2386
 				'EVT_CAT_ID' => $cat_id,
2387 2387
 			);
2388 2388
 		} else {
2389
-			$query_args = array( 'action' => 'add_category' );
2389
+			$query_args = array('action' => 'add_category');
2390 2390
 		}
2391
-		$this->_redirect_after_action( $success, '', '', $query_args, true );
2391
+		$this->_redirect_after_action($success, '', '', $query_args, true);
2392 2392
 	}
2393 2393
 
2394 2394
 
@@ -2397,14 +2397,14 @@  discard block
 block discarded – undo
2397 2397
 	 * @param bool $update
2398 2398
 	 * @return bool|mixed|string
2399 2399
 	 */
2400
-	private function _insert_category( $update = false ) {
2400
+	private function _insert_category($update = false) {
2401 2401
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2402
-		$category_name = isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2403
-		$category_desc = isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2404
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2405
-		if ( empty( $category_name ) ) {
2406
-			$msg = esc_html__( 'You must add a name for the category.', 'event_espresso' );
2407
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2402
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2403
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2404
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2405
+		if (empty($category_name)) {
2406
+			$msg = esc_html__('You must add a name for the category.', 'event_espresso');
2407
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2408 2408
 			return false;
2409 2409
 		}
2410 2410
 		$term_args = array(
@@ -2413,22 +2413,22 @@  discard block
 block discarded – undo
2413 2413
 			'parent'      => $category_parent,
2414 2414
 		);
2415 2415
 		//was the category_identifier input disabled?
2416
-		if ( isset( $this->_req_data['category_identifier'] ) ) {
2416
+		if (isset($this->_req_data['category_identifier'])) {
2417 2417
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2418 2418
 		}
2419 2419
 		$insert_ids = $update
2420
-			? wp_update_term( $cat_id, 'espresso_event_categories', $term_args )
2421
-			: wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2422
-		if ( ! is_array( $insert_ids ) ) {
2420
+			? wp_update_term($cat_id, 'espresso_event_categories', $term_args)
2421
+			: wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2422
+		if ( ! is_array($insert_ids)) {
2423 2423
 			$msg = esc_html__(
2424 2424
 				'An error occurred and the category has not been saved to the database.',
2425 2425
 				'event_espresso'
2426 2426
 			);
2427
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2427
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2428 2428
 		} else {
2429 2429
 			$cat_id = $insert_ids['term_id'];
2430
-			$msg = sprintf( esc_html__( 'The category %s was successfully saved', 'event_espresso' ), $category_name );
2431
-			EE_Error::add_success( $msg );
2430
+			$msg = sprintf(esc_html__('The category %s was successfully saved', 'event_espresso'), $category_name);
2431
+			EE_Error::add_success($msg);
2432 2432
 		}
2433 2433
 		return $cat_id;
2434 2434
 	}
@@ -2441,28 +2441,28 @@  discard block
 block discarded – undo
2441 2441
 	 * @param bool $count
2442 2442
 	 * @return \EE_Base_Class[]|int
2443 2443
 	 */
2444
-	public function get_categories( $per_page = 10, $current_page = 1, $count = false ) {
2444
+	public function get_categories($per_page = 10, $current_page = 1, $count = false) {
2445 2445
 		//testing term stuff
2446
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2448
-		$limit = ( $current_page - 1 ) * $per_page;
2449
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2450
-		if ( isset( $this->_req_data['s'] ) ) {
2451
-			$sstr = '%' . $this->_req_data['s'] . '%';
2446
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2447
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2448
+		$limit = ($current_page - 1) * $per_page;
2449
+		$where = array('taxonomy' => 'espresso_event_categories');
2450
+		if (isset($this->_req_data['s'])) {
2451
+			$sstr = '%'.$this->_req_data['s'].'%';
2452 2452
 			$where['OR'] = array(
2453
-				'Term.name'   => array( 'LIKE', $sstr ),
2454
-				'description' => array( 'LIKE', $sstr ),
2453
+				'Term.name'   => array('LIKE', $sstr),
2454
+				'description' => array('LIKE', $sstr),
2455 2455
 			);
2456 2456
 		}
2457 2457
 		$query_params = array(
2458 2458
 			$where,
2459
-			'order_by'   => array( $orderby => $order ),
2460
-			'limit'      => $limit . ',' . $per_page,
2461
-			'force_join' => array( 'Term' ),
2459
+			'order_by'   => array($orderby => $order),
2460
+			'limit'      => $limit.','.$per_page,
2461
+			'force_join' => array('Term'),
2462 2462
 		);
2463 2463
 		$categories = $count
2464
-			? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' )
2465
-			: EEM_Term_Taxonomy::instance()->get_all( $query_params );
2464
+			? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id')
2465
+			: EEM_Term_Taxonomy::instance()->get_all($query_params);
2466 2466
 		return $categories;
2467 2467
 	}
2468 2468
 
Please login to merge, or discard this patch.