Completed
Branch FET/asset-manager (433489)
by
unknown
32:42 queued 18:11
created
core/db_classes/EE_CPT_Base.class.php 3 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @link   http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
132 132
 	 * @access protected
133
-	 * @param string|array $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ).
133
+	 * @param string $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ).
134 134
 	 * @param string|array $attr Optional. Query string or array of attributes.
135 135
 	 * @return string HTML image element
136 136
 	 */
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	 * This is a method for restoring this_obj using details from the given $revision_id
173 173
 	 *
174 174
 	 * @param int $revision_id 		ID of the revision we're getting data from
175
-	 * @param array $related_obj_names if included this will be used to restore for related obj
175
+	 * @param string[] $related_obj_names if included this will be used to restore for related obj
176 176
 	 *                                 if not included then we just do restore on the meta.
177 177
 	 *                                 We will accept an array of related_obj_names for restoration here.
178 178
 	 * @param array $where_query       You can optionally include an array of key=>value pairs
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * Wrapper for get_post_meta, http://codex.wordpress.org/Function_Reference/get_post_meta
227 227
 	 * @param string  $meta_key
228 228
 	 * @param boolean $single
229
-	 * @return mixed <ul><li>If only $id is set it will return all meta values in an associative array.</li>
229
+	 * @return string|null <ul><li>If only $id is set it will return all meta values in an associative array.</li>
230 230
 	 * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li>
231 231
 	 * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul>
232 232
 	 */
@@ -254,8 +254,8 @@  discard block
 block discarded – undo
254 254
 
255 255
 	/**
256 256
 	 * Wrapper for add_post_meta, http://codex.wordpress.org/Function_Reference/add_post_meta
257
-	 * @param mixed $meta_key
258
-	 * @param mixed $meta_value
257
+	 * @param string $meta_key
258
+	 * @param string $meta_value
259 259
 	 * @param bool  $unique . If postmeta for this $meta_key already exists, whether to add an additional item or not
260 260
 	 * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned.
261 261
 	 */
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	/**
272 272
 	 * Wrapper for delete_post_meta, http://codex.wordpress.org/Function_Reference/delete_post_meta
273 273
 	 *
274
-	 * @param mixed $meta_key
274
+	 * @param string $meta_key
275 275
 	 * @param mixed $meta_value
276 276
 	 * @return boolean False for failure. True for success.
277 277
 	 */
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	/**
300 300
 	 * Gets all the term-taxonomies for this CPT
301 301
 	 * @param array $query_params
302
-	 * @return EE_Term_Taxonomy
302
+	 * @return EE_Base_Class[]
303 303
 	 */
304 304
 	public function term_taxonomies( $query_params = array() ) {
305 305
 		return $this->get_many_related( 'Term_Taxonomy', $query_params );
Please login to merge, or discard this patch.
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	protected $_feature_image = array();
38 38
 
39
-    /**
40
-     * @var WP_Post the WP_Post that corresponds with this CPT model object
41
-     */
39
+	/**
40
+	 * @var WP_Post the WP_Post that corresponds with this CPT model object
41
+	 */
42 42
 	protected $_wp_post;
43 43
 
44 44
 
@@ -46,75 +46,75 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
 
49
-    /**
50
-     * Returns the WP post associated with this CPT model object. If this CPT is saved, fetches it
51
-     * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally.
52
-     * @return WP_Post
53
-     */
54
-    public function wp_post(){
55
-        global $wpdb;
56
-        if (! $this->_wp_post instanceof WP_Post) {
57
-            if ($this->ID()) {
58
-                $this->_wp_post = get_post($this->ID());
59
-            } else {
60
-                $simulated_db_result = new stdClass();
61
-                foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){
62
-                    if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){
63
-                        $column = $field_obj->get_table_column();
64
-
65
-                        if($field_obj instanceof EE_Datetime_Field){
66
-                            $value_on_model_obj = $this->get_DateTime_object($field_name);
67
-                        } elseif( $field_obj->is_db_only_field()){
68
-                            $value_on_model_obj = $field_obj->get_default_value();
69
-                        } else {
70
-                            $value_on_model_obj = $this->get_raw($field_name);
71
-                        }
72
-                        $simulated_db_result->{$column} = $field_obj->prepare_for_use_in_db($value_on_model_obj);
73
-                    }
74
-                }
75
-                $this->_wp_post = new WP_Post($simulated_db_result);
76
-            }
77
-            //and let's make retrieving the EE CPT object easy too
78
-            $classname = get_class($this);
79
-            if (! isset($this->_wp_post->{$classname})) {
80
-                $this->_wp_post->{$classname} = $this;
81
-            }
82
-        }
83
-        return $this->_wp_post;
84
-    }
85
-
86
-    /**
87
-     * When fetching a new value for a post field that uses the global $post for rendering,
88
-     * set the global $post temporarily to be this model object; and afterwards restore it
89
-     * @param string $fieldname
90
-     * @param bool $pretty
91
-     * @param string $extra_cache_ref
92
-     * @return mixed
93
-     */
94
-    protected function _get_fresh_property($fieldname, $pretty = false, $extra_cache_ref = null)
95
-    {
96
-        global $post;
97
-
98
-        if ( $pretty
99
-            && (
100
-                ! (
101
-                       $post instanceof WP_Post
102
-                       && $post->ID
103
-                   )
104
-                || (int)$post->ID !== $this->ID()
105
-             )
106
-            && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) {
107
-            $old_post = $post;
108
-            $post = $this->wp_post();
109
-            $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref);
110
-            $post = $old_post;
111
-        } else {
112
-            $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref);
113
-        }
114
-        return $return_value;
115
-    }
116
-
117
-    /**
49
+	/**
50
+	 * Returns the WP post associated with this CPT model object. If this CPT is saved, fetches it
51
+	 * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally.
52
+	 * @return WP_Post
53
+	 */
54
+	public function wp_post(){
55
+		global $wpdb;
56
+		if (! $this->_wp_post instanceof WP_Post) {
57
+			if ($this->ID()) {
58
+				$this->_wp_post = get_post($this->ID());
59
+			} else {
60
+				$simulated_db_result = new stdClass();
61
+				foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){
62
+					if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){
63
+						$column = $field_obj->get_table_column();
64
+
65
+						if($field_obj instanceof EE_Datetime_Field){
66
+							$value_on_model_obj = $this->get_DateTime_object($field_name);
67
+						} elseif( $field_obj->is_db_only_field()){
68
+							$value_on_model_obj = $field_obj->get_default_value();
69
+						} else {
70
+							$value_on_model_obj = $this->get_raw($field_name);
71
+						}
72
+						$simulated_db_result->{$column} = $field_obj->prepare_for_use_in_db($value_on_model_obj);
73
+					}
74
+				}
75
+				$this->_wp_post = new WP_Post($simulated_db_result);
76
+			}
77
+			//and let's make retrieving the EE CPT object easy too
78
+			$classname = get_class($this);
79
+			if (! isset($this->_wp_post->{$classname})) {
80
+				$this->_wp_post->{$classname} = $this;
81
+			}
82
+		}
83
+		return $this->_wp_post;
84
+	}
85
+
86
+	/**
87
+	 * When fetching a new value for a post field that uses the global $post for rendering,
88
+	 * set the global $post temporarily to be this model object; and afterwards restore it
89
+	 * @param string $fieldname
90
+	 * @param bool $pretty
91
+	 * @param string $extra_cache_ref
92
+	 * @return mixed
93
+	 */
94
+	protected function _get_fresh_property($fieldname, $pretty = false, $extra_cache_ref = null)
95
+	{
96
+		global $post;
97
+
98
+		if ( $pretty
99
+			&& (
100
+				! (
101
+					   $post instanceof WP_Post
102
+					   && $post->ID
103
+				   )
104
+				|| (int)$post->ID !== $this->ID()
105
+			 )
106
+			&& $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) {
107
+			$old_post = $post;
108
+			$post = $this->wp_post();
109
+			$return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref);
110
+			$post = $old_post;
111
+		} else {
112
+			$return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref);
113
+		}
114
+		return $return_value;
115
+	}
116
+
117
+	/**
118 118
 	 * Adds to the specified event category. If it category doesn't exist, creates it.
119 119
 	 * @param string $category_name
120 120
 	 * @param string $category_description    optional
@@ -399,14 +399,14 @@  discard block
 block discarded – undo
399 399
 
400 400
 
401 401
 
402
-    /**
403
-     * Don't serialize the WP Post. That's just duplicate data and we want to avoid recursion
404
-     * @return array
405
-     */
406
-    public function __sleep()
407
-    {
408
-        $properties_to_serialize = parent::__sleep();
409
-        $properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post'));
410
-        return $properties_to_serialize;
411
-    }
402
+	/**
403
+	 * Don't serialize the WP Post. That's just duplicate data and we want to avoid recursion
404
+	 * @return array
405
+	 */
406
+	public function __sleep()
407
+	{
408
+		$properties_to_serialize = parent::__sleep();
409
+		$properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post'));
410
+		return $properties_to_serialize;
411
+	}
412 412
 }
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 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
  * Event Espresso
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
      * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally.
52 52
      * @return WP_Post
53 53
      */
54
-    public function wp_post(){
54
+    public function wp_post() {
55 55
         global $wpdb;
56
-        if (! $this->_wp_post instanceof WP_Post) {
56
+        if ( ! $this->_wp_post instanceof WP_Post) {
57 57
             if ($this->ID()) {
58 58
                 $this->_wp_post = get_post($this->ID());
59 59
             } else {
60 60
                 $simulated_db_result = new stdClass();
61
-                foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){
62
-                    if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){
61
+                foreach ($this->get_model()->field_settings(true) as $field_name => $field_obj) {
62
+                    if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts) {
63 63
                         $column = $field_obj->get_table_column();
64 64
 
65
-                        if($field_obj instanceof EE_Datetime_Field){
65
+                        if ($field_obj instanceof EE_Datetime_Field) {
66 66
                             $value_on_model_obj = $this->get_DateTime_object($field_name);
67
-                        } elseif( $field_obj->is_db_only_field()){
67
+                        } elseif ($field_obj->is_db_only_field()) {
68 68
                             $value_on_model_obj = $field_obj->get_default_value();
69 69
                         } else {
70 70
                             $value_on_model_obj = $this->get_raw($field_name);
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             }
77 77
             //and let's make retrieving the EE CPT object easy too
78 78
             $classname = get_class($this);
79
-            if (! isset($this->_wp_post->{$classname})) {
79
+            if ( ! isset($this->_wp_post->{$classname})) {
80 80
                 $this->_wp_post->{$classname} = $this;
81 81
             }
82 82
         }
@@ -95,15 +95,15 @@  discard block
 block discarded – undo
95 95
     {
96 96
         global $post;
97 97
 
98
-        if ( $pretty
98
+        if ($pretty
99 99
             && (
100 100
                 ! (
101 101
                        $post instanceof WP_Post
102 102
                        && $post->ID
103 103
                    )
104
-                || (int)$post->ID !== $this->ID()
104
+                || (int) $post->ID !== $this->ID()
105 105
              )
106
-            && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) {
106
+            && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field) {
107 107
             $old_post = $post;
108 108
             $post = $this->wp_post();
109 109
             $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref);
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param int    $parent_term_taxonomy_id optional
122 122
 	 * @return EE_Term_Taxonomy
123 123
 	 */
124
-	function add_event_category( $category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL ) {
125
-		return $this->get_model()->add_event_category( $this, $category_name, $category_description, $parent_term_taxonomy_id );
124
+	function add_event_category($category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL) {
125
+		return $this->get_model()->add_event_category($this, $category_name, $category_description, $parent_term_taxonomy_id);
126 126
 	}
127 127
 
128 128
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param string $category_name
133 133
 	 * @return bool
134 134
 	 */
135
-	function remove_event_category( $category_name ) {
136
-		return $this->get_model()->remove_event_category( $this, $category_name );
135
+	function remove_event_category($category_name) {
136
+		return $this->get_model()->remove_event_category($this, $category_name);
137 137
 	}
138 138
 
139 139
 
@@ -144,14 +144,14 @@  discard block
 block discarded – undo
144 144
 	 * @param EE_Term_Taxonomy $term_taxonomy
145 145
 	 * @return EE_Base_Class the relation was removed from
146 146
 	 */
147
-	function remove_relation_to_term_taxonomy( $term_taxonomy ) {
148
-		if ( !$term_taxonomy ) {
149
-			EE_Error::add_error( sprintf( __( "No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso" ), get_class( $this ), $this->ID() ), __FILE__, __FUNCTION__, __LINE__ );
147
+	function remove_relation_to_term_taxonomy($term_taxonomy) {
148
+		if ( ! $term_taxonomy) {
149
+			EE_Error::add_error(sprintf(__("No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso"), get_class($this), $this->ID()), __FILE__, __FUNCTION__, __LINE__);
150 150
 			return NULL;
151 151
 		}
152
-		$term_taxonomy->set_count( $term_taxonomy->count() - 1 );
152
+		$term_taxonomy->set_count($term_taxonomy->count() - 1);
153 153
 		$term_taxonomy->save();
154
-		return $this->_remove_relation_to( $term_taxonomy, 'Term_Taxonomy' );
154
+		return $this->_remove_relation_to($term_taxonomy, 'Term_Taxonomy');
155 155
 	}
156 156
 
157 157
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @return int
176 176
 	 */
177 177
 	public function parent() {
178
-		return $this->get( 'parent' );
178
+		return $this->get('parent');
179 179
 	}
180 180
 
181 181
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @return string
186 186
 	 */
187 187
 	public function status() {
188
-		return $this->get( 'status' );
188
+		return $this->get('status');
189 189
 	}
190 190
 
191 191
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 	/**
194 194
 	 * @param string $status
195 195
 	 */
196
-	public function set_status( $status ) {
197
-		$this->set( 'status', $status );
196
+	public function set_status($status) {
197
+		$this->set('status', $status);
198 198
 	}
199 199
 
200 200
 
@@ -208,12 +208,12 @@  discard block
 block discarded – undo
208 208
 	 * @param string|array $attr Optional. Query string or array of attributes.
209 209
 	 * @return string HTML image element
210 210
 	 */
211
-	protected function _get_feature_image( $size, $attr ) {
211
+	protected function _get_feature_image($size, $attr) {
212 212
 		//first let's see if we already have the _feature_image property set AND if it has a cached element on it FOR the given size
213
-		$attr_key = is_array( $attr ) ? implode( '_', $attr ) : $attr;
214
-		$cache_key = is_array( $size ) ? implode( '_', $size ) . $attr_key : $size . $attr_key;
215
-		$this->_feature_image[ $cache_key ] = isset( $this->_feature_image[ $cache_key ] ) ? $this->_feature_image[ $cache_key ] : $this->get_model()->get_feature_image( $this->ID(), $size, $attr );
216
-		return $this->_feature_image[ $cache_key ];
213
+		$attr_key = is_array($attr) ? implode('_', $attr) : $attr;
214
+		$cache_key = is_array($size) ? implode('_', $size).$attr_key : $size.$attr_key;
215
+		$this->_feature_image[$cache_key] = isset($this->_feature_image[$cache_key]) ? $this->_feature_image[$cache_key] : $this->get_model()->get_feature_image($this->ID(), $size, $attr);
216
+		return $this->_feature_image[$cache_key];
217 217
 	}
218 218
 
219 219
 
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param string|array $attr
225 225
 	 * @return string of html
226 226
 	 */
227
-	public function feature_image( $size = 'thumbnail', $attr = '' ) {
228
-		return $this->_get_feature_image( $size, $attr );
227
+	public function feature_image($size = 'thumbnail', $attr = '') {
228
+		return $this->_get_feature_image($size, $attr);
229 229
 	}
230 230
 
231 231
 
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	 * @param  string|array $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32).
236 236
 	 * @return string|boolean          the url of the image or false if not found
237 237
 	 */
238
-	public function feature_image_url( $size = 'thumbnail' ) {
239
-		$attachment = wp_get_attachment_image_src( get_post_thumbnail_id( $this->ID() ), $size );
240
-		return !empty( $attachment ) ? $attachment[ 0 ] : FALSE;
238
+	public function feature_image_url($size = 'thumbnail') {
239
+		$attachment = wp_get_attachment_image_src(get_post_thumbnail_id($this->ID()), $size);
240
+		return ! empty($attachment) ? $attachment[0] : FALSE;
241 241
 	}
242 242
 
243 243
 
@@ -259,36 +259,36 @@  discard block
 block discarded – undo
259 259
 	 *                                 This array is INDEXED by RELATED OBJ NAME (so it corresponds with the obj_names sent);
260 260
 	 * @return void
261 261
 	 */
262
-	public function restore_revision( $revision_id, $related_obj_names = array(), $where_query = array() ) {
262
+	public function restore_revision($revision_id, $related_obj_names = array(), $where_query = array()) {
263 263
 		//get revision object
264
-		$revision_obj = $this->get_model()->get_one_by_ID( $revision_id );
265
-		if ( $revision_obj instanceof EE_CPT_Base ) {
264
+		$revision_obj = $this->get_model()->get_one_by_ID($revision_id);
265
+		if ($revision_obj instanceof EE_CPT_Base) {
266 266
 			//no related_obj_name so we assume we're saving a revision on this object.
267
-			if ( empty( $related_obj_names ) ) {
267
+			if (empty($related_obj_names)) {
268 268
 				$fields = $this->get_model()->get_meta_table_fields();
269
-				foreach ( $fields as $field ) {
270
-					$this->set( $field, $revision_obj->get( $field ) );
269
+				foreach ($fields as $field) {
270
+					$this->set($field, $revision_obj->get($field));
271 271
 				}
272 272
 				$this->save();
273 273
 			}
274
-			$related_obj_names = (array)$related_obj_names;
275
-			foreach ( $related_obj_names as $related_name ) {
274
+			$related_obj_names = (array) $related_obj_names;
275
+			foreach ($related_obj_names as $related_name) {
276 276
 				//related_obj_name so we're saving a revision on an object related to this object
277 277
 				//do we have $where_query params for this related object?  If we do then we include that.
278
-				$cols_n_values = isset( $where_query[ $related_name ] ) ? $where_query[ $related_name ] : array();
279
-				$where_params = !empty( $cols_n_values ) ? array( $cols_n_values ) : array();
280
-				$related_objs = $this->get_many_related( $related_name, $where_params );
281
-				$revision_related_objs = $revision_obj->get_many_related( $related_name, $where_params );
278
+				$cols_n_values = isset($where_query[$related_name]) ? $where_query[$related_name] : array();
279
+				$where_params = ! empty($cols_n_values) ? array($cols_n_values) : array();
280
+				$related_objs = $this->get_many_related($related_name, $where_params);
281
+				$revision_related_objs = $revision_obj->get_many_related($related_name, $where_params);
282 282
 				//load helper
283 283
 				//remove related objs from this object that are not in revision
284 284
 				//array_diff *should* work cause I think objects are indexed by ID?
285
-				$related_to_remove = EEH_Array::object_array_diff( $related_objs, $revision_related_objs );
286
-				foreach ( $related_to_remove as $rr ) {
287
-					$this->_remove_relation_to( $rr, $related_name, $cols_n_values );
285
+				$related_to_remove = EEH_Array::object_array_diff($related_objs, $revision_related_objs);
286
+				foreach ($related_to_remove as $rr) {
287
+					$this->_remove_relation_to($rr, $related_name, $cols_n_values);
288 288
 				}
289 289
 				//add all related objs attached to revision to this object
290
-				foreach ( $revision_related_objs as $r_obj ) {
291
-					$this->_add_relation_to( $r_obj, $related_name, $cols_n_values );
290
+				foreach ($revision_related_objs as $r_obj) {
291
+					$this->_add_relation_to($r_obj, $related_name, $cols_n_values);
292 292
 				}
293 293
 			}
294 294
 		}
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 	 * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li>
305 305
 	 * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul>
306 306
 	 */
307
-	public function get_post_meta( $meta_key = NULL, $single = FALSE ) {
308
-		return get_post_meta( $this->ID(), $meta_key, $single );
307
+	public function get_post_meta($meta_key = NULL, $single = FALSE) {
308
+		return get_post_meta($this->ID(), $meta_key, $single);
309 309
 	}
310 310
 
311 311
 
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 	 * @param mixed  $prev_value
318 318
 	 * @return mixed Returns meta_id if the meta doesn't exist, otherwise returns true on success and false on failure. NOTE: If the meta_value passed to this function is the same as the value that is already in the database, this function returns false.
319 319
 	 */
320
-	public function update_post_meta( $meta_key, $meta_value, $prev_value = NULL ) {
321
-		if ( ! $this->ID() ) {
320
+	public function update_post_meta($meta_key, $meta_value, $prev_value = NULL) {
321
+		if ( ! $this->ID()) {
322 322
 			$this->save();
323 323
 		}
324
-		return update_post_meta( $this->ID(), $meta_key, $meta_value, $prev_value );
324
+		return update_post_meta($this->ID(), $meta_key, $meta_value, $prev_value);
325 325
 	}
326 326
 
327 327
 
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 	 * @param bool  $unique . If postmeta for this $meta_key already exists, whether to add an additional item or not
334 334
 	 * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned.
335 335
 	 */
336
-	public function add_post_meta( $meta_key, $meta_value, $unique = FALSE ) {
337
-		if ( $this->ID() ) {
336
+	public function add_post_meta($meta_key, $meta_value, $unique = FALSE) {
337
+		if ($this->ID()) {
338 338
 			$this->save();
339 339
 		}
340
-		return add_post_meta( $this->ID(), $meta_key, $meta_value, $unique );
340
+		return add_post_meta($this->ID(), $meta_key, $meta_value, $unique);
341 341
 	}
342 342
 
343 343
 
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
 	 * @param mixed $meta_value
350 350
 	 * @return boolean False for failure. True for success.
351 351
 	 */
352
-	public function delete_post_meta( $meta_key, $meta_value = '' ) {
353
-		if ( ! $this->ID() ) {
352
+	public function delete_post_meta($meta_key, $meta_value = '') {
353
+		if ( ! $this->ID()) {
354 354
 			//there are obviously no postmetas for this if it's not saved
355 355
 			//so let's just report this as a success
356 356
 			return true;
357 357
 		}
358
-		return delete_post_meta( $this->ID(), $meta_key, $meta_value );
358
+		return delete_post_meta($this->ID(), $meta_key, $meta_value);
359 359
 	}
360 360
 
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return string
366 366
 	 */
367 367
 	public function get_permalink() {
368
-		return get_permalink( $this->ID() );
368
+		return get_permalink($this->ID());
369 369
 	}
370 370
 
371 371
 
@@ -375,8 +375,8 @@  discard block
 block discarded – undo
375 375
 	 * @param array $query_params
376 376
 	 * @return EE_Term_Taxonomy
377 377
 	 */
378
-	public function term_taxonomies( $query_params = array() ) {
379
-		return $this->get_many_related( 'Term_Taxonomy', $query_params );
378
+	public function term_taxonomies($query_params = array()) {
379
+		return $this->get_many_related('Term_Taxonomy', $query_params);
380 380
 	}
381 381
 
382 382
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     public function __sleep()
407 407
     {
408 408
         $properties_to_serialize = parent::__sleep();
409
-        $properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post'));
409
+        $properties_to_serialize = array_diff($properties_to_serialize, array('_wp_post'));
410 410
         return $properties_to_serialize;
411 411
     }
412 412
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Import.class.php 4 patches
Braces   +27 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
3
+if (!defined( 'EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5
+}
4 6
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
5 7
 /**
6 8
  * EE_Import class
@@ -297,7 +299,7 @@  discard block
 block discarded – undo
297 299
 			if(isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()){
298 300
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from the same database, so attempting to update data", "event_espresso")));
299 301
 				$export_from_site_a_to_b = false;
300
-			}else{
302
+			} else{
301 303
 				$old_site_url = isset( $csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
302 304
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"),$old_site_url,site_url()));
303 305
 			};
@@ -378,7 +380,7 @@  discard block
 block discarded – undo
378 380
 			//now check that assumption was correct. If
379 381
 			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
380 382
 				$model_name = $model_name_in_csv_data;
381
-			}else {
383
+			} else {
382 384
 				// no table info in the array and no table name passed to the function?? FAIL
383 385
 				EE_Error::add_error( __('No table information was specified and/or found, therefore the import could not be completed','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
384 386
 				return FALSE;
@@ -402,7 +404,7 @@  discard block
 block discarded – undo
402 404
 				//there is no primary key)
403 405
 				if($model->has_primary_key_field()){
404 406
 					$id_in_csv =  $model_object_data[$model->primary_key_name()];
405
-				}else{
407
+				} else{
406 408
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
407 409
 				}
408 410
 
@@ -412,7 +414,7 @@  discard block
 block discarded – undo
412 414
 				//or just update.
413 415
 				if($export_from_site_a_to_b){
414 416
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
415
-				}else{//this is just a re-import
417
+				} else{//this is just a re-import
416 418
 					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
417 419
 				}
418 420
 				if( $what_to_do == self::do_nothing ) {
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 						if($model->has_primary_key_field()){
433 435
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
434 436
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
435
-						}else{
437
+						} else{
436 438
 							//we want to update this conflicting item, instead of inserting a conflicting item
437 439
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
438 440
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
@@ -444,9 +446,9 @@  discard block
 block discarded – undo
444 446
 				}
445 447
 				if( $what_to_do == self::do_insert ) {
446 448
 					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
447
-				}elseif( $what_to_do == self::do_update ) {
449
+				} elseif( $what_to_do == self::do_update ) {
448 450
 					$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
449
-				}else{
451
+				} else{
450 452
 					throw new EE_Error( sprintf( __( 'Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso' ), $what_to_do ) );
451 453
 				}
452 454
 			}
@@ -474,7 +476,7 @@  discard block
 block discarded – undo
474 476
 		//in the old data that we know of
475 477
 		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
476 478
 			return self::do_update;
477
-		}else{
479
+		} else{
478 480
 			return self::do_insert;
479 481
 		}
480 482
 	}
@@ -493,7 +495,7 @@  discard block
 block discarded – undo
493 495
 		//in this case, check if this thing ACTUALLY exists in the database
494 496
 		if( $model->get_one_conflicting( $model_object_data ) ){
495 497
 			return self::do_update;
496
-		}else{
498
+		} else{
497 499
 			return self::do_insert;
498 500
 		}
499 501
 	}
@@ -524,7 +526,7 @@  discard block
 block discarded – undo
524 526
 		try{
525 527
 			$model_name_field = $model->get_field_containing_related_model_name();
526 528
 			$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
527
-		}catch( EE_Error $e ){
529
+		} catch( EE_Error $e ){
528 530
 			$model_name_field = NULL;
529 531
 			$models_pointed_to_by_model_name_field = array();
530 532
 		}
@@ -545,7 +547,7 @@  discard block
 block discarded – undo
545 547
 								$found_a_mapping = true;
546 548
 								break;
547 549
 						}
548
-					}else{
550
+					} else{
549 551
 						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
550 552
 								$model_object_data[ $field_obj->get_name() ],
551 553
 								$model_pointed_to_by_fk,
@@ -560,7 +562,7 @@  discard block
 block discarded – undo
560 562
 
561 563
 
562 564
 				}
563
-			}else{
565
+			} else{
564 566
 				//it's a string foreign key (which we leave alone, because those are things
565 567
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
566 568
 				//prefer to just update one)
@@ -603,14 +605,14 @@  discard block
 block discarded – undo
603 605
 		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
604 606
 
605 607
 				return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
606
-			}elseif( $object_id == '0' || $object_id == '' ) {
608
+			} elseif( $object_id == '0' || $object_id == '' ) {
607 609
 				//leave as-is
608 610
 				return $object_id;
609
-			}elseif( $export_from_site_a_to_b ){
611
+			} elseif( $export_from_site_a_to_b ){
610 612
 				//we couldn't find a mapping for this, and it's from a different site,
611 613
 				//so blank it out
612 614
 				return NULL;
613
-			}elseif( ! $export_from_site_a_to_b ) {
615
+			} elseif( ! $export_from_site_a_to_b ) {
614 616
 				//we coudln't find a mapping for this, but it's from thsi DB anyway
615 617
 				//so let's just leave it as-is
616 618
 				return $object_id;
@@ -631,7 +633,7 @@  discard block
 block discarded – undo
631 633
 		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
632 634
 			$effective_id = $model_object_data[$model->primary_key_name()];
633 635
 			unset($model_object_data[$model->primary_key_name()]);
634
-		}else{
636
+		} else{
635 637
 			$effective_id = $model->get_index_primary_key_string( $model_object_data );
636 638
 		}
637 639
 		//the model takes care of validating the CSV's input
@@ -641,7 +643,7 @@  discard block
 block discarded – undo
641 643
 				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_id;
642 644
 				$this->_total_inserts++;
643 645
 				EE_Error::add_success( sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"),$model->get_this_model_name(),$new_id, implode(",",$model_object_data)));
644
-			}else{
646
+			} else{
645 647
 				$this->_total_insert_errors++;
646 648
 				//put the ID used back in there for the error message
647 649
 				if($model->has_primary_key_field()){
@@ -649,7 +651,7 @@  discard block
 block discarded – undo
649 651
 				}
650 652
 				EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__ );
651 653
 			}
652
-		}catch(EE_Error $e){
654
+		} catch(EE_Error $e){
653 655
 			$this->_total_insert_errors++;
654 656
 			if($model->has_primary_key_field()){
655 657
 				$model_object_data[$model->primary_key_name()] = $effective_id;
@@ -676,12 +678,12 @@  discard block
 block discarded – undo
676 678
 				$conditions = array($model->primary_key_name() => $model_object_data[$model->primary_key_name()]);
677 679
 				//remove the primary key because we shouldn't use it for updating
678 680
 				unset($model_object_data_for_update[$model->primary_key_name()]);
679
-			}elseif($model->get_combined_primary_key_fields() > 1 ){
681
+			} elseif($model->get_combined_primary_key_fields() > 1 ){
680 682
 				$conditions = array();
681 683
 				foreach($model->get_combined_primary_key_fields() as $key_field){
682 684
 					$conditions[$key_field->get_name()] = $model_object_data[$key_field->get_name()];
683 685
 				}
684
-			}else{
686
+			} else{
685 687
 				$model->primary_key_name();//this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
686 688
 			}
687 689
 
@@ -695,23 +697,23 @@  discard block
 block discarded – undo
695 697
 				//and so we record what record ended up being updated using the mapping
696 698
 				if( $model->has_primary_key_field() ){
697 699
 					$new_key_for_mapping = $model_object_data[ $model->primary_key_name() ];
698
-				}else{
700
+				} else{
699 701
 					//no primary key just a combined key
700 702
 					$new_key_for_mapping = $model->get_index_primary_key_string( $model_object_data );
701 703
 				}
702 704
 				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $new_key_for_mapping;
703
-			}else{
705
+			} else{
704 706
 				$matched_items = $model->get_all(array($conditions));
705 707
 				if( ! $matched_items){
706 708
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
707 709
 					$this->_total_update_errors++;
708 710
 					EE_Error::add_error( sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data),http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__ );
709
-				}else{
711
+				} else{
710 712
 					$this->_total_updates++;
711 713
 					EE_Error::add_success( sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data)));
712 714
 				}
713 715
 			}
714
-		}catch(EE_Error $e){
716
+		} catch(EE_Error $e){
715 717
 			$this->_total_update_errors++;
716 718
 			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage());
717 719
 			$debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -10 removed lines patch added patch discarded remove patch
@@ -79,10 +79,6 @@  discard block
 block discarded – undo
79 79
 	 *	@ access 	public
80 80
 	 * 	@param 	string 		$title - heading for the form
81 81
 	 * 	@param 	string 		$intro - additional text explaing what to do
82
-	 * 	@param 	string 		$page - EE Admin page to direct form to - in the form "espresso_{pageslug}"
83
-	 * 	@param 	string 		$action - EE Admin page route array "action" that form will direct to
84
-	 * 	@param 	string 		$type - type of file to import
85
-	 *	@ return 	string
86 82
 	 */
87 83
 	public function upload_form ( $title, $intro, $form_url, $action, $type  ) {
88 84
 
@@ -121,7 +117,7 @@  discard block
 block discarded – undo
121 117
 	/**
122 118
 	 *	@Import Event Espresso data - some code "borrowed" from event espresso csv_import.php
123 119
 	 *	@access public
124
-	 *	@return boolean success
120
+	 *	@return boolean|null success
125 121
 	 */
126 122
 	public function import() {
127 123
 
@@ -272,8 +268,7 @@  discard block
 block discarded – undo
272 268
       *
273 269
       * @access public
274 270
       * @param array $csv_data_array - the array containing the csv data produced from EE_CSV::import_csv_to_model_data_array()
275
-      * @param array $fields_to_save - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
276
-      * @return TRUE on success, FALSE on fail
271
+      * @return boolean on success, FALSE on fail
277 272
       * @throws \EE_Error
278 273
       */
279 274
 	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
@@ -370,7 +365,7 @@  discard block
 block discarded – undo
370 365
 	 * we need to insert a new row for that ID, and then map from the non-existent ID
371 366
 	 * to the newly-inserted real ID.
372 367
 	 * @param type $csv_data_array
373
-	 * @param type $export_from_site_a_to_b
368
+	 * @param boolean $export_from_site_a_to_b
374 369
 	 * @param type $old_db_to_new_db_mapping
375 370
 	 * @return array updated $old_db_to_new_db_mapping
376 371
 	 */
@@ -487,7 +482,6 @@  discard block
 block discarded – undo
487 482
 	 * @param type $id_in_csv
488 483
 	 * @param type $model_object_data
489 484
 	 * @param EEM_Base $model
490
-	 * @param type $old_db_to_new_db_mapping
491 485
 	 * @return
492 486
 	 */
493 487
 	protected function _decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model ) {
@@ -597,7 +591,7 @@  discard block
 block discarded – undo
597 591
 	 * @param type $object_id
598 592
 	 * @param string $model_name
599 593
 	 * @param array $old_db_to_new_db_mapping
600
-	 * @param type $export_from_site_a_to_b
594
+	 * @param boolean $export_from_site_a_to_b
601 595
 	 * @return int
602 596
 	 */
603 597
 	protected function _find_mapping_in( $object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
Please login to merge, or discard this patch.
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -131,43 +131,43 @@  discard block
 block discarded – undo
131 131
 		if ( isset( $_REQUEST['import'] )) {
132 132
 			if( isset( $_POST['csv_submitted'] )) {
133 133
 
134
-			    switch ( $_FILES['file']['error'][0] ) {
135
-			        case UPLOAD_ERR_OK:
136
-			            $error_msg = FALSE;
137
-			            break;
138
-			        case UPLOAD_ERR_INI_SIZE:
139
-			            $error_msg = __("'The uploaded file exceeds the upload_max_filesize directive in php.ini.'", "event_espresso");
140
-			            break;
141
-			        case UPLOAD_ERR_FORM_SIZE:
142
-			            $error_msg = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', "event_espresso");
143
-			            break;
144
-			        case UPLOAD_ERR_PARTIAL:
145
-			            $error_msg = __('The uploaded file was only partially uploaded.', "event_espresso");
146
-			            break;
147
-			        case UPLOAD_ERR_NO_FILE:
148
-			            $error_msg = __('No file was uploaded.', "event_espresso");
149
-			            break;
150
-			        case UPLOAD_ERR_NO_TMP_DIR:
151
-			            $error_msg = __('Missing a temporary folder.', "event_espresso");
152
-			            break;
153
-			        case UPLOAD_ERR_CANT_WRITE:
154
-			            $error_msg = __('Failed to write file to disk.', "event_espresso");
155
-			            break;
156
-			        case UPLOAD_ERR_EXTENSION:
157
-			            $error_msg = __('File upload stopped by extension.', "event_espresso");
158
-			            break;
159
-			        default:
160
-			            $error_msg = __('An unknown error occurred and the file could not be uploaded', "event_espresso");
161
-			            break;
162
-			    }
134
+				switch ( $_FILES['file']['error'][0] ) {
135
+					case UPLOAD_ERR_OK:
136
+						$error_msg = FALSE;
137
+						break;
138
+					case UPLOAD_ERR_INI_SIZE:
139
+						$error_msg = __("'The uploaded file exceeds the upload_max_filesize directive in php.ini.'", "event_espresso");
140
+						break;
141
+					case UPLOAD_ERR_FORM_SIZE:
142
+						$error_msg = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.', "event_espresso");
143
+						break;
144
+					case UPLOAD_ERR_PARTIAL:
145
+						$error_msg = __('The uploaded file was only partially uploaded.', "event_espresso");
146
+						break;
147
+					case UPLOAD_ERR_NO_FILE:
148
+						$error_msg = __('No file was uploaded.', "event_espresso");
149
+						break;
150
+					case UPLOAD_ERR_NO_TMP_DIR:
151
+						$error_msg = __('Missing a temporary folder.', "event_espresso");
152
+						break;
153
+					case UPLOAD_ERR_CANT_WRITE:
154
+						$error_msg = __('Failed to write file to disk.', "event_espresso");
155
+						break;
156
+					case UPLOAD_ERR_EXTENSION:
157
+						$error_msg = __('File upload stopped by extension.', "event_espresso");
158
+						break;
159
+					default:
160
+						$error_msg = __('An unknown error occurred and the file could not be uploaded', "event_espresso");
161
+						break;
162
+				}
163 163
 
164 164
 				if ( ! $error_msg ) {
165 165
 
166
-				    $filename	= $_FILES['file']['name'][0];
166
+					$filename	= $_FILES['file']['name'][0];
167 167
 					$file_ext 		= substr( strrchr( $filename, '.' ), 1 );
168
-				    $file_type 	= $_FILES['file']['type'][0];
169
-				    $temp_file	= $_FILES['file']['tmp_name'][0];
170
-				    $filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
168
+					$file_type 	= $_FILES['file']['type'][0];
169
+					$temp_file	= $_FILES['file']['tmp_name'][0];
170
+					$filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
171 171
 
172 172
 					if ( $file_ext=='csv' ) {
173 173
 
@@ -242,40 +242,40 @@  discard block
 block discarded – undo
242 242
 
243 243
 
244 244
 
245
-     /**
246
-      *    Given an array of data (usually from a CSV import) attempts to save that data to the db.
247
-      *    If $model_name ISN'T provided, assumes that this is a 3d array, with toplevel keys being model names,
248
-      *    next level being numeric indexes adn each value representing a model object, and the last layer down
249
-      *    being keys of model fields and their proposed values.
250
-      *    If $model_name IS provided, assumes a 2d array of the bottom two layers previously mentioned.
251
-      *    If the CSV data says (in the metadata row) that it's from the SAME database,
252
-      *    we treat the IDs in the CSV as the normal IDs, and try to update those records. However, if those
253
-      *    IDs DON'T exist in the database, they're treated as temporary IDs,
254
-      *    which can used elsewhere to refer to the same object. Once an item
255
-      *    with a temporary ID gets inserted, we record its mapping from temporary
256
-      *    ID to real ID, and use the real ID in place of the temporary ID
257
-      *    when that temporary ID was used as a foreign key.
258
-      *    If the CSV data says (in the metadata again) that it's from a DIFFERENT database,
259
-      *    we treat all the IDs in the CSV as temporary ID- eg, if the CSV specifies an event with
260
-      *    ID 1, and the database already has an event with ID 1, we assume that's just a coincidence,
261
-      *    and insert a new event, and map it's temporary ID of 1 over to its new real ID.
262
-      *    An important exception are non-auto-increment primary keys. If one entry in the
263
-      *    CSV file has the same ID as one in the DB, we assume they are meant to be
264
-      *    the same item, and instead update the item in the DB with that same ID.
265
-      *    Also note, we remember the mappings permanently. So the 2nd, 3rd, and 10000th
266
-      *    time you import a CSV from a different site, we remember their mappings, and
267
-      * will try to update the item in the DB instead of inserting another item (eg
268
-      * if we previously imported an event with temporary ID 1, and then it got a
269
-      * real ID of 123, we remember that. So the next time we import an event with
270
-      * temporary ID, from the same site, we know that it's real ID is 123, and will
271
-      * update that event, instead of adding a new event).
272
-      *
273
-      * @access public
274
-      * @param array $csv_data_array - the array containing the csv data produced from EE_CSV::import_csv_to_model_data_array()
275
-      * @param array $fields_to_save - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
276
-      * @return TRUE on success, FALSE on fail
277
-      * @throws \EE_Error
278
-      */
245
+	 /**
246
+	  *    Given an array of data (usually from a CSV import) attempts to save that data to the db.
247
+	  *    If $model_name ISN'T provided, assumes that this is a 3d array, with toplevel keys being model names,
248
+	  *    next level being numeric indexes adn each value representing a model object, and the last layer down
249
+	  *    being keys of model fields and their proposed values.
250
+	  *    If $model_name IS provided, assumes a 2d array of the bottom two layers previously mentioned.
251
+	  *    If the CSV data says (in the metadata row) that it's from the SAME database,
252
+	  *    we treat the IDs in the CSV as the normal IDs, and try to update those records. However, if those
253
+	  *    IDs DON'T exist in the database, they're treated as temporary IDs,
254
+	  *    which can used elsewhere to refer to the same object. Once an item
255
+	  *    with a temporary ID gets inserted, we record its mapping from temporary
256
+	  *    ID to real ID, and use the real ID in place of the temporary ID
257
+	  *    when that temporary ID was used as a foreign key.
258
+	  *    If the CSV data says (in the metadata again) that it's from a DIFFERENT database,
259
+	  *    we treat all the IDs in the CSV as temporary ID- eg, if the CSV specifies an event with
260
+	  *    ID 1, and the database already has an event with ID 1, we assume that's just a coincidence,
261
+	  *    and insert a new event, and map it's temporary ID of 1 over to its new real ID.
262
+	  *    An important exception are non-auto-increment primary keys. If one entry in the
263
+	  *    CSV file has the same ID as one in the DB, we assume they are meant to be
264
+	  *    the same item, and instead update the item in the DB with that same ID.
265
+	  *    Also note, we remember the mappings permanently. So the 2nd, 3rd, and 10000th
266
+	  *    time you import a CSV from a different site, we remember their mappings, and
267
+	  * will try to update the item in the DB instead of inserting another item (eg
268
+	  * if we previously imported an event with temporary ID 1, and then it got a
269
+	  * real ID of 123, we remember that. So the next time we import an event with
270
+	  * temporary ID, from the same site, we know that it's real ID is 123, and will
271
+	  * update that event, instead of adding a new event).
272
+	  *
273
+	  * @access public
274
+	  * @param array $csv_data_array - the array containing the csv data produced from EE_CSV::import_csv_to_model_data_array()
275
+	  * @param array $fields_to_save - an array containing the csv column names as keys with the corresponding db table fields they will be saved to
276
+	  * @return TRUE on success, FALSE on fail
277
+	  * @throws \EE_Error
278
+	  */
279 279
 	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
280 280
 
281 281
 
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
 			unset($csv_data_array[EE_CSV::metadata_header]);
307 307
 		}
308 308
 		/**
309
-		* @var $old_db_to_new_db_mapping 2d array: toplevel keys being model names, bottom-level keys being the original key, and
310
-		* the value will be the newly-inserted ID.
311
-		* If we have already imported data from the same website via CSV, it shoudl be kept in this wp option
312
-		*/
309
+		 * @var $old_db_to_new_db_mapping 2d array: toplevel keys being model names, bottom-level keys being the original key, and
310
+		 * the value will be the newly-inserted ID.
311
+		 * If we have already imported data from the same website via CSV, it shoudl be kept in this wp option
312
+		 */
313 313
 	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url),array());
314 314
 	   if( $old_db_to_new_db_mapping){
315 315
 		   EE_Error::add_attention(sprintf(__("We noticed you have imported data via CSV from %s before. Because of this, IDs in your CSV have been mapped to their new IDs in %s", "event_espresso"),$old_site_url,site_url()));
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if (!defined( 'EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
4
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
5 5
 /**
6 6
  * EE_Import class
7 7
  *
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function instance() {
60 60
 		// check if class object is instantiated
61
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Import )) {
61
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Import)) {
62 62
 			self::$_instance = new self();
63 63
 		}
64 64
 		return self::$_instance;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * Resets the importer
69 69
 	 * @return EE_Import
70 70
 	 */
71
-	public static function reset(){
71
+	public static function reset() {
72 72
 		self::$_instance = null;
73 73
 		return self::instance();
74 74
 	}
@@ -86,27 +86,27 @@  discard block
 block discarded – undo
86 86
 	 * 	@param 	string 		$type - type of file to import
87 87
 	 *	@ return 	string
88 88
 	 */
89
-	public function upload_form ( $title, $intro, $form_url, $action, $type  ) {
89
+	public function upload_form($title, $intro, $form_url, $action, $type) {
90 90
 
91
-		$form_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => $action ), $form_url );
91
+		$form_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => $action), $form_url);
92 92
 
93 93
 		ob_start();
94 94
 ?>
95 95
 	<div class="ee-upload-form-dv">
96
-		<h3><?php echo $title;?></h3>
97
-		<p><?php echo $intro;?></p>
96
+		<h3><?php echo $title; ?></h3>
97
+		<p><?php echo $intro; ?></p>
98 98
 
99 99
 		<form action="<?php echo $form_url?>" method="post" enctype="multipart/form-data">
100
-			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time();?>">
101
-			<input name="import" type="hidden" value="<?php echo $type;?>" />
100
+			<input type="hidden" name="csv_submitted" value="TRUE" id="<?php echo time(); ?>">
101
+			<input name="import" type="hidden" value="<?php echo $type; ?>" />
102 102
 			<input type="file" name="file[]" size="90" >
103
-			<input class="button-primary" type="submit" value="<?php _e( 'Upload File', 'event_espresso' );?>">
103
+			<input class="button-primary" type="submit" value="<?php _e('Upload File', 'event_espresso'); ?>">
104 104
 		</form>
105 105
 
106 106
 		<p class="ee-attention">
107
-			<b><?php _e( 'Attention', 'event_espresso' );?></b><br/>
108
-			<?php echo sprintf( __( 'Accepts .%s file types only.', 'event_espresso' ), $type ) ;?>
109
-			<?php echo __( 'Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso' );?>
107
+			<b><?php _e('Attention', 'event_espresso'); ?></b><br/>
108
+			<?php echo sprintf(__('Accepts .%s file types only.', 'event_espresso'), $type); ?>
109
+			<?php echo __('Please only import CSV files exported from Event Espresso, or compatible 3rd-party software.', 'event_espresso'); ?>
110 110
 		</p>
111 111
 
112 112
 	</div>
@@ -127,13 +127,13 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function import() {
129 129
 
130
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
130
+		require_once(EE_CLASSES.'EE_CSV.class.php');
131 131
 		$this->EE_CSV = EE_CSV::instance();
132 132
 
133
-		if ( isset( $_REQUEST['import'] )) {
134
-			if( isset( $_POST['csv_submitted'] )) {
133
+		if (isset($_REQUEST['import'])) {
134
+			if (isset($_POST['csv_submitted'])) {
135 135
 
136
-			    switch ( $_FILES['file']['error'][0] ) {
136
+			    switch ($_FILES['file']['error'][0]) {
137 137
 			        case UPLOAD_ERR_OK:
138 138
 			            $error_msg = FALSE;
139 139
 			            break;
@@ -163,32 +163,32 @@  discard block
 block discarded – undo
163 163
 			            break;
164 164
 			    }
165 165
 
166
-				if ( ! $error_msg ) {
166
+				if ( ! $error_msg) {
167 167
 
168
-				    $filename	= $_FILES['file']['name'][0];
169
-					$file_ext 		= substr( strrchr( $filename, '.' ), 1 );
170
-				    $file_type 	= $_FILES['file']['type'][0];
171
-				    $temp_file	= $_FILES['file']['tmp_name'][0];
172
-				    $filesize    	= $_FILES['file']['size'][0] / 1024;//convert from bytes to KB
168
+				    $filename = $_FILES['file']['name'][0];
169
+					$file_ext = substr(strrchr($filename, '.'), 1);
170
+				    $file_type = $_FILES['file']['type'][0];
171
+				    $temp_file = $_FILES['file']['tmp_name'][0];
172
+				    $filesize = $_FILES['file']['size'][0] / 1024; //convert from bytes to KB
173 173
 
174
-					if ( $file_ext=='csv' ) {
174
+					if ($file_ext == 'csv') {
175 175
 
176
-						$max_upload = $this->EE_CSV->get_max_upload_size();//max upload size in KB
177
-						if ( $filesize < $max_upload || true) {
176
+						$max_upload = $this->EE_CSV->get_max_upload_size(); //max upload size in KB
177
+						if ($filesize < $max_upload || true) {
178 178
 
179
-							$wp_upload_dir = str_replace( array( '\\', '/' ), DS, wp_upload_dir());
180
-							$path_to_file = $wp_upload_dir['basedir'] . DS . 'espresso' . DS . $filename;
179
+							$wp_upload_dir = str_replace(array('\\', '/'), DS, wp_upload_dir());
180
+							$path_to_file = $wp_upload_dir['basedir'].DS.'espresso'.DS.$filename;
181 181
 
182
-							if( move_uploaded_file( $temp_file, $path_to_file )) {
182
+							if (move_uploaded_file($temp_file, $path_to_file)) {
183 183
 
184 184
 								// convert csv to array
185
-								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array( $path_to_file );
185
+								$this->csv_array = $this->EE_CSV->import_csv_to_model_data_array($path_to_file);
186 186
 
187 187
 								// was data successfully stored in an array?
188
-								if ( is_array( $this->csv_array ) ) {
188
+								if (is_array($this->csv_array)) {
189 189
 
190
-									$import_what = str_replace( 'csv_import_', '', $_REQUEST['action'] );
191
-									$import_what = str_replace( '_', ' ', ucwords( $import_what ));
190
+									$import_what = str_replace('csv_import_', '', $_REQUEST['action']);
191
+									$import_what = str_replace('_', ' ', ucwords($import_what));
192 192
 									$processed_data = $this->csv_array;
193 193
 									$this->columns_to_save = FALSE;
194 194
 
@@ -207,33 +207,33 @@  discard block
 block discarded – undo
207 207
 
208 208
 									}
209 209
 									// save processed codes to db
210
-									if ( $this->save_csv_data_array_to_db( $processed_data, $this->columns_to_save ) ) {
210
+									if ($this->save_csv_data_array_to_db($processed_data, $this->columns_to_save)) {
211 211
 										return TRUE;
212 212
 
213 213
 									}
214 214
 								} else {
215 215
 									// no array? must be an error
216
-									EE_Error::add_error(sprintf(__("No file seems to have been uploaded", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
216
+									EE_Error::add_error(sprintf(__("No file seems to have been uploaded", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
217 217
 									return FALSE;
218 218
 								}
219 219
 
220 220
 							} else {
221
-								EE_Error::add_error(sprintf(__("%s was not successfully uploaded", "event_espresso"),$filename), __FILE__, __FUNCTION__, __LINE__ );
221
+								EE_Error::add_error(sprintf(__("%s was not successfully uploaded", "event_espresso"), $filename), __FILE__, __FUNCTION__, __LINE__);
222 222
 								return FALSE;
223 223
 							}
224 224
 
225 225
 						} else {
226
-							EE_Error::add_error( sprintf(__("%s was too large of a file and could not be uploaded. The max filesize is %s' KB.", "event_espresso"),$filename,$max_upload), __FILE__, __FUNCTION__, __LINE__ );
226
+							EE_Error::add_error(sprintf(__("%s was too large of a file and could not be uploaded. The max filesize is %s' KB.", "event_espresso"), $filename, $max_upload), __FILE__, __FUNCTION__, __LINE__);
227 227
 							return FALSE;
228 228
 						}
229 229
 
230 230
 					} else {
231
-						EE_Error::add_error( sprintf(__("%s  had an invalid file extension, not uploaded", "event_espresso"),$filename), __FILE__, __FUNCTION__, __LINE__ );
231
+						EE_Error::add_error(sprintf(__("%s  had an invalid file extension, not uploaded", "event_espresso"), $filename), __FILE__, __FUNCTION__, __LINE__);
232 232
 						return FALSE;
233 233
 					}
234 234
 
235 235
 				} else {
236
-					EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
236
+					EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
237 237
 					return FALSE;
238 238
 				}
239 239
 
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
       * @return TRUE on success, FALSE on fail
279 279
       * @throws \EE_Error
280 280
       */
281
-	public function save_csv_data_array_to_db( $csv_data_array, $model_name = FALSE ) {
281
+	public function save_csv_data_array_to_db($csv_data_array, $model_name = FALSE) {
282 282
 
283 283
 
284 284
 		$success = FALSE;
@@ -288,22 +288,22 @@  discard block
 block discarded – undo
288 288
 		$export_from_site_a_to_b = true;
289 289
 		// first level of array is not table information but a table name was passed to the function
290 290
 		// array is only two levels deep, so let's fix that by adding a level, else the next steps will fail
291
-		if($model_name){
291
+		if ($model_name) {
292 292
 			$csv_data_array = array($csv_data_array);
293 293
 		}
294 294
 		// begin looking through the $csv_data_array, expecting the toplevel key to be the model's name...
295 295
 		$old_site_url = 'none-specified';
296 296
 
297 297
 		//hanlde metadata
298
-		if(isset($csv_data_array[EE_CSV::metadata_header]) ){
298
+		if (isset($csv_data_array[EE_CSV::metadata_header])) {
299 299
 			$csv_metadata = array_shift($csv_data_array[EE_CSV::metadata_header]);
300 300
 			//ok so its metadata, dont try to save it to ehte db obviously...
301
-			if(isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()){
301
+			if (isset($csv_metadata['site_url']) && $csv_metadata['site_url'] == site_url()) {
302 302
 				EE_Error::add_attention(sprintf(__("CSV Data appears to be from the same database, so attempting to update data", "event_espresso")));
303 303
 				$export_from_site_a_to_b = false;
304
-			}else{
305
-				$old_site_url = isset( $csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
306
-				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"),$old_site_url,site_url()));
304
+			} else {
305
+				$old_site_url = isset($csv_metadata['site_url']) ? $csv_metadata['site_url'] : $old_site_url;
306
+				EE_Error::add_attention(sprintf(__("CSV Data appears to be from a different database (%s instead of %s), so we assume IDs in the CSV data DO NOT correspond to IDs in this database", "event_espresso"), $old_site_url, site_url()));
307 307
 			};
308 308
 			unset($csv_data_array[EE_CSV::metadata_header]);
309 309
 		}
@@ -312,30 +312,30 @@  discard block
 block discarded – undo
312 312
 		* the value will be the newly-inserted ID.
313 313
 		* If we have already imported data from the same website via CSV, it shoudl be kept in this wp option
314 314
 		*/
315
-	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url),array());
316
-	   if( $old_db_to_new_db_mapping){
317
-		   EE_Error::add_attention(sprintf(__("We noticed you have imported data via CSV from %s before. Because of this, IDs in your CSV have been mapped to their new IDs in %s", "event_espresso"),$old_site_url,site_url()));
315
+	   $old_db_to_new_db_mapping = get_option('ee_id_mapping_from'.sanitize_title($old_site_url), array());
316
+	   if ($old_db_to_new_db_mapping) {
317
+		   EE_Error::add_attention(sprintf(__("We noticed you have imported data via CSV from %s before. Because of this, IDs in your CSV have been mapped to their new IDs in %s", "event_espresso"), $old_site_url, site_url()));
318 318
 	   }
319 319
 	   $old_db_to_new_db_mapping = $this->save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping);
320 320
 
321 321
 		//save the mapping from old db to new db in case they try re-importing the same data from the same website again
322
-		update_option('ee_id_mapping_from'.sanitize_title($old_site_url),$old_db_to_new_db_mapping);
322
+		update_option('ee_id_mapping_from'.sanitize_title($old_site_url), $old_db_to_new_db_mapping);
323 323
 
324
-		if ( $this->_total_updates > 0 ) {
325
-			EE_Error::add_success( sprintf(__("%s existing records in the database were updated.", "event_espresso"),$this->_total_updates));
324
+		if ($this->_total_updates > 0) {
325
+			EE_Error::add_success(sprintf(__("%s existing records in the database were updated.", "event_espresso"), $this->_total_updates));
326 326
 			$success = true;
327 327
 		}
328
-		if ( $this->_total_inserts > 0 ) {
329
-			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"),$this->_total_inserts));
328
+		if ($this->_total_inserts > 0) {
329
+			EE_Error::add_success(sprintf(__("%s new records were added to the database.", "event_espresso"), $this->_total_inserts));
330 330
 			$success = true;
331 331
 		}
332 332
 
333
-		if ( $this->_total_update_errors > 0 ) {
334
-			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"),$this->_total_update_errors), __FILE__, __FUNCTION__, __LINE__ );
333
+		if ($this->_total_update_errors > 0) {
334
+			EE_Error::add_error(sprintf(__("'One or more errors occurred, and a total of %s existing records in the database were <strong>not</strong> updated.'", "event_espresso"), $this->_total_update_errors), __FILE__, __FUNCTION__, __LINE__);
335 335
 			$error = true;
336 336
 		}
337
-		if ( $this->_total_insert_errors > 0 ) {
338
-			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"),$this->_total_insert_errors), __FILE__, __FUNCTION__, __LINE__ );
337
+		if ($this->_total_insert_errors > 0) {
338
+			EE_Error::add_error(sprintf(__("One or more errors occurred, and a total of %s new records were <strong>not</strong> added to the database.'", "event_espresso"), $this->_total_insert_errors), __FILE__, __FUNCTION__, __LINE__);
339 339
 			$error = true;
340 340
 		}
341 341
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		EEM_Ticket::instance()->update_tickets_sold(EEM_Ticket::instance()->get_all());
345 345
 
346 346
 		// if there was at least one success and absolutely no errors
347
-		if ( $success && ! $error ) {
347
+		if ($success && ! $error) {
348 348
 			return TRUE;
349 349
 		} else {
350 350
 			return FALSE;
@@ -376,81 +376,81 @@  discard block
 block discarded – undo
376 376
 	 * @param type $old_db_to_new_db_mapping
377 377
 	 * @return array updated $old_db_to_new_db_mapping
378 378
 	 */
379
-	public function save_data_rows_to_db( $csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping ) {
380
-		foreach ( $csv_data_array as $model_name_in_csv_data => $model_data_from_import ) {
379
+	public function save_data_rows_to_db($csv_data_array, $export_from_site_a_to_b, $old_db_to_new_db_mapping) {
380
+		foreach ($csv_data_array as $model_name_in_csv_data => $model_data_from_import) {
381 381
 			//now check that assumption was correct. If
382
-			if ( EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
382
+			if (EE_Registry::instance()->is_model_name($model_name_in_csv_data)) {
383 383
 				$model_name = $model_name_in_csv_data;
384
-			}else {
384
+			} else {
385 385
 				// no table info in the array and no table name passed to the function?? FAIL
386
-				EE_Error::add_error( __('No table information was specified and/or found, therefore the import could not be completed','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
386
+				EE_Error::add_error(__('No table information was specified and/or found, therefore the import could not be completed', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
387 387
 				return FALSE;
388 388
 			}
389 389
 			/* @var $model EEM_Base */
390 390
 			$model = EE_Registry::instance()->load_model($model_name);
391 391
 
392 392
 			//so without further ado, scanning all the data provided for primary keys and their inital values
393
-			foreach ( $model_data_from_import as $model_object_data ) {
393
+			foreach ($model_data_from_import as $model_object_data) {
394 394
 				//before we do ANYTHING, make sure the csv row wasn't just completely blank
395 395
 				$row_is_completely_empty = true;
396
-				foreach($model_object_data as $field){
397
-					if($field){
396
+				foreach ($model_object_data as $field) {
397
+					if ($field) {
398 398
 						$row_is_completely_empty = false;
399 399
 					}
400 400
 				}
401
-				if($row_is_completely_empty){
401
+				if ($row_is_completely_empty) {
402 402
 					continue;
403 403
 				}
404 404
 				//find the PK in the row of data (or a combined key if
405 405
 				//there is no primary key)
406
-				if($model->has_primary_key_field()){
407
-					$id_in_csv =  $model_object_data[$model->primary_key_name()];
408
-				}else{
406
+				if ($model->has_primary_key_field()) {
407
+					$id_in_csv = $model_object_data[$model->primary_key_name()];
408
+				} else {
409 409
 					$id_in_csv = $model->get_index_primary_key_string($model_object_data);
410 410
 				}
411 411
 
412 412
 
413
-				$model_object_data = $this->_replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b );
413
+				$model_object_data = $this->_replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b);
414 414
 				//now we need to decide if we're going to add a new model object given the $model_object_data,
415 415
 				//or just update.
416
-				if($export_from_site_a_to_b){
417
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
418
-				}else{//this is just a re-import
419
-					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
416
+				if ($export_from_site_a_to_b) {
417
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
418
+				} else {//this is just a re-import
419
+					$what_to_do = $this->_decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
420 420
 				}
421
-				if( $what_to_do == self::do_nothing ) {
421
+				if ($what_to_do == self::do_nothing) {
422 422
 					continue;
423 423
 				}
424 424
 
425 425
 				//double-check we actually want to insert, if that's what we're planning
426 426
 				//based on whether this item would be unique in the DB or not
427
-				if( $what_to_do == self::do_insert ) {
427
+				if ($what_to_do == self::do_insert) {
428 428
 					//we're supposed to be inserting. But wait, will this thing
429 429
 					//be acceptable if inserted?
430
-					$conflicting = $model->get_one_conflicting( $model_object_data, false );
431
-					if($conflicting){
430
+					$conflicting = $model->get_one_conflicting($model_object_data, false);
431
+					if ($conflicting) {
432 432
 						//ok, this item would conflict if inserted. Just update the item that it conflicts with.
433 433
 						$what_to_do = self::do_update;
434 434
 						//and if this model has a primary key, remember its mapping
435
-						if($model->has_primary_key_field()){
435
+						if ($model->has_primary_key_field()) {
436 436
 							$old_db_to_new_db_mapping[$model_name][$id_in_csv] = $conflicting->ID();
437 437
 							$model_object_data[$model->primary_key_name()] = $conflicting->ID();
438
-						}else{
438
+						} else {
439 439
 							//we want to update this conflicting item, instead of inserting a conflicting item
440 440
 							//so we need to make sure they match entirely (its possible that they only conflicted on one field, but we need them to match on other fields
441 441
 							//for the WHERE conditions in the update). At the time of this comment, there were no models like this
442
-							foreach($model->get_combined_primary_key_fields() as $key_field){
442
+							foreach ($model->get_combined_primary_key_fields() as $key_field) {
443 443
 								$model_object_data[$key_field->get_name()] = $conflicting->get($key_field->get_name());
444 444
 							}
445 445
 						}
446 446
 					}
447 447
 				}
448
-				if( $what_to_do == self::do_insert ) {
449
-					$old_db_to_new_db_mapping = $this->_insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
450
-				}elseif( $what_to_do == self::do_update ) {
451
-					$old_db_to_new_db_mapping = $this->_update_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping );
452
-				}else{
453
-					throw new EE_Error( sprintf( __( 'Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso' ), $what_to_do ) );
448
+				if ($what_to_do == self::do_insert) {
449
+					$old_db_to_new_db_mapping = $this->_insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
450
+				}elseif ($what_to_do == self::do_update) {
451
+					$old_db_to_new_db_mapping = $this->_update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping);
452
+				} else {
453
+					throw new EE_Error(sprintf(__('Programming error. We shoudl be inserting or updating, but instead we are being told to "%s", whifh is invalid', 'event_espresso'), $what_to_do));
454 454
 				}
455 455
 			}
456 456
 		}
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 	 * @param array $old_db_to_new_db_mapping by reference so it can be modified
472 472
 	 * @return string one of the consts on this class that starts with do_*
473 473
 	 */
474
-	protected function _decide_whether_to_insert_or_update_given_data_from_other_db( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
474
+	protected function _decide_whether_to_insert_or_update_given_data_from_other_db($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
475 475
 		$model_name = $model->get_this_model_name();
476 476
 		//if it's a site-to-site export-and-import, see if this modelobject's id
477 477
 		//in the old data that we know of
478
-		if( isset($old_db_to_new_db_mapping[$model_name][$id_in_csv]) ){
478
+		if (isset($old_db_to_new_db_mapping[$model_name][$id_in_csv])) {
479 479
 			return self::do_update;
480
-		}else{
480
+		} else {
481 481
 			return self::do_insert;
482 482
 		}
483 483
 	}
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	 * @param type $old_db_to_new_db_mapping
493 493
 	 * @return
494 494
 	 */
495
-	protected function _decide_whether_to_insert_or_update_given_data_from_same_db( $id_in_csv, $model_object_data, $model ) {
495
+	protected function _decide_whether_to_insert_or_update_given_data_from_same_db($id_in_csv, $model_object_data, $model) {
496 496
 		//in this case, check if this thing ACTUALLY exists in the database
497
-		if( $model->get_one_conflicting( $model_object_data ) ){
497
+		if ($model->get_one_conflicting($model_object_data)) {
498 498
 			return self::do_update;
499
-		}else{
499
+		} else {
500 500
 			return self::do_insert;
501 501
 		}
502 502
 	}
@@ -515,55 +515,55 @@  discard block
 block discarded – undo
515 515
 	 * @param boolean $export_from_site_a_to_b
516 516
 	 * @return array updated model object data with temp IDs removed
517 517
 	 */
518
-	protected function _replace_temp_ids_with_mappings( $model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b ) {
518
+	protected function _replace_temp_ids_with_mappings($model_object_data, $model, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
519 519
 		//if this model object's primary key is in the mapping, replace it
520
-		if( $model->has_primary_key_field() &&
520
+		if ($model->has_primary_key_field() &&
521 521
 				$model->get_primary_key_field()->is_auto_increment() &&
522
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ] ) &&
523
-				isset( $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ] ) ) {
524
-			$model_object_data[ $model->primary_key_name() ] = $old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $model_object_data[ $model->primary_key_name() ] ];
522
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()]) &&
523
+				isset($old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]])) {
524
+			$model_object_data[$model->primary_key_name()] = $old_db_to_new_db_mapping[$model->get_this_model_name()][$model_object_data[$model->primary_key_name()]];
525 525
 		}
526 526
 
527
-		try{
527
+		try {
528 528
 			$model_name_field = $model->get_field_containing_related_model_name();
529 529
 			$models_pointed_to_by_model_name_field = $model_name_field->get_model_names_pointed_to();
530
-		}catch( EE_Error $e ){
530
+		} catch (EE_Error $e) {
531 531
 			$model_name_field = NULL;
532 532
 			$models_pointed_to_by_model_name_field = array();
533 533
 		}
534
-		foreach( $model->field_settings( true )  as $field_obj ){
535
-			if( $field_obj instanceof EE_Foreign_Key_Int_Field ) {
534
+		foreach ($model->field_settings(true)  as $field_obj) {
535
+			if ($field_obj instanceof EE_Foreign_Key_Int_Field) {
536 536
 				$models_pointed_to = $field_obj->get_model_names_pointed_to();
537 537
 				$found_a_mapping = false;
538
-				foreach( $models_pointed_to as $model_pointed_to_by_fk ) {
538
+				foreach ($models_pointed_to as $model_pointed_to_by_fk) {
539 539
 
540
-					if( $model_name_field ){
541
-						$value_of_model_name_field = $model_object_data[ $model_name_field->get_name() ];
542
-						if( $value_of_model_name_field == $model_pointed_to_by_fk ) {
543
-							$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
544
-									$model_object_data[ $field_obj->get_name() ],
540
+					if ($model_name_field) {
541
+						$value_of_model_name_field = $model_object_data[$model_name_field->get_name()];
542
+						if ($value_of_model_name_field == $model_pointed_to_by_fk) {
543
+							$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
544
+									$model_object_data[$field_obj->get_name()],
545 545
 									$model_pointed_to_by_fk,
546 546
 									$old_db_to_new_db_mapping,
547 547
 									$export_from_site_a_to_b );
548 548
 								$found_a_mapping = true;
549 549
 								break;
550 550
 						}
551
-					}else{
552
-						$model_object_data[ $field_obj->get_name() ] = $this->_find_mapping_in(
553
-								$model_object_data[ $field_obj->get_name() ],
551
+					} else {
552
+						$model_object_data[$field_obj->get_name()] = $this->_find_mapping_in(
553
+								$model_object_data[$field_obj->get_name()],
554 554
 								$model_pointed_to_by_fk,
555 555
 								$old_db_to_new_db_mapping,
556 556
 								$export_from_site_a_to_b );
557 557
 						$found_a_mapping = true;
558 558
 					}
559 559
 					//once we've found a mapping for this field no need to continue
560
-					if( $found_a_mapping ) {
560
+					if ($found_a_mapping) {
561 561
 						break;
562 562
 					}
563 563
 
564 564
 
565 565
 				}
566
-			}else{
566
+			} else {
567 567
 				//it's a string foreign key (which we leave alone, because those are things
568 568
 				//like country names, which we'd really rather not make 2 USAs etc (we'd actually
569 569
 				//prefer to just update one)
@@ -571,8 +571,8 @@  discard block
 block discarded – undo
571 571
 			}
572 572
 		}
573 573
 		//
574
-		if( $model instanceof EEM_Term_Taxonomy ){
575
-			$model_object_data = $this->_handle_split_term_ids( $model_object_data );
574
+		if ($model instanceof EEM_Term_Taxonomy) {
575
+			$model_object_data = $this->_handle_split_term_ids($model_object_data);
576 576
 		}
577 577
 		return $model_object_data;
578 578
 	}
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
 	 * @param type $model_object_data
585 585
 	 * @return array new model object data
586 586
 	 */
587
-	protected function _handle_split_term_ids( $model_object_data ){
588
-		if( isset( $model_object_data['term_id'] ) && isset( $model_object_data[ 'taxonomy' ]) && apply_filters( 'FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists( 'wp_get_split_term' ), $model_object_data ) ) {
589
-			$new_term_id = wp_get_split_term( $model_object_data[ 'term_id' ], $model_object_data[ 'taxonomy' ] );
590
-			if( $new_term_id ){
591
-				$model_object_data[ 'term_id' ] = $new_term_id;
587
+	protected function _handle_split_term_ids($model_object_data) {
588
+		if (isset($model_object_data['term_id']) && isset($model_object_data['taxonomy']) && apply_filters('FHEE__EE_Import__handle_split_term_ids__function_exists', function_exists('wp_get_split_term'), $model_object_data)) {
589
+			$new_term_id = wp_get_split_term($model_object_data['term_id'], $model_object_data['taxonomy']);
590
+			if ($new_term_id) {
591
+				$model_object_data['term_id'] = $new_term_id;
592 592
 			}
593 593
 		}
594 594
 		return $model_object_data;
@@ -602,18 +602,18 @@  discard block
 block discarded – undo
602 602
 	 * @param type $export_from_site_a_to_b
603 603
 	 * @return int
604 604
 	 */
605
-	protected function _find_mapping_in( $object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
606
-		if(	isset( $old_db_to_new_db_mapping[ $model_name ][ $object_id ] ) ){
605
+	protected function _find_mapping_in($object_id, $model_name, $old_db_to_new_db_mapping, $export_from_site_a_to_b) {
606
+		if (isset($old_db_to_new_db_mapping[$model_name][$object_id])) {
607 607
 
608
-				return $old_db_to_new_db_mapping[ $model_name ][ $object_id ];
609
-			}elseif( $object_id == '0' || $object_id == '' ) {
608
+				return $old_db_to_new_db_mapping[$model_name][$object_id];
609
+			}elseif ($object_id == '0' || $object_id == '') {
610 610
 				//leave as-is
611 611
 				return $object_id;
612
-			}elseif( $export_from_site_a_to_b ){
612
+			}elseif ($export_from_site_a_to_b) {
613 613
 				//we couldn't find a mapping for this, and it's from a different site,
614 614
 				//so blank it out
615 615
 				return NULL;
616
-			}elseif( ! $export_from_site_a_to_b ) {
616
+			}elseif ( ! $export_from_site_a_to_b) {
617 617
 				//we coudln't find a mapping for this, but it's from thsi DB anyway
618 618
 				//so let's just leave it as-is
619 619
 				return $object_id;
@@ -628,36 +628,36 @@  discard block
 block discarded – undo
628 628
 	 * @param type $old_db_to_new_db_mapping
629 629
 	 * @return array updated $old_db_to_new_db_mapping
630 630
 	 */
631
-	protected function _insert_from_data_array( $id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping ) {
631
+	protected function _insert_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
632 632
 		//remove the primary key, if there is one (we don't want it for inserts OR updates)
633 633
 		//we'll put it back in if we need it
634
-		if($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()){
634
+		if ($model->has_primary_key_field() && $model->get_primary_key_field()->is_auto_increment()) {
635 635
 			$effective_id = $model_object_data[$model->primary_key_name()];
636 636
 			unset($model_object_data[$model->primary_key_name()]);
637
-		}else{
638
-			$effective_id = $model->get_index_primary_key_string( $model_object_data );
637
+		} else {
638
+			$effective_id = $model->get_index_primary_key_string($model_object_data);
639 639
 		}
640 640
 		//the model takes care of validating the CSV's input
641
-		try{
641
+		try {
642 642
 			$new_id = $model->insert($model_object_data);
643
-			if( $new_id ){
643
+			if ($new_id) {
644 644
 				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_id;
645 645
 				$this->_total_inserts++;
646
-				EE_Error::add_success( sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"),$model->get_this_model_name(),$new_id, implode(",",$model_object_data)));
647
-			}else{
646
+				EE_Error::add_success(sprintf(__("Successfully added new %s (with id %s) with csv data %s", "event_espresso"), $model->get_this_model_name(), $new_id, implode(",", $model_object_data)));
647
+			} else {
648 648
 				$this->_total_insert_errors++;
649 649
 				//put the ID used back in there for the error message
650
-				if($model->has_primary_key_field()){
650
+				if ($model->has_primary_key_field()) {
651 651
 					$model_object_data[$model->primary_key_name()] = $effective_id;
652 652
 				}
653
-				EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__ );
653
+				EE_Error::add_error(sprintf(__("Could not insert new %s with the csv data: %s", "event_espresso"), $model->get_this_model_name(), http_build_query($model_object_data)), __FILE__, __FUNCTION__, __LINE__);
654 654
 			}
655
-		}catch(EE_Error $e){
655
+		} catch (EE_Error $e) {
656 656
 			$this->_total_insert_errors++;
657
-			if($model->has_primary_key_field()){
657
+			if ($model->has_primary_key_field()) {
658 658
 				$model_object_data[$model->primary_key_name()] = $effective_id;
659 659
 			}
660
-			EE_Error::add_error( sprintf(__("Could not insert new %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage()), __FILE__, __FUNCTION__, __LINE__ );
660
+			EE_Error::add_error(sprintf(__("Could not insert new %s with the csv data: %s because %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data), $e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
661 661
 		}
662 662
 		return $old_db_to_new_db_mapping;
663 663
 	}
@@ -670,55 +670,55 @@  discard block
 block discarded – undo
670 670
 	 * @param array $old_db_to_new_db_mapping
671 671
 	 * @return array updated $old_db_to_new_db_mapping
672 672
 	 */
673
-	protected function _update_from_data_array( $id_in_csv,  $model_object_data, $model, $old_db_to_new_db_mapping ) {
674
-		try{
673
+	protected function _update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping) {
674
+		try {
675 675
 			//let's keep two copies of the model object data:
676 676
 			//one for performing an update, one for everthing else
677 677
 			$model_object_data_for_update = $model_object_data;
678
-			if($model->has_primary_key_field()){
678
+			if ($model->has_primary_key_field()) {
679 679
 				$conditions = array($model->primary_key_name() => $model_object_data[$model->primary_key_name()]);
680 680
 				//remove the primary key because we shouldn't use it for updating
681 681
 				unset($model_object_data_for_update[$model->primary_key_name()]);
682
-			}elseif($model->get_combined_primary_key_fields() > 1 ){
682
+			}elseif ($model->get_combined_primary_key_fields() > 1) {
683 683
 				$conditions = array();
684
-				foreach($model->get_combined_primary_key_fields() as $key_field){
684
+				foreach ($model->get_combined_primary_key_fields() as $key_field) {
685 685
 					$conditions[$key_field->get_name()] = $model_object_data[$key_field->get_name()];
686 686
 				}
687
-			}else{
688
-				$model->primary_key_name();//this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
687
+			} else {
688
+				$model->primary_key_name(); //this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
689 689
 			}
690 690
 
691
-			$success = $model->update($model_object_data_for_update,array($conditions));
692
-			if($success){
691
+			$success = $model->update($model_object_data_for_update, array($conditions));
692
+			if ($success) {
693 693
 				$this->_total_updates++;
694
-				EE_Error::add_success( sprintf(__("Successfully updated %s with csv data %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data_for_update)));
694
+				EE_Error::add_success(sprintf(__("Successfully updated %s with csv data %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data_for_update)));
695 695
 				//we should still record the mapping even though it was an update
696 696
 				//because if we were going to insert somethign but it was going to conflict
697 697
 				//we would have last-minute decided to update. So we'd like to know what we updated
698 698
 				//and so we record what record ended up being updated using the mapping
699
-				if( $model->has_primary_key_field() ){
700
-					$new_key_for_mapping = $model_object_data[ $model->primary_key_name() ];
701
-				}else{
699
+				if ($model->has_primary_key_field()) {
700
+					$new_key_for_mapping = $model_object_data[$model->primary_key_name()];
701
+				} else {
702 702
 					//no primary key just a combined key
703
-					$new_key_for_mapping = $model->get_index_primary_key_string( $model_object_data );
703
+					$new_key_for_mapping = $model->get_index_primary_key_string($model_object_data);
704 704
 				}
705
-				$old_db_to_new_db_mapping[ $model->get_this_model_name() ][ $id_in_csv ] = $new_key_for_mapping;
706
-			}else{
705
+				$old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_key_for_mapping;
706
+			} else {
707 707
 				$matched_items = $model->get_all(array($conditions));
708
-				if( ! $matched_items){
708
+				if ( ! $matched_items) {
709 709
 					//no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
710 710
 					$this->_total_update_errors++;
711
-					EE_Error::add_error( sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"),$model->get_this_model_name(),http_build_query($model_object_data),http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__ );
712
-				}else{
711
+					EE_Error::add_error(sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"), $model->get_this_model_name(), http_build_query($model_object_data), http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__);
712
+				} else {
713 713
 					$this->_total_updates++;
714
-					EE_Error::add_success( sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data)));
714
+					EE_Error::add_success(sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data)));
715 715
 				}
716 716
 			}
717
-		}catch(EE_Error $e){
717
+		} catch (EE_Error $e) {
718 718
 			$this->_total_update_errors++;
719
-			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"),$model->get_this_model_name(),implode(",",$model_object_data),$e->getMessage());
720
-			$debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
721
-			EE_Error::add_error( "$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__ );
719
+			$basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data), $e->getMessage());
720
+			$debug_message = $basic_message.' Stack trace: '.$e->getTraceAsString();
721
+			EE_Error::add_error("$basic_message | $debug_message", __FILE__, __FUNCTION__, __LINE__);
722 722
 		}
723 723
 		return $old_db_to_new_db_mapping;
724 724
 	}
@@ -727,28 +727,28 @@  discard block
 block discarded – undo
727 727
 	 * Gets the number of inserts performed since importer was instantiated or reset
728 728
 	 * @return int
729 729
 	 */
730
-	public function get_total_inserts(){
730
+	public function get_total_inserts() {
731 731
 		return $this->_total_inserts;
732 732
 	}
733 733
 	/**
734 734
 	 *  Gets the number of insert errors since importer was instantiated or reset
735 735
 	 * @return int
736 736
 	 */
737
-	public function get_total_insert_errors(){
737
+	public function get_total_insert_errors() {
738 738
 		return $this->_total_insert_errors;
739 739
 	}
740 740
 	/**
741 741
 	 *  Gets the number of updates performed since importer was instantiated or reset
742 742
 	 * @return int
743 743
 	 */
744
-	public function get_total_updates(){
744
+	public function get_total_updates() {
745 745
 		return $this->_total_updates;
746 746
 	}
747 747
 	/**
748 748
 	 *  Gets the number of update errors since importer was instantiated or reset
749 749
 	 * @return int
750 750
 	 */
751
-	public function get_total_update_errors(){
751
+	public function get_total_update_errors() {
752 752
 		return $this->_total_update_errors;
753 753
 	}
754 754
 
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_State_Select_Input.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@  discard block
 block discarded – undo
6 6
  * @subpackage
7 7
  * @author				Mike Nelson
8 8
  */
9
-class EE_State_Select_Input extends EE_Select_Input{
9
+class EE_State_Select_Input extends EE_Select_Input {
10 10
 
11 11
 	/**
12 12
 	 * @param array $state_options
13 13
 	 * @param array $input_settings
14 14
 	 */
15
-	function __construct( $state_options, $input_settings = array() ){
15
+	function __construct($state_options, $input_settings = array()) {
16 16
 		$state_options = apply_filters(
17 17
 			'FHEE__EE_State_Select_Input____construct__state_options',
18
-			$this->get_state_answer_options( $state_options ),
18
+			$this->get_state_answer_options($state_options),
19 19
 			$this
20 20
 		);
21
-		$input_settings['html_class'] = isset( $input_settings['html_class'] )
22
-			? $input_settings['html_class'] . ' ee-state-select-js'
21
+		$input_settings['html_class'] = isset($input_settings['html_class'])
22
+			? $input_settings['html_class'].' ee-state-select-js'
23 23
 			: 'ee-state-select-js';
24
-		parent::__construct( $state_options, $input_settings );
24
+		parent::__construct($state_options, $input_settings);
25 25
 	}
26 26
 
27 27
 
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 	 * @param array $state_options
33 33
 	 * @return array
34 34
 	 */
35
-	public function get_state_answer_options( $state_options = NULL ){
35
+	public function get_state_answer_options($state_options = NULL) {
36 36
 		// if passed something that is NOT an array
37
-		if ( ! is_array( $state_options )) {
37
+		if ( ! is_array($state_options)) {
38 38
 			// get possibly cached list of states
39 39
 			$states = EEM_State::instance()->get_all_active_states();
40
-			if ( ! empty( $states )) {
40
+			if ( ! empty($states)) {
41 41
 				//set the default
42 42
 				$state_options[''][''] = '';
43
-				foreach( $states as $state ){
44
-					if ( $state instanceof EE_State ) {
45
-						$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
43
+				foreach ($states as $state) {
44
+					if ($state instanceof EE_State) {
45
+						$state_options[$state->country()->name()][$state->ID()] = $state->name();
46 46
 					}
47 47
 				}
48 48
 			} else {
Please login to merge, or discard this patch.
core/admin/templates/espresso_ratings_request_content.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <div class="padding">
2
-	<p><?php _e( 'We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso' ); ?></p>
3
-	<p><?php _e( 'Rate it five stars today!', 'event_espresso' ); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
-	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e( 'Rate It!', 'event_espresso' ); ?></a></p>
2
+	<p><?php _e('We need your help to continue maintaining and providing this plugin for free. You can help by leaving a positive review in the WordPress plugin directory. 5 star ratings bring Event Espresso Decaf to the attention of more users which increases our support and features for this version of Event Espresso.', 'event_espresso'); ?></p>
3
+	<p><?php _e('Rate it five stars today!', 'event_espresso'); ?></p><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span><span class="ee-wp-blue dashicons dashicons-star-filled"></span>
4
+	<p><a class="button button-primary" href="https://events.codebasehq.com/redirect?https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Fview%2Fplugin-reviews%2Fevent-espresso-decaf%3Frate%3D5%23postform"><?php _e('Rate It!', 'event_espresso'); ?></a></p>
5 5
 </div>
6 6
\ No newline at end of file
Please login to merge, or discard this patch.
payment_methods/Paypal_Express/templates/paypal_express_intro.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,1 +1,1 @@
 block discarded – undo
1
-<?php printf( __('PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">','</a>' ); ?> 
2 1
\ No newline at end of file
2
+<?php printf(__('PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', '</a>'); ?> 
3 3
\ No newline at end of file
Please login to merge, or discard this patch.
Paypal_Express/templates/paypal_express_debug_info.template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { exit('No direct script access allowed'); } ?>
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } ?>
2 2
 
3 3
 <div id="ppexpress-sandbox-panel" class="sandbox-panel">
4 4
 
@@ -6,13 +6,13 @@  discard block
 block discarded – undo
6 6
 
7 7
 	<h4><?php _e('How do I test specific error codes?', 'event_espresso'); ?></h4>
8 8
 	<p>
9
-		<?php _e( 'To trigger an error condition on an amount-related field, 
9
+		<?php _e('To trigger an error condition on an amount-related field, 
10 10
 			specify a error code value as a number with two digits to the right of the decimal point. 
11 11
 			For example, specify a value of 107.55 to trigger the 10755 error.', 
12
-		'event_espresso');?>
12
+		'event_espresso'); ?>
13 13
 	</p>
14 14
 	<p>
15
-		<?php printf( __( 'More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'), '<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">', '</a>');?>
15
+		<?php printf(__('More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'), '<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">', '</a>'); ?>
16 16
 	</p>
17 17
 
18 18
 </div>
19 19
\ No newline at end of file
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_Checkout.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 
277 277
 	/**
278 278
 	 * @param $REG_ID
279
-	 * @param $reg_status
279
+	 * @param boolean $reg_status
280 280
 	 */
281 281
 	public function set_reg_status_updated( $REG_ID, $reg_status ) {
282 282
 		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
@@ -1110,6 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 *
1111 1111
 	 * @param    string | int    $reg_cache_ID
1112 1112
 	 * @param    EE_Registration $registration
1113
+	 * @param integer $reg_cache_ID
1113 1114
 	 * @return void
1114 1115
 	 * @throws \EE_Error
1115 1116
 	 */
Please login to merge, or discard this patch.
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_Checkout
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage    core
10
- * @author				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_Checkout
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage    core
10
+  * @author				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_Checkout {
15 15
 
16 16
 	/**
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
251 251
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
252 252
 		$this->reg_cache_where_params = array(
253
-		    0 => array( 'REG_deleted' => false ),
254
-		    'order_by' => array( 'REG_count' => 'ASC' )
255
-        );
253
+			0 => array( 'REG_deleted' => false ),
254
+			'order_by' => array( 'REG_count' => 'ASC' )
255
+		);
256 256
 	}
257 257
 
258 258
 
@@ -807,10 +807,10 @@  discard block
 block discarded – undo
807 807
 	 */
808 808
 	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
809 809
 		return ! $this->revisit
810
-		       || $this->primary_revisit
811
-		       || (
812
-			       $this->revisit && $this->reg_url_link === $registration->reg_url_link()
813
-		       )
810
+			   || $this->primary_revisit
811
+			   || (
812
+				   $this->revisit && $this->reg_url_link === $registration->reg_url_link()
813
+			   )
814 814
 			? true
815 815
 			: false;
816 816
 	}
@@ -1202,16 +1202,16 @@  discard block
 block discarded – undo
1202 1202
 	 * @return array
1203 1203
 	 * @throws \EE_Error
1204 1204
 	 */
1205
-    public function __sleep()
1206
-    {
1207
-	    if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1208
-		    $this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1209
-	    }        // remove the reg form and the checkout
1210
-	    if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1211
-		    $this->transaction = $this->transaction->ID();
1212
-	    }        // remove the reg form and the checkout
1213
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1214
-    }
1205
+	public function __sleep()
1206
+	{
1207
+		if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1208
+			$this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1209
+		}        // remove the reg form and the checkout
1210
+		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1211
+			$this->transaction = $this->transaction->ID();
1212
+		}        // remove the reg form and the checkout
1213
+		return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1214
+	}
1215 1215
 
1216 1216
 
1217 1217
 	/**
Please login to merge, or discard this patch.
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 		$this->reg_page_base_url = EE_Registry::instance()->CFG->core->reg_page_url();
248 248
 		$this->thank_you_page_url = EE_Registry::instance()->CFG->core->thank_you_page_url();
249 249
 		$this->cancel_page_url = EE_Registry::instance()->CFG->core->cancel_page_url();
250
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', TRUE );
250
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', TRUE);
251 251
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->ajax;
252 252
 		$this->reg_cache_where_params = array(
253
-		    0 => array( 'REG_deleted' => false ),
254
-		    'order_by' => array( 'REG_count' => 'ASC' )
253
+		    0 => array('REG_deleted' => false),
254
+		    'order_by' => array('REG_count' => 'ASC')
255 255
         );
256 256
 	}
257 257
 
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 	 * @return boolean
264 264
 	 */
265 265
 	public function any_reg_status_updated() {
266
-		foreach ( $this->reg_status_updated as $reg_status ) {
267
-			if ( $reg_status ) {
266
+		foreach ($this->reg_status_updated as $reg_status) {
267
+			if ($reg_status) {
268 268
 				return true;
269 269
 			}
270 270
 		}
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param $REG_ID
278 278
 	 * @return boolean
279 279
 	 */
280
-	public function reg_status_updated( $REG_ID ) {
281
-		return isset( $this->reg_status_updated[ $REG_ID ] ) ? $this->reg_status_updated[ $REG_ID ] : false;
280
+	public function reg_status_updated($REG_ID) {
281
+		return isset($this->reg_status_updated[$REG_ID]) ? $this->reg_status_updated[$REG_ID] : false;
282 282
 	}
283 283
 
284 284
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param $REG_ID
288 288
 	 * @param $reg_status
289 289
 	 */
290
-	public function set_reg_status_updated( $REG_ID, $reg_status ) {
291
-		$this->reg_status_updated[ $REG_ID ] = filter_var( $reg_status, FILTER_VALIDATE_BOOLEAN );
290
+	public function set_reg_status_updated($REG_ID, $reg_status) {
291
+		$this->reg_status_updated[$REG_ID] = filter_var($reg_status, FILTER_VALIDATE_BOOLEAN);
292 292
 	}
293 293
 
294 294
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * can ONLY be set by the  Finalize_Registration reg step
310 310
 	 */
311 311
 	public function set_exit_spco() {
312
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) {
312
+		if ($this->current_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
313 313
 			$this->exit_spco = true;
314 314
 		}
315 315
 	}
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	public function reset_for_current_request() {
328 328
 		$this->process_form_submission = FALSE;
329
-		$this->continue_reg = apply_filters( 'FHEE__EE_Checkout___construct___continue_reg', true );
329
+		$this->continue_reg = apply_filters('FHEE__EE_Checkout___construct___continue_reg', true);
330 330
 		$this->admin_request = is_admin() && ! EE_Registry::instance()->REQ->front_ajax;
331 331
 		$this->continue_reg = true;
332 332
 		$this->redirect = false;
333 333
 		// don't reset the cached redirect form if we're about to be asked to display it !!!
334
-		if ( EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ) !== 'redirect_form' ) {
334
+		if (EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step') !== 'redirect_form') {
335 335
 			$this->redirect_form = '';
336 336
 		}
337 337
 		$this->redirect_url = '';
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
 	 * @param EE_SPCO_Reg_Step $reg_step_obj
349 349
 	 * @return    void
350 350
 	 */
351
-	public function add_reg_step( EE_SPCO_Reg_Step $reg_step_obj ) {
352
-		$this->reg_steps[ $reg_step_obj->slug()  ] = $reg_step_obj;
351
+	public function add_reg_step(EE_SPCO_Reg_Step $reg_step_obj) {
352
+		$this->reg_steps[$reg_step_obj->slug()] = $reg_step_obj;
353 353
 	}
354 354
 
355 355
 
@@ -365,22 +365,22 @@  discard block
 block discarded – undo
365 365
 	 * @return    void
366 366
 	 * @throws \EE_Error
367 367
 	 */
368
-	public function skip_reg_step( $reg_step_slug = '' ) {
369
-		$step_to_skip = $this->find_reg_step( $reg_step_slug );
370
-		if ( $step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step() ) {
371
-			$step_to_skip->set_is_current_step( false );
368
+	public function skip_reg_step($reg_step_slug = '') {
369
+		$step_to_skip = $this->find_reg_step($reg_step_slug);
370
+		if ($step_to_skip instanceof EE_SPCO_Reg_Step && $step_to_skip->is_current_step()) {
371
+			$step_to_skip->set_is_current_step(false);
372 372
 			$step_to_skip->set_completed();
373 373
 			// advance to the next step
374
-			$this->set_current_step( $this->next_step->slug() );
374
+			$this->set_current_step($this->next_step->slug());
375 375
 			// also reset the step param in the request in case any other code references that directly
376
-			EE_Registry::instance()->REQ->set( 'step', $this->current_step->slug() );
376
+			EE_Registry::instance()->REQ->set('step', $this->current_step->slug());
377 377
 			// since we are skipping a step and setting the current step to be what was previously the next step,
378 378
 			// we need to check that the next step is now correct, and not still set to the current step.
379
-			if ( $this->current_step->slug() === $this->next_step->slug() ) {
379
+			if ($this->current_step->slug() === $this->next_step->slug()) {
380 380
 				// correctly setup the next step
381 381
 				$this->set_next_step();
382 382
 			}
383
-			$this->set_reg_step_initiated( $this->current_step );
383
+			$this->set_reg_step_initiated($this->current_step);
384 384
 		}
385 385
 	}
386 386
 
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
 	 * @param bool   $reset whether to reset reg steps after removal
395 395
 	 * @throws EE_Error
396 396
 	 */
397
-	public function remove_reg_step( $reg_step_slug = '', $reset = true ) {
398
-		unset( $this->reg_steps[ $reg_step_slug  ] );
399
-		if ( $this->transaction instanceof EE_Transaction ) {
397
+	public function remove_reg_step($reg_step_slug = '', $reset = true) {
398
+		unset($this->reg_steps[$reg_step_slug]);
399
+		if ($this->transaction instanceof EE_Transaction) {
400 400
 			// now remove reg step from TXN and save
401
-			$this->transaction->remove_reg_step( $reg_step_slug );
401
+			$this->transaction->remove_reg_step($reg_step_slug);
402 402
 			$this->transaction->save();
403 403
 		}
404
-		if ( $reset ) {
404
+		if ($reset) {
405 405
 			$this->reset_reg_steps();
406 406
 		}
407 407
 	}
@@ -416,9 +416,9 @@  discard block
 block discarded – undo
416 416
 	 * @param int    $order
417 417
 	 * @return    void
418 418
 	 */
419
-	public function set_reg_step_order( $reg_step_slug = '', $order = 100 ) {
420
-		if ( isset( $this->reg_steps[ $reg_step_slug  ] )) {
421
-			$this->reg_steps[ $reg_step_slug ]->set_order( $order );
419
+	public function set_reg_step_order($reg_step_slug = '', $order = 100) {
420
+		if (isset($this->reg_steps[$reg_step_slug])) {
421
+			$this->reg_steps[$reg_step_slug]->set_order($order);
422 422
 		}
423 423
 	}
424 424
 
@@ -431,25 +431,25 @@  discard block
 block discarded – undo
431 431
 	 * @param string $current_step
432 432
 	 * @return    void
433 433
 	 */
434
-	public function set_current_step( $current_step ) {
434
+	public function set_current_step($current_step) {
435 435
 		// grab what step we're on
436
-		$this->current_step = isset( $this->reg_steps[ $current_step ] ) ? $this->reg_steps[ $current_step ] : reset( $this->reg_steps );
436
+		$this->current_step = isset($this->reg_steps[$current_step]) ? $this->reg_steps[$current_step] : reset($this->reg_steps);
437 437
 		// verify instance
438
-		if ( $this->current_step instanceof EE_SPCO_Reg_Step ) {
438
+		if ($this->current_step instanceof EE_SPCO_Reg_Step) {
439 439
 			// we don't want to repeat completed steps if this is the first time through SPCO
440
-			if ( $this->continue_reg && ! $this->revisit && $this->current_step->completed() ) {
440
+			if ($this->continue_reg && ! $this->revisit && $this->current_step->completed()) {
441 441
 				// so advance to the next step
442 442
 				$this->set_next_step();
443
-				if ( $this->next_step instanceof EE_SPCO_Reg_Step ) {
443
+				if ($this->next_step instanceof EE_SPCO_Reg_Step) {
444 444
 					// and attempt to set it as the current step
445
-					$this->set_current_step( $this->next_step->slug() );
445
+					$this->set_current_step($this->next_step->slug());
446 446
 				}
447 447
 				return;
448 448
 			}
449
-			$this->current_step->set_is_current_step( TRUE );
449
+			$this->current_step->set_is_current_step(TRUE);
450 450
 		} else {
451 451
 			EE_Error::add_error(
452
-				__( 'The current step could not be set.', 'event_espresso' ),
452
+				__('The current step could not be set.', 'event_espresso'),
453 453
 				__FILE__, __FUNCTION__, __LINE__
454 454
 			);
455 455
 		}
@@ -466,20 +466,20 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	public function set_next_step() {
468 468
 		// set pointer to start of array
469
-		reset( $this->reg_steps );
469
+		reset($this->reg_steps);
470 470
 		// if there is more than one step
471
-		if ( count( $this->reg_steps ) > 1 ) {
471
+		if (count($this->reg_steps) > 1) {
472 472
 			// advance to the current step and set pointer
473
-			while ( key( $this->reg_steps ) !== $this->current_step->slug() && key( $this->reg_steps ) !== '' ) {
474
-				next( $this->reg_steps );
473
+			while (key($this->reg_steps) !== $this->current_step->slug() && key($this->reg_steps) !== '') {
474
+				next($this->reg_steps);
475 475
 			}
476 476
 		}
477 477
 		// advance one more spot ( if it exists )
478
-		$this->next_step = next( $this->reg_steps );
478
+		$this->next_step = next($this->reg_steps);
479 479
 		// verify instance
480
-		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step  : NULL;
480
+		$this->next_step = $this->next_step instanceof EE_SPCO_Reg_Step ? $this->next_step : NULL;
481 481
 		// then back to current step to reset
482
-		prev( $this->reg_steps );
482
+		prev($this->reg_steps);
483 483
 	}
484 484
 
485 485
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 *  @return 	EE_SPCO_Reg_Step | null
494 494
 	 */
495 495
 	public function get_next_reg_step() {
496
-		$next = next( $this->reg_steps );
497
-		prev( $this->reg_steps );
496
+		$next = next($this->reg_steps);
497
+		prev($this->reg_steps);
498 498
 		return $next instanceof EE_SPCO_Reg_Step ? $next : null;
499 499
 	}
500 500
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 	 *  @return 	EE_SPCO_Reg_Step | null
510 510
 	 */
511 511
 	public function get_prev_reg_step() {
512
-		$prev = prev( $this->reg_steps );
513
-		next( $this->reg_steps );
512
+		$prev = prev($this->reg_steps);
513
+		next($this->reg_steps);
514 514
 		return $prev instanceof EE_SPCO_Reg_Step ? $prev : null;
515 515
 	}
516 516
 
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @return void
524 524
 	 */
525 525
 	public function sort_reg_steps() {
526
-		$reg_step_sorting_callback = apply_filters( 'FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback' );
527
-		uasort( $this->reg_steps, array( $this, $reg_step_sorting_callback ));
526
+		$reg_step_sorting_callback = apply_filters('FHEE__EE_Checkout__sort_reg_steps__reg_step_sorting_callback', 'reg_step_sorting_callback');
527
+		uasort($this->reg_steps, array($this, $reg_step_sorting_callback));
528 528
 	}
529 529
 
530 530
 
@@ -537,19 +537,19 @@  discard block
 block discarded – undo
537 537
 	 * @param string $reg_step_slug
538 538
 	 * @return EE_SPCO_Reg_Step|null
539 539
 	 */
540
-	public function find_reg_step( $reg_step_slug = '' ) {
541
-		if ( ! empty( $reg_step_slug ) ) {
540
+	public function find_reg_step($reg_step_slug = '') {
541
+		if ( ! empty($reg_step_slug)) {
542 542
 			// copy reg step array
543 543
 			$reg_steps = $this->reg_steps;
544 544
 			// set pointer to start of array
545
-			reset( $reg_steps );
545
+			reset($reg_steps);
546 546
 			// if there is more than one step
547
-			if ( count( $reg_steps ) > 1 ) {
547
+			if (count($reg_steps) > 1) {
548 548
 				// advance to the current step and set pointer
549
-				while ( key( $reg_steps ) !== $reg_step_slug && key( $reg_steps ) !== '' ) {
550
-					next( $reg_steps );
549
+				while (key($reg_steps) !== $reg_step_slug && key($reg_steps) !== '') {
550
+					next($reg_steps);
551 551
 				}
552
-				return current( $reg_steps );
552
+				return current($reg_steps);
553 553
 			}
554 554
 		}
555 555
 		return null;
@@ -565,17 +565,17 @@  discard block
 block discarded – undo
565 565
 	 * @param EE_SPCO_Reg_Step $reg_step_B
566 566
 	 * @return int
567 567
 	 */
568
-	public function reg_step_sorting_callback( EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B ) {
568
+	public function reg_step_sorting_callback(EE_SPCO_Reg_Step $reg_step_A, EE_SPCO_Reg_Step $reg_step_B) {
569 569
 		// send finalize_registration step to the end of the array
570
-		if ( $reg_step_A->slug() === 'finalize_registration' ) {
570
+		if ($reg_step_A->slug() === 'finalize_registration') {
571 571
 			return 1;
572
-		} else if ( $reg_step_B->slug() === 'finalize_registration' ) {
572
+		} else if ($reg_step_B->slug() === 'finalize_registration') {
573 573
 			return -1;
574 574
 		}
575
-		if ( $reg_step_A->order() === $reg_step_B->order() ) {
575
+		if ($reg_step_A->order() === $reg_step_B->order()) {
576 576
 			return 0;
577 577
 		}
578
-		return ( $reg_step_A->order() > $reg_step_B->order() ) ? 1 : -1;
578
+		return ($reg_step_A->order() > $reg_step_B->order()) ? 1 : -1;
579 579
 	}
580 580
 
581 581
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 	 * @param    EE_SPCO_Reg_Step $reg_step
588 588
 	 * @throws \EE_Error
589 589
 	 */
590
-	public function set_reg_step_initiated( EE_SPCO_Reg_Step $reg_step ) {
590
+	public function set_reg_step_initiated(EE_SPCO_Reg_Step $reg_step) {
591 591
 		// call set_reg_step_initiated ???
592 592
 		if (
593 593
 			// first time visiting SPCO ?
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
 			)
601 601
 		) {
602 602
 			// set the start time for this reg step
603
-			if ( ! $this->transaction->set_reg_step_initiated( $reg_step->slug() ) ) {
604
-				if ( WP_DEBUG ) {
603
+			if ( ! $this->transaction->set_reg_step_initiated($reg_step->slug())) {
604
+				if (WP_DEBUG) {
605 605
 					EE_Error::add_error(
606 606
 						sprintf(
607
-							__( 'The "%1$s" registration step was not initialized properly.', 'event_espresso' ),
607
+							__('The "%1$s" registration step was not initialized properly.', 'event_espresso'),
608 608
 							$reg_step->name()
609 609
 						),
610 610
 						__FILE__, __FUNCTION__, __LINE__
@@ -623,10 +623,10 @@  discard block
 block discarded – undo
623 623
 	 * 	@return 	void
624 624
 	 */
625 625
 	public function set_reg_step_JSON_info() {
626
-		EE_Registry::$i18n_js_strings[ 'reg_steps' ] = array();
626
+		EE_Registry::$i18n_js_strings['reg_steps'] = array();
627 627
 		// pass basic reg step data to JS
628
-		foreach ( $this->reg_steps as $reg_step ) {
629
-			EE_Registry::$i18n_js_strings[ 'reg_steps' ][] = $reg_step->slug();
628
+		foreach ($this->reg_steps as $reg_step) {
629
+			EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step->slug();
630 630
 		}
631 631
 		// reset reg step html
632 632
 //		$this->json_response->set_reg_step_html( '' );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	 */
643 643
 	public function reset_reg_steps() {
644 644
 		$this->sort_reg_steps();
645
-		$this->set_current_step( EE_Registry::instance()->REQ->get( 'step' ));
645
+		$this->set_current_step(EE_Registry::instance()->REQ->get('step'));
646 646
 		$this->set_next_step();
647 647
 		// the text that appears on the reg step form submit button
648 648
 		$this->current_step->set_submit_button_text();
@@ -659,9 +659,9 @@  discard block
 block discarded – undo
659 659
 	 */
660 660
 	public function get_registration_time_limit() {
661 661
 
662
-		$registration_time_limit = (float)( EE_Registry::instance()	->SSN->expiration() - time() );
662
+		$registration_time_limit = (float) (EE_Registry::instance()	->SSN->expiration() - time());
663 663
 		$time_limit_format = $registration_time_limit > 60 * MINUTE_IN_SECONDS ? 'H:i:s' : 'i:s';
664
-		$registration_time_limit = date( $time_limit_format, $registration_time_limit );
664
+		$registration_time_limit = date($time_limit_format, $registration_time_limit);
665 665
 		return apply_filters(
666 666
 			'FHEE__EE_Checkout__get_registration_time_limit__registration_time_limit',
667 667
 			$registration_time_limit
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
 		//		overpaid TXN
682 682
 		//		free TXN ( total = 0.00 )
683 683
 		// then payment required is TRUE
684
-		return ! ( $this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free() ) ? TRUE : FALSE;
684
+		return ! ($this->admin_request || $this->transaction->is_completed() || $this->transaction->is_overpaid() || $this->transaction->is_free()) ? TRUE : FALSE;
685 685
 	}
686 686
 
687 687
 
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
 	 * @param EE_Transaction $transaction
694 694
 	 * @return EE_Cart
695 695
 	 */
696
-	public function get_cart_for_transaction( $transaction ) {
697
-		$session = EE_Registry::instance()->load_core( 'Session' );
698
-		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction, $session ) : null;
696
+	public function get_cart_for_transaction($transaction) {
697
+		$session = EE_Registry::instance()->load_core('Session');
698
+		$cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction, $session) : null;
699 699
 		// verify cart
700
-		if ( ! $cart instanceof EE_Cart ) {
701
-			$cart = EE_Registry::instance()->load_core( 'Cart' );
700
+		if ( ! $cart instanceof EE_Cart) {
701
+			$cart = EE_Registry::instance()->load_core('Cart');
702 702
 		}
703 703
 
704 704
 		return $cart;
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 	 */
715 715
 	public function initialize_txn_reg_steps_array() {
716 716
 		$txn_reg_steps_array = array();
717
-		foreach ( $this->reg_steps as $reg_step ) {
718
-			$txn_reg_steps_array[ $reg_step->slug() ] = FALSE;
717
+		foreach ($this->reg_steps as $reg_step) {
718
+			$txn_reg_steps_array[$reg_step->slug()] = FALSE;
719 719
 		}
720 720
 		return $txn_reg_steps_array;
721 721
 	}
@@ -731,14 +731,14 @@  discard block
 block discarded – undo
731 731
 	 */
732 732
 	public function update_txn_reg_steps_array() {
733 733
 		$updated = false;
734
-		foreach ( $this->reg_steps as $reg_step ) {
735
-			if ( $reg_step->completed() ) {
736
-				$updated = $this->transaction->set_reg_step_completed( $reg_step->slug() )
734
+		foreach ($this->reg_steps as $reg_step) {
735
+			if ($reg_step->completed()) {
736
+				$updated = $this->transaction->set_reg_step_completed($reg_step->slug())
737 737
 					? true
738 738
 					: $updated;
739 739
 			}
740 740
 		}
741
-		if ( $updated ) {
741
+		if ($updated) {
742 742
 			$this->transaction->save();
743 743
 		}
744 744
 		return $updated;
@@ -754,14 +754,14 @@  discard block
 block discarded – undo
754 754
 	 * @throws \EE_Error
755 755
 	 */
756 756
 	public function stash_transaction_and_checkout() {
757
-		if ( ! $this->revisit ) {
757
+		if ( ! $this->revisit) {
758 758
 			$this->update_txn_reg_steps_array();
759 759
 		}
760 760
 		$this->track_transaction_and_registration_status_updates();
761 761
 		// save all data to the db, but suppress errors
762 762
 		//$this->save_all_data( FALSE );
763 763
 		// cache the checkout in the session
764
-		EE_Registry::instance()->SSN->set_checkout( $this );
764
+		EE_Registry::instance()->SSN->set_checkout($this);
765 765
 	}
766 766
 
767 767
 
@@ -776,15 +776,15 @@  discard block
 block discarded – undo
776 776
 	 */
777 777
 	public function track_transaction_and_registration_status_updates() {
778 778
 		// verify the transaction
779
-		if ( $this->transaction instanceof EE_Transaction ) {
779
+		if ($this->transaction instanceof EE_Transaction) {
780 780
 			// has there been a TXN status change during this checkout?
781 781
 			$this->txn_status_updated = $this->transaction->txn_status_updated();
782 782
 			/** @type EE_Registration_Processor $registration_processor */
783
-			$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
783
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
784 784
 			// grab the saved registrations from the transaction
785
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $registration ) {
786
-				if ( $registration_processor->reg_status_updated( $registration->ID() ) ) {
787
-					$this->set_reg_status_updated( $registration->ID(), true );
785
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
786
+				if ($registration_processor->reg_status_updated($registration->ID())) {
787
+					$this->set_reg_status_updated($registration->ID(), true);
788 788
 				}
789 789
 			}
790 790
 		}
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 	 * @return    bool
806 806
 	 * @throws \EE_Error
807 807
 	 */
808
-	public function visit_allows_processing_of_this_registration( EE_Registration $registration ) {
808
+	public function visit_allows_processing_of_this_registration(EE_Registration $registration) {
809 809
 		return ! $this->revisit
810 810
 		       || $this->primary_revisit
811 811
 		       || (
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 	 * @return bool
839 839
 	 * @throws \EE_Error
840 840
 	 */
841
-	public function save_all_data( $show_errors = TRUE ) {
841
+	public function save_all_data($show_errors = TRUE) {
842 842
 		// verify the transaction
843
-		if ( $this->transaction instanceof EE_Transaction ) {
843
+		if ($this->transaction instanceof EE_Transaction) {
844 844
 			// save to ensure that TXN has ID
845 845
 			$this->transaction->save();
846 846
 			// grab the saved registrations from the transaction
847
-			foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as  $registration ) {
848
-				$this->_save_registration( $registration, $show_errors );
847
+			foreach ($this->transaction->registrations($this->reg_cache_where_params) as  $registration) {
848
+				$this->_save_registration($registration, $show_errors);
849 849
 			}
850 850
 		} else {
851
-			if ( $show_errors ) {
852
-				EE_Error::add_error( __( 'A valid Transaction was not found when attempting to save your registration information.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
851
+			if ($show_errors) {
852
+				EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
853 853
 			}
854 854
 			return FALSE;
855 855
 		}
@@ -866,32 +866,32 @@  discard block
 block discarded – undo
866 866
 	 * @return void
867 867
 	 * @throws \EE_Error
868 868
 	 */
869
-	private function _save_registration( $registration, $show_errors = TRUE  ) {
869
+	private function _save_registration($registration, $show_errors = TRUE) {
870 870
 		// verify object
871
-		if ( $registration instanceof EE_Registration ) {
871
+		if ($registration instanceof EE_Registration) {
872 872
 			// should this registration be processed during this visit ?
873
-			if ( $this->visit_allows_processing_of_this_registration( $registration ) ) {
873
+			if ($this->visit_allows_processing_of_this_registration($registration)) {
874 874
 				//set TXN ID
875
-				if ( ! $registration->transaction_ID() ) {
876
-					$registration->set_transaction_id( $this->transaction->ID() );
875
+				if ( ! $registration->transaction_ID()) {
876
+					$registration->set_transaction_id($this->transaction->ID());
877 877
 				}
878 878
 				// verify and save the attendee
879
-				$this->_save_registration_attendee( $registration, $show_errors );
879
+				$this->_save_registration_attendee($registration, $show_errors);
880 880
 				// save answers to reg form questions
881
-				$this->_save_registration_answers( $registration, $show_errors );
881
+				$this->_save_registration_answers($registration, $show_errors);
882 882
 				// save changes
883 883
 				$registration->save();
884 884
 				// update txn cache
885
-				if ( ! $this->transaction->update_cache_after_object_save( 'Registration', $registration )) {
886
-					if ( $show_errors ) {
887
-						EE_Error::add_error( __( 'The newly saved Registration object could not be cached on the Transaction.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
885
+				if ( ! $this->transaction->update_cache_after_object_save('Registration', $registration)) {
886
+					if ($show_errors) {
887
+						EE_Error::add_error(__('The newly saved Registration object could not be cached on the Transaction.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
888 888
 					}
889 889
 				}
890 890
 			}
891 891
 		} else {
892
-			if ( $show_errors ) {
892
+			if ($show_errors) {
893 893
 				EE_Error::add_error(
894
-					__( 'An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso' ),
894
+					__('An invalid Registration object was discovered when attempting to save your registration information.', 'event_espresso'),
895 895
 					__FILE__, __FUNCTION__, __LINE__
896 896
 				);
897 897
 			}
@@ -908,25 +908,25 @@  discard block
 block discarded – undo
908 908
 	 * @return void
909 909
 	 * @throws \EE_Error
910 910
 	 */
911
-	private function _save_registration_attendee( $registration, $show_errors = TRUE ) {
912
-		if ( $registration->attendee() instanceof EE_Attendee ) {
911
+	private function _save_registration_attendee($registration, $show_errors = TRUE) {
912
+		if ($registration->attendee() instanceof EE_Attendee) {
913 913
 			// save so that ATT has ID
914 914
 			$registration->attendee()->save();
915
-			if ( ! $registration->update_cache_after_object_save( 'Attendee', $registration->attendee() ) ) {
916
-				if ( $show_errors ) {
915
+			if ( ! $registration->update_cache_after_object_save('Attendee', $registration->attendee())) {
916
+				if ($show_errors) {
917 917
 					EE_Error::add_error(
918
-						__( 'The newly saved Attendee object could not be cached on the registration.', 'event_espresso' ),
918
+						__('The newly saved Attendee object could not be cached on the registration.', 'event_espresso'),
919 919
 						__FILE__, __FUNCTION__, __LINE__
920 920
 					);
921 921
 				}
922 922
 			}
923 923
 		} else {
924
-			if ( $show_errors ) {
924
+			if ($show_errors) {
925 925
 				EE_Error::add_error(
926 926
 					sprintf(
927 927
 						'%1$s||%1$s $attendee = %2$s',
928
-						__( 'Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso' ),
929
-						var_export( $registration->attendee(), true )
928
+						__('Either no Attendee information was found, or an invalid Attendee object was discovered when attempting to save your registration information.', 'event_espresso'),
929
+						var_export($registration->attendee(), true)
930 930
 					),
931 931
 					__FILE__, __FUNCTION__, __LINE__
932 932
 				);
@@ -944,25 +944,25 @@  discard block
 block discarded – undo
944 944
 	 * @return void
945 945
 	 * @throws \EE_Error
946 946
 	 */
947
-	private function _save_registration_answers( $registration, $show_errors = TRUE ) {
947
+	private function _save_registration_answers($registration, $show_errors = TRUE) {
948 948
 		// now save the answers
949
-		foreach ( $registration->answers() as $cache_key => $answer ) {
949
+		foreach ($registration->answers() as $cache_key => $answer) {
950 950
 			// verify object
951
-			if ( $answer instanceof EE_Answer ) {
952
-				$answer->set_registration( $registration->ID() );
951
+			if ($answer instanceof EE_Answer) {
952
+				$answer->set_registration($registration->ID());
953 953
 				$answer->save();
954
-				if ( ! $registration->update_cache_after_object_save( 'Answer', $answer, $cache_key )) {
955
-					if ( $show_errors ) {
954
+				if ( ! $registration->update_cache_after_object_save('Answer', $answer, $cache_key)) {
955
+					if ($show_errors) {
956 956
 						EE_Error::add_error(
957
-							__( 'The newly saved Answer object could not be cached on the registration.', 'event_espresso' ),
957
+							__('The newly saved Answer object could not be cached on the registration.', 'event_espresso'),
958 958
 							__FILE__, __FUNCTION__, __LINE__
959 959
 						);
960 960
 					}
961 961
 				}
962 962
 			} else {
963
-				if ( $show_errors ) {
963
+				if ($show_errors) {
964 964
 					EE_Error::add_error(
965
-						__( 'An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso' ),
965
+						__('An invalid Answer object was discovered when attempting to save your registration information.', 'event_espresso'),
966 966
 						__FILE__, __FUNCTION__, __LINE__
967 967
 					);
968 968
 				}
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 	 * @return bool
982 982
 	 * @throws \EE_Error
983 983
 	 */
984
-	public function refresh_all_entities( $from_db = false ) {
984
+	public function refresh_all_entities($from_db = false) {
985 985
 		$from_db = $this->current_step->is_final_step() || $this->action === 'process_gateway_response'
986 986
 			? true
987 987
 			: $from_db;
@@ -1005,11 +1005,11 @@  discard block
 block discarded – undo
1005 1005
 	 */
1006 1006
 	protected function refresh_from_db() {
1007 1007
 		// verify the transaction
1008
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1008
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1009 1009
 			// pull fresh TXN data from the db
1010
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db( $this->transaction->ID() );
1010
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID());
1011 1011
 			// update EE_Checkout's cached primary_attendee object
1012
-			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db( $this->transaction );
1012
+			$this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction);
1013 1013
 			// update EE_Checkout's cached payment object
1014 1014
 			$payment = $this->transaction->last_payment();
1015 1015
 			$this->payment = $payment instanceof EE_Payment ? $payment : $this->payment;
@@ -1017,9 +1017,9 @@  discard block
 block discarded – undo
1017 1017
 			$payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null;
1018 1018
 			$this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method;
1019 1019
 			//now refresh the cart, based on the TXN
1020
-			$this->cart = $this->get_cart_for_transaction( $this->transaction );
1020
+			$this->cart = $this->get_cart_for_transaction($this->transaction);
1021 1021
 		} else {
1022
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1022
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1023 1023
 			return FALSE;
1024 1024
 		}
1025 1025
 		return TRUE;
@@ -1034,21 +1034,21 @@  discard block
 block discarded – undo
1034 1034
 	 * @return  EE_Attendee | null
1035 1035
 	 * @throws \EE_Error
1036 1036
 	 */
1037
-	protected function _refresh_primary_attendee_obj_from_db( EE_Transaction $transaction ) {
1037
+	protected function _refresh_primary_attendee_obj_from_db(EE_Transaction $transaction) {
1038 1038
 
1039 1039
 		$primary_attendee_obj = null;
1040 1040
 		// grab the saved registrations from the transaction
1041
-		foreach ( $transaction->registrations( $this->reg_cache_where_params, true ) as $registration ) {
1041
+		foreach ($transaction->registrations($this->reg_cache_where_params, true) as $registration) {
1042 1042
 			// verify object
1043
-			if ( $registration instanceof EE_Registration ) {
1043
+			if ($registration instanceof EE_Registration) {
1044 1044
 				$attendee = $registration->attendee();
1045 1045
 				// verify object && maybe cache primary_attendee_obj ?
1046
-				if ( $attendee instanceof EE_Attendee&& $registration->is_primary_registrant() ) {
1046
+				if ($attendee instanceof EE_Attendee && $registration->is_primary_registrant()) {
1047 1047
 					$primary_attendee_obj = $attendee;
1048 1048
 				}
1049 1049
 			} else {
1050 1050
 				EE_Error::add_error(
1051
-						__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1051
+						__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1052 1052
 						__FILE__, __FUNCTION__, __LINE__
1053 1053
 				);
1054 1054
 			}
@@ -1069,43 +1069,43 @@  discard block
 block discarded – undo
1069 1069
 	 */
1070 1070
 	protected function refresh_entity_map() {
1071 1071
 		// verify the transaction
1072
-		if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1072
+		if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1073 1073
 			// never cache payment info
1074
-			$this->transaction->clear_cache( 'Payment' );
1074
+			$this->transaction->clear_cache('Payment');
1075 1075
 			// is the Payment Options Reg Step completed ?
1076
-			if ( $this->transaction->reg_step_completed( 'payment_options' ) ) {
1076
+			if ($this->transaction->reg_step_completed('payment_options')) {
1077 1077
 				// then check for payments and update TXN accordingly
1078 1078
 				/** @type EE_Transaction_Payments $transaction_payments */
1079
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1080
-				$transaction_payments->calculate_total_payments_and_update_status( $this->transaction );
1079
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1080
+				$transaction_payments->calculate_total_payments_and_update_status($this->transaction);
1081 1081
 			}
1082 1082
 			// grab the saved registrations from the transaction
1083 1083
 			foreach (
1084
-				$this->transaction->registrations( $this->reg_cache_where_params ) as $reg_cache_ID => $registration
1084
+				$this->transaction->registrations($this->reg_cache_where_params) as $reg_cache_ID => $registration
1085 1085
 			) {
1086
-				$this->_refresh_registration( $reg_cache_ID, $registration );
1086
+				$this->_refresh_registration($reg_cache_ID, $registration);
1087 1087
 			}
1088 1088
 			// make sure our cached TXN is added to the model entity mapper
1089
-			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with( $this->transaction->ID(), $this->transaction );
1089
+			$this->transaction = $this->transaction->get_model()->refresh_entity_map_with($this->transaction->ID(), $this->transaction);
1090 1090
 
1091 1091
 		} else {
1092
-			EE_Error::add_error( __( 'A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
1092
+			EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1093 1093
 			return FALSE;
1094 1094
 		}
1095 1095
 		// verify and update the cart because inaccurate totals are not so much fun
1096
-		if ( $this->cart instanceof EE_Cart ) {
1096
+		if ($this->cart instanceof EE_Cart) {
1097 1097
 			$grand_total = $this->cart->get_grand_total();
1098
-			if ( $grand_total instanceof EE_Line_Item && $grand_total->ID() ) {
1098
+			if ($grand_total instanceof EE_Line_Item && $grand_total->ID()) {
1099 1099
 				$grand_total->recalculate_total_including_taxes();
1100 1100
 				$grand_total = $grand_total->get_model()->refresh_entity_map_with(
1101 1101
 					$this->cart->get_grand_total()->ID(),
1102 1102
 					$this->cart->get_grand_total()
1103 1103
 				);
1104 1104
 			}
1105
-			if ( $grand_total instanceof EE_Line_Item ) {
1106
-				$this->cart = EE_Cart::instance( $grand_total );
1105
+			if ($grand_total instanceof EE_Line_Item) {
1106
+				$this->cart = EE_Cart::instance($grand_total);
1107 1107
 			} else {
1108
-				EE_Error::add_error( __( 'A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1108
+				EE_Error::add_error(__('A valid Cart was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1109 1109
 				return false;
1110 1110
 			}
1111 1111
 		}
@@ -1122,19 +1122,19 @@  discard block
 block discarded – undo
1122 1122
 	 * @return void
1123 1123
 	 * @throws \EE_Error
1124 1124
 	 */
1125
-	protected function _refresh_registration( $reg_cache_ID, $registration ) {
1125
+	protected function _refresh_registration($reg_cache_ID, $registration) {
1126 1126
 
1127 1127
 		// verify object
1128
-		if ( $registration instanceof EE_Registration ) {
1128
+		if ($registration instanceof EE_Registration) {
1129 1129
 			// update the entity mapper attendee
1130
-			$this->_refresh_registration_attendee( $registration );
1130
+			$this->_refresh_registration_attendee($registration);
1131 1131
 			// update the entity mapper answers for reg form questions
1132
-			$this->_refresh_registration_answers( $registration );
1132
+			$this->_refresh_registration_answers($registration);
1133 1133
 			// make sure the cached registration is added to the model entity mapper
1134
-			$registration->get_model()->refresh_entity_map_with( $reg_cache_ID, $registration );
1134
+			$registration->get_model()->refresh_entity_map_with($reg_cache_ID, $registration);
1135 1135
 		} else {
1136 1136
 			EE_Error::add_error(
1137
-				__( 'An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1137
+				__('An invalid Registration object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1138 1138
 				__FILE__, __FUNCTION__, __LINE__
1139 1139
 			);
1140 1140
 		}
@@ -1149,15 +1149,15 @@  discard block
 block discarded – undo
1149 1149
 	 * @return void
1150 1150
 	 * @throws \EE_Error
1151 1151
 	 */
1152
-	protected function _refresh_registration_attendee( $registration ) {
1152
+	protected function _refresh_registration_attendee($registration) {
1153 1153
 
1154 1154
 		$attendee = $registration->attendee();
1155 1155
 		// verify object
1156
-		if ( $attendee instanceof EE_Attendee && $attendee->ID() ) {
1156
+		if ($attendee instanceof EE_Attendee && $attendee->ID()) {
1157 1157
 			// make sure the cached attendee is added to the model entity mapper
1158
-			$registration->attendee()->get_model()->refresh_entity_map_with( $attendee->ID(), $attendee );
1158
+			$registration->attendee()->get_model()->refresh_entity_map_with($attendee->ID(), $attendee);
1159 1159
 			// maybe cache primary_attendee_obj ?
1160
-			if ( $registration->is_primary_registrant() ) {
1160
+			if ($registration->is_primary_registrant()) {
1161 1161
 				$this->primary_attendee_obj = $attendee;
1162 1162
 			}
1163 1163
 		}
@@ -1172,19 +1172,19 @@  discard block
 block discarded – undo
1172 1172
 	 * @return void
1173 1173
 	 * @throws \EE_Error
1174 1174
 	 */
1175
-	protected function _refresh_registration_answers( $registration ) {
1175
+	protected function _refresh_registration_answers($registration) {
1176 1176
 
1177 1177
 		// now update the answers
1178
-		foreach ( $registration->answers() as $cache_key => $answer ) {
1178
+		foreach ($registration->answers() as $cache_key => $answer) {
1179 1179
 			// verify object
1180
-			if ( $answer instanceof EE_Answer ) {
1181
-				if ( $answer->ID() ) {
1180
+			if ($answer instanceof EE_Answer) {
1181
+				if ($answer->ID()) {
1182 1182
 					// make sure the cached answer is added to the model entity mapper
1183
-					$answer->get_model()->refresh_entity_map_with( $answer->ID(), $answer );
1183
+					$answer->get_model()->refresh_entity_map_with($answer->ID(), $answer);
1184 1184
 				}
1185 1185
 			} else {
1186 1186
 				EE_Error::add_error(
1187
-					__( 'An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso' ),
1187
+					__('An invalid Answer object was discovered when attempting to update the model entity mapper.', 'event_espresso'),
1188 1188
 					__FILE__, __FUNCTION__, __LINE__
1189 1189
 				);
1190 1190
 			}
@@ -1204,13 +1204,13 @@  discard block
 block discarded – undo
1204 1204
 	 */
1205 1205
     public function __sleep()
1206 1206
     {
1207
-	    if ( $this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID() ) {
1207
+	    if ($this->primary_attendee_obj instanceof EE_Attendee && $this->primary_attendee_obj->ID()) {
1208 1208
 		    $this->primary_attendee_obj = $this->primary_attendee_obj->ID();
1209 1209
 	    }        // remove the reg form and the checkout
1210
-	    if ( $this->transaction instanceof EE_Transaction && $this->transaction->ID() ) {
1210
+	    if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) {
1211 1211
 		    $this->transaction = $this->transaction->ID();
1212 1212
 	    }        // remove the reg form and the checkout
1213
-        return array_diff( array_keys( get_object_vars( $this ) ), array( 'billing_form', 'registration_form' ) );
1213
+        return array_diff(array_keys(get_object_vars($this)), array('billing_form', 'registration_form'));
1214 1214
     }
1215 1215
 
1216 1216
 
@@ -1220,15 +1220,15 @@  discard block
 block discarded – undo
1220 1220
 	 * this will reinstate the EE_Checkout object on each EE_SPCO_Reg_Step object
1221 1221
 	 */
1222 1222
 	public function __wakeup() {
1223
-		if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint( $this->primary_attendee_obj ) !== 0 ) {
1223
+		if ( ! $this->primary_attendee_obj instanceof EE_Attendee && absint($this->primary_attendee_obj) !== 0) {
1224 1224
 			// $this->primary_attendee_obj is actually just an ID, so use it to get the object from the db
1225
-			$this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID( $this->primary_attendee_obj );
1225
+			$this->primary_attendee_obj = EEM_Attendee::instance()->get_one_by_ID($this->primary_attendee_obj);
1226 1226
 		}
1227
-		if ( ! $this->transaction instanceof EE_Transaction && absint( $this->transaction ) !== 0 ) {
1227
+		if ( ! $this->transaction instanceof EE_Transaction && absint($this->transaction) !== 0) {
1228 1228
 			// $this->transaction is actually just an ID, so use it to get the object from the db
1229
-			$this->transaction = EEM_Transaction::instance()->get_one_by_ID( $this->transaction );
1229
+			$this->transaction = EEM_Transaction::instance()->get_one_by_ID($this->transaction);
1230 1230
 		}
1231
-		foreach ( $this->reg_steps as $reg_step ) {
1231
+		foreach ($this->reg_steps as $reg_step) {
1232 1232
 			$reg_step->checkout = $this;
1233 1233
 		}
1234 1234
 	}
@@ -1245,12 +1245,12 @@  discard block
 block discarded – undo
1245 1245
 	 * @param bool   $display_request
1246 1246
 	 * @throws \EE_Error
1247 1247
 	 */
1248
-	public function log( $class = '', $func = '', $line = '', $info = array(), $display_request = false ) {
1248
+	public function log($class = '', $func = '', $line = '', $info = array(), $display_request = false) {
1249 1249
 		$disabled = true;
1250
-		if ( WP_DEBUG && ! $disabled ) {
1251
-			$debug_data = get_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array() );
1250
+		if (WP_DEBUG && ! $disabled) {
1251
+			$debug_data = get_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), array());
1252 1252
 			$default_data = array(
1253
-				$class 		=> $func . '() : ' . $line,
1253
+				$class 		=> $func.'() : '.$line,
1254 1254
 				'request->step' 		=> $this->step,
1255 1255
 				'request->action' 	=> $this->action,
1256 1256
 				'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ?
@@ -1262,24 +1262,24 @@  discard block
 block discarded – undo
1262 1262
 				'reg_url_link' => $this->reg_url_link,
1263 1263
 				'REQ' => $display_request ? $_REQUEST : '',
1264 1264
 			);
1265
-			if ( $this->transaction instanceof EE_Transaction ) {
1266
-				$default_data[ 'TXN_status' ] 		= $this->transaction->status_ID();
1267
-				$default_data[ 'TXN_reg_steps' ] 	= $this->transaction->reg_steps();
1268
-				foreach ( $this->transaction->registrations( $this->reg_cache_where_params ) as $REG_ID => $registration ) {
1269
-					$default_data[ 'registrations' ][ $REG_ID ] = $registration->status_ID();
1265
+			if ($this->transaction instanceof EE_Transaction) {
1266
+				$default_data['TXN_status'] = $this->transaction->status_ID();
1267
+				$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
1268
+				foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
1269
+					$default_data['registrations'][$REG_ID] = $registration->status_ID();
1270 1270
 				}
1271
-				if ( $this->transaction->ID() ) {
1272
-					$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
1271
+				if ($this->transaction->ID()) {
1272
+					$TXN_ID = 'EE_Transaction: '.$this->transaction->ID();
1273 1273
 					// don't serialize objects
1274
-					$info = $this->_strip_objects( $info );
1275
-					if ( ! isset( $debug_data[ $TXN_ID ] ) ) {
1276
-						$debug_data[ $TXN_ID ] = array();
1274
+					$info = $this->_strip_objects($info);
1275
+					if ( ! isset($debug_data[$TXN_ID])) {
1276
+						$debug_data[$TXN_ID] = array();
1277 1277
 					}
1278
-					$debug_data[ $TXN_ID ][ microtime() ] = array_merge(
1278
+					$debug_data[$TXN_ID][microtime()] = array_merge(
1279 1279
 						$default_data,
1280 1280
 						$info
1281 1281
 					);
1282
-					update_option( 'EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data );
1282
+					update_option('EE_DEBUG_SPCO_'.EE_Session::instance()->id(), $debug_data);
1283 1283
 				}
1284 1284
 			}
1285 1285
 		}
@@ -1292,23 +1292,23 @@  discard block
 block discarded – undo
1292 1292
 	 * @param array $info
1293 1293
 	 * @return array
1294 1294
 	 */
1295
-	public function _strip_objects( $info = array() ) {
1296
-		foreach ( (array)$info as $key => $value ) {
1297
-			if ( is_array( $value )) {
1298
-				$info[ $key ] = $this->_strip_objects( $value );
1299
-			} else if ( is_object( $value ) ) {
1300
-				$object_class = get_class( $value );
1301
-				$info[ $object_class ] = array();
1302
-				$info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : 0;
1303
-				if ( method_exists( $value, 'status' ) ) {
1304
-					$info[ $object_class ][ 'status' ] = $value->status();
1305
-				} else if ( method_exists( $value, 'status_ID' ) ) {
1306
-					$info[ $object_class ][ 'status' ] = $value->status_ID();
1295
+	public function _strip_objects($info = array()) {
1296
+		foreach ((array) $info as $key => $value) {
1297
+			if (is_array($value)) {
1298
+				$info[$key] = $this->_strip_objects($value);
1299
+			} else if (is_object($value)) {
1300
+				$object_class = get_class($value);
1301
+				$info[$object_class] = array();
1302
+				$info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : 0;
1303
+				if (method_exists($value, 'status')) {
1304
+					$info[$object_class]['status'] = $value->status();
1305
+				} else if (method_exists($value, 'status_ID')) {
1306
+					$info[$object_class]['status'] = $value->status_ID();
1307 1307
 				}
1308
-				unset( $info[ $key ] );
1308
+				unset($info[$key]);
1309 1309
 			}
1310 1310
 		}
1311
-		return (array)$info;
1311
+		return (array) $info;
1312 1312
 	}
1313 1313
 
1314 1314
 
Please login to merge, or discard this patch.
admin_pages/registrations/templates/reg_admin_details_header.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <div style="float:right">
2
-	<?php printf( __( 'View %1$sRegistrations%4$s /  %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso' ), '<a href="' . $filtered_registrations_link . '">', '<a href="' . $filtered_transactions_link . '">', '<a href="' . $event_link . '">', '</a>' );?>
2
+	<?php printf(__('View %1$sRegistrations%4$s /  %2$sTransactions%4$s for this %3$sevent%4$s.', 'event_espresso'), '<a href="'.$filtered_registrations_link.'">', '<a href="'.$filtered_transactions_link.'">', '<a href="'.$event_link.'">', '</a>'); ?>
3 3
 </div>
4
-<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration . '&nbsp;'; echo __( 'Registration # ', 'event_espresso' ) . $reg_nmbr['value']; echo '&nbsp;' . $next_registration; ?></h3>
5
-<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value'];?></h2>
4
+<h3 id="reg-admin-reg-details-reg-nmbr-hdr"><?php echo $previous_registration.'&nbsp;'; echo __('Registration # ', 'event_espresso').$reg_nmbr['value']; echo '&nbsp;'.$next_registration; ?></h3>
5
+<h2 id="reg-admin-reg-details-reg-date-hdr"><?php echo $reg_datetime['value']; ?></h2>
6 6
 
7
-<?php if ( $registration->group_size() > 1 ) : ?>
8
-	<a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __( 'Scroll to Other Registrations in the Same Transaction', 'event_espresso' );?></a>
7
+<?php if ($registration->group_size() > 1) : ?>
8
+	<a id="scroll-to-other-attendees" class="scroll-to" href="#other-attendees"><?php echo __('Scroll to Other Registrations in the Same Transaction', 'event_espresso'); ?></a>
9 9
 <?php endif; ?>
10 10
 
11
-<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?>
11
+<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?>
12 12
 
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_receipt_content.template.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 			</td>
24 24
 			<td>
25 25
 				<div id="invoice-info">
26
-					<h2 id="invoice-hdr"><?php _e( 'Order Confirmation', 'event_espresso' ) ?></h2>
26
+					<h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso') ?></h2>
27 27
 
28
-					<h3 id="invoice-date"><?php _e( 'Date:', 'event_espresso' ) ?>
28
+					<h3 id="invoice-date"><?php _e('Date:', 'event_espresso') ?>
29 29
 						<span class="plain-text">[PRIMARY_REGISTRANT_REGISTRATION_DATE]</span></h3>
30 30
 
31
-					<h3 id="invoice-txn-id"><?php _e( 'Transaction ID:', 'event_espresso' ) ?>
31
+					<h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso') ?>
32 32
 						<span class="plain-text">[TXN_ID]</span></h3>
33 33
 
34
-					<h3 id="invoice-txn-status"><?php _e( 'Status:', 'event_espresso' ) ?>
34
+					<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso') ?>
35 35
 						<span class="[TXN_STATUS_ID] plain-text">[TXN_STATUS]</span></h3>
36 36
 				</div>
37 37
 			</td>
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 		[EVENT_LIST]
42 42
 	</div>
43 43
 	<div class="taxes">
44
-		<h3 class="section-title"><?php _e( "Additional Charges/Discounts", 'event_espresso' ) ?></h3>
44
+		<h3 class="section-title"><?php _e("Additional Charges/Discounts", 'event_espresso') ?></h3>
45 45
 		<table class="invoice-amount">
46 46
 			<thead>
47 47
 				<tr class="header_row">
48
-					<th class="left ticket_th"><?php _e( "Name", "event_espresso" ); ?></th>
49
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
50
-					<th class="event_th item_c"><?php _e( 'Quantity', 'event_espresso' ); ?></th>
51
-					<th class="event_th item_c"><?php _e( 'Unit Price', 'event_espresso' ); ?></th>
52
-					<th class="subtotal_th"><?php _e( 'Total', 'event_espresso' ); ?></th>
48
+					<th class="left ticket_th"><?php _e("Name", "event_espresso"); ?></th>
49
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
50
+					<th class="event_th item_c"><?php _e('Quantity', 'event_espresso'); ?></th>
51
+					<th class="event_th item_c"><?php _e('Unit Price', 'event_espresso'); ?></th>
52
+					<th class="subtotal_th"><?php _e('Total', 'event_espresso'); ?></th>
53 53
 				</tr>
54 54
 			</thead>
55 55
 			<tbody>
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 		</table>
61 61
 	</div>
62 62
 	<div class="taxes">
63
-		<h3 class="section-title"><?php _e( "Taxes", 'event_espresso' ) ?></h3>
64
-		<p><?php printf( __( '%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso' ), '<strong>', '</strong>' ); ?></p>
63
+		<h3 class="section-title"><?php _e("Taxes", 'event_espresso') ?></h3>
64
+		<p><?php printf(__('%s*%s Taxable items. The total amount collected for taxes is reflected in the total(s) below.', 'event_espresso'), '<strong>', '</strong>'); ?></p>
65 65
 		<table class="invoice-amount">
66 66
 			<thead>
67 67
 				<tr class="header_row">
68
-					<th class="left ticket_th"><?php _e( "Tax Name", "event_espresso" ); ?></th>
69
-					<th class="left"><?php _e( 'Description', 'event_espresso' ); ?></th>
70
-					<th class="event_th item_c"><?php _e( 'Rate', 'event_espresso' ); ?></th>
71
-					<th class="subtotal_th"><?php _e( 'Tax Amount', 'event_espresso' ); ?></th>
68
+					<th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th>
69
+					<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
70
+					<th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th>
71
+					<th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th>
72 72
 				</tr>
73 73
 			</thead>
74 74
 			<tbody>
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 		</table>
80 80
 	</div>
81 81
 	<div class="grand-total-dv">
82
-		<h2 class="grand-total"><?php printf( __( "Grand Total: %s", "event_espresso" ), '[TOTAL_COST]' ); ?></h2>
82
+		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), '[TOTAL_COST]'); ?></h2>
83 83
 	</div>
84 84
 	<div class="payment-dv">
85
-		<h3 class="section-title"><?php _e( "Payments", 'event_espresso' ) ?></h3>
85
+		<h3 class="section-title"><?php _e("Payments", 'event_espresso') ?></h3>
86 86
 		<table class="invoice-amount">
87 87
 			<thead>
88 88
 				<tr class="header_row">
89
-					<th><span class=""><?php _e( 'Payment Method', 'event_espresso' ); ?></span></th>
90
-					<th class='left datetime_th'><?php _e( "Date", 'event_espresso' ) ?></th>
91
-					<th><span class=""><?php _e( 'Transaction Id / Cheque #', 'event_espresso' ); ?></span></th>
92
-					<th><span class=""><?php _e( 'P.O. / S.O.#', 'event_espresso' ); ?></span></th>
93
-					<th><span class=""><?php _e( 'Status', 'event_espresso' ); ?></span></th>
94
-					<th><?php _e( 'Amount', 'event_espresso' ); ?></th>
89
+					<th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th>
90
+					<th class='left datetime_th'><?php _e("Date", 'event_espresso') ?></th>
91
+					<th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th>
92
+					<th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th>
93
+					<th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th>
94
+					<th><?php _e('Amount', 'event_espresso'); ?></th>
95 95
 				</tr>
96 96
 			</thead>
97 97
 			<tbody>
@@ -105,21 +105,21 @@  discard block
 block discarded – undo
105 105
 			<tfoot>
106 106
 				<tr class='total_tr'>
107 107
 					<td colspan="4">&nbsp;</td>
108
-					<td class="item_r"><?php _e( 'Total Paid', 'event_espresso' ) ?></td>
108
+					<td class="item_r"><?php _e('Total Paid', 'event_espresso') ?></td>
109 109
 					<td class="item_r">[TOTAL_AMOUNT_PAID]</td>
110 110
 				</tr>
111 111
 				<tr class="total_tr odd">
112 112
 					<td colspan="4">&nbsp;</td>
113
-					<td class="total" id="total_currency"><?php _e( 'Amount Owed:', 'event_espresso' ); ?></td>
113
+					<td class="total" id="total_currency"><?php _e('Amount Owed:', 'event_espresso'); ?></td>
114 114
 					<td class="total">[TOTAL_OWING]</td>
115 115
 				</tr>
116 116
 			</tfoot>
117 117
 		</table>
118 118
 	</div>
119 119
 	<div class="additional-info-dv">
120
-		<h3 class="section-title"><?php _e( "Additional Information:", "event_espresso" ); ?></h3>
120
+		<h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3>
121 121
 		<div class="additional-info">
122
-			<h2><?php _e( "Venue Details:", "event_espresso" ); ?></h2>
122
+			<h2><?php _e("Venue Details:", "event_espresso"); ?></h2>
123 123
 			<table class="venue-list">
124 124
 				<tr class="venue-details">
125 125
 					<td class="venue-details-part venue-address-dv">
Please login to merge, or discard this patch.