Completed
Branch BUG-9623-config-log (c144cd)
by
unknown
110:09 queued 92:18
created
espresso_event_attendees/EES_Espresso_Event_Attendees.shortcode.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 * @param       WP $WP
20 20
 	 * @return    void
21 21
 	 */
22
-	public function run( WP $WP ) {}
22
+	public function run(WP $WP) {}
23 23
 
24 24
 
25 25
 	/**
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 *  @param 	    array 	$attributes
70 70
 	 *  @return 	string
71 71
 	 */
72
-	public function process_shortcode( $attributes = array() ) {
72
+	public function process_shortcode($attributes = array()) {
73 73
 
74 74
 		// merge in any attributes passed via fallback shortcode processor
75
-		$attributes = array_merge( (array) $attributes, (array) $this->_attributes );
75
+		$attributes = array_merge((array) $attributes, (array) $this->_attributes);
76 76
 
77 77
 		//set default attributes
78 78
 		$default_shortcode_attributes = array(
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		// allow the defaults to be filtered
87
-		$default_shortcode_attributes = apply_filters( 'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes );
87
+		$default_shortcode_attributes = apply_filters('EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts', $default_shortcode_attributes);
88 88
 		// grab attributes and merge with defaults, then extract
89
-		$attributes = array_merge( $default_shortcode_attributes, $attributes );
89
+		$attributes = array_merge($default_shortcode_attributes, $attributes);
90 90
 
91 91
 		$template_args = array(
92 92
 			'contacts'      => array(),
@@ -102,31 +102,31 @@  discard block
 block discarded – undo
102 102
 		$error = false;
103 103
 
104 104
 		//what event?
105
-		if ( empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) && empty( $attributes['ticket_id'] ) ) {
105
+		if (empty($attributes['event_id']) && empty($attributes['datetime_id']) && empty($attributes['ticket_id'])) {
106 106
 			//seems like is_espresso_event_single() isn't working as expected. So using alternate method.
107
-			if ( is_single() && is_espresso_event() ) {
107
+			if (is_single() && is_espresso_event()) {
108 108
 				$event = EEH_Event_View::get_event();
109
-				if ( $event instanceof EE_Event ) {
109
+				if ($event instanceof EE_Event) {
110 110
 					$template_args['event']          = $event;
111 111
 					$query[0]['Registration.EVT_ID'] = $event->ID();
112 112
 				}
113 113
 			} else {
114 114
 				//try getting the earliest active event if none then get the
115
-				$events = EEM_Event::instance()->get_active_events( array( 'limit'    => 1,
116
-				                                                          'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
117
-				) );
118
-				$events = empty( $events ) ? EEM_Event::instance()->get_upcoming_events( array( 'limit'    => 1,
119
-				                                                                              'order_by' => array( 'Datetime.DTT_EVT_start' => 'ASC' )
120
-				) ) : $events;
121
-				$event = reset( $events );
122
-				if ( $event instanceof EE_Event ) {
115
+				$events = EEM_Event::instance()->get_active_events(array('limit'    => 1,
116
+				                                                          'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
117
+				));
118
+				$events = empty($events) ? EEM_Event::instance()->get_upcoming_events(array('limit'    => 1,
119
+				                                                                              'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
120
+				)) : $events;
121
+				$event = reset($events);
122
+				if ($event instanceof EE_Event) {
123 123
 					$query[0]['Registration.EVT_ID'] = $event->ID();
124 124
 					$template_args['event']          = $event;
125 125
 				}
126 126
 			}
127
-		} elseif ( ! empty( $attributes['event_id'] ) ) {
128
-			$event = EEM_Event::instance()->get_one_by_ID( $attributes['event_id'] );
129
-			if ( $event instanceof EE_Event ) {
127
+		} elseif ( ! empty($attributes['event_id'])) {
128
+			$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
129
+			if ($event instanceof EE_Event) {
130 130
 				$query[0]['Registration.EVT_ID'] = $attributes['event_id'];
131 131
 				$template_args['event']          = $event;
132 132
 			} else {
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 		}
136 136
 
137 137
 		//datetime?
138
-		if ( ! empty( $attributes['datetime_id'] ) && empty( $attributes['event_id'] ) ) {
139
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $attributes['datetime_id'] );
140
-			if ( $datetime instanceof EE_Datetime ) {
138
+		if ( ! empty($attributes['datetime_id']) && empty($attributes['event_id'])) {
139
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
140
+			if ($datetime instanceof EE_Datetime) {
141 141
 				$query[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
142 142
 				$query['default_where_conditions'] = 'this_model_only';
143 143
 				$template_args['datetime']                      = $datetime;
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 		}
149 149
 
150 150
 		//ticket?just
151
-		if ( ! empty( $attributes['ticket_id'] ) && empty( $attributes['event_id'] ) && empty( $attributes['datetime_id'] ) ) {
152
-			$ticket = EEM_Ticket::instance()->get_one_by_ID( $attributes['ticket_id'] );
153
-			if ( $ticket instanceof EE_Ticket ) {
151
+		if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
152
+			$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
153
+			if ($ticket instanceof EE_Ticket) {
154 154
 				$query[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
155 155
 				$template_args['ticket']         = $ticket;
156 156
 				$template_args['event']          = $ticket->first_datetime() instanceof EE_Datetime ? $ticket->first_datetime()->event() : null;
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
 
162 162
 		//status
163 163
 		$reg_status_array = EEM_Registration::reg_status_array();
164
-		if ( $attributes['status'] != 'all' && isset( $reg_status_array[$attributes['status']] ) ) {
164
+		if ($attributes['status'] != 'all' && isset($reg_status_array[$attributes['status']])) {
165 165
 			$query[0]['Registration.STS_ID'] = $attributes['status'];
166 166
 		}
167
-		$query['group_by'] = array( 'ATT_ID' );
168
-		$query['order_by'] = apply_filters( 'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array( 'ATT_lname' => 'ASC', 'ATT_fname' => 'ASC' ) );
167
+		$query['group_by'] = array('ATT_ID');
168
+		$query['order_by'] = apply_filters('FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by', array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC'));
169 169
 
170 170
 		//if we have NO query where conditions, then there was an invalid parameter or the shortcode was used incorrectly
171 171
 		//so when WP_DEBUG is set and true, we'll show a message, otherwise we'll just return an empty string.
172
-		if ( ( ! isset( $query[0] ) || ! is_array( $query[0] ) ) || $error ) {
173
-			if ( WP_DEBUG ) {
174
-				return '<div class="important-notice ee-attention">' . __( 'The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso' ) . '</div>';
172
+		if (( ! isset($query[0]) || ! is_array($query[0])) || $error) {
173
+			if (WP_DEBUG) {
174
+				return '<div class="important-notice ee-attention">'.__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.', 'event_espresso').'</div>';
175 175
 			} else {
176 176
 				return '';
177 177
 			}
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 
180 180
 
181 181
 		//get contacts!
182
-		$template_args['contacts'] = EEM_Attendee::instance()->get_all( $query );
182
+		$template_args['contacts'] = EEM_Attendee::instance()->get_all($query);
183 183
 
184 184
 
185 185
 		//all set let's load up the template and return.
186
-		return EEH_Template::locate_template( 'loop-espresso_event_attendees.php', $template_args, true, true );
186
+		return EEH_Template::locate_template('loop-espresso_event_attendees.php', $template_args, true, true);
187 187
 
188 188
 	}
189 189
 
Please login to merge, or discard this patch.
shortcodes/espresso_events/EES_Espresso_Events.shortcode.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 * @param WP $WP
51 51
 	 * @return    void
52 52
 	 */
53
-	public function run( WP $WP ) {
54
-		if ( did_action( 'pre_get_posts' ) && did_action( 'send_headers' ) ) {
53
+	public function run(WP $WP) {
54
+		if (did_action('pre_get_posts') && did_action('send_headers')) {
55 55
 			EED_Events_Archive::instance()->event_list();
56 56
 		} else {
57 57
 			// this will trigger the EED_Events_Archive module's event_list() method during the pre_get_posts hook point,
58 58
 			// this allows us to initialize things, enqueue assets, etc,
59 59
 			// as well, this saves an instantiation of the module in an array using 'espresso_events' as the key, so that we can retrieve it
60
-			add_action( 'pre_get_posts', array( EED_Events_Archive::instance(), 'event_list' ) );
60
+			add_action('pre_get_posts', array(EED_Events_Archive::instance(), 'event_list'));
61 61
 		}
62 62
 	}
63 63
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
 	 *  @param 	array 	$attributes
80 80
 	 *  @return 	string
81 81
 	 */
82
-	public function process_shortcode( $attributes = array() ) {
82
+	public function process_shortcode($attributes = array()) {
83 83
 		// make sure EED_Events_Archive is setup properly
84
-		if ( apply_filters( 'FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE )) {
84
+		if (apply_filters('FHEE__fallback_shortcode_processor__EES_Espresso_Events', FALSE)) {
85 85
 			EED_Events_Archive::instance()->event_list();
86 86
 		}
87 87
 		// merge in any attributes passed via fallback shortcode processor
88
-		$attributes = array_merge( (array)$attributes, (array)$this->_attributes );
88
+		$attributes = array_merge((array) $attributes, (array) $this->_attributes);
89 89
 		//set default attributes
90 90
 		$default_espresso_events_shortcode_atts = array(
91 91
 			'title' => NULL,
@@ -99,26 +99,26 @@  discard block
 block discarded – undo
99 99
 			'fallback_shortcode_processor' => FALSE
100 100
 		);
101 101
 		// allow the defaults to be filtered
102
-		$default_espresso_events_shortcode_atts = apply_filters( 'EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts );
102
+		$default_espresso_events_shortcode_atts = apply_filters('EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts', $default_espresso_events_shortcode_atts);
103 103
 		// grab attributes and merge with defaults, then extract
104
-		$attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes );
104
+		$attributes = array_merge($default_espresso_events_shortcode_atts, $attributes);
105 105
 		// make sure we use the_excerpt()
106
-		add_filter( 'FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true' );
106
+		add_filter('FHEE__EES_Espresso_Events__process_shortcode__true', '__return_true');
107 107
 		// apply query filters
108
-		add_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' );
108
+		add_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
109 109
 		// run the query
110 110
 		global $wp_query;
111
-		$wp_query = new EE_Event_List_Query( $attributes );
111
+		$wp_query = new EE_Event_List_Query($attributes);
112 112
 		// check what template is loaded and load filters accordingly
113
-		EED_Events_Archive::instance()->template_include( 'loop-espresso_events.php' );
113
+		EED_Events_Archive::instance()->template_include('loop-espresso_events.php');
114 114
 		// load our template
115
-		$event_list = EEH_Template::locate_template( 'loop-espresso_events.php', array(), TRUE, TRUE );
115
+		$event_list = EEH_Template::locate_template('loop-espresso_events.php', array(), TRUE, TRUE);
116 116
 		// now reset the query and postdata
117 117
 		wp_reset_query();
118 118
 		wp_reset_postdata();
119 119
 		EED_Events_Archive::remove_all_events_archive_filters();
120 120
 		// remove query filters
121
-		remove_filter( 'FHEE__EEH_Event_Query__apply_query_filters', '__return_true' );
121
+		remove_filter('FHEE__EEH_Event_Query__apply_query_filters', '__return_true');
122 122
 		// pull our content from the output buffer and return it
123 123
 		return $event_list;
124 124
 	}
@@ -163,44 +163,44 @@  discard block
 block discarded – undo
163 163
 	 * @param array $args
164 164
 	 * @return \EE_Event_List_Query
165 165
 	 */
166
-	function __construct( $args = array() ) {
166
+	function __construct($args = array()) {
167 167
 //		EEH_Debug_Tools::printr( $args, '$args  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
168 168
 		// incoming args could be a mix of WP query args + EE shortcode args
169
-		foreach ( $args as $key =>$value ) {
170
-			$property = '_' . $key;
169
+		foreach ($args as $key =>$value) {
170
+			$property = '_'.$key;
171 171
 			// if the arg is a property of this class, then it's an EE shortcode arg
172
-			if ( property_exists( $this, $property )) {
172
+			if (property_exists($this, $property)) {
173 173
 				// set the property value
174 174
 				$this->{$property} = $value;
175 175
 				// then remove it from the array of args that will later be passed to WP_Query()
176
-				unset( $args[ $key ] );
176
+				unset($args[$key]);
177 177
 			}
178 178
 		}
179 179
 		//add query filters
180 180
 		EEH_Event_Query::add_query_filters();
181 181
 		// set params that will get used by the filters
182
-		EEH_Event_Query::set_query_params( $this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort );
182
+		EEH_Event_Query::set_query_params($this->_month, $this->_category_slug, $this->_show_expired, $this->_order_by, $this->_sort);
183 183
 		// first off, let's remove any filters from previous queries
184
-		remove_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ));
185
-		remove_all_filters( 'FHEE__content_espresso_events__event_class' );
184
+		remove_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'));
185
+		remove_all_filters('FHEE__content_espresso_events__event_class');
186 186
 		// Event List Title ?
187
-		add_filter( 'FHEE__archive_espresso_events_template__upcoming_events_h1', array( $this, 'event_list_title' ), 10, 1 );
187
+		add_filter('FHEE__archive_espresso_events_template__upcoming_events_h1', array($this, 'event_list_title'), 10, 1);
188 188
 		// add the css class
189
-		add_filter( 'FHEE__content_espresso_events__event_class', array( $this, 'event_list_css' ), 10, 1 );
189
+		add_filter('FHEE__content_espresso_events__event_class', array($this, 'event_list_css'), 10, 1);
190 190
 		// the current "page" we are viewing
191
-		$paged = max( 1, get_query_var( 'paged' ));
191
+		$paged = max(1, get_query_var('paged'));
192 192
 		// Force these args
193
-		$args = array_merge( $args, array(
193
+		$args = array_merge($args, array(
194 194
 			'post_type' => 'espresso_events',
195 195
 			'posts_per_page' => $this->_limit,
196 196
 			'update_post_term_cache' => FALSE,
197 197
 			'update_post_meta_cache' => FALSE,
198 198
 			'paged' => $paged,
199
-			'offset' => ( $paged - 1 ) * $this->_limit
199
+			'offset' => ($paged - 1) * $this->_limit
200 200
 		));
201 201
 
202 202
 		// run the query
203
-		parent::__construct( $args );
203
+		parent::__construct($args);
204 204
 	}
205 205
 
206 206
 
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 * @param string $event_list_title
214 214
 	 * @return    string
215 215
 	 */
216
-	public function event_list_title( $event_list_title = '' ) {
217
-		if ( ! empty( $this->_title )) {
216
+	public function event_list_title($event_list_title = '') {
217
+		if ( ! empty($this->_title)) {
218 218
 			return $this->_title;
219 219
 		}
220 220
 		return $event_list_title;
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
 	 * @param string $event_list_css
230 230
 	 * @return    array
231 231
 	 */
232
-	public function event_list_css( $event_list_css = '' ) {
233
-		$event_list_css .=  ! empty( $event_list_css ) ? ' ' : '';
234
-		$event_list_css .=  ! empty( $this->_css_class ) ? $this->_css_class : '';
235
-		$event_list_css .=  ! empty( $event_list_css ) ? ' ' : '';
236
-		$event_list_css .=  ! empty( $this->_category_slug ) ? $this->_category_slug : '';
232
+	public function event_list_css($event_list_css = '') {
233
+		$event_list_css .= ! empty($event_list_css) ? ' ' : '';
234
+		$event_list_css .= ! empty($this->_css_class) ? $this->_css_class : '';
235
+		$event_list_css .= ! empty($event_list_css) ? ' ' : '';
236
+		$event_list_css .= ! empty($this->_category_slug) ? $this->_category_slug : '';
237 237
 		return $event_list_css;
238 238
 	}
239 239
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
 	 * All children of this must call parent::__construct() at the end of their constructor or suffer the consequences!
118 118
 	 */
119 119
 	public function __construct() {
120
-		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages',$this->_migration_stages);
121
-		foreach($this->_migration_stages as $migration_stage){
122
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
120
+		$this->_migration_stages = apply_filters('FHEE__'.get_class($this).'__construct__migration_stages', $this->_migration_stages);
121
+		foreach ($this->_migration_stages as $migration_stage) {
122
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
123 123
 				$migration_stage->_construct_finalize($this);
124 124
 			}
125 125
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * Place to add hooks and filters for tweaking the migrations page, in order
133 133
 	 * to customize it
134 134
 	 */
135
-	public function migration_page_hooks(){
135
+	public function migration_page_hooks() {
136 136
 		//by default none are added because we normally like the default look of the migration page
137 137
 	}
138 138
 
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @param int|string $new_pk eg posts.ID
148 148
 	 * @return void
149 149
 	 */
150
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
150
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
151 151
 		//make sure it has the needed keys
152
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
152
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
153 153
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
154 154
 		}
155 155
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
166 166
 	 * @return mixed the primary key on the new table
167 167
 	 */
168
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
169
-		if( ! isset($this->_mappings[$old_table]) ||
170
-			! isset($this->_mappings[$old_table][$new_table])){
168
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
169
+		if ( ! isset($this->_mappings[$old_table]) ||
170
+			! isset($this->_mappings[$old_table][$new_table])) {
171 171
 			//try fetching the option
172 172
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
173 173
 		}
@@ -184,15 +184,15 @@  discard block
 block discarded – undo
184 184
 	 * @param mixed $new_pk
185 185
 	 * @return mixed
186 186
 	 */
187
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
188
-		if( ! isset($this->_mappings[$old_table]) ||
189
-			! isset($this->_mappings[$old_table][$new_table])){
187
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
188
+		if ( ! isset($this->_mappings[$old_table]) ||
189
+			! isset($this->_mappings[$old_table][$new_table])) {
190 190
 			//try fetching the option
191 191
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
192 192
 		}
193
-		if(isset($this->_mappings[$old_table][$new_table])){
193
+		if (isset($this->_mappings[$old_table][$new_table])) {
194 194
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
195
-			if(isset($new_pk_to_old_pk[$new_pk])){
195
+			if (isset($new_pk_to_old_pk[$new_pk])) {
196 196
 				return $new_pk_to_old_pk[$new_pk];
197 197
 			}
198 198
 		}
@@ -207,8 +207,8 @@  discard block
 block discarded – undo
207 207
 	 * @param string $new_table_name
208 208
 	 * @return array
209 209
 	 */
210
-	protected function _get_mapping_option($old_table_name,$new_table_name){
211
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
210
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
211
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
212 212
 		return $option;
213 213
 	}
214 214
 
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
 	 * @param array $mapping_array
222 222
 	 * @return boolean success of updating option
223 223
 	 */
224
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
224
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
225 225
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
226
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
226
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
227 227
 		return $success;
228 228
 	}
229 229
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param string $new_table_name
236 236
 	 * @return string
237 237
 	 */
238
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
238
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
239 239
 		global $wpdb;
240
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
241
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
240
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
241
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
242 242
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
243
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
243
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
244 244
 	}
245 245
 
246 246
 
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
258 258
 	 * @return int
259 259
 	 */
260
-	protected function _count_records_to_migrate(){
260
+	protected function _count_records_to_migrate() {
261 261
 		$count = 0;
262
-		foreach($this->stages() as $stage){
263
-			$count+= $stage->count_records_to_migrate();
262
+		foreach ($this->stages() as $stage) {
263
+			$count += $stage->count_records_to_migrate();
264 264
 		}
265 265
 		return $count;
266 266
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * by just setting a transient and updating it after each migration_step
273 273
 	 * @return int
274 274
 	 */
275
-	public function count_records_migrated(){
275
+	public function count_records_migrated() {
276 276
 		$count = 0;
277
-		foreach($this->stages() as $stage){
278
-			$count+= $stage->count_records_migrated();
277
+		foreach ($this->stages() as $stage) {
278
+			$count += $stage->count_records_migrated();
279 279
 		}
280 280
 		$this->_records_migrated = $count;
281 281
 		return $count;
@@ -289,24 +289,24 @@  discard block
 block discarded – undo
289 289
 	 * @throws EE_Error
290 290
 	 * @throws Exception
291 291
 	 */
292
-	public function migration_step($num_records_to_migrate_limit){
292
+	public function migration_step($num_records_to_migrate_limit) {
293 293
 		//reset the feedback message
294 294
 		$this->_feedback_message = '';
295 295
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
296 296
 		$this->_maybe_do_schema_changes(true);
297 297
 
298
-		$num_records_actually_migrated =0;
298
+		$num_records_actually_migrated = 0;
299 299
 		$records_migrated_per_stage = array();
300 300
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
301 301
 		$stage = null;
302 302
 		//get the next stage that isn't complete
303
-		foreach($this->stages() as $stage){
304
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
305
-				try{
303
+		foreach ($this->stages() as $stage) {
304
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
305
+				try {
306 306
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
307 307
 					$num_records_actually_migrated += $records_migrated_during_stage;
308 308
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
309
-				}catch(Exception $e){
309
+				} catch (Exception $e) {
310 310
 					//yes if we catch an exception here, we consider that migration stage borked.
311 311
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
312 312
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 					throw $e;
315 315
 				}
316 316
 				//check that the migration stage didn't mark itself as having a fatal error
317
-				if($stage->is_broken()){
317
+				if ($stage->is_broken()) {
318 318
 					$this->set_broken();
319 319
 					throw new EE_Error($stage->get_last_error());
320 320
 				}
@@ -322,24 +322,24 @@  discard block
 block discarded – undo
322 322
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
323 323
 			//or if we had a fatal error
324 324
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
325
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
325
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
326 326
 				break;
327 327
 			}
328 328
 		}
329 329
 		//check if we're all done this data migration...
330 330
 		//which is indicated by being done early AND the last stage claims to be done
331
-		if($stage == NULL){
331
+		if ($stage == NULL) {
332 332
 			//this migration script apparently has NO stages... which is super weird, but whatever
333 333
 			$this->set_completed();
334 334
 			$this->_maybe_do_schema_changes(false);
335
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
335
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
336 336
 			//apparently we're done, because we couldn't migrate the number we intended to
337 337
 			$this->set_completed();
338 338
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
339 339
 			//do schema changes for after the migration now
340 340
 			//first double-check we haven't already done this
341 341
 			$this->_maybe_do_schema_changes(false);
342
-		}else{
342
+		} else {
343 343
 			//update feedback message, keeping in mind that we show them with the most recent at the top
344 344
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
345 345
 		}
@@ -353,12 +353,12 @@  discard block
 block discarded – undo
353 353
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
354 354
 	 * @return void
355 355
 	 */
356
-	private function _update_feedback_message($records_migrated_per_stage){
356
+	private function _update_feedback_message($records_migrated_per_stage) {
357 357
 		$feedback_message_array = array();
358
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
359
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
358
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
359
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
360 360
 		}
361
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
361
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
362 362
 	}
363 363
 
364 364
 
@@ -370,27 +370,27 @@  discard block
 block discarded – undo
370 370
 	 * @throws Exception
371 371
 	 * @return void
372 372
 	 */
373
-	private function _maybe_do_schema_changes($before = true){
373
+	private function _maybe_do_schema_changes($before = true) {
374 374
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
375
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
376
-		if ( ! $this->{$property_name} ){
377
-			try{
375
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
376
+		if ( ! $this->{$property_name} ) {
377
+			try {
378 378
 				ob_start();
379
-				if($before){
379
+				if ($before) {
380 380
 					$this->schema_changes_before_migration();
381
-				}else{
381
+				} else {
382 382
 					$this->schema_changes_after_migration();
383 383
 				}
384 384
 				$output = ob_get_contents();
385 385
 				ob_end_clean();
386
-			}catch(Exception $e){
386
+			} catch (Exception $e) {
387 387
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
388 388
 				throw $e;
389 389
 			}
390 390
 			//record that we've done these schema changes
391 391
 			$this->{$property_name} = true;
392 392
 			//if there were any warnings etc, record them as non-fatal errors
393
-			if( $output ){
393
+			if ($output) {
394 394
 				//there were some warnings
395 395
 				$this->_errors[] = $output;
396 396
 			}
@@ -417,9 +417,9 @@  discard block
 block discarded – undo
417 417
 	 * @param string $table_definition_sql
418 418
 	 * @param string $engine_string
419 419
 	 */
420
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
420
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
421 421
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name );
422
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  true ) );
422
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true));
423 423
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name  );
424 424
 	}
425 425
 
@@ -433,9 +433,9 @@  discard block
 block discarded – undo
433 433
 	 * @param string $table_definition_sql
434 434
 	 * @param string $engine_string
435 435
 	 */
436
-	protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
436
+	protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
437 437
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name );
438
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
438
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
439 439
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name  );
440 440
 	}
441 441
 
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
 	 * @param string $table_name
447 447
 	 * @return boolean
448 448
 	 */
449
-	protected function _old_table_exists( $table_name ) {
450
-		return EEH_Activation::table_exists( $table_name );
449
+	protected function _old_table_exists($table_name) {
450
+		return EEH_Activation::table_exists($table_name);
451 451
 	}
452 452
 
453 453
 
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 	 * @param string $table_name
458 458
 	 * @return boolean
459 459
 	 */
460
-	protected function _delete_table_if_empty( $table_name ) {
461
-		return EEH_Activation::delete_db_table_if_empty( $table_name );
460
+	protected function _delete_table_if_empty($table_name) {
461
+		return EEH_Activation::delete_db_table_if_empty($table_name);
462 462
 	}
463 463
 
464 464
 
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 	 * @param string $table_definition_sql
478 478
 	 * @param string $engine_string
479 479
 	 */
480
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
480
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
481 481
 //		EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name );
482
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
482
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
483 483
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
484 484
 	}
485 485
 
@@ -494,13 +494,13 @@  discard block
 block discarded – undo
494 494
 	 * @param string $table_definition_sql
495 495
 	 * @param string $engine_string
496 496
 	 */
497
-	protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
498
-		if( $this->_currently_migrating() ) {
497
+	protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
498
+		if ($this->_currently_migrating()) {
499 499
 			//if we're doing a migration, and this table apparently already exists, then we don't need do anything right?
500 500
 //			EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
501 501
 			return;
502 502
 		}
503
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
503
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
504 504
 	}
505 505
 
506 506
 	/**
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	protected function _currently_migrating() {
511 511
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
512 512
 		return $this->_migrating &&
513
-					$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
513
+					$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
514 514
 					EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
515 515
 	}
516 516
 
@@ -521,17 +521,17 @@  discard block
 block discarded – undo
521 521
 	 * @param boolean $table_is_new
522 522
 	 * @return boolean
523 523
 	 */
524
-	protected function _pre_existing_table_should_be_dropped( $table_is_new ) {
525
-		if( $table_is_new ) {
526
-			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
524
+	protected function _pre_existing_table_should_be_dropped($table_is_new) {
525
+		if ($table_is_new) {
526
+			if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) {
527 527
 				return true;
528
-			}else{
528
+			} else {
529 529
 				return false;
530 530
 			}
531
-		}else{
532
-			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
531
+		} else {
532
+			if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
533 533
 				return true;
534
-			}else{
534
+			} else {
535 535
 				return false;
536 536
 			}
537 537
 		}
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
 	 * @param string $engine_string
545 545
 	 * @param boolean $drop_pre_existing_tables
546 546
 	 */
547
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
548
-		try{
549
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
550
-		}catch( EE_Error $e ) {
551
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
552
-			$this->add_error( $message  );
547
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
548
+		try {
549
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
550
+		} catch (EE_Error $e) {
551
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
552
+			$this->add_error($message);
553 553
 			$this->_feedback_message .= $message;
554 554
 		}
555 555
 	}
@@ -561,15 +561,15 @@  discard block
 block discarded – undo
561 561
 	 * @return int one of EE_System::_req_type_* constants
562 562
 	 * @throws EE_Error
563 563
 	 */
564
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
565
-		if($this->slug() == 'Core'){
564
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
565
+		if ($this->slug() == 'Core') {
566 566
 			return EE_System::instance()->detect_req_type();
567
-		}else{//it must be for an addon
567
+		} else {//it must be for an addon
568 568
 			$addon_name = $this->slug();
569
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
569
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
570 570
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
571
-			}else{
572
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
571
+			} else {
572
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
573 573
 			}
574 574
 		}
575 575
 	}
@@ -580,13 +580,13 @@  discard block
 block discarded – undo
580 580
 	 * returns an array of strings describing errors by all the script's stages
581 581
 	 * @return array
582 582
 	 */
583
-	public function get_errors(){
583
+	public function get_errors() {
584 584
 		$all_errors = $this->_errors;
585
-		if( ! is_array($all_errors)){
585
+		if ( ! is_array($all_errors)) {
586 586
 			$all_errors = array();
587 587
 		}
588
-		foreach($this->stages() as $stage){
589
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
588
+		foreach ($this->stages() as $stage) {
589
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
590 590
 		}
591 591
 		return $all_errors;
592 592
 	}
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 	 * Indicates whether or not this migration script should continue
598 598
 	 * @return boolean
599 599
 	 */
600
-	public function can_continue(){
601
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
600
+	public function can_continue() {
601
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
602 602
 	}
603 603
 
604 604
 
@@ -610,8 +610,8 @@  discard block
 block discarded – undo
610 610
 	 * get ordered by the indexes
611 611
 	 * @return EE_Data_Migration_Script_Stage[]
612 612
 	 */
613
-	protected function stages(){
614
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
613
+	protected function stages() {
614
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
615 615
 		ksort($stages);
616 616
 		return $stages;
617 617
 	}
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 * can be displayed to the user
624 624
 	 * @return string
625 625
 	 */
626
-	public function get_feedback_message(){
626
+	public function get_feedback_message() {
627 627
 		return $this->_feedback_message;
628 628
 	}
629 629
 
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
636 636
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
637 637
 	 */
638
-	public function properties_as_array(){
638
+	public function properties_as_array() {
639 639
 		$properties = parent::properties_as_array();
640 640
 		$properties['_migration_stages'] = array();
641
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
641
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
642 642
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
643 643
 		}
644 644
 		unset($properties['_mappings']);
645 645
 
646
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
647
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
646
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
647
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
648 648
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
649 649
 			}
650 650
 		}
@@ -659,19 +659,19 @@  discard block
 block discarded – undo
659 659
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
660 660
 	 * @return void
661 661
 	 */
662
-	public function instantiate_from_array_of_properties($array_of_properties){
662
+	public function instantiate_from_array_of_properties($array_of_properties) {
663 663
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
664 664
 		unset($array_of_properties['_migration_stages']);
665 665
 		unset($array_of_properties['class']);
666
-		foreach($array_of_properties as $property_name => $property_value){
666
+		foreach ($array_of_properties as $property_name => $property_value) {
667 667
 			$this->{$property_name} = $property_value;
668 668
 		}
669 669
 		//_migration_stages are already instantiated, but have only default data
670
-		foreach($this->_migration_stages as $stage){
671
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
670
+		foreach ($this->_migration_stages as $stage) {
671
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
672 672
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
673 673
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
674
-			if($stage_data){
674
+			if ($stage_data) {
675 675
 				$stage->instantiate_from_array_of_properties($stage_data);
676 676
 			}
677 677
 		}
@@ -687,9 +687,9 @@  discard block
 block discarded – undo
687 687
 	 * @param array $migration_stage_data_arrays
688 688
 	 * @return null
689 689
 	 */
690
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
691
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
692
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
690
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
691
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
692
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
693 693
 				return $migration_stage_data_array;
694 694
 			}
695 695
 		}
@@ -705,8 +705,8 @@  discard block
 block discarded – undo
705 705
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
706 706
 	 * that will be updated to. Eg array('Core','4.1.0')
707 707
 	 */
708
-	public final function migrates_to_version(){
709
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
708
+	public final function migrates_to_version() {
709
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
710 710
 	}
711 711
 
712 712
 
@@ -718,10 +718,10 @@  discard block
 block discarded – undo
718 718
 	 * Or 'Core' for core (non-addon).
719 719
 	 * @return string
720 720
 	 */
721
-	public function slug(){
721
+	public function slug() {
722 722
 		$migrates_to_version_info = $this->migrates_to_version();
723 723
 		//the slug is the first part of the array
724
-		return $migrates_to_version_info[ 'slug' ];
724
+		return $migrates_to_version_info['slug'];
725 725
 	}
726 726
 
727 727
 
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
736 736
 	 * @return int
737 737
 	 */
738
-	public function priority(){
738
+	public function priority() {
739 739
 		return $this->_priority;
740 740
 	}
741 741
 
@@ -748,18 +748,18 @@  discard block
 block discarded – undo
748 748
 	 * @param boolean $migrating
749 749
 	 * @return void
750 750
 	 */
751
-	public function set_migrating( $migrating = TRUE ){
751
+	public function set_migrating($migrating = TRUE) {
752 752
 		$this->_migrating = $migrating;
753 753
 	}
754 754
 
755 755
 	/**
756 756
 	 * Marks that we think this migration class can continue to migrate
757 757
 	 */
758
-	public function reattempt(){
758
+	public function reattempt() {
759 759
 		parent::reattempt();
760 760
 		//also, we want to reattempt any stages that were marked as borked
761
-		foreach( $this->stages() as $stage ) {
762
-			if( $stage->is_broken() ) {
761
+		foreach ($this->stages() as $stage) {
762
+			if ($stage->is_broken()) {
763 763
 				$stage->reattempt();
764 764
 			}
765 765
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 // (all other times it gets resurrected from a wordpress option)
15 15
 $stages = glob(EE_CORE.'data_migration_scripts/4_7_0_stages/*');
16 16
 $class_to_filepath = array();
17
-foreach($stages as $filepath){
17
+foreach ($stages as $filepath) {
18 18
 	$matches = array();
19
-	preg_match('~4_7_0_stages/(.*).dmsstage.php~',$filepath,$matches);
19
+	preg_match('~4_7_0_stages/(.*).dmsstage.php~', $filepath, $matches);
20 20
 	$class_to_filepath[$matches[1]] = $filepath;
21 21
 }
22 22
 //give addons a chance to autoload their stages too
23
-$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages',$class_to_filepath);
23
+$class_to_filepath = apply_filters('FHEE__EE_DMS_4_7_0__autoloaded_stages', $class_to_filepath);
24 24
 EEH_Autoloader::register_autoloader($class_to_filepath);
25 25
 
26 26
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * @since                4.7.0
37 37
  *
38 38
  */
39
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
39
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
40 40
 
41 41
 	/**
42 42
 	 * return EE_DMS_Core_4_7_0
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 	public function can_migrate_from_version($version_array) {
61 61
 		$version_string = $version_array['Core'];
62 62
 		if (
63
-			( $version_string <= '4.7.0' && $version_string >= '4.6.0' )
63
+			($version_string <= '4.7.0' && $version_string >= '4.6.0')
64 64
 			||
65
-			( $version_string >= '4.7.0' &&
66
-					! EEH_Activation::table_exists( 'esp_registration_payment' ) &&
67
-					EEH_Activation::table_exists( 'esp_registration' ) ) ) {
65
+			($version_string >= '4.7.0' &&
66
+					! EEH_Activation::table_exists('esp_registration_payment') &&
67
+					EEH_Activation::table_exists('esp_registration')) ) {
68 68
 			return true;
69
-		} elseif ( ! $version_string ) {
69
+		} elseif ( ! $version_string) {
70 70
 			//no version string provided... this must be pre 4.3
71
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
71
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
72 72
 		} else {
73 73
 			return false;
74 74
 		}
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function schema_changes_before_migration() {
92 92
 		//relies on 4.1's EEH_Activation::create_table
93
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
94
-		$table_name='esp_answer';
95
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
93
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
94
+		$table_name = 'esp_answer';
95
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
96 96
 					REG_ID INT UNSIGNED NOT NULL,
97 97
 					QST_ID INT UNSIGNED NOT NULL,
98 98
 					ANS_value TEXT NOT NULL,
99 99
 					PRIMARY KEY  (ANS_ID),
100 100
 					KEY REG_ID (REG_ID),
101 101
 					KEY QST_ID (QST_ID)";
102
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
102
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
103 103
 
104 104
 		$table_name = 'esp_attendee_meta';
105 105
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
140 140
 					  CNT_active TINYINT(1) DEFAULT '0',
141 141
 					  PRIMARY KEY  (CNT_ISO)";
142
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
142
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
143 143
 
144 144
 		$table_name = 'esp_currency';
145 145
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
150 150
 				CUR_active TINYINT(1) DEFAULT '0',
151 151
 				PRIMARY KEY  (CUR_code)";
152
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
152
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
153 153
 
154 154
 
155 155
 		$table_name = 'esp_currency_payment_method';
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 						KEY EVT_ID (EVT_ID),
180 180
 						KEY DTT_is_primary (DTT_is_primary)";
181 181
 
182
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
182
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
183 183
 
184 184
 		$table_name = 'esp_event_meta';
185 185
 		$sql = "
@@ -198,44 +198,44 @@  discard block
 block discarded – undo
198 198
 			EVT_donations TINYINT(1) NULL,
199 199
 			PRIMARY KEY  (EVTM_ID),
200 200
 			KEY EVT_ID (EVT_ID)";
201
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
201
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
202 202
 
203 203
 
204 204
 
205
-		$table_name='esp_event_question_group';
206
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
205
+		$table_name = 'esp_event_question_group';
206
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
207 207
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
208 208
 					QSG_ID INT UNSIGNED NOT NULL,
209 209
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
210 210
 					PRIMARY KEY  (EQG_ID),
211 211
 					KEY EVT_ID (EVT_ID),
212 212
 					KEY QSG_ID (QSG_ID)";
213
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
213
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
214 214
 
215 215
 
216 216
 
217
-		$table_name='esp_event_venue';
218
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
217
+		$table_name = 'esp_event_venue';
218
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
219 219
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
220 220
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
221 221
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
222 222
 				PRIMARY KEY  (EVV_ID)";
223
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
223
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
224 224
 
225 225
 
226 226
 
227
-		$table_name='esp_extra_meta';
228
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
227
+		$table_name = 'esp_extra_meta';
228
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
229 229
 				OBJ_ID INT(11) DEFAULT NULL,
230 230
 				EXM_type VARCHAR(45) DEFAULT NULL,
231 231
 				EXM_key VARCHAR(45) DEFAULT NULL,
232 232
 				EXM_value TEXT,
233 233
 				PRIMARY KEY  (EXM_ID),
234 234
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
235
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
235
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
236 236
 
237
-		$table_name='esp_line_item';
238
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
237
+		$table_name = 'esp_line_item';
238
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
239 239
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
240 240
 				TXN_ID INT(11) DEFAULT NULL,
241 241
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 				PRIMARY KEY  (LIN_ID),
254 254
 				KEY LIN_code (LIN_code(191)),
255 255
 				KEY TXN_ID (TXN_ID)";
256
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
256
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
257 257
 
258 258
 		$table_name = 'esp_log';
259 259
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
294 294
 					PRIMARY KEY  (GRP_ID),
295 295
 					KEY MTP_user_id (MTP_user_id)";
296
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
296
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
297 297
 
298 298
 		$table_name = 'esp_event_message_template';
299 299
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 					PRIMARY KEY  (EMT_ID),
303 303
 					KEY EVT_ID (EVT_ID),
304 304
 					KEY GRP_ID (GRP_ID)";
305
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
305
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
306 306
 
307 307
 
308 308
 		$table_name = 'esp_payment';
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 					  PRIMARY KEY  (TTM_ID)";
376 376
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
377 377
 
378
-		$table_name='esp_question';
379
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
378
+		$table_name = 'esp_question';
379
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
380 380
 					QST_display_text TEXT NOT NULL,
381 381
 					QST_admin_label VARCHAR(255) NOT NULL,
382 382
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -389,22 +389,22 @@  discard block
 block discarded – undo
389 389
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
390 390
 					PRIMARY KEY  (QST_ID),
391 391
 					KEY QST_order (QST_order)';
392
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
392
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
393 393
 
394
-		$table_name='esp_question_group_question';
395
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
394
+		$table_name = 'esp_question_group_question';
395
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
396 396
 					QSG_ID INT UNSIGNED NOT NULL,
397 397
 					QST_ID INT UNSIGNED NOT NULL,
398 398
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
399 399
 					PRIMARY KEY  (QGQ_ID),
400 400
 					KEY QST_ID (QST_ID),
401 401
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
402
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
402
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
403 403
 
404 404
 
405 405
 
406
-		$table_name='esp_question_option';
407
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
406
+		$table_name = 'esp_question_option';
407
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
408 408
 					QSO_value VARCHAR(255) NOT NULL,
409 409
 					QSO_desc TEXT NOT NULL,
410 410
 					QST_ID INT UNSIGNED NOT NULL,
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 					PRIMARY KEY  (QSO_ID),
414 414
 					KEY QST_ID (QST_ID),
415 415
 					KEY QSO_order (QSO_order)";
416
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
416
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
417 417
 
418 418
 
419 419
 
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 
460 460
 
461 461
 
462
-		$table_name='esp_checkin';
463
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
462
+		$table_name = 'esp_checkin';
463
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
464 464
 					REG_ID INT(10) UNSIGNED NOT NULL,
465 465
 					DTT_ID INT(10) UNSIGNED NOT NULL,
466 466
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
556 556
 					  PRIMARY KEY  (PRC_ID),
557 557
 					  KEY PRT_ID (PRT_ID)";
558
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
558
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
559 559
 
560 560
 		$table_name = "esp_price_type";
561 561
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -593,10 +593,10 @@  discard block
 block discarded – undo
593 593
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
594 594
 					  PRIMARY KEY  (TKT_ID),
595 595
 					  KEY TKT_start_date (TKT_start_date)";
596
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
596
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
597 597
 
598 598
 		$table_name = 'esp_question_group';
599
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
599
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
600 600
 					QSG_name VARCHAR(255) NOT NULL,
601 601
 					QSG_identifier VARCHAR(100) NOT NULL,
602 602
 					QSG_desc TEXT NULL,
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 					PRIMARY KEY  (QSG_ID),
610 610
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
611 611
 					KEY QSG_order (QSG_order)';
612
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
612
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
613 613
 
614 614
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
615 615
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 		return true;
642 642
 	}
643 643
 
644
-	public function migration_page_hooks(){
644
+	public function migration_page_hooks() {
645 645
 
646 646
 	}
647 647
 }
Please login to merge, or discard this patch.
4_5_0_stages/EE_DMS_4_5_0_invoice_settings.dmsstage.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * Just initializes the status of the migration
30 30
 	 */
31 31
 	public function __construct() {
32
-		$this->_pretty_name = __( 'Update Invoice Gateway Settings', 'event_espresso' );
32
+		$this->_pretty_name = __('Update Invoice Gateway Settings', 'event_espresso');
33 33
 		parent::__construct();
34 34
 	}
35 35
 
@@ -56,39 +56,39 @@  discard block
 block discarded – undo
56 56
 	 * @throws EE_Error
57 57
 	 * @return int number of items ACTUALLY migrated
58 58
 	 */
59
-	protected function _migration_step( $num_items = 1 ){
59
+	protected function _migration_step($num_items = 1) {
60 60
 		// if this isn't set then something is really wrong
61
-		if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config ) {
62
-			throw new EE_Error( __( 'It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso' ));
61
+		if ( ! EE_Config::instance()->gateway instanceof EE_Gateway_Config) {
62
+			throw new EE_Error(__('It appears the Event Espresso Core Configuration is not setup correctly.', 'event_espresso'));
63 63
 		}
64
-		$invoice_settings = isset( EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] ) ? EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] : NULL;
65
-		if( ! $invoice_settings ){
66
-			$this->add_error( __( 'Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso' ) );
67
-		}else{
68
-			$invoice_settings[ 'template_payment_instructions' ] = $invoice_settings[ 'pdf_instructions' ];
69
-			$invoice_settings[ 'template_invoice_payee_name' ] = $invoice_settings[ 'payable_to' ];
70
-			$invoice_settings[ 'template_invoice_address' ] = $invoice_settings[ 'payment_address' ];
71
-			$invoice_settings[ 'template_invoice_email' ] = '';
72
-			$invoice_settings[ 'template_invoice_tax_number' ] = '';
73
-			unset( $invoice_settings[ 'pdf_instructions' ] );
74
-			unset( $invoice_settings[ 'payable_to' ] );
75
-			unset( $invoice_settings[ 'payment_address' ] );
76
-			EE_Config::instance()->gateway->payment_settings[ 'Invoice' ] = $invoice_settings;
77
-			EE_Config::instance()->update_espresso_config(false,false);
64
+		$invoice_settings = isset(EE_Config::instance()->gateway->payment_settings['Invoice']) ? EE_Config::instance()->gateway->payment_settings['Invoice'] : NULL;
65
+		if ( ! $invoice_settings) {
66
+			$this->add_error(__('Could not migrate EE4.4 invoice settings to EE4.5 because they didnt exist', 'event_espresso'));
67
+		} else {
68
+			$invoice_settings['template_payment_instructions'] = $invoice_settings['pdf_instructions'];
69
+			$invoice_settings['template_invoice_payee_name'] = $invoice_settings['payable_to'];
70
+			$invoice_settings['template_invoice_address'] = $invoice_settings['payment_address'];
71
+			$invoice_settings['template_invoice_email'] = '';
72
+			$invoice_settings['template_invoice_tax_number'] = '';
73
+			unset($invoice_settings['pdf_instructions']);
74
+			unset($invoice_settings['payable_to']);
75
+			unset($invoice_settings['payment_address']);
76
+			EE_Config::instance()->gateway->payment_settings['Invoice'] = $invoice_settings;
77
+			EE_Config::instance()->update_espresso_config(false, false);
78 78
 
79 79
 			//@todo: check 'invoice_css' too because we can't easily affect that so we might need to set a persistent notice
80 80
 			//(why is it tough to change? because we want to update the receipt and invoice message template, but
81 81
 			//message templates are only initialized AFTER migrations and those two are new in 4.5. So if we wanted to
82 82
 			//update them from a DMS, we'd need to have the DMS create the message templates which is quite a lot of code;
83 83
 			//also we don't want to build a dependency on the messages code because it is likely to change soon
84
-			if( ! in_array( $invoice_settings[ 'invoice_css' ], array( '', 'simple.css' ) ) ){
85
-				EE_Error::add_persistent_admin_notice( 'invoice_css_not_updated', sprintf( __( 'You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', 'event_espresso'), $invoice_settings[ 'invoice_css' ] ), FALSE );
84
+			if ( ! in_array($invoice_settings['invoice_css'], array('', 'simple.css'))) {
85
+				EE_Error::add_persistent_admin_notice('invoice_css_not_updated', sprintf(__('You had previously set your Invoice Payment Method\'s stylesheet to be %1$s, but that setting has moved. PDF and HTML Invoices and Receipts are now Messages, which means you can easily modify them from your Wordpress Dashboard instead of using filters or uploading template files. Please visit Messages -> Receipt and Messages -> Invoice to change their stylesheets.', 'event_espresso'), $invoice_settings['invoice_css']), FALSE);
86 86
 			}
87 87
 			$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
88
-			$overridden_invoice_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE );
89
-			$overridden_receipt_body= EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE );
90
-			if( $overridden_invoice_body || $overridden_receipt_body ) {
91
-				EE_Error::add_persistent_admin_notice( 'invoice_overriding_templates', sprintf( __( 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE );
88
+			$overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', NULL, FALSE, FALSE, TRUE);
89
+			$overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', NULL, FALSE, FALSE, TRUE);
90
+			if ($overridden_invoice_body || $overridden_receipt_body) {
91
+				EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents. We recommend deleting your old Invoice/Receipt templates and modifying the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE);
92 92
 			}
93 93
 
94 94
 		}
Please login to merge, or discard this patch.
4_6_0_stages/EE_DMS_4_6_0_invoice_settings.dmsstage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * Just initializes the status of the migration
28 28
 	 */
29 29
 	public function __construct() {
30
-		$this->_pretty_name = __( 'Update Invoice Settings', 'event_espresso' );
30
+		$this->_pretty_name = __('Update Invoice Settings', 'event_espresso');
31 31
 		parent::__construct();
32 32
 	}
33 33
 
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 	 * @throws EE_Error
55 55
 	 * @return int number of items ACTUALLY migrated
56 56
 	 */
57
-	protected function _migration_step( $num_items = 1 ){
57
+	protected function _migration_step($num_items = 1) {
58 58
 
59 59
 		$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
60
-		$overridden_invoice_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', NULL, FALSE, FALSE, TRUE );
61
-		$overridden_receipt_body= EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', NULL, FALSE, FALSE, TRUE );
62
-		if( $overridden_invoice_body || $overridden_receipt_body ) {
63
-			EE_Error::add_persistent_admin_notice( 'invoice_overriding_templates', sprintf( __( 'Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE );
60
+		$overridden_invoice_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', NULL, FALSE, FALSE, TRUE);
61
+		$overridden_receipt_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', NULL, FALSE, FALSE, TRUE);
62
+		if ($overridden_invoice_body || $overridden_receipt_body) {
63
+			EE_Error::add_persistent_admin_notice('invoice_overriding_templates', sprintf(__('Note: in this version of Event Espresso, PDF and HTML Invoices and Receipts are now Messages and can be changed just like any other messages; however we noticed you had previously overriden the old default Invoice/Receipt templates. Because of this, your old Invoice/Receipt templates will continue to be used INSTEAD of the new Invoice/Receipt message equivalents (but this will be removed in an upcoming version). We recommend deleting your old Invoice/Receipt templates and using the new messages system. Then modify the new Invoice and Receipt messages\'s content in Messages -> Invoice and Messages -> Receipt.')), TRUE);
64 64
 		}
65 65
 
66 66
 		//regardless of whether it worked or not, we ought to continue the migration
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 1 patch
Spacing   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,77 +341,77 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
345
-		$current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' );
346
-		$current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' );
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
346
+		$current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end');
347 347
 
348
-		switch ( $evt_active_status ) {
348
+		switch ($evt_active_status) {
349 349
 			case 'upcoming' :
350 350
 					$where_params['Event.status'] = 'publish';
351 351
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
352
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
352
+					if (isset($where_params['DTT_EVT_start'])) {
353 353
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
354 354
 					}
355
-					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start );
355
+					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
356 356
 					break;
357 357
 
358 358
 			case 'expired' :
359
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
359
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
360 360
 				//get events to exclude
361
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
361
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end)));
362 362
 				//first get all events that have datetimes where its not expired.
363
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
364
-				$event_ids = array_keys( $event_ids );
363
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
364
+				$event_ids = array_keys($event_ids);
365 365
 
366
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
366
+				if (isset($where_params['DTT_EVT_end'])) {
367 367
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
368 368
 				}
369
-				$where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end );
370
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
369
+				$where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end);
370
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
371 371
 				break;
372 372
 
373 373
 			case 'active' :
374 374
 				$where_params['Event.status'] = 'publish';
375
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
375
+				if (isset($where_params['DTT_EVT_start'])) {
376 376
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
377 377
 				}
378
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
378
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
379 379
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
380 380
 				}
381
-				$where_params['DTT_EVT_start'] = array('<',  $current_time_for_DTT_EVT_start );
382
-				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end );
381
+				$where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
382
+				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end);
383 383
 				break;
384 384
 
385 385
 			case 'inactive' :
386
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
387
-				if ( isset( $where_params['OR'] ) ) {
386
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
387
+				if (isset($where_params['OR'])) {
388 388
 					$where_params['AND']['OR'] = $where_params['OR'];
389 389
 				}
390
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
390
+				if (isset($where_params['DTT_EVT_end'])) {
391 391
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
392
-					unset( $where_params['DTT_EVT_end'] );
392
+					unset($where_params['DTT_EVT_end']);
393 393
 				}
394 394
 
395
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
395
+				if (isset($where_params['DTT_EVT_start'])) {
396 396
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
397
-					unset( $where_params['DTT_EVT_start'] );
397
+					unset($where_params['DTT_EVT_start']);
398 398
 				}
399
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
399
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
400 400
 				break;
401 401
 		}
402 402
 
403 403
 		$query_params[0] = $where_params;
404 404
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
405
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
405
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
406 406
 
407
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' );
407
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start');
408 408
 
409 409
 		$columns_to_select = array(
410
-			'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'),
411
-			'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'),
412
-			'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s')
410
+			'dtt_year' => array('YEAR('.$query_interval.')', '%s'),
411
+			'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'),
412
+			'dtt_month_num' => array('MONTH('.$query_interval.')', '%s')
413 413
 			);
414
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
414
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
415 415
 	}
416 416
 
417 417
 	/**
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * for the tickets for each datetime)
420 420
 	 * @param EE_Datetime[] $datetimes
421 421
 	 */
422
-	public function update_sold($datetimes){
423
-		foreach($datetimes as $datetime){
422
+	public function update_sold($datetimes) {
423
+		foreach ($datetimes as $datetime) {
424 424
 			$datetime->update_sold();
425 425
 		}
426 426
 	}
@@ -435,10 +435,10 @@  discard block
 block discarded – undo
435 435
 	 * @param array $query_params
436 436
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
437 437
 	 */
438
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
439
-		$datetime = $this->get_one_by_ID( $DTT_ID );
440
-		if ( $datetime instanceof EE_Datetime ) {
441
-			return $datetime->tickets_remaining( $query_params );
438
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
439
+		$datetime = $this->get_one_by_ID($DTT_ID);
440
+		if ($datetime instanceof EE_Datetime) {
441
+			return $datetime->tickets_remaining($query_params);
442 442
 		}
443 443
 		return 0;
444 444
 	}
@@ -460,36 +460,36 @@  discard block
 block discarded – undo
460 460
 	 *                EE_Datetime::upcoming
461 461
 	 *                EE_Datetime::expired
462 462
 	 */
463
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
463
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
464 464
 		//only accept where conditions for this query.
465
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
465
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
466 466
 		$status_query_args = array(
467 467
 				EE_Datetime::active => array_merge(
468 468
 						$_where,
469
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
469
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
470 470
 				),
471 471
 				EE_Datetime::upcoming => array_merge(
472 472
 						$_where,
473
-						array( 'DTT_EVT_start' => array( '>', time() ) )
473
+						array('DTT_EVT_start' => array('>', time()))
474 474
 				),
475 475
 				EE_Datetime::expired => array_merge(
476 476
 						$_where,
477
-						array( 'DTT_EVT_end' => array('<', time() ) )
477
+						array('DTT_EVT_end' => array('<', time()))
478 478
 				)
479 479
 		);
480 480
 
481
-		if ( ! empty( $stati_to_include ) ) {
482
-			foreach( array_keys( $status_query_args ) as $status ) {
483
-				if ( ! in_array( $status, $stati_to_include ) ) {
484
-					unset( $status_query_args[$status] );
481
+		if ( ! empty($stati_to_include)) {
482
+			foreach (array_keys($status_query_args) as $status) {
483
+				if ( ! in_array($status, $stati_to_include)) {
484
+					unset($status_query_args[$status]);
485 485
 				}
486 486
 			}
487 487
 		}
488 488
 
489 489
 		//loop through and query counts for each stati.
490 490
 		$status_query_results = array();
491
-		foreach( $status_query_args as $status => $status_where_conditions ) {
492
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
491
+		foreach ($status_query_args as $status => $status_where_conditions) {
492
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
493 493
 		}
494 494
 
495 495
 		return $status_query_results;
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
 	 * @param array $query_params
504 504
 	 * @return int
505 505
 	 */
506
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
507
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
508
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
506
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
507
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
508
+		return ! empty($count[$status]) ? $count[$status] : 0;
509 509
 	}
510 510
 
511 511
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Money_Field.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Text_Fields is a base class for any fields which are have float value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...)
4 4
  */
5
-class EE_Money_Field extends EE_Float_Field{
6
-	function get_wpdb_data_type(){
5
+class EE_Money_Field extends EE_Float_Field {
6
+	function get_wpdb_data_type() {
7 7
 		return '%f';
8 8
 	}
9 9
 	/**
@@ -15,20 +15,20 @@  discard block
 block discarded – undo
15 15
 	 * @param type $schema
16 16
 	 * @return string
17 17
 	 */
18
-	function prepare_for_pretty_echoing($value_on_field_to_be_outputted,$schema = null){
18
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
19 19
 		$pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
20 20
 
21
-		if($schema == 'localized_float'){
21
+		if ($schema == 'localized_float') {
22 22
 			return $pretty_float;
23 23
 		}
24
-		if($schema == 'no_currency_code'){
24
+		if ($schema == 'no_currency_code') {
25 25
 //			echo "schema no currency!";
26 26
 			$display_code = false;
27
-		}else{
27
+		} else {
28 28
 			$display_code = true;
29 29
 		}
30 30
 		//we don't use the $pretty_float because format_currency will take care of it.
31
-		return EEH_Template::format_currency( $value_on_field_to_be_outputted, false, $display_code );
31
+		return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
32 32
 	}
33 33
 
34 34
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 		//now it's a float-style string or number
48 48
 		$float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
49 49
 		//round to the correctly number of decimal places for this  currency
50
-		$rounded_value = round($float_val,  EE_Registry::instance()->CFG->currency->dec_plc);
50
+		$rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc);
51 51
 		return $rounded_value;
52 52
 	}
53 53
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Datetime_Field.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * EE_Datetime_Field
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @param string 	$pretty_date_format
112 112
 	 * @param string 	$pretty_time_format
113 113
 	 */
114
-	public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '' ){
114
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') {
115 115
 
116
-		$this->_date_format = ! empty( $date_format ) ? $date_format : get_option('date_format');
117
-		$this->_time_format = ! empty( $time_format ) ? $time_format : get_option('time_format');
118
-		$this->_pretty_date_format = ! empty( $pretty_date_format ) ? $pretty_date_format : get_option('date_format');
119
-		$this->_pretty_time_format = ! empty( $pretty_time_format ) ? $pretty_time_format : get_option('time_format');
116
+		$this->_date_format = ! empty($date_format) ? $date_format : get_option('date_format');
117
+		$this->_time_format = ! empty($time_format) ? $time_format : get_option('time_format');
118
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
119
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
120 120
 
121
-		parent::__construct( $table_column, $nice_name, $nullable, $default_value );
122
-		$this->set_timezone( $timezone_string );
121
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
122
+		$this->set_timezone($timezone_string);
123 123
 
124 124
 	}
125 125
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return DateTimeZone
139 139
 	 */
140 140
 	public function get_UTC_DateTimeZone() {
141
-		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string( 'UTC' );
141
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string('UTC');
142 142
 	}
143 143
 
144 144
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return DateTimeZone
148 148
 	 */
149 149
 	public function get_blog_DateTimeZone() {
150
-		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string( '' );
150
+		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string('');
151 151
 	}
152 152
 
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp
158 158
 	 * @return DateTime
159 159
 	 */
160
-	public function prepare_for_set( $value_inputted_for_field_on_model_object ) {
161
-		return $this->_get_date_object( $value_inputted_for_field_on_model_object );
160
+	public function prepare_for_set($value_inputted_for_field_on_model_object) {
161
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
162 162
 	}
163 163
 
164 164
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	 * @param bool $pretty If we're returning the pretty formats or standard format string.
175 175
 	 * @return string    The final assembled format string.
176 176
 	 */
177
-	protected function _get_date_time_output( $pretty = FALSE ) {
177
+	protected function _get_date_time_output($pretty = FALSE) {
178 178
 
179
-		switch ( $this->_date_time_output ) {
179
+		switch ($this->_date_time_output) {
180 180
 			case 'time' :
181 181
 				return $pretty ? $this->_pretty_time_format : $this->_time_format;
182 182
 				break;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				break;
187 187
 
188 188
 			default :
189
-				return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format;
189
+				return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format;
190 190
 		}
191 191
 	}
192 192
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param string $what acceptable values are 'time' or 'date'.  Any other value will be set but will always result in both 'date' and 'time' being returned.
201 201
 	 * @return void
202 202
 	 */
203
-	public function set_date_time_output( $what = NULL ) {
203
+	public function set_date_time_output($what = NULL) {
204 204
 		$this->_date_time_output = $what;
205 205
 	}
206 206
 
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	 * @param string $timezone_string A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php
217 217
 	 * @return void
218 218
 	 */
219
-	public function set_timezone( $timezone_string ) {
220
-		if( empty( $timezone_string ) && $this->_timezone_string != NULL ){
219
+	public function set_timezone($timezone_string) {
220
+		if (empty($timezone_string) && $this->_timezone_string != NULL) {
221 221
 			// leave the timezone AS-IS if we already have one and
222 222
 			// the function arg didn't provide one
223 223
 			return;
224 224
 		}
225
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
226
-		$this->_timezone_string = ! empty( $timezone_string ) ? $timezone_string : 'UTC';
227
-		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string( $this->_timezone_string );
225
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
226
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
227
+		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
228 228
 	}
229 229
 
230 230
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @param string $timezone_string
237 237
 	 * @return \DateTimeZone
238 238
 	 */
239
-	protected function _create_timezone_object_from_timezone_string( $timezone_string = '' ) {
240
-		return new DateTimeZone( EEH_DTT_Helper::get_valid_timezone_string( $timezone_string ) );
239
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '') {
240
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
241 241
 	}
242 242
 
243 243
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param bool   $pretty Whether to set pretty format or not.
263 263
 	 * @return void
264 264
 	 */
265
-	public function set_date_format( $format, $pretty = false ) {
266
-		if ( $pretty ) {
265
+	public function set_date_format($format, $pretty = false) {
266
+		if ($pretty) {
267 267
 			$this->_pretty_date_format = $format;
268 268
 		} else {
269 269
 			$this->_date_format = $format;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param bool   $pretty Whether to get pretty format or not.
279 279
 	 * @return string
280 280
 	 */
281
-	public function get_date_format( $pretty = false ) {
281
+	public function get_date_format($pretty = false) {
282 282
 		return $pretty ? $this->_pretty_date_format : $this->_date_format;
283 283
 	}
284 284
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 * @param bool   $pretty Whether to set pretty format or not.
294 294
 	 * @return void
295 295
 	 */
296
-	public function set_time_format( $format, $pretty = false ) {
297
-		if ( $pretty ) {
296
+	public function set_time_format($format, $pretty = false) {
297
+		if ($pretty) {
298 298
 			$this->_pretty_time_format = $format;
299 299
 		} else {
300 300
 			$this->_time_format = $format;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool   $pretty Whether to get pretty format or not.
310 310
 	 * @return string
311 311
 	 */
312
-	public function get_time_format( $pretty = false ) {
312
+	public function get_time_format($pretty = false) {
313 313
 		return $pretty ? $this->_pretty_time_format : $this->_time_format;
314 314
 	}
315 315
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
325 325
 	 * @return void
326 326
 	 */
327
-	public function set_pretty_date_format( $format ) {
327
+	public function set_pretty_date_format($format) {
328 328
 		$this->_pretty_date_format = $format;
329 329
 	}
330 330
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
342 342
 	 * @return void
343 343
 	 */
344
-	public function set_pretty_time_format( $format ) {
344
+	public function set_pretty_time_format($format) {
345 345
 		$this->_pretty_time_format = $format;
346 346
 	}
347 347
 
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 	 * @param DateTime    $current current DateTime object for the datetime field
354 354
 	 * @return DateTime
355 355
 	 */
356
-	public function prepare_for_set_with_new_time( $time_to_set_string, DateTime $current ){
356
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current) {
357 357
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
358
-		if ( $time_to_set_string instanceof DateTime ) {
358
+		if ($time_to_set_string instanceof DateTime) {
359 359
 			$parsed = array(
360 360
 				'hour' => $time_to_set_string->format('H'),
361 361
 				'minute' => $time_to_set_string->format('i'),
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 				);
364 364
 		} else {
365 365
 			//parse incoming string
366
-			$parsed = date_parse_from_format( $this->_time_format, $time_to_set_string );
366
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
367 367
 		}
368 368
 
369 369
 		//make sure $current is in the correct timezone.
370
-		$current->setTimezone( $this->_DateTimeZone );
371
-		return $current->setTime( $parsed['hour'], $parsed['minute'], $parsed['second'] );
370
+		$current->setTimezone($this->_DateTimeZone);
371
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
372 372
 	}
373 373
 
374 374
 
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	 * @param DateTime    $current current DateTime object for the datetime field
380 380
 	 * @return DateTime
381 381
 	 */
382
-	public function prepare_for_set_with_new_date( $date_to_set_string, DateTime $current ){
382
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current) {
383 383
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
384
-		if ( $date_to_set_string instanceof DateTime ) {
384
+		if ($date_to_set_string instanceof DateTime) {
385 385
 			$parsed = array(
386 386
 				'year' => $date_to_set_string->format('Y'),
387 387
 				'month' => $date_to_set_string->format('m'),
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 				);
390 390
 		} else {
391 391
 			//parse incoming string
392
-			$parsed = date_parse_from_format( $this->_date_format, $date_to_set_string );
392
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
393 393
 		}
394 394
 
395 395
 		//make sure $current is in the correct timezone
396
-		$current->setTimezone( $this->_DateTimeZone );
397
-		return $current->setDate( $parsed['year'], $parsed['month'], $parsed['day'] );
396
+		$current->setTimezone($this->_DateTimeZone);
397
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
398 398
 	}
399 399
 
400 400
 
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 * @param  DateTime $DateTime
407 407
 	 * @return string formatted date time for given timezone
408 408
 	 */
409
-	public function prepare_for_get( $DateTime ) {
410
-		return $this->_prepare_for_display( $DateTime  );
409
+	public function prepare_for_get($DateTime) {
410
+		return $this->_prepare_for_display($DateTime);
411 411
 	}
412 412
 
413 413
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @param null     $schema
423 423
 	 * @return string
424 424
 	 */
425
-	public function prepare_for_pretty_echoing( $DateTime, $schema = null ) {
426
-		return $this->_prepare_for_display( $DateTime, $schema ? $schema : true );
425
+	public function prepare_for_pretty_echoing($DateTime, $schema = null) {
426
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
427 427
 	}
428 428
 
429 429
 
@@ -437,36 +437,36 @@  discard block
 block discarded – undo
437 437
 	 * @return string
438 438
 	 * @throws \EE_Error
439 439
 	 */
440
-	protected function _prepare_for_display( $DateTime, $schema = false ) {
441
-		if ( ! $DateTime instanceof DateTime  ) {
442
-			if ( $this->_nullable ) {
440
+	protected function _prepare_for_display($DateTime, $schema = false) {
441
+		if ( ! $DateTime instanceof DateTime) {
442
+			if ($this->_nullable) {
443 443
 				return '';
444 444
 			} else {
445
-				if ( WP_DEBUG ) {
446
-					throw new EE_Error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso' ), $this->_nicename ) );
445
+				if (WP_DEBUG) {
446
+					throw new EE_Error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso'), $this->_nicename));
447 447
 				} else {
448
-					$DateTime = new DateTime( "now" );
449
-					EE_Error::add_error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso' ), $this->_nicename ) );
448
+					$DateTime = new DateTime("now");
449
+					EE_Error::add_error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso'), $this->_nicename));
450 450
 				}
451 451
 			}
452 452
 		}
453
-		$format_string = $this->_get_date_time_output( $schema );
453
+		$format_string = $this->_get_date_time_output($schema);
454 454
 		//make sure datetime_value is in the correct timezone (in case that's been updated).
455
-		$DateTime->setTimezone( $this->_DateTimeZone );
456
-		if ( $schema ) {
457
-			if( $this->_display_timezone() ) {
455
+		$DateTime->setTimezone($this->_DateTimeZone);
456
+		if ($schema) {
457
+			if ($this->_display_timezone()) {
458 458
 				//must be explicit because schema could equal true.
459
-				if( $schema === 'no_html' ){
460
-					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
461
-				}else{
462
-					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
459
+				if ($schema === 'no_html') {
460
+					$timezone_string = ' ('.$DateTime->format('T').')';
461
+				} else {
462
+					$timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
463 463
 				}
464 464
 			} else {
465 465
 				$timezone_string = '';
466 466
 			}
467
-			return $DateTime->format( $format_string ) . $timezone_string;
467
+			return $DateTime->format($format_string).$timezone_string;
468 468
 		} else {
469
-			return $DateTime->format( $format_string );
469
+			return $DateTime->format($format_string);
470 470
 		}
471 471
 	}
472 472
 
@@ -480,18 +480,18 @@  discard block
 block discarded – undo
480 480
 	 * @return string mysql timestamp in UTC
481 481
 	 * @throws \EE_Error
482 482
 	 */
483
-	public function prepare_for_use_in_db( $datetime_value ) {
483
+	public function prepare_for_use_in_db($datetime_value) {
484 484
 		//we allow an empty value or DateTime object, but nothing else.
485
-		if ( ! empty( $datetime_value ) && ! $datetime_value instanceof DateTime ) {
486
-			throw new EE_Error( __('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso' ) );
485
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
486
+			throw new EE_Error(__('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso'));
487 487
 		}
488 488
 
489
-		if ( $datetime_value instanceof DateTime ) {
490
-			return $datetime_value->setTimezone( $this->get_UTC_DateTimeZone() )->format( EE_Datetime_Field::mysql_timestamp_format );
489
+		if ($datetime_value instanceof DateTime) {
490
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(EE_Datetime_Field::mysql_timestamp_format);
491 491
 		}
492 492
 
493 493
 		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
494
-		return ! $this->_nullable && empty( $datetime_value ) ? current_time( 'mysql', true ) : null;
494
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
495 495
 	}
496 496
 
497 497
 
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
 	 * @param string $datetime_string mysql timestamp in UTC
505 505
 	 * @return  mixed null | DateTime
506 506
 	 */
507
-	public function prepare_for_set_from_db( $datetime_string ) {
507
+	public function prepare_for_set_from_db($datetime_string) {
508 508
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
509
-		if ( empty( $datetime_string) && $this->_nullable ) {
509
+		if (empty($datetime_string) && $this->_nullable) {
510 510
 			return null;
511 511
 		}
512 512
 		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
513
-		$DateTime = empty( $datetime_string ) ? new DateTime( 'now', $this->get_UTC_DateTimeZone() ) : DateTime::createFromFormat( EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone() );
513
+		$DateTime = empty($datetime_string) ? new DateTime('now', $this->get_UTC_DateTimeZone()) : DateTime::createFromFormat(EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone());
514 514
 
515
-		if ( ! $DateTime instanceof DateTime ) {
515
+		if ( ! $DateTime instanceof DateTime) {
516 516
 			//if still no datetime object, then let's just use now
517
-			$DateTime = new DateTime( 'now', $this->get_UTC_DateTimeZone() );
517
+			$DateTime = new DateTime('now', $this->get_UTC_DateTimeZone());
518 518
 		}
519 519
 		// THEN apply the field's set DateTimeZone
520
-		$DateTime->setTimezone( $this->_DateTimeZone );
520
+		$DateTime->setTimezone($this->_DateTimeZone);
521 521
 		return $DateTime;
522 522
 	}
523 523
 
@@ -534,15 +534,15 @@  discard block
 block discarded – undo
534 534
 	protected function _display_timezone() {
535 535
 
536 536
 		// first let's do a comparison of timezone strings.  If they match then we can get out without any further calculations
537
-		$blog_string = get_option( 'timezone_string' );
538
-		if ( $blog_string == $this->_timezone_string ) {
537
+		$blog_string = get_option('timezone_string');
538
+		if ($blog_string == $this->_timezone_string) {
539 539
 			return FALSE;
540 540
 		}
541 541
 		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
542
-		$this_offset = $this->get_timezone_offset( $this->_DateTimeZone );
543
-		$blog_offset = $this->get_timezone_offset( $this->get_blog_DateTimeZone() );
542
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
543
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
544 544
 		// now compare
545
-		if ( $blog_offset === $this_offset ) {
545
+		if ($blog_offset === $this_offset) {
546 546
 			return FALSE;
547 547
 		}
548 548
 		return TRUE;
@@ -560,24 +560,24 @@  discard block
 block discarded – undo
560 560
 	 *
561 561
 	 * @return DateTime
562 562
 	 */
563
-	protected function _get_date_object( $date_string ) {
563
+	protected function _get_date_object($date_string) {
564 564
 		//first if this is an empty date_string and nullable is allowed, just return null.
565
-		if ( $this->_nullable && empty( $date_string ) ) {
565
+		if ($this->_nullable && empty($date_string)) {
566 566
 			return null;
567 567
 		}
568 568
 
569 569
 		// if incoming date
570
-		if ( $date_string instanceof DateTime ) {
571
-			$date_string->setTimezone( $this->_DateTimeZone );
570
+		if ($date_string instanceof DateTime) {
571
+			$date_string->setTimezone($this->_DateTimeZone);
572 572
 			return $date_string;
573 573
 		}
574 574
 		// if empty date_string and made it here.
575 575
 		// Return a datetime object for now in the given timezone.
576
-		if ( empty( $date_string ) ) {
577
-			return new DateTime( "now", $this->_DateTimeZone );
576
+		if (empty($date_string)) {
577
+			return new DateTime("now", $this->_DateTimeZone);
578 578
 		}
579 579
 		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
580
-		if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $date_string ) ) {
580
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
581 581
 			try {
582 582
 				/**
583 583
 				 * This is operating under the assumption that the incoming Unix timestamp is
@@ -585,29 +585,29 @@  discard block
 block discarded – undo
585 585
 				 * current_time('timestamp');
586 586
 				 *
587 587
 				 */
588
-				$DateTime = new DateTime( "now", $this->_DateTimeZone );
589
-				return $DateTime->setTimestamp( $date_string );
590
-			 } catch ( Exception $e )  {
588
+				$DateTime = new DateTime("now", $this->_DateTimeZone);
589
+				return $DateTime->setTimestamp($date_string);
590
+			 } catch (Exception $e) {
591 591
 			 	// should be rare, but if things got fooled then let's just continue
592 592
 			 }
593 593
 		}
594 594
 		//not a unix timestamp.  So we will use the set format on this object and set timezone to
595 595
 		//create the DateTime object.
596
-		$format = $this->_date_format . ' ' . $this->_time_format;
596
+		$format = $this->_date_format.' '.$this->_time_format;
597 597
 		try {
598
-			$DateTime = DateTime::createFromFormat( $format, $date_string, $this->_DateTimeZone );
599
-			if ( ! $DateTime instanceof DateTime ) {
598
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
599
+			if ( ! $DateTime instanceof DateTime) {
600 600
 				throw new EE_Error(
601 601
 					sprintf(
602
-						__( '"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso' ),
602
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
603 603
 						$date_string,
604 604
 						$format
605 605
 					)
606 606
 				);
607 607
 			}
608
-		} catch ( Exception $e ) {
608
+		} catch (Exception $e) {
609 609
 			// if we made it here then likely then something went really wrong.  Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
610
-			$DateTime = new DateTime( "now", $this->_DateTimeZone );
610
+			$DateTime = new DateTime("now", $this->_DateTimeZone);
611 611
 		}
612 612
 		return $DateTime;
613 613
 	}
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 	 * @param null          $time
622 622
 	 * @return mixed
623 623
 	 */
624
-	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
625
-		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
626
-		$transitions = $DateTimeZone->getTransitions( $time );
624
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null) {
625
+		$time = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
626
+		$transitions = $DateTimeZone->getTransitions($time);
627 627
 		return $transitions[0]['offset'];
628 628
 	}
629 629
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 * @param  string $timezone_string
636 636
 	 * @return string           abbreviation
637 637
 	 */
638
-	public function get_timezone_abbrev( $timezone_string ) {
639
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
640
-		$dateTime = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
641
-		return $dateTime->format( 'T' );
638
+	public function get_timezone_abbrev($timezone_string) {
639
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
640
+		$dateTime = new DateTime('now', new DateTimeZone($timezone_string));
641
+		return $dateTime->format('T');
642 642
 	}
643 643
 
644 644
 
Please login to merge, or discard this patch.