Completed
Branch BUG-9492-refactor-activation-l... (cb6da3)
by
unknown
26:42 queued 14:49
created
modules/venue_single/EED_Venue_Single.module.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venue_Single
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venue', 'Venue_Single', 'run' );
40
+		EE_Config::register_route('venue', 'Venue_Single', 'run');
41 41
 //		EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
82
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82
+			add_filter('the_content', array($this, 'venue_details'), 100);
83 83
 			// don't display entry meta because the existing theme will take car of that
84
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
84
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
85 85
 		}
86 86
 		return $template;
87 87
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param  string $title
96 96
 	 * @return string
97 97
 	 */
98
-	public function the_title( $title = '' ) {
98
+	public function the_title($title = '') {
99 99
 		return $title;
100 100
 	}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @param  string $content
108 108
 	 * @return string
109 109
 	 */
110
-	public function venue_details( $content ) {
110
+	public function venue_details($content) {
111 111
 		global $post;
112 112
 		if (
113 113
 			$post->post_type == 'espresso_venues'
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 			// it uses the_content() for displaying the $post->post_content
118 118
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
119 119
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
120
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
120
+			remove_filter('the_content', array($this, 'venue_details'), 100);
121 121
 			// add filters we want
122
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
122
+			add_filter('the_content', array($this, 'venue_location'), 110);
123 123
 			// now load our template
124
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
124
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
125 125
 			// remove other filters we added so they won't get applied to the next post
126
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
126
+			remove_filter('the_content', array($this, 'venue_location'), 110);
127 127
 		}
128 128
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
129
-		return ! empty( $template ) ? $template : $content;
129
+		return ! empty($template) ? $template : $content;
130 130
 	}
131 131
 
132 132
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param  string $content
139 139
 	 * @return string
140 140
 	 */
141
-	public function venue_location( $content ) {
142
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
141
+	public function venue_location($content) {
142
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
143 143
 	}
144 144
 
145 145
 
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function wp_enqueue_scripts() {
154 154
 		// get some style
155
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) {
155
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) {
156 156
 			// first check theme folder
157
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
158
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
159
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
160
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
157
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
158
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
159
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
160
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
161 161
 			}
162
-			wp_enqueue_style( $this->theme );
163
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
164
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
162
+			wp_enqueue_style($this->theme);
163
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
164
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
165 165
 			}
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
modules/venues_archive/EED_Venues_Archive.module.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venues_Archive
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venues', 'Venues_Archive', 'run' );
40
+		EE_Config::register_route('venues', 'Venues_Archive', 'run');
41 41
 //		EE_Config::register_view( 'venues', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'archive-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'archive-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'archive-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82 82
 			// don't know if theme uses the_excerpt
83
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
83
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
84 84
 			// or the_content
85
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
85
+			add_filter('the_content', array($this, 'venue_details'), 100);
86 86
 			// don't display entry meta because the existing theme will take care of that
87
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
87
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
88 88
 		}
89 89
 		return $template;
90 90
 	}
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param  string $title
99 99
 	 * @return string
100 100
 	 */
101
-	public function the_title( $title = '' ) {
101
+	public function the_title($title = '') {
102 102
 		return $title;
103 103
 	}
104 104
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $content
111 111
 	 * @return string
112 112
 	 */
113
-	public function venue_details( $content ) {
113
+	public function venue_details($content) {
114 114
 		global $post;
115 115
 		if (
116 116
 			$post->post_type == 'espresso_venues'
@@ -120,22 +120,22 @@  discard block
 block discarded – undo
120 120
 			// it uses the_content() for displaying the $post->post_content
121 121
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
122 122
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
123
-			remove_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
124
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
123
+			remove_filter('the_excerpt', array($this, 'venue_details'), 100);
124
+			remove_filter('the_content', array($this, 'venue_details'), 100);
125 125
 			// add filters we want
126
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
127
-			add_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
126
+			add_filter('the_content', array($this, 'venue_location'), 110);
127
+			add_filter('the_excerpt', array($this, 'venue_location'), 110);
128 128
 			// now load our template
129
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
129
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
130 130
 			//now add our filter back in, plus some others
131
-			add_filter( 'the_excerpt', array( $this, 'venue_details' ), 100 );
132
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
131
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
132
+			add_filter('the_content', array($this, 'venue_details'), 100);
133 133
 			// remove other filters we added so they won't get applied to the next post
134
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
135
-			remove_filter( 'the_excerpt', array( $this, 'venue_location' ), 110 );
134
+			remove_filter('the_content', array($this, 'venue_location'), 110);
135
+			remove_filter('the_excerpt', array($this, 'venue_location'), 110);
136 136
 			// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
137 137
 		}
138
-		return ! empty( $template ) ? $template : $content;
138
+		return ! empty($template) ? $template : $content;
139 139
 	}
140 140
 
141 141
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @param  string $content
148 148
 	 * @return string
149 149
 	 */
150
-	public function venue_location( $content ) {
151
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
150
+	public function venue_location($content) {
151
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
152 152
 	}
153 153
 
154 154
 
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function wp_enqueue_scripts() {
164 164
 		// get some style
165
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_archive() ) {
165
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_archive()) {
166 166
 			// first check theme folder
167
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
168
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
169
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
170
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
167
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
168
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
169
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
170
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
171 171
 			}
172
-			wp_enqueue_style( $this->theme );
172
+			wp_enqueue_style($this->theme);
173 173
 		}
174 174
 	}
175 175
 
Please login to merge, or discard this patch.
registrations/form_sections/EE_Registration_Custom_Questions_Form.form.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * @since		 	   4.8.30.rc.009
14 14
  *
15 15
  */
16
-if( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
17
-	exit( 'No direct script access allowed' );
16
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
17
+	exit('No direct script access allowed');
18 18
 }
19 19
 
20
-class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper{
20
+class EE_Registration_Custom_Questions_Form extends EE_Form_Section_Proper {
21 21
 	/**
22 22
 	 *
23 23
 	 * @var EE_Registration
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
 	 * @param EE_Registration $reg
30 30
 	 * @param array $options
31 31
 	 */
32
-	public function __construct( EE_Registration $reg, $options = array() ) {
32
+	public function __construct(EE_Registration $reg, $options = array()) {
33 33
 		$this->_registration = $reg;
34
-		if( ! isset( $options[ 'layout_strategy' ] ) ) {
35
-			$options[ 'layout_strategy' ] = new EE_Admin_Two_Column_Layout();
34
+		if ( ! isset($options['layout_strategy'])) {
35
+			$options['layout_strategy'] = new EE_Admin_Two_Column_Layout();
36 36
 		}
37
-		if( ! isset( $options[ 'html_id' ] ) ) {
38
-			$options[ 'html_id' ] = 'reg-admin-attendee-questions-frm';
37
+		if ( ! isset($options['html_id'])) {
38
+			$options['html_id'] = 'reg-admin-attendee-questions-frm';
39 39
 		}
40 40
 		$this->build_form_from_registration();
41
-		parent::__construct( $options );
41
+		parent::__construct($options);
42 42
 	}
43 43
 
44 44
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	public function build_form_from_registration() {
54 54
 		$reg = $this->get_registration();
55
-		if( ! $reg instanceof EE_Registration ) {
56
-			throw new EE_Error( __( 'We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso') );
55
+		if ( ! $reg instanceof EE_Registration) {
56
+			throw new EE_Error(__('We cannot build the registration custom questions form because there is no registration set on it yet', 'event_espresso'));
57 57
 		}
58 58
 		//we want to get all their question groups
59 59
 		$question_groups = EEM_Question_Group::instance()->get_all(
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
 					'Event_Question_Group.EQG_primary' => $reg->count() == 1 ? TRUE : FALSE,
64 64
 					'OR' => array(
65 65
 						'Question.QST_system*blank' =>  '',
66
-						'Question.QST_system*null' => array( 'IS_NULL' ) 
66
+						'Question.QST_system*null' => array('IS_NULL') 
67 67
 					)
68 68
 				),
69
-				'order_by' => array( 'QSG_order' => 'ASC' )
69
+				'order_by' => array('QSG_order' => 'ASC')
70 70
 			)
71 71
 		);
72 72
 		//get each question groups questions
73
-		foreach( $question_groups as $question_group ) {
74
-			if ( $question_group instanceof EE_Question_Group ) {
75
-				$this->_subsections[ $question_group->ID() ] = $this->build_subform_from_question_group(
73
+		foreach ($question_groups as $question_group) {
74
+			if ($question_group instanceof EE_Question_Group) {
75
+				$this->_subsections[$question_group->ID()] = $this->build_subform_from_question_group(
76 76
 					$question_group,
77 77
 					$reg
78 78
 				);
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
 	 * @return \EE_Form_Section_Proper
90 90
 	 * @throws \EE_Error
91 91
 	 */
92
-	public function build_subform_from_question_group( $question_group, $registration ) {
93
-		if( ! $question_group instanceof EE_Question_Group ||
92
+	public function build_subform_from_question_group($question_group, $registration) {
93
+		if ( ! $question_group instanceof EE_Question_Group ||
94 94
 			! $registration instanceof EE_Registration) {
95
-			throw new EE_Error( __( 'A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso' ) );
95
+			throw new EE_Error(__('A valid question group and registration must be passed to EE_Registration_Custom_Question_Form', 'event_espresso'));
96 96
 		}
97 97
 		$parts_of_subsection = array(
98 98
 			'title' => new EE_Form_Section_HTML(
99
-					EEH_HTML::h5( $question_group->name(),
99
+					EEH_HTML::h5($question_group->name(),
100 100
 					$question_group->identifier(),
101
-					'espresso-question-group-title-h5 section-title' )
101
+					'espresso-question-group-title-h5 section-title')
102 102
 				)
103 103
 		);
104 104
 		$questions = $question_group->questions( 
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 				array( 
107 107
 					'OR' => array(
108 108
 						'QST_system*blank' => '',
109
-						'QST_system*null' => array( 'IS_NULL' )
109
+						'QST_system*null' => array('IS_NULL')
110 110
 					)
111 111
 				)
112 112
 			)
113 113
 		);
114
-		foreach( $questions as $question ) {
115
-			$parts_of_subsection[ $question->ID() ] = $question->generate_form_input( $registration );
114
+		foreach ($questions as $question) {
115
+			$parts_of_subsection[$question->ID()] = $question->generate_form_input($registration);
116 116
 		}
117
-		$parts_of_subsection[ 'edit_link' ] = new EE_Form_Section_HTML(
118
-				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
119
-					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
117
+		$parts_of_subsection['edit_link'] = new EE_Form_Section_HTML(
118
+				'<tr><th/><td class="reg-admin-edit-attendee-question-td"><a class="reg-admin-edit-attendee-question-lnk" href="#" title="'.esc_attr__('click to edit question', 'event_espresso').'">
119
+					<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
120 120
 					<div class="dashicons dashicons-edit"></div>
121 121
 				</a></td></tr>'
122 122
 			);
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
 	protected function _normalize($req_data) {
137 137
 		$this->_received_submission = TRUE;
138 138
 		$this->_validation_errors = array();
139
-		foreach($this->get_validatable_subsections() as $subsection){
140
-			if( $subsection->form_data_present_in( $req_data ) ) {
141
-				try{
139
+		foreach ($this->get_validatable_subsections() as $subsection) {
140
+			if ($subsection->form_data_present_in($req_data)) {
141
+				try {
142 142
 					$subsection->_normalize($req_data);
143
-				}catch( EE_Validation_Error $e ){
144
-					$subsection->add_validation_error( $e );
143
+				} catch (EE_Validation_Error $e) {
144
+					$subsection->add_validation_error($e);
145 145
 				}
146 146
 			}
147 147
 		}
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
 	 * calling parent::_validate() first.
157 157
 	 */
158 158
 	protected function _validate() {
159
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
160
-			if( $subsection->form_data_present_in( array_merge( $_GET, $_POST ) ) ) {
161
-				if(method_exists($this,'_validate_'.$subsection_name)){
162
-					call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
159
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
160
+			if ($subsection->form_data_present_in(array_merge($_GET, $_POST))) {
161
+				if (method_exists($this, '_validate_'.$subsection_name)) {
162
+					call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
163 163
 				}
164 164
 				$subsection->_validate();
165
-			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
165
+			} elseif ($subsection instanceof EE_Form_Section_Proper) {
166 166
 				$subsection->_received_submission = true;
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
core/db_classes/EE_Export.class.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * EE_Export class
5 5
  * 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	  * @access private
40 40
 	  * @param array $request_data
41 41
 	  */
42
- 	private function __construct( $request_data = array() ) {
42
+ 	private function __construct($request_data = array()) {
43 43
 		$this->_req_data = $request_data;
44
-		$this->today = date("Y-m-d",time());
45
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
46
-		$this->EE_CSV= EE_CSV::instance();
44
+		$this->today = date("Y-m-d", time());
45
+		require_once(EE_CLASSES.'EE_CSV.class.php');
46
+		$this->EE_CSV = EE_CSV::instance();
47 47
 	}
48 48
 
49 49
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	  * @param array $request_data
56 56
 	  * @return \EE_Export
57 57
 	  */
58
-	public static function instance( $request_data = array() ) {
58
+	public static function instance($request_data = array()) {
59 59
 		// check if class object is instantiated
60
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) {
61
-			self::$_instance = new self( $request_data );
60
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) {
61
+			self::$_instance = new self($request_data);
62 62
 		}
63 63
 		return self::$_instance;
64 64
 	}
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	public function export() {
73 73
 
74 74
 		// in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword
75
-		if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) {
75
+		if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) {
76 76
 			// check if action2 has export action
77
-			if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) {
77
+			if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) {
78 78
 				// whoop! there it is!
79 79
 				$this->_req_data['action'] = $this->_req_data['action2'];
80 80
 			}
81 81
 		}
82 82
 
83
-		$this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : '';
83
+		$this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : '';
84 84
 
85 85
 		switch ($this->_req_data['export']) {
86 86
 			case 'report':
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					break;
95 95
 
96 96
 					case 'registrations_report_for_event':
97
-						$this->report_registrations_for_event( $this->_req_data['EVT_ID'] );
97
+						$this->report_registrations_for_event($this->_req_data['EVT_ID']);
98 98
 					break;
99 99
 
100 100
 					case 'attendees':
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					break;
107 107
 
108 108
 					default:
109
-						EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ;
109
+						EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
110 110
 						return FALSE;
111 111
 					break;
112 112
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * Downloads a CSV file with all the columns, but no data. This should be used for importing
125 125
 	 * @return null kills execution
126 126
 	 */
127
-	function export_sample(){
127
+	function export_sample() {
128 128
 		$event = EEM_Event::instance()->get_one();
129 129
 		$this->_req_data['EVT_ID'] = $event->ID();
130 130
 		$this->export_all_event_data();
@@ -150,23 +150,23 @@  discard block
 block discarded – undo
150 150
 		$state_country_query_params = array();
151 151
 		$question_group_query_params = array();
152 152
 		$question_query_params = array();
153
-		if ( isset( $this->_req_data['EVT_ID'] )) {
153
+		if (isset($this->_req_data['EVT_ID'])) {
154 154
 			// do we have an array of IDs ?
155 155
 
156
-			if ( is_array( $this->_req_data['EVT_ID'] )) {
157
-				$EVT_IDs =  array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] );
158
-				$value_to_equal = array('IN',$EVT_IDs);
156
+			if (is_array($this->_req_data['EVT_ID'])) {
157
+				$EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']);
158
+				$value_to_equal = array('IN', $EVT_IDs);
159 159
 				$filename = 'events';
160 160
 			} else {
161 161
 				// generate regular where = clause
162
-				$EVT_ID = absint( $this->_req_data['EVT_ID'] );
162
+				$EVT_ID = absint($this->_req_data['EVT_ID']);
163 163
 				$value_to_equal = $EVT_ID;
164 164
 				$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID);
165 165
 
166
-				$filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) );
166
+				$filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'));
167 167
 
168 168
 			}
169
-			$event_query_params[0]['EVT_ID'] =$value_to_equal;
169
+			$event_query_params[0]['EVT_ID'] = $value_to_equal;
170 170
 			$related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal;
171 171
 			$related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal;
172 172
 			$datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal;
@@ -210,42 +210,42 @@  discard block
 block discarded – undo
210 210
 
211 211
 			);
212 212
 
213
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
213
+		$model_data = $this->_get_export_data_for_models($models_to_export);
214 214
 
215
-		$filename = $this->generate_filename ( $filename );
215
+		$filename = $this->generate_filename($filename);
216 216
 
217
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
218
-			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
217
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
218
+			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
219 219
 		}
220 220
 	}
221 221
 
222
-	function report_attendees(){
222
+	function report_attendees() {
223 223
 		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( 
224 224
 			array( 
225
-				'force_join' => array( 'State', 'Country' ), 
225
+				'force_join' => array('State', 'Country'), 
226 226
 				'caps' => EEM_Base::caps_read_admin 
227 227
 			) 
228 228
 		);
229 229
 		$csv_data = array();
230
-		foreach( $attendee_rows as $attendee_row ){
230
+		foreach ($attendee_rows as $attendee_row) {
231 231
 			$csv_row = array();
232
-			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
233
-				if( $field_name == 'STA_ID' ){
234
-					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
235
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
236
-				}elseif( $field_name == 'CNT_ISO' ){
237
-					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
238
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
239
-				}else{
240
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
232
+			foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
233
+				if ($field_name == 'STA_ID') {
234
+					$state_name_field = EEM_State::instance()->field_settings_for('STA_name');
235
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
236
+				}elseif ($field_name == 'CNT_ISO') {
237
+					$country_name_field = EEM_Country::instance()->field_settings_for('CNT_name');
238
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
239
+				} else {
240
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
241 241
 				}
242 242
 			}
243 243
 			$csv_data[] = $csv_row;
244 244
 		}
245 245
 
246
-		$filename = $this->generate_filename ( 'contact-list-report' );
246
+		$filename = $this->generate_filename('contact-list-report');
247 247
 
248
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
248
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
249 249
 		$this->EE_CSV->write_data_array_to_csv($handle, $csv_data);
250 250
 		$this->EE_CSV->end_sending_csv($handle);
251 251
 	}
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 		$countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL'))));
263 263
 //		$states_to_export_query_params
264 264
 		$models_to_export = array(
265
-			'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))),
266
-			'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))),
265
+			'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))),
266
+			'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))),
267 267
 			'Attendee'=>array(),
268 268
 		);
269 269
 
270 270
 
271 271
 
272
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
273
-		$filename = $this->generate_filename ( 'all-attendees' );
272
+		$model_data = $this->_get_export_data_for_models($models_to_export);
273
+		$filename = $this->generate_filename('all-attendees');
274 274
 
275
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
276
-			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
275
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
276
+			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
277 277
 		}
278 278
 	}
279 279
 
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
286 286
 	 * @return string
287 287
 	 */
288
-	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
289
-		$field_obj = $model->field_settings_for( $field_name );
290
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
291
-		if( $field_obj instanceof EE_Datetime_Field ) {
292
-			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
293
-			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
288
+	protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
289
+		$field_obj = $model->field_settings_for($field_name);
290
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
291
+		if ($field_obj instanceof EE_Datetime_Field) {
292
+			$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
293
+			$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
294 294
 		}
295
-		if( $pretty_schema === true){
296
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
297
-		}elseif( is_string( $pretty_schema ) ) {
298
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
299
-		}else{
300
-			return $field_obj->prepare_for_get( $value_on_model_obj );
295
+		if ($pretty_schema === true) {
296
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
297
+		}elseif (is_string($pretty_schema)) {
298
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
299
+		} else {
300
+			return $field_obj->prepare_for_get($value_on_model_obj);
301 301
 		}
302 302
 	}
303 303
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * and the questions associated with the registrations
307 307
 	 * @param int $event_id
308 308
 	 */
309
-	function report_registrations_for_event( $event_id = NULL ){
309
+	function report_registrations_for_event($event_id = NULL) {
310 310
 		$reg_fields_to_include = array(
311 311
 				'TXN_ID',
312 312
 				'ATT_ID',
@@ -338,126 +338,126 @@  discard block
 block discarded – undo
338 338
 				array(
339 339
 					'OR' => array(
340 340
 						//don't include registrations from failed or abandoned transactions...
341
-						'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ),
341
+						'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)),
342 342
 						//unless the registration is approved, in which case include it regardless of transaction status
343 343
 						'STS_ID' => EEM_Registration::status_id_approved
344 344
 						),
345
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
345
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
346 346
 					),
347
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
348
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
347
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
348
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
349 349
 				'caps' => EEM_Base::caps_read_admin
350 350
 			),
351 351
 			$event_id
352 352
 		);
353
-		if( $event_id ){
354
-			$query_params[0]['EVT_ID'] =  $event_id;
355
-		}else{
356
-			$query_params[ 'force_join' ][] = 'Event';
353
+		if ($event_id) {
354
+			$query_params[0]['EVT_ID'] = $event_id;
355
+		} else {
356
+			$query_params['force_join'][] = 'Event';
357 357
 		}
358
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
358
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
359 359
 		//get all questions which relate to someone in this group
360 360
 		$registration_ids = array();
361
-		foreach( $registration_rows as $reg_row ) {
362
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
361
+		foreach ($registration_rows as $reg_row) {
362
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
363 363
 		}
364 364
 //		EEM_Question::instance()->show_next_x_db_queries();
365
-		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids))));
366
-		foreach($registration_rows as $reg_row){
367
-			if ( is_array( $reg_row ) ) {
365
+		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids))));
366
+		foreach ($registration_rows as $reg_row) {
367
+			if (is_array($reg_row)) {
368 368
 				$reg_csv_array = array();
369
-				if( ! $event_id ){
369
+				if ( ! $event_id) {
370 370
 					//get the event's name and Id
371
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), $this->_prepare_value_from_db_for_display( EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
371
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), $this->_prepare_value_from_db_for_display(EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
372 372
 				}
373
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
373
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
374 374
 				/*@var $reg_row EE_Registration */
375
-				foreach($reg_fields_to_include as $field_name){
375
+				foreach ($reg_fields_to_include as $field_name) {
376 376
 					$field = $reg_model->field_settings_for($field_name);
377
-					if($field_name == 'REG_final_price'){
378
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
379
-					}elseif( $field_name == 'REG_count' ){
380
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
381
-					}elseif( $field_name == 'REG_date' ) {
382
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
383
-					}else{
384
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
377
+					if ($field_name == 'REG_final_price') {
378
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
379
+					}elseif ($field_name == 'REG_count') {
380
+						$value = sprintf(__('%s of %s', 'event_espresso'), $this->_prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), $this->_prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
381
+					}elseif ($field_name == 'REG_date') {
382
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
383
+					} else {
384
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
385 385
 					}
386 386
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
387
-					if($field_name == 'REG_final_price'){
387
+					if ($field_name == 'REG_final_price') {
388 388
 						//add a column named Currency after the final price
389 389
 						$reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code;
390 390
 					}
391 391
 				}
392 392
 				//get pretty status
393
-				$stati = EEM_Status::instance()->localized_status( array(
394
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
395
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
393
+				$stati = EEM_Status::instance()->localized_status(array(
394
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
395
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
396 396
 						FALSE,
397
-						'sentence' );
398
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
397
+						'sentence');
398
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
399 399
 				//get pretty trnasaction status
400
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
401
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00';
402
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00';
400
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
401
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
402
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
403 403
 				$payment_methods = array();
404 404
 				$gateway_txn_ids_etc = array();
405 405
 				$payment_times = array();
406
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
406
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
407 407
 					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
408 408
 							array(
409 409
 								array(
410
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
410
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
411 411
 									'STS_ID' => EEM_Payment::status_id_approved
412 412
 								),
413
-								'force_join' => array( 'Payment_Method' ),
413
+								'force_join' => array('Payment_Method'),
414 414
 
415 415
 							),
416 416
 							ARRAY_A,
417 417
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
418 418
 
419
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
420
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
421
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
422
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
419
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
420
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
421
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
422
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
423 423
 					}
424 424
 
425 425
 				}
426
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
427
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
428
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
426
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
427
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
428
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
429 429
 
430 430
 				//get whether or not the user has checked in
431
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
431
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
432 432
 				//get ticket of registration and its price
433 433
 				$ticket_model = EE_Registry::instance()->load_model('Ticket');
434
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
435
-					$ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
434
+				if ($reg_row['Ticket.TKT_ID']) {
435
+					$ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
436 436
 					$datetimes_strings = array();
437
-					foreach( EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
438
-						$datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
437
+					foreach (EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
438
+						$datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
439 439
 					}
440 440
 
441 441
 				} else {
442
-					$ticket_name = __( 'Unknown', 'event_espresso' );
443
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
442
+					$ticket_name = __('Unknown', 'event_espresso');
443
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
444 444
 				}
445 445
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
446 446
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
447 447
 				//get datetime(s) of registration
448 448
 
449 449
 				//add attendee columns
450
-				foreach($att_fields_to_include as $att_field_name){
450
+				foreach ($att_fields_to_include as $att_field_name) {
451 451
 					$field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name);
452
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
453
-						if($att_field_name == 'STA_ID'){
454
-							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
455
-						}elseif($att_field_name == 'CNT_ISO'){
456
-							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
457
-						}else{
458
-							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
452
+					if ($reg_row['Attendee_CPT.ID']) {
453
+						if ($att_field_name == 'STA_ID') {
454
+							$value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
455
+						}elseif ($att_field_name == 'CNT_ISO') {
456
+							$value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
457
+						} else {
458
+							$value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
459 459
 						}
460
-					}else{
460
+					} else {
461 461
 						$value = '';
462 462
 					}
463 463
 
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
 				}
466 466
 
467 467
 				//make sure each registration has the same questions in the same order
468
-				foreach($questions_for_these_regs_rows as $question_row){
469
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
470
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
468
+				foreach ($questions_for_these_regs_rows as $question_row) {
469
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
470
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
471 471
 					}
472 472
 				}
473 473
 				//now fill out the questions THEY answered
474
-				foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){
474
+				foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) {
475 475
 					/* @var $answer EE_Answer */
476
-					if( $answer_row[ 'Question.QST_ID' ] ){
477
-						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
478
-					}else{
479
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
476
+					if ($answer_row['Question.QST_ID']) {
477
+						$question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']);
478
+					} else {
479
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
480 480
 					}
481
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
482
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
481
+                                        if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) {
482
+                                            $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']);
483 483
                                         } else {
484
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
484
+                                            $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']);
485 485
                                         }
486 486
 				}
487
-				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
487
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row);
488 488
 			}
489 489
 		}
490 490
 
491 491
 		//if we couldn't export anything, we want to at least show the column headers
492
-		if(empty($registrations_csv_ready_array)){
492
+		if (empty($registrations_csv_ready_array)) {
493 493
 			$reg_csv_array = array();
494 494
 			$model_and_fields_to_include = array(
495 495
 				'Registration' => $reg_fields_to_include,
496 496
 				'Attendee' => $att_fields_to_include
497 497
 			);
498
-			foreach($model_and_fields_to_include as $model_name => $field_list){
498
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
499 499
 				$model = EE_Registry::instance()->load_model($model_name);
500
-				foreach($field_list as $field_name){
500
+				foreach ($field_list as $field_name) {
501 501
 					$field = $model->field_settings_for($field_name);
502
-					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
502
+					$reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name());
503 503
 				}
504 504
 			}
505 505
 			$registrations_csv_ready_array [] = $reg_csv_array;
506 506
 		}
507
-		if( $event_id ){
508
-			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
509
-			if( ! $event_slug ) {
510
-				$event_slug = __( 'unknown', 'event_espresso' );
507
+		if ($event_id) {
508
+			$event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
509
+			if ( ! $event_slug) {
510
+				$event_slug = __('unknown', 'event_espresso');
511 511
 			}
512
-		}else{
513
-			$event_slug = __( 'all', 'event_espresso' );
512
+		} else {
513
+			$event_slug = __('all', 'event_espresso');
514 514
 		}
515
-		$filename = sprintf( "registrations-for-%s", $event_slug );
515
+		$filename = sprintf("registrations-for-%s", $event_slug);
516 516
 
517
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
517
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
518 518
 		$this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array);
519 519
 		$this->EE_CSV->end_sending_csv($handle);
520 520
 	}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 * @param EE_Model_Field_Base $field
525 525
 	 * @return string
526 526
 	 */
527
-	protected function _get_column_name_for_field(EE_Model_Field_Base $field){
527
+	protected function _get_column_name_for_field(EE_Model_Field_Base $field) {
528 528
 		return $field->get_nicename()."[".$field->get_name()."]";
529 529
 	}
530 530
 
@@ -537,17 +537,17 @@  discard block
 block discarded – undo
537 537
 	function export_categories() {
538 538
 		// are any Event IDs set?
539 539
 		$query_params = array();
540
-		if ( isset( $this->_req_data['EVT_CAT_ID'] )) {
540
+		if (isset($this->_req_data['EVT_CAT_ID'])) {
541 541
 			// do we have an array of IDs ?
542
-			if ( is_array( $this->_req_data['EVT_CAT_ID'] )) {
542
+			if (is_array($this->_req_data['EVT_CAT_ID'])) {
543 543
 				// generate an "IN (CSV)" where clause
544
-				$EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] );
544
+				$EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']);
545 545
 				$filename = 'event-categories';
546
-				$query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs);
546
+				$query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs);
547 547
 			} else {
548 548
 				// generate regular where = clause
549
-				$EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] );
550
-				$filename = 'event-category#' . $EVT_CAT_ID;
549
+				$EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']);
550
+				$filename = 'event-category#'.$EVT_CAT_ID;
551 551
 				$query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID;
552 552
 			}
553 553
 		} else {
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 				'Term_Taxonomy' => $query_params
560 560
 			);
561 561
 
562
-		$table_data = $this->_get_export_data_for_models( $tables_to_export );
563
-		$filename = $this->generate_filename ( $filename );
562
+		$table_data = $this->_get_export_data_for_models($tables_to_export);
563
+		$filename = $this->generate_filename($filename);
564 564
 
565
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) {
566
-			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
565
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) {
566
+			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
567 567
 		}
568 568
 	}
569 569
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *		  @param string - export_name
575 575
 	 *			@return string on success, FALSE on fail
576 576
 	 */
577
-	private function generate_filename ( $export_name = '' ) {
578
-		if ( $export_name != '' ) {
579
-			$filename = get_bloginfo('name') . '-' . $export_name;
580
-			$filename = sanitize_key( $filename ) . '-' . $this->today;
577
+	private function generate_filename($export_name = '') {
578
+		if ($export_name != '') {
579
+			$filename = get_bloginfo('name').'-'.$export_name;
580
+			$filename = sanitize_key($filename).'-'.$this->today;
581 581
 			return $filename;
582
-		}	 else {
583
-			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
582
+		} else {
583
+			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
584 584
 		}
585 585
 		return false;
586 586
 	}
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 *	@param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all
594 594
 	 *	@return array on success, FALSE on fail
595 595
 	 */
596
-	private function _get_export_data_for_models( $models_to_export = array() ) {
596
+	private function _get_export_data_for_models($models_to_export = array()) {
597 597
 		$table_data = FALSE;
598
-		if ( is_array( $models_to_export ) ) {
599
-			foreach ( $models_to_export as $model_name => $query_params ) {
598
+		if (is_array($models_to_export)) {
599
+			foreach ($models_to_export as $model_name => $query_params) {
600 600
 				//check for a numerically-indexed array. in that case, $model_name is the value!!
601
-				if(is_int($model_name)){
601
+				if (is_int($model_name)) {
602 602
 					$model_name = $query_params;
603 603
 					$query_params = array();
604 604
 				}
@@ -606,17 +606,17 @@  discard block
 block discarded – undo
606 606
 				$model_objects = $model->get_all($query_params);
607 607
 
608 608
 				$table_data[$model_name] = array();
609
-				foreach($model_objects as $model_object){
609
+				foreach ($model_objects as $model_object) {
610 610
 					$model_data_array = array();
611 611
 					$fields = $model->field_settings();
612
-					foreach($fields as $field){
612
+					foreach ($fields as $field) {
613 613
 						$column_name = $field->get_nicename()."[".$field->get_name()."]";
614
-						if($field instanceof EE_Datetime_Field){
614
+						if ($field instanceof EE_Datetime_Field) {
615 615
 //							$field->set_date_format('Y-m-d');
616 616
 //							$field->set_time_format('H:i:s');
617
-							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
617
+							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s');
618 618
 						}
619
-						else{
619
+						else {
620 620
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
621 621
 						}
622 622
 					}
Please login to merge, or discard this patch.
payment_methods/Aim/help_tabs/payment_methods_overview_aim.help_tab.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 <?php _e('Adjust the settings for the Authorize.net AIM payment gateway.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <p>
6
-<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso' ), "<a href='http://www.authorize.net/international/'  target='_blank'>","</a>" ); ?>
6
+<?php printf(__('See %1$shere%2$s for list of currencies supported by Authorize.net AIM.', 'event_espresso'), "<a href='http://www.authorize.net/international/'  target='_blank'>", "</a>"); ?>
7 7
 </p>
8 8
 <p><strong><?php _e('Authorize.net AIM Settings', 'event_espresso'); ?></strong></p>
9 9
 <ul>
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 <?php _e('By logging into Authorize.net, you can change which payment fields are required by Authorize.net when processing payments. These settings affect both the Advanced Integration Method (AIM, this) and the Simple Integration Method (SIM, different). The payment method settings "Excluded Payment Form Fields" and "Required Payment Form Fields" allow you to change the billing form in Event Espresso to reflect your payment form settings in Authorize.net.', 'event_espresso'); ?>
29 29
 <br>
30 30
 <?php printf( 
31
-		__( 'To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
31
+		__('To change your payment form settings in Authorize.net, %1$slog in to authorize.net%2$s, go to %3$sAccount then Payment Form%2$s, then %4$sForm Fields%2$s. It will look similar to %5$sthis%2$s. If you make a field required in Authorize.net, you should also make it required in Event Espresso. If it isn\'t required in Authorize.net, and you want to simplify the billing form in Event Espresso, you can exclude it from the Event Espresso Form too.'),
32 32
 		'<a href="http://authorize.net" target="_blank">',
33 33
 		'</a>',
34 34
 		'<a href="https://monosnap.com/file/nebVteOkEXcdDIos88SojStWOifP23" target="_blank">',
35 35
 		'<a href="https://monosnap.com/file/WyxGJtev87TcDmdGBEZ2oi1xaBIQAm" target="_blank">',
36
-		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">');?>
36
+		'<a href="https://monosnap.com/image/DbCJNfEesWXeSNUs1wLIpGYODFw52m" target="_blank">'); ?>
37 37
 </li>
38 38
 <li>
39
-	<strong><?php _e( 'Server', 'event_espresso');?></strong>
40
-	<?php _e( 'Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso' );?>
39
+	<strong><?php _e('Server', 'event_espresso'); ?></strong>
40
+	<?php _e('Use this setting to change the server where Authorize.net AIM requests are sent. Change this to "Authorize.net/Akamai" before June 30th 2016 to verify your server wil work with Authorize.net\'s servers which will be in use after that date.', 'event_espresso'); ?>
41 41
 </li>
42 42
 <li>
43 43
 <strong><?php _e('Button Image URL', 'event_espresso'); ?></strong><br />
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EE_PMT_Aim.pm.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_PMT_Aim extends EE_PMT_Base{
28
+class EE_PMT_Aim extends EE_PMT_Base {
29 29
 
30 30
 	
31 31
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		require_once($this->file_folder().'EEG_Aim.gateway.php');
49 49
 		$this->_gateway = new EEG_AIM();
50 50
 		$this->_pretty_name = __("Authorize.net AIM", 'event_espresso');
51
-		$this->_default_description = __( 'Please provide the following billing information.', 'event_espresso' );
51
+		$this->_default_description = __('Please provide the following billing information.', 'event_espresso');
52 52
 		$this->_requires_https = true;
53 53
 	}
54 54
 
@@ -57,60 +57,60 @@  discard block
 block discarded – undo
57 57
 	 * @param \EE_Transaction $transaction
58 58
 	 * @return EE_Billing_Info_Form
59 59
 	 */
60
-	public function generate_new_billing_form( EE_Transaction $transaction = NULL ) {
61
-		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance,array(
60
+	public function generate_new_billing_form(EE_Transaction $transaction = NULL) {
61
+		$billing_form = new EE_Billing_Attendee_Info_Form($this->_pm_instance, array(
62 62
 			'name'=>'AIM_Form',
63 63
 			'subsections'=>array(
64 64
 				'credit_card'=>new EE_Credit_Card_Input(array(
65 65
 					'required'=>true,
66
-					'html_label_text' => __( 'Card Number', 'event_espresso' )
66
+					'html_label_text' => __('Card Number', 'event_espresso')
67 67
 				)),
68 68
 				'exp_month'=>new EE_Credit_Card_Month_Input(true, array(
69 69
 					'required'=>true,
70
-					'html_label_text' => __( 'Expiry Month', 'event_espresso' )
70
+					'html_label_text' => __('Expiry Month', 'event_espresso')
71 71
 				)),
72
-				'exp_year'=>new EE_Credit_Card_Year_Input( array( 
72
+				'exp_year'=>new EE_Credit_Card_Year_Input(array( 
73 73
 					'required'=>true,
74
-					'html_label_text' => __( 'Expiry Year', 'event_espresso' ) 
74
+					'html_label_text' => __('Expiry Year', 'event_espresso') 
75 75
 				)),
76
-				'cvv'=>new EE_CVV_Input( array(
76
+				'cvv'=>new EE_CVV_Input(array(
77 77
 					'required'=>true,
78
-					'html_label_text' => __( 'CVV', 'event_espresso' ) ) ),
78
+					'html_label_text' => __('CVV', 'event_espresso') )),
79 79
 			)
80 80
 		));
81
-		$billing_form->add_subsections( array(
82
-			'company' => new EE_Text_Input( array(
81
+		$billing_form->add_subsections(array(
82
+			'company' => new EE_Text_Input(array(
83 83
 				'html_label_text' => __('Company', 'event_espresso')
84 84
 			))
85
-		), 'email', false );
85
+		), 'email', false);
86 86
 		$billing_form->add_subsections( 
87 87
 				array(
88
-					'fax' => new EE_Text_Input( array(
88
+					'fax' => new EE_Text_Input(array(
89 89
 						'html_label_text' => __('Fax', 'event_espresso')
90 90
 					))
91 91
 				), 
92 92
 				'phone', 
93 93
 				false );
94 94
 		$settings_form = $this->settings_form();
95
-		if( $settings_form->get_input( 'excluded_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
96
-				$billing_form->exclude( $settings_form->get_input( 'excluded_billing_inputs' )->normalized_value() );
95
+		if ($settings_form->get_input('excluded_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
96
+				$billing_form->exclude($settings_form->get_input('excluded_billing_inputs')->normalized_value());
97 97
 		}
98
-		if( $settings_form->get_input( 'required_billing_inputs' ) instanceof EE_Checkbox_Multi_Input ) {
99
-			$required_inputs = $settings_form->get_input( 'required_billing_inputs' )->normalized_value();
98
+		if ($settings_form->get_input('required_billing_inputs') instanceof EE_Checkbox_Multi_Input) {
99
+			$required_inputs = $settings_form->get_input('required_billing_inputs')->normalized_value();
100 100
 			//only change the requirement of inputs which are allowed to be changed
101 101
 			$inputs_to_evaluate = array_intersect_key( 
102 102
 				$billing_form->inputs(), 
103 103
 				$this->billing_input_names()
104 104
 			);
105
-			foreach( $inputs_to_evaluate as $input_name => $input ) {
106
-				if( in_array( $input_name, $required_inputs ) ) {
107
-					$input->set_required( true );
105
+			foreach ($inputs_to_evaluate as $input_name => $input) {
106
+				if (in_array($input_name, $required_inputs)) {
107
+					$input->set_required(true);
108 108
 				} else {
109
-					$input->set_required( false );
109
+					$input->set_required(false);
110 110
 				}
111 111
 			}
112 112
 		}
113
-		return $this->apply_billing_form_debug_settings( $billing_form );
113
+		return $this->apply_billing_form_debug_settings($billing_form);
114 114
 	}
115 115
 
116 116
 
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 * @param \EE_Billing_Info_Form $billing_form
123 123
 	 * @return \EE_Billing_Info_Form
124 124
 	 */
125
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
126
-		if ( $this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta( 'test_transactions', TRUE, FALSE )) {
127
-			$billing_form->get_input( 'credit_card' )->set_default( '4007000000027' );
128
-			$billing_form->get_input( 'exp_year' )->set_default( '2020' );
129
-			if( $billing_form->get_subsection( 'cvv' ) instanceof EE_Form_Input_Base ) {
130
-				$billing_form->get_input( 'cvv' )->set_default(( '123' ));
125
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
126
+		if ($this->_pm_instance->debug_mode() || $this->_pm_instance->get_extra_meta('test_transactions', TRUE, FALSE)) {
127
+			$billing_form->get_input('credit_card')->set_default('4007000000027');
128
+			$billing_form->get_input('exp_year')->set_default('2020');
129
+			if ($billing_form->get_subsection('cvv') instanceof EE_Form_Input_Base) {
130
+				$billing_form->get_input('cvv')->set_default(('123'));
131 131
 			}
132 132
 			$billing_form->add_subsections(
133
-				array( 'fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html() ),
133
+				array('fyi_about_autofill' => $billing_form->payment_fields_autofilled_notice_html()),
134 134
 				'credit_card'
135 135
 			);
136 136
 			$billing_form->add_subsections(
137
-				array( 'debug_content' => new EE_Form_Section_HTML_From_Template( dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php' )),
137
+				array('debug_content' => new EE_Form_Section_HTML_From_Template(dirname(__FILE__).DS.'templates'.DS.'authorize_net_aim_debug_info.template.php')),
138 138
 				'first_name'
139 139
 			);
140 140
 		}
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 				'extra_meta_inputs'=>array(
155 155
 					'login_id'=>new EE_Text_Input(
156 156
 						array(
157
-							'html_label_text'=>  sprintf( __("Authorize.net API Login ID %s", "event_espresso"),  $this->get_help_tab_link() ),
157
+							'html_label_text'=>  sprintf(__("Authorize.net API Login ID %s", "event_espresso"), $this->get_help_tab_link()),
158 158
 							'required' => true )
159 159
 					),
160 160
 					'transaction_key'=>new EE_Text_Input(
161 161
 						array(
162
-							'html_label_text'=> sprintf( __("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link() ),
162
+							'html_label_text'=> sprintf(__("Authorize.net Transaction Key %s", "event_espresso"), $this->get_help_tab_link()),
163 163
 							'required' => true )
164 164
 					),
165 165
 					'test_transactions'=>new EE_Yes_No_Input(
166 166
 						array(
167
-							'html_label_text'=>  sprintf( __("Send test transactions? %s", 'event_espresso'),  $this->get_help_tab_link() ),
167
+							'html_label_text'=>  sprintf(__("Send test transactions? %s", 'event_espresso'), $this->get_help_tab_link()),
168 168
 							'html_help_text'=>  __("Send test transactions, even to live server", 'event_espresso'),
169 169
 							'default' => false,
170 170
 							'required' => true
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 					'excluded_billing_inputs' => new EE_Checkbox_Multi_Input( 
174 174
 							$billing_input_names,
175 175
 					array( 
176
-						'html_label_text' => sprintf( __("Excluded Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
176
+						'html_label_text' => sprintf(__("Excluded Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
177 177
 						'default' => array(
178 178
 							'company',
179 179
 							'fax',
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 					'required_billing_inputs' => new EE_Checkbox_Multi_Input( 
183 183
 						$billing_input_names,
184 184
 						array(
185
-							'html_label_text' => sprintf( __("Required Payment Form Fields %s", 'event_espresso'),  $this->get_help_tab_link() ),
185
+							'html_label_text' => sprintf(__("Required Payment Form Fields %s", 'event_espresso'), $this->get_help_tab_link()),
186 186
 							'default' => array_diff(
187
-										array_keys( $billing_input_names ),
188
-										array( 'address2', 'phone', 'company', 'fax' )
187
+										array_keys($billing_input_names),
188
+										array('address2', 'phone', 'company', 'fax')
189 189
 							),
190 190
 							'html_help_text' => __('Note: if fields are excluded they cannot be required.', 'event_espresso')
191 191
 						)
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
 						apply_filters(
195 195
 							'FHEE__EE_PMT_Aim__generate_new_settings_form__server_select_input__options',
196 196
 							array(
197
-								'authorize.net' => __( 'Authorize.net (default)', 'event_espresso' ),
198
-								'akamai' => __( 'Authorize.net/Akamai', 'event_espresso' )
197
+								'authorize.net' => __('Authorize.net (default)', 'event_espresso'),
198
+								'akamai' => __('Authorize.net/Akamai', 'event_espresso')
199 199
 							),
200 200
 							$this
201 201
 						),
202 202
 						array(
203
-							'html_label_text' => __( 'Server', 'event_espresso' ),
204
-							'html_help_text' => __( 'The Gateway Server where payment requests will be sent', 'event_espresso' )
203
+							'html_label_text' => __('Server', 'event_espresso'),
204
+							'html_help_text' => __('The Gateway Server where payment requests will be sent', 'event_espresso')
205 205
 						)
206 206
 					)
207 207
 						
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function billing_input_names() {
219 219
 		return array(
220
-			'first_name' => __( 'First Name', 'event_espresso' ),
220
+			'first_name' => __('First Name', 'event_espresso'),
221 221
 			'last_name' => __('Last Name', 'event_espresso'),
222
-			'email' => __( 'Email', 'event_espresso' ),
223
-			'company' => __( 'Company', 'event_espresso' ),
222
+			'email' => __('Email', 'event_espresso'),
223
+			'company' => __('Company', 'event_espresso'),
224 224
 			'address' => __('Address', 'event_espresso'),
225 225
 			'address2' => __('Address2', 'event_espresso'),
226 226
 			'city' => __('City', 'event_espresso'),
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			'country' => __('Country', 'event_espresso'),
229 229
 			'zip' =>  __('Zip', 'event_espresso'),
230 230
 			'phone' => __('Phone', 'event_espresso'),
231
-			'fax' => __( 'Fax', 'event_espresso' ),
231
+			'fax' => __('Fax', 'event_espresso'),
232 232
 			'cvv' => __('CVV', 'event_espresso')
233 233
 		);
234 234
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param type $billing_form
240 240
 	 * @return array
241 241
 	 */
242
-	protected function _get_billing_values_from_form( $billing_form ){
242
+	protected function _get_billing_values_from_form($billing_form) {
243 243
 		$all_billing_values_empty = array();
244
-		foreach( array_keys( $this->billing_input_names() ) as $input_name ) {
245
-			$all_billing_values_empty[ $input_name ] = '';
244
+		foreach (array_keys($this->billing_input_names()) as $input_name) {
245
+			$all_billing_values_empty[$input_name] = '';
246 246
 		}
247 247
 		return array_merge(
248 248
 				$all_billing_values_empty,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 * @see EE_PMT_Base::help_tabs_config()
258 258
 	 * @return array
259 259
 	 */
260
-	public function help_tabs_config(){
260
+	public function help_tabs_config() {
261 261
 		return array(
262 262
 			$this->get_help_tab_name() => array(
263 263
 				'title' => __('Authorize.net AIM Settings', 'event_espresso'),
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EEG_Aim.gateway.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Aim extends EE_Onsite_Gateway{
28
+class EEG_Aim extends EE_Onsite_Gateway {
29 29
 	protected $_login_id;
30 30
 	protected $_transaction_key;
31 31
 	protected $_server;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @param EEG_Aim $gateway_object
95 95
 	 * @return string
96 96
 	 */
97
-	public function possibly_use_akamai_server( $url, EEG_Aim $gateway_object ) {
98
-		if( $gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode ) {
97
+	public function possibly_use_akamai_server($url, EEG_Aim $gateway_object) {
98
+		if ($gateway_object->_server === 'akamai' && ! $gateway_object->_debug_mode) {
99 99
 			return 'https://secure2.authorize.net/gateway/transact.dll';
100 100
 		} else {
101 101
 			return $url;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 
120 120
 	public function do_direct_payment($payment, $billing_info = null) {
121
-			add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_akamai_server' ), 10, 2 );
121
+			add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_akamai_server'), 10, 2);
122 122
 			// Enable test mode if needed
123 123
 			//4007000000027  <-- test successful visa
124 124
 			//4222222222222  <-- test failure card number
@@ -129,17 +129,17 @@  discard block
 block discarded – undo
129 129
 			$primary_registrant = $transaction->primary_registration();
130 130
 			//if we're are charging for the full amount, show the normal line items
131 131
 			//and the itemized total adds up properly
132
-			if( $this->_can_easily_itemize_transaction_for( $payment ) ){
132
+			if ($this->_can_easily_itemize_transaction_for($payment)) {
133 133
 				$total_line_item = $transaction->total_line_item();
134 134
 				foreach ($total_line_item->get_items() as $line_item) {
135 135
 					$this->addLineItem($item_num++, $line_item->name(), $line_item->desc(), $line_item->quantity(), $line_item->unit_price(), 'N');
136 136
 					$order_description .= $line_item->desc().', ';
137 137
 				}
138
-				foreach($total_line_item->tax_descendants() as $tax_line_item){
138
+				foreach ($total_line_item->tax_descendants() as $tax_line_item) {
139 139
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
140 140
 				}
141
-			}else{//partial payment
142
-				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"),$payment->amount(),$primary_registrant->reg_code());
141
+			} else {//partial payment
142
+				$order_description = sprintf(__("Payment of %s for %s", "event_espresso"), $payment->amount(), $primary_registrant->reg_code());
143 143
 			}
144 144
 
145 145
 
@@ -148,18 +148,18 @@  discard block
 block discarded – undo
148 148
 			//start transaction
149 149
 			//if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id
150 150
 			$partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363';
151
-			$this->setField( 'solution_id', $partner_id );
151
+			$this->setField('solution_id', $partner_id);
152 152
 			$this->setField('amount', $this->format_currency($payment->amount()));
153
-			$this->setField('description',substr(rtrim($order_description, ', '), 0, 255));
154
-			$this->_set_sensitive_billing_data( $billing_info );
153
+			$this->setField('description', substr(rtrim($order_description, ', '), 0, 255));
154
+			$this->_set_sensitive_billing_data($billing_info);
155 155
 			$this->setField('first_name', $billing_info['first_name']);
156 156
 			$this->setField('last_name', $billing_info['last_name']);
157 157
 			$this->setField('email', $billing_info['email']);
158 158
 			$this->setField('company', $billing_info['company']);
159 159
 			$this->setField('address', $billing_info['address'].' '.$billing_info['address2']);
160 160
 			$this->setField('city', $billing_info['city']);
161
-			$this->setField('state', $billing_info['state'] );
162
-			$this->setField('country', $billing_info['country'] );
161
+			$this->setField('state', $billing_info['state']);
162
+			$this->setField('country', $billing_info['country']);
163 163
 			$this->setField('zip', $billing_info['zip']);
164 164
 			$this->setField('fax', $billing_info['fax']);
165 165
 			$this->setField('cust_id', $primary_registrant->ID());
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 			//invoice_num would be nice to have itbe unique per SPCO page-load, taht way if users
168 168
 			//press back, they don't submit a duplicate. However, we may be keepin gthe user on teh same spco page
169 169
 			//in which case, we need to generate teh invoice num per request right here...
170
-			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
170
+			$this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
171 171
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
172
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
172
+            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS);
173 173
 
174 174
 
175 175
 			if ($this->_test_transactions) {
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			//Capture response
180 180
 			$this->type = "AUTH_CAPTURE";
181 181
 			$response = $this->_sendRequest($payment);
182
-			if (!empty($response)){
182
+			if ( ! empty($response)) {
183 183
 				if ($this->_debug_mode) {
184 184
 					$txn_id = $response->invoice_number;
185 185
 				} else {
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 				$payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
189 189
 				$payment->set_status($payment_status);
190 190
 				//make sure we interpret the AMT as a float, not an international string (where periods are thousand seperators)
191
-				$payment->set_amount( floatval( $response->amount ) );
192
-				$payment->set_gateway_response(sprintf("%s (code: %s)",$response->response_reason_text,$response->response_reason_code));
193
-				$payment->set_txn_id_chq_nmbr( $txn_id );
191
+				$payment->set_amount(floatval($response->amount));
192
+				$payment->set_gateway_response(sprintf("%s (code: %s)", $response->response_reason_text, $response->response_reason_code));
193
+				$payment->set_txn_id_chq_nmbr($txn_id);
194 194
 				$payment->set_extra_accntng($primary_registrant->reg_code());
195
-				$payment->set_details(print_r($response,true));
195
+				$payment->set_details(print_r($response, true));
196 196
 			} else {
197 197
 				$payment->set_status($this->_pay_model->failed_status());
198 198
 				$payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso'));
199
-				$payment->set_details(print_r($response,true));
199
+				$payment->set_details(print_r($response, true));
200 200
 			}
201 201
 		return $payment;
202 202
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * what billing data gets sent
208 208
 	 * @param array $billing_info
209 209
 	 */
210
-	protected function _set_sensitive_billing_data( $billing_info ) {
210
+	protected function _set_sensitive_billing_data($billing_info) {
211 211
 		$this->setField('card_num', $billing_info['credit_card']);
212 212
 		$this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']);
213 213
 		$this->setField('card_code', $billing_info['cvv']);
@@ -259,22 +259,22 @@  discard block
 block discarded – undo
259 259
 		$this->_x_post_fields['tran_key'] = $this->_transaction_key;
260 260
 		$x_keys = array();
261 261
 		foreach ($this->_x_post_fields as $key => $value) {
262
-			$x_keys[] = "x_$key=" . urlencode($value);
262
+			$x_keys[] = "x_$key=".urlencode($value);
263 263
 		}
264 264
 		// Add line items
265 265
 		foreach ($this->_additional_line_items as $key => $value) {
266
-			$x_keys[] =  "x_line_item=" . urlencode($value);
266
+			$x_keys[] = "x_line_item=".urlencode($value);
267 267
 		}
268 268
 		$this->_log_clean_request($x_keys, $payment);
269 269
 		$post_url = $this->_get_server_url();
270 270
 		$curl_request = curl_init($post_url);
271
-		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&",$x_keys));
271
+		curl_setopt($curl_request, CURLOPT_POSTFIELDS, implode("&", $x_keys));
272 272
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
273 273
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
274 274
 		curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
275 275
 		curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2);
276 276
 		if ($this->VERIFY_PEER) {
277
-			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem');
277
+			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)).'/ssl/cert.pem');
278 278
 		} else {
279 279
 			curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
280 280
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$response = curl_exec($curl_request);
287 287
 
288 288
 		curl_close($curl_request);
289
-		$response_obj =  new EE_AuthorizeNetAIM_Response($response);
289
+		$response_obj = new EE_AuthorizeNetAIM_Response($response);
290 290
 
291 291
 		return $this->_log_and_clean_response($response_obj, $payment);
292 292
 	}
@@ -295,18 +295,18 @@  discard block
 block discarded – undo
295 295
 	 * @param array $request_array
296 296
 	 * @param EEI_Payment $payment
297 297
 	 */
298
-	protected function _log_clean_request($request_array,$payment){
299
-		$keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' );
300
-		foreach($request_array as $index => $keyvaltogether ) {
301
-			foreach( $keys_to_filter_out as $key ) {
302
-				if( strpos( $keyvaltogether, $key ) === 0 ){
298
+	protected function _log_clean_request($request_array, $payment) {
299
+		$keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date');
300
+		foreach ($request_array as $index => $keyvaltogether) {
301
+			foreach ($keys_to_filter_out as $key) {
302
+				if (strpos($keyvaltogether, $key) === 0) {
303 303
 					//found it at the first character
304 304
 					//so its one of them
305
-					unset( $request_array[ $index ] );
305
+					unset($request_array[$index]);
306 306
 				}
307 307
 			}
308 308
 		}
309
-		$this->log(array('AIM Request sent:'=>$request_array),$payment);
309
+		$this->log(array('AIM Request sent:'=>$request_array), $payment);
310 310
 	}
311 311
 
312 312
 	/**
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 	 * @param EE_AuthorizeNetAIM_Response $response_obj
315 315
 	 * @param EE_Payment $payment
316 316
 	 */
317
-	private function _log_and_clean_response($response_obj,$payment){
317
+	private function _log_and_clean_response($response_obj, $payment) {
318 318
 		$response_obj->account_number = '';
319
-		$this->log(array('AIM Response received:'=>$response_obj),$payment);
319
+		$this->log(array('AIM Response received:'=>$response_obj), $payment);
320 320
 		return $response_obj;
321 321
 	}
322 322
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 			// Split Array
413 413
 			$this->response = $response;
414 414
 			if ($encap_char) {
415
-				$this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
415
+				$this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
416 416
 			} else {
417 417
 				$this->_response_array = explode($delimiter, $response);
418 418
 			}
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			$this->held = ($this->response_code == self::HELD);
483 483
 
484 484
 			if ($this->error || $this->declined || $this->held) {
485
-				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />' . $this->response_reason_text . '<br /><span class="response_code">Response Code: ' . $this->response_code . '<br /></span><span class="response_subcode">Response Subcode: ' . $this->response_subcode . '</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
485
+				$this->error_message = '<p><strong class="credit_card_failure">Attention: your transaction was declined for the following reason(s):</strong><br />'.$this->response_reason_text.'<br /><span class="response_code">Response Code: '.$this->response_code.'<br /></span><span class="response_subcode">Response Subcode: '.$this->response_subcode.'</span></p><p>To try again, <a href="#payment_options">please click here</a>.</p> ';
486 486
 
487 487
 
488 488
 				/* $this->error_message = "AuthorizeNet Error:
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Strategy.core.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function instance() {
80 80
 		// check if class object is instantiated
81
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
81
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
82 82
 			self::$_instance = new self();
83 83
 		}
84 84
 		return self::$_instance;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 //		d( $this->_CPT_endpoints );
102 102
 //		d( $this->_CPT_taxonomies );
103 103
 
104
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
104
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
105 105
 	}
106 106
 
107 107
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	private function _set_CPT_endpoints() {
116 116
 		$_CPT_endpoints = array();
117
-		if ( is_array( $this->_CPTs )) {
118
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
119
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
117
+		if (is_array($this->_CPTs)) {
118
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
119
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
120 120
 			}
121 121
 		}
122 122
 		return $_CPT_endpoints;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param WP_Query $WP_Query
132 132
 	 * @return void
133 133
 	 */
134
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
134
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
135 135
 		$WP_Query->is_espresso_event_single = FALSE;
136 136
 		$WP_Query->is_espresso_event_archive = FALSE;
137 137
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	private function _set_CPT_taxonomies() {
160 160
 		// check if taxonomies have already been set
161
-		if ( empty( $this->_CPT_taxonomies )) {
161
+		if (empty($this->_CPT_taxonomies)) {
162 162
 			// and that this CPT has taxonomies registered for it
163
-			if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) {
163
+			if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) {
164 164
 				// if so then grab them, but we want the taxonomy name as the key
165
-				$taxonomies = array_flip( $this->CPT['args']['taxonomies'] );
165
+				$taxonomies = array_flip($this->CPT['args']['taxonomies']);
166 166
 				// then grab the list of ALL taxonomies
167 167
 				$all_taxonomies = EE_Register_CPTs::get_taxonomies();
168
-				foreach ( $taxonomies as $taxonomy => $details ) {
168
+				foreach ($taxonomies as $taxonomy => $details) {
169 169
 					// add details to our taxonomies if they exist
170
-					$taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL;
170
+					$taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL;
171 171
 				}
172 172
 				$this->_CPT_taxonomies = $taxonomies;
173 173
 			}
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * @return void
193 193
 	 */
194 194
 	private function _set_CPT_terms() {
195
-		if ( empty( $this->_CPT_terms )) {
195
+		if (empty($this->_CPT_terms)) {
196 196
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
197
-			foreach ( $terms as $term ) {
198
-				if ( $term instanceof EE_Term ) {
199
-					$this->_CPT_terms[ $term->slug() ] = $term;
197
+			foreach ($terms as $term) {
198
+				if ($term instanceof EE_Term) {
199
+					$this->_CPT_terms[$term->slug()] = $term;
200 200
 				}
201 201
 			}
202 202
 		}
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
 	 * @param $WP_Query
212 212
 	 * @return void
213 213
 	 */
214
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
214
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
215 215
 		// is a tag set ?
216
-		if ( isset( $WP_Query->query['tag'] )) {
216
+		if (isset($WP_Query->query['tag'])) {
217 217
 			// set post_tags
218 218
 			$this->_set_CPT_terms();
219 219
 			// is this tag archive term in the list of terms used by our CPTs ?
220
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
220
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
221 221
 			// verify the term
222
-			if ( $term instanceof EE_Term ) {
223
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
224
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
222
+			if ($term instanceof EE_Term) {
223
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
224
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
225 225
 				// if a post type is already set
226
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
226
+				if (isset($WP_Query->query_vars['post_type'])) {
227 227
 						// add to existing array
228
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
228
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
229 229
 				}
230 230
 				// just set post_type to our CPT
231
-				$WP_Query->set( 'post_type', $term->post_type );
231
+				$WP_Query->set('post_type', $term->post_type);
232 232
 			}
233 233
 		}
234 234
 	}
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 * in order for is_archive() and is_single() methods to work properly.
244 244
 	 * @return void
245 245
 	 */
246
-	public function _possibly_set_ee_request_var(){
246
+	public function _possibly_set_ee_request_var() {
247 247
 		// check if ee action var has been set
248
-		if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) {
248
+		if ( ! EE_Registry::instance()->REQ->is_set('ee')) {
249 249
 			// check that route exists for CPT archive slug
250
-			if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) {
250
+			if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) {
251 251
 				// ie: set "ee" to "events"
252
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] );
252
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']);
253 253
 			// or does it match a single page CPT like /event/
254
-			} else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) {
254
+			} else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) {
255 255
 				// ie: set "ee" to "event"
256
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
256
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
257 257
 			}
258 258
 		}
259 259
 	}
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param WP_Query $WP_Query
268 268
 	 * @return void
269 269
 	 */
270
-	public function _set_paging( $WP_Query ) {
271
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
272
-			$page = ( get_query_var('page') ) ? get_query_var('page') : NULL;
273
-			$paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page;
274
-			$WP_Query->set( 'paged', $paged );
270
+	public function _set_paging($WP_Query) {
271
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
272
+			$page = (get_query_var('page')) ? get_query_var('page') : NULL;
273
+			$paged = (get_query_var('paged')) ? get_query_var('paged') : $page;
274
+			$WP_Query->set('paged', $paged);
275 275
 		}
276 276
 	}
277 277
 
@@ -288,35 +288,35 @@  discard block
 block discarded – undo
288 288
 	 * @param WP_Query $WP_Query
289 289
 	 * @return void
290 290
 	 */
291
-	public function pre_get_posts( $WP_Query ) {
291
+	public function pre_get_posts($WP_Query) {
292 292
 		// check that post-type is set
293
-		if ( ! $WP_Query instanceof WP_Query ) {
293
+		if ( ! $WP_Query instanceof WP_Query) {
294 294
 			return;
295 295
 		}
296 296
 
297 297
 		// add our conditionals
298
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
298
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
299 299
 		// check for terms
300
-		$this->_set_post_type_for_terms( $WP_Query );
300
+		$this->_set_post_type_for_terms($WP_Query);
301 301
 		// make sure paging is always set
302
-		$this->_set_paging( $WP_Query );
302
+		$this->_set_paging($WP_Query);
303 303
 
304 304
 		// is a taxonomy set ?
305
-		if ( $WP_Query->is_tax ) {
305
+		if ($WP_Query->is_tax) {
306 306
 			// loop thru our taxonomies
307
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
307
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
308 308
 				// check if one of our taxonomies is set as a query var
309
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) {
309
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
310 310
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
311
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
311
+					foreach ($this->_CPTs as $post_type => $CPT) {
312 312
 						// verify our CPT has args, is public and has taxonomies set
313
-						if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) {
313
+						if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) {
314 314
 							// does the captured taxonomy belong to this CPT ?
315
-							if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) {
315
+							if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) {
316 316
 								// if so, then add this CPT post_type to the current query's array of post_types'
317
-								$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array();
317
+								$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array();
318 318
 								$WP_Query->query_vars['post_type'][] = $post_type;
319
-								switch( $post_type ) {
319
+								switch ($post_type) {
320 320
 									case 'espresso_events' :
321 321
 										$WP_Query->is_espresso_event_taxonomy = TRUE;
322 322
 										break;
@@ -337,27 +337,27 @@  discard block
 block discarded – undo
337 337
 //		d( $CPT_taxonomy );
338 338
 //		d( $WP_Query );
339 339
 
340
-		if ( isset( $WP_Query->query_vars['post_type'] )) {
340
+		if (isset($WP_Query->query_vars['post_type'])) {
341 341
 			// loop thru post_types as array
342
-			foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) {
342
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
343 343
 
344 344
 				// is current query for an EE CPT ?
345
-				if ( isset( $this->_CPTs[ $post_type ] )) {
345
+				if (isset($this->_CPTs[$post_type])) {
346 346
 					// is EE on or off ?
347
-					if ( EE_Maintenance_Mode::instance()->level() ) {
347
+					if (EE_Maintenance_Mode::instance()->level()) {
348 348
 						// reroute CPT template view to maintenance_mode.template.php
349
-						if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){
350
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
349
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
350
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
351 351
 						}
352
-						if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
353
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
352
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
353
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
354 354
 						}
355 355
 						return;
356 356
 					}
357 357
 					// load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037
358
-					EE_Registry::instance()->load_core( 'Request_Handler' );
358
+					EE_Registry::instance()->load_core('Request_Handler');
359 359
 					// grab details for the CPT the current query is for
360
-					$this->CPT = $this->_CPTs[ $post_type ];
360
+					$this->CPT = $this->_CPTs[$post_type];
361 361
 					// set post type
362 362
 					$this->CPT['post_type'] = $post_type;
363 363
 					// set taxonomies
@@ -365,27 +365,27 @@  discard block
 block discarded – undo
365 365
 					// the post or category or term that is triggering EE
366 366
 					$this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page();
367 367
 					// requested post name
368
-					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' );
368
+					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name');
369 369
 					//d( $this->CPT );
370 370
 					// add support for viewing 'private', 'draft', or 'pending' posts
371
-					if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) {
371
+					if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) {
372 372
 						// we can just inject directly into the WP_Query object
373
-						$WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
373
+						$WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
374 374
 						// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
375
-						EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
375
+						EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
376 376
 					}
377 377
 					$this->_possibly_set_ee_request_var();
378 378
 					// convert post_type to model name
379
-					$model_name = str_replace( 'EE_', '', $this->CPT['class_name'] );
379
+					$model_name = str_replace('EE_', '', $this->CPT['class_name']);
380 380
 					// get CPT table data via CPT Model
381
-					$this->CPT_model = EE_Registry::instance()->load_model( $model_name );
381
+					$this->CPT_model = EE_Registry::instance()->load_model($model_name);
382 382
 					$this->CPT['tables'] = $this->CPT_model->get_tables();
383 383
 					// is there a Meta Table for this CPT?
384
-					$this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE;
384
+					$this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE;
385 385
 					// creates classname like:  CPT_Event_Strategy
386
-					$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
386
+					$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
387 387
 					// load and instantiate
388
-					 $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT ));
388
+					 $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT));
389 389
 
390 390
 					// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
391 391
 					// here's the list of available filters in the WP_Query object
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 					// 'post_limits'
398 398
 					// 'posts_fields'
399 399
 					// 'posts_join'
400
-					add_filter( 'posts_fields', array( $this, 'posts_fields' ));
401
-					add_filter( 'posts_join',	array( $this, 'posts_join' ));
402
-					add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 );
403
-					add_filter( 'the_posts',	array( $this, 'the_posts' ), 1, 1 );
404
-					add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 );
400
+					add_filter('posts_fields', array($this, 'posts_fields'));
401
+					add_filter('posts_join', array($this, 'posts_join'));
402
+					add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4);
403
+					add_filter('the_posts', array($this, 'the_posts'), 1, 1);
404
+					add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2);
405 405
 
406
-					$this->_do_template_filters( $WP_Query );
406
+					$this->_do_template_filters($WP_Query);
407 407
 				}
408 408
 			}
409 409
 		}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @param $SQL
419 419
 	 * @return    string
420 420
 	 */
421
-	public function posts_fields( $SQL ) {
421
+	public function posts_fields($SQL) {
422 422
 		// does this CPT have a meta table ?
423
-		if ( ! empty( $this->CPT['meta_table'] )) {
423
+		if ( ! empty($this->CPT['meta_table'])) {
424 424
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
425
-			$SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ;
425
+			$SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* ';
426 426
 		}
427
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ));
427
+		remove_filter('posts_fields', array($this, 'posts_fields'));
428 428
 		return $SQL;
429 429
 	}
430 430
 
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * @param $SQL
453 453
 	 * @return    string
454 454
 	 */
455
-	public function posts_join( $SQL ) {
455
+	public function posts_join($SQL) {
456 456
 		// does this CPT have a meta table ?
457
-		if ( ! empty( $this->CPT['meta_table'] )) {
457
+		if ( ! empty($this->CPT['meta_table'])) {
458 458
 			global $wpdb;
459 459
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
460
-			$SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) ';
460
+			$SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) ';
461 461
 		}
462
-		remove_filter( 'posts_join',	array( $this, 'posts_join' ));
462
+		remove_filter('posts_join', array($this, 'posts_join'));
463 463
 		return $SQL;
464 464
 	}
465 465
 
@@ -472,18 +472,18 @@  discard block
 block discarded – undo
472 472
 	 * @param 	\WP_Post[] 	$posts
473 473
 	 * @return 	\WP_Post[]
474 474
 	 */
475
-	public function the_posts( $posts ) {
475
+	public function the_posts($posts) {
476 476
 //		d( $posts );
477 477
 		$CPT_class = $this->CPT['class_name'];
478 478
 		// loop thru posts
479
-		if ( is_array( $posts )) {
480
-			foreach( $posts as $key => $post ) {
481
-				if ( isset( $this->_CPTs[ $post->post_type ] )) {
482
-					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post );
479
+		if (is_array($posts)) {
480
+			foreach ($posts as $key => $post) {
481
+				if (isset($this->_CPTs[$post->post_type])) {
482
+					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post);
483 483
 				}
484 484
 			}
485 485
 		}
486
-		remove_filter( 'the_posts',	array( $this, 'the_posts' ), 1 );
486
+		remove_filter('the_posts', array($this, 'the_posts'), 1);
487 487
 		return $posts;
488 488
 	}
489 489
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @param $ID
495 495
 	 * @return string
496 496
 	 */
497
-	function get_edit_post_link( $url, $ID ) {
497
+	function get_edit_post_link($url, $ID) {
498 498
 		//need to make sure we only edit links if our cpt
499 499
 		global $post;
500
-		if ( ! isset( $this->_CPTs[ $post->post_type ] )) {
500
+		if ( ! isset($this->_CPTs[$post->post_type])) {
501 501
 			return $url;
502 502
 		}
503 503
 		//k made it here so all is good.
504 504
 		$scheme = is_ssl() ? 'https' : 'http';
505
-		$url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme );
505
+		$url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme);
506 506
 		// http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6
507
-		return wp_nonce_url( add_query_arg( array( 'page' => $post->post_type, 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' );
507
+		return wp_nonce_url(add_query_arg(array('page' => $post->post_type, 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce');
508 508
 	}
509 509
 
510 510
 
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
 	 * @param WP_Query $WP_Query
519 519
 	 * @return void
520 520
 	 */
521
-	protected function _do_template_filters( WP_Query $WP_Query ) {
521
+	protected function _do_template_filters(WP_Query $WP_Query) {
522 522
 		// if it's the main query  and requested cpt supports page_templates,
523
-		if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) {
523
+		if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) {
524 524
 			// then let's hook into the appropriate query_template hook
525
-			add_filter( 'single_template', array( $this, 'single_cpt_template' ) );
525
+			add_filter('single_template', array($this, 'single_cpt_template'));
526 526
 		}
527 527
 	}
528 528
 
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 	 * @param string $current_template Existing default template path derived for this page call.
537 537
 	 * @return string the path to the full template file.
538 538
 	 */
539
-	public function single_cpt_template( $current_template ) {
539
+	public function single_cpt_template($current_template) {
540 540
 		$object = get_queried_object();
541 541
 		//does this called object HAVE a page template set that is something other than the default.
542
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
542
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
543 543
 
544 544
 		//exit early if default or not set or invalid path (accounts for theme changes)
545
-		if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) {
545
+		if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) {
546 546
 			return $current_template;
547 547
 		}
548 548
 		//made it here so we SHOULD be able to just locate the template and then return it.
549
-		$template = locate_template( array($template)  );
549
+		$template = locate_template(array($template));
550 550
 
551 551
 		return $template;
552 552
 	}
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	 * @param 	array 	$arguments
595 595
 	 * @return 	\EE_CPT_Default_Strategy
596 596
 	 */
597
-	public function __construct( $arguments = array() ) {
598
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
599
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
597
+	public function __construct($arguments = array()) {
598
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
599
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
600 600
 		//EEH_Debug_Tools::printr( $this->CPT, '$this->CPT  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
601 601
 //		add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 );
602 602
 //		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	 * @param 	\WP_Query $WP_Query
612 612
 	 * @return 	\WP_Query
613 613
 	 */
614
-	public function pre_get_posts(  WP_Query $WP_Query  ) {
614
+	public function pre_get_posts(WP_Query $WP_Query) {
615 615
 		//EEH_Debug_Tools::printr( $WP_Query, '$WP_Query  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
616
-		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) {
616
+		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) {
617 617
 			return $WP_Query;
618 618
 		}
619 619
 //		$WP_Query->set( 'post_type', array( $this->CPT['post_type'] ));
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * @param 	\WP_Query $WP_Query
632 632
 	 * @return 	\WP_Post[]
633 633
 	 */
634
-	public function the_posts(  $posts, WP_Query $WP_Query ) {
634
+	public function the_posts($posts, WP_Query $WP_Query) {
635 635
 		return $posts;
636 636
 	}
637 637
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * @param 	string 	$single
648 648
 	 * @return 	mixed
649 649
 	 */
650
-	public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) {
650
+	public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) {
651 651
 		return $meta_value;
652 652
 	}
653 653
 
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 1 patch
Spacing   +233 added lines, -234 removed lines patch added patch discarded remove patch
@@ -42,21 +42,21 @@  discard block
 block discarded – undo
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
44 44
 	 */
45
-	public function __construct( EE_Checkout $checkout ) {
45
+	public function __construct(EE_Checkout $checkout) {
46 46
 		$this->_slug = 'attendee_information';
47 47
 		$this->_name = __('Attendee Information', 'event_espresso');
48
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
48
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
49 49
 		$this->checkout = $checkout;
50 50
 		$this->_reset_success_message();
51 51
 		$this->set_instructions(
52
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
52
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
53 53
 		);
54 54
 	}
55 55
 
56 56
 
57 57
 
58 58
 	public function translate_js_strings() {
59
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
59
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
60 60
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
61 61
 			' is a required question. Please enter a value for at least one of the options.',
62 62
 			'event_espresso'
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		// calculate taxes
117 117
 		$Line_Item_Display->display_line_item(
118 118
 			$this->checkout->cart->get_grand_total(),
119
-			array( 'set_tax_rate' => true )
119
+			array('set_tax_rate' => true)
120 120
 		);
121 121
 		/** @var $subsections EE_Form_Section_Proper[] */
122 122
 		$subsections = array(
@@ -128,51 +128,51 @@  discard block
 block discarded – undo
128 128
 			'ticket_count' 	=> array()
129 129
 		);
130 130
 		// grab the saved registrations from the transaction
131
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
132
-		if ( $registrations ) {
133
-			foreach ( $registrations as $registration ) {
131
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
132
+		if ($registrations) {
133
+			foreach ($registrations as $registration) {
134 134
 				// can this registration be processed during this visit ?
135 135
 				if (
136 136
 					$registration instanceof EE_Registration
137
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
137
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
138 138
 				) {
139
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
140
-					if ( ! $this->checkout->admin_request ) {
141
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
142
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
143
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
139
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
140
+					if ( ! $this->checkout->admin_request) {
141
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
142
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
143
+							$template_args['ticket_count'][$registration->ticket()->ID()]
144 144
 						)
145
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
145
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
146 146
 							: 1;
147 147
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
148 148
 							$this->checkout->cart->get_grand_total(),
149 149
 							'Ticket',
150
-							array( $registration->ticket()->ID() )
150
+							array($registration->ticket()->ID())
151 151
 						);
152
-						$ticket_line_item = is_array( $ticket_line_item )
153
-							? reset( $ticket_line_item )
152
+						$ticket_line_item = is_array($ticket_line_item)
153
+							? reset($ticket_line_item)
154 154
 							: $ticket_line_item;
155
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
155
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
156 156
 							$ticket_line_item
157 157
 						);
158 158
 					}
159
-					if ( $registration->is_primary_registrant() ) {
159
+					if ($registration->is_primary_registrant()) {
160 160
 						$primary_registrant = $registration->reg_url_link();
161 161
 					}
162 162
 				}
163 163
 			}
164 164
 			// print_copy_info ?
165
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
165
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
166 166
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
167 167
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
168 168
 					? $this->_copy_attendee_info_form()
169 169
 					: $this->_auto_copy_attendee_info();
170 170
 				// generate hidden input
171 171
 				if (
172
-					isset( $subsections[ $primary_registrant ] )
173
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
172
+					isset($subsections[$primary_registrant])
173
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
174 174
 				) {
175
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
175
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
176 176
 				}
177 177
 			}
178 178
 
@@ -184,8 +184,7 @@  discard block
 block discarded – undo
184 184
 				'html_id' 					=> $this->reg_form_name(),
185 185
 				'subsections' 			=> $subsections,
186 186
 				'layout_strategy'		=> $this->checkout->admin_request ?
187
-					new EE_Div_Per_Section_Layout() :
188
-					new EE_Template_Layout(
187
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
189 188
 						array(
190 189
 							'layout_template_file' 	=> $this->_template, // layout_template
191 190
 							'template_args' 				=> $template_args
@@ -203,11 +202,11 @@  discard block
 block discarded – undo
203 202
 	 * @return EE_Form_Section_Proper
204 203
 	 * @throws \EE_Error
205 204
 	 */
206
-	private function _registrations_reg_form( EE_Registration $registration ) {
205
+	private function _registrations_reg_form(EE_Registration $registration) {
207 206
 		static $attendee_nmbr = 1;
208 207
 		// array of params to pass to parent constructor
209 208
 		$form_args = array(
210
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
209
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
211 210
 			'html_class'      => 'ee-reg-form-attendee-dv',
212 211
 			'html_style'      => $this->checkout->admin_request
213 212
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -216,24 +215,24 @@  discard block
 block discarded – undo
216 215
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
217 216
 				array(
218 217
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
219
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
218
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
220 219
 				)
221 220
 			)
222 221
 		);
223 222
 		// verify that registration has valid event
224
-		if ( $registration->event() instanceof EE_Event ) {
223
+		if ($registration->event() instanceof EE_Event) {
225 224
 			$query_params = array(
226 225
 				array(
227 226
 					'Event.EVT_ID' => $registration->event()->ID(),
228 227
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
229 228
 				),
230
-				'order_by'=>array( 'QSG_order'=>'ASC' )
229
+				'order_by'=>array('QSG_order'=>'ASC')
231 230
 			);
232
-			$question_groups = $registration->event()->question_groups( $query_params );
233
-			if ( $question_groups ) {
234
-				foreach ( $question_groups as $question_group ) {
235
-					if ( $question_group instanceof EE_Question_Group ) {
236
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
231
+			$question_groups = $registration->event()->question_groups($query_params);
232
+			if ($question_groups) {
233
+				foreach ($question_groups as $question_group) {
234
+					if ($question_group instanceof EE_Question_Group) {
235
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
237 236
 							$registration,
238 237
 							$question_group
239 238
 						);
@@ -246,10 +245,10 @@  discard block
 block discarded – undo
246 245
 				// if we have question groups for additional attendees, then display the copy options
247 246
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
248 247
 			} else {
249
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
250
-				) ] = new EE_Form_Section_HTML(
248
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
249
+				)] = new EE_Form_Section_HTML(
251 250
 					EEH_Template::locate_template(
252
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
251
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
253 252
 						apply_filters(
254 253
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
255 254
 							array()
@@ -265,12 +264,12 @@  discard block
 block discarded – undo
265 264
 				);
266 265
 			}
267 266
 		}
268
-		if ( $registration->is_primary_registrant() ) {
267
+		if ($registration->is_primary_registrant()) {
269 268
 			// generate hidden input
270
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
269
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
271 270
 		}
272 271
 		$attendee_nmbr++;
273
-		return new EE_Form_Section_Proper( $form_args );
272
+		return new EE_Form_Section_Proper($form_args);
274 273
 	}
275 274
 
276 275
 
@@ -291,7 +290,7 @@  discard block
 block discarded – undo
291 290
 		// generate hidden input
292 291
 		return new EE_Hidden_Input(
293 292
 			array(
294
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
293
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
295 294
 				'default' => $additional_attendee_reg_info
296 295
 			)
297 296
 		);
@@ -305,26 +304,26 @@  discard block
 block discarded – undo
305 304
 	 * @return EE_Form_Section_Proper
306 305
 	 * @throws \EE_Error
307 306
 	 */
308
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
307
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
309 308
 		// array of params to pass to parent constructor
310 309
 		$form_args = array(
311
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
310
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
312 311
 			'html_class'      => $this->checkout->admin_request
313 312
 				? 'form-table ee-reg-form-qstn-grp-dv'
314 313
 				: 'ee-reg-form-qstn-grp-dv',
315
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
314
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
316 315
 			'subsections'     => array(
317
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
316
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
318 317
 			),
319 318
 			'layout_strategy' => $this->checkout->admin_request
320 319
 				? new EE_Admin_Two_Column_Layout()
321 320
 				: new EE_Div_Per_Section_Layout()
322 321
 		);
323 322
 		// where params
324
-		$query_params = array( 'QST_deleted' => 0 );
323
+		$query_params = array('QST_deleted' => 0);
325 324
 		// don't load admin only questions on the frontend
326
-		if ( ! $this->checkout->admin_request ) {
327
-			$query_params['QST_admin_only'] = array( '!=', true );
325
+		if ( ! $this->checkout->admin_request) {
326
+			$query_params['QST_admin_only'] = array('!=', true);
328 327
 		}
329 328
 		$questions = $question_group->get_many_related(
330 329
 			'Question',
@@ -346,10 +345,10 @@  discard block
 block discarded – undo
346 345
 			)
347 346
 		);
348 347
 		// loop thru questions
349
-		foreach ( $questions as $question ) {
350
-			if( $question instanceof EE_Question ){
348
+		foreach ($questions as $question) {
349
+			if ($question instanceof EE_Question) {
351 350
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
352
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
351
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
353 352
 			}
354 353
 		}
355 354
 		$form_args['subsections'] = apply_filters(
@@ -370,7 +369,7 @@  discard block
 block discarded – undo
370 369
 			)
371 370
 		);
372 371
 //		d( $form_args );
373
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
372
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
374 373
 		return apply_filters(
375 374
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
376 375
 			$question_group_reg_form,
@@ -387,11 +386,11 @@  discard block
 block discarded – undo
387 386
 	 * @param EE_Question_Group $question_group
388 387
 	 * @return 	EE_Form_Section_HTML
389 388
 	 */
390
-	private function _question_group_header( EE_Question_Group $question_group ){
389
+	private function _question_group_header(EE_Question_Group $question_group) {
391 390
 		$html = '';
392 391
 		// group_name
393
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
394
-			if ( $this->checkout->admin_request ) {
392
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
393
+			if ($this->checkout->admin_request) {
395 394
 				$html .= EEH_HTML::br();
396 395
 				$html .= EEH_HTML::h3(
397 396
 					$question_group->name(),
@@ -405,7 +404,7 @@  discard block
 block discarded – undo
405 404
 			}
406 405
 		}
407 406
 		// group_desc
408
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
407
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
409 408
 			$html .= EEH_HTML::p(
410 409
 				$question_group->desc(),
411 410
 				'',
@@ -415,7 +414,7 @@  discard block
 block discarded – undo
415 414
 			);
416 415
 
417 416
 		}
418
-		return new EE_Form_Section_HTML( $html );
417
+		return new EE_Form_Section_HTML($html);
419 418
 	}
420 419
 
421 420
 
@@ -425,7 +424,7 @@  discard block
 block discarded – undo
425 424
 	 * @return    EE_Form_Section_Proper
426 425
 	 * @throws \EE_Error
427 426
 	 */
428
-	private function _copy_attendee_info_form(){
427
+	private function _copy_attendee_info_form() {
429 428
 		// array of params to pass to parent constructor
430 429
 		return new EE_Form_Section_Proper(
431 430
 			array(
@@ -454,7 +453,7 @@  discard block
 block discarded – undo
454 453
 	private function _auto_copy_attendee_info() {
455 454
 		return new EE_Form_Section_HTML(
456 455
 			EEH_Template::locate_template(
457
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
456
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
458 457
 				apply_filters(
459 458
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
460 459
 					array()
@@ -478,32 +477,32 @@  discard block
 block discarded – undo
478 477
 		$copy_attendee_info_inputs = array();
479 478
 		$prev_ticket = NULL;
480 479
 		// grab the saved registrations from the transaction
481
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
482
-		foreach ( $registrations as $registration ) {
480
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
481
+		foreach ($registrations as $registration) {
483 482
 			// for all  attendees other than the primary attendee
484
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
483
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
485 484
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
486
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
485
+				if ($registration->ticket()->ID() !== $prev_ticket) {
487 486
 					$item_name = $registration->ticket()->name();
488 487
 					$item_name .= $registration->ticket()->description() !== ''
489
-						? ' - ' . $registration->ticket()->description()
488
+						? ' - '.$registration->ticket()->description()
490 489
 						: '';
491
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
492
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
490
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
491
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
493 492
 					);
494 493
 					$prev_ticket = $registration->ticket()->ID();
495 494
 				}
496 495
 
497
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
496
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
498 497
 				EE_Checkbox_Multi_Input(
499 498
 					array(
500 499
 						$registration->ID() => sprintf(
501
-							__( 'Attendee #%s', 'event_espresso' ),
500
+							__('Attendee #%s', 'event_espresso'),
502 501
 							$registration->count()
503 502
 						)
504 503
 					),
505 504
 					array(
506
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
505
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
507 506
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
508 507
 						'display_html_label_text' => false
509 508
 					)
@@ -523,7 +522,7 @@  discard block
 block discarded – undo
523 522
 	 * @return    EE_Form_Input_Base
524 523
 	 * @throws \EE_Error
525 524
 	 */
526
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
525
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
527 526
 		// generate hidden input
528 527
 		return new EE_Hidden_Input(
529 528
 			array(
@@ -542,7 +541,7 @@  discard block
 block discarded – undo
542 541
 	 * @return    EE_Form_Input_Base
543 542
 	 * @throws \EE_Error
544 543
 	 */
545
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
544
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
546 545
 
547 546
 		// if this question was for an attendee detail, then check for that answer
548 547
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -551,32 +550,32 @@  discard block
 block discarded – undo
551 550
 		);
552 551
 		$answer = $answer_value === null
553 552
 			? EEM_Answer::instance()->get_one(
554
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
553
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
555 554
 			)
556 555
 			: null;
557 556
 		// if NOT returning to edit an existing registration
558 557
 		// OR if this question is for an attendee property
559 558
 		// OR we still don't have an EE_Answer object
560
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
559
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
561 560
 			// create an EE_Answer object for storing everything in
562
-			$answer = EE_Answer::new_instance ( array(
561
+			$answer = EE_Answer::new_instance(array(
563 562
 				'QST_ID'=> $question->ID(),
564 563
 				'REG_ID'=> $registration->ID()
565 564
 			));
566 565
 		}
567 566
 		// verify instance
568
-		if( $answer instanceof EE_Answer ){
569
-			if ( ! empty( $answer_value )) {
570
-				$answer->set( 'ANS_value', $answer_value );
567
+		if ($answer instanceof EE_Answer) {
568
+			if ( ! empty($answer_value)) {
569
+				$answer->set('ANS_value', $answer_value);
571 570
 			}
572
-			$answer->cache( 'Question', $question );
571
+			$answer->cache('Question', $question);
573 572
 			//remember system ID had a bug where sometimes it could be null
574
-			$answer_cache_id =$question->is_system_question()
575
-				? $question->system_ID() . '-' . $registration->reg_url_link()
576
-				: $question->ID() . '-' . $registration->reg_url_link();			
577
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
573
+			$answer_cache_id = $question->is_system_question()
574
+				? $question->system_ID().'-'.$registration->reg_url_link()
575
+				: $question->ID().'-'.$registration->reg_url_link();			
576
+			$registration->cache('Answer', $answer, $answer_cache_id);
578 577
 		}
579
-		return $this->_generate_question_input( $registration, $question, $answer );
578
+		return $this->_generate_question_input($registration, $question, $answer);
580 579
 
581 580
 	}
582 581
 
@@ -589,46 +588,46 @@  discard block
 block discarded – undo
589 588
 	 * @return EE_Form_Input_Base
590 589
 	 * @throws \EE_Error
591 590
 	 */
592
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
591
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
593 592
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
594
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
593
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
595 594
 		add_filter(
596 595
 			'FHEE__EE_Question__generate_form_input__country_options',
597
-			array( $this, 'use_cached_countries_for_form_input' ),
596
+			array($this, 'use_cached_countries_for_form_input'),
598 597
 			10,
599 598
 			4
600 599
 		);
601 600
 		add_filter(
602 601
 			'FHEE__EE_Question__generate_form_input__state_options',
603
-			array( $this, 'use_cached_states_for_form_input' ),
602
+			array($this, 'use_cached_states_for_form_input'),
604 603
 			10,
605 604
 			4
606 605
 		);
607 606
 		$input_constructor_args = array(
608
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
609
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
610
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
611
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
607
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
608
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
609
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
610
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
612 611
 			'html_label_class'	=> 'ee-reg-qstn',
613 612
 		);
614
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
615
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
616
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
617
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
618
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
613
+		$input_constructor_args['html_label_id'] .= '-lbl';
614
+		if ($answer instanceof EE_Answer && $answer->ID()) {
615
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
616
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
617
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
619 618
 		}
620
-		$form_input =  $question->generate_form_input(
619
+		$form_input = $question->generate_form_input(
621 620
 			$registration,
622 621
 			$answer,
623 622
 			$input_constructor_args
624 623
 		);
625 624
 		remove_filter(
626 625
 			'FHEE__EE_Question__generate_form_input__country_options',
627
-			array( $this, 'use_cached_countries_for_form_input' )
626
+			array($this, 'use_cached_countries_for_form_input')
628 627
 		);
629 628
 		remove_filter(
630 629
 			'FHEE__EE_Question__generate_form_input__state_options',
631
-			array( $this, 'use_cached_states_for_form_input' )
630
+			array($this, 'use_cached_states_for_form_input')
632 631
 		);
633 632
 		return $form_input;
634 633
 	}
@@ -642,23 +641,23 @@  discard block
 block discarded – undo
642 641
 	 * @return array 2d keys are country IDs, values are their names
643 642
 	 * @throws \EE_Error
644 643
 	 */
645
-	public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) {
646
-		$country_options = array( '' => '' );
644
+	public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) {
645
+		$country_options = array('' => '');
647 646
 		// get possibly cached list of countries
648 647
 		$countries = $this->checkout->action === 'process_reg_step'
649 648
 			? EEM_Country::instance()->get_all_countries()
650 649
 			: EEM_Country::instance()->get_all_active_countries();
651
-		if ( ! empty( $countries )) {
652
-			foreach( $countries as $country ){
653
-				if ( $country instanceof EE_Country ) {
654
-					$country_options[ $country->ID() ] = $country->name();
650
+		if ( ! empty($countries)) {
651
+			foreach ($countries as $country) {
652
+				if ($country instanceof EE_Country) {
653
+					$country_options[$country->ID()] = $country->name();
655 654
 				}
656 655
 			}
657 656
 		}
658
-		if( $question instanceof EE_Question
659
-			&& $registration instanceof EE_Registration ) {
657
+		if ($question instanceof EE_Question
658
+			&& $registration instanceof EE_Registration) {
660 659
 			$answer = EEM_Answer::instance()->get_one(
661
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
660
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
662 661
 			);
663 662
 		} else {
664 663
 			$answer = EE_Answer::new_instance();
@@ -685,15 +684,15 @@  discard block
 block discarded – undo
685 684
 	 * @return array 2d keys are state IDs, values are their names
686 685
 	 * @throws \EE_Error
687 686
 	 */
688
-	public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) {
689
-		$state_options = array( '' => array( '' => ''));
687
+	public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) {
688
+		$state_options = array('' => array('' => ''));
690 689
 		$states = $this->checkout->action === 'process_reg_step'
691 690
 			? EEM_State::instance()->get_all_states()
692 691
 			: EEM_State::instance()->get_all_active_states();
693
-		if ( ! empty( $states )) {
694
-			foreach( $states as $state ){
695
-				if ( $state instanceof EE_State ) {
696
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
692
+		if ( ! empty($states)) {
693
+			foreach ($states as $state) {
694
+				if ($state instanceof EE_State) {
695
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
697 696
 				}
698 697
 			}
699 698
 		}
@@ -721,24 +720,24 @@  discard block
 block discarded – undo
721 720
 	 * @throws \EE_Error
722 721
 	 */
723 722
 	public function process_reg_step() {
724
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
723
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
725 724
 		// grab validated data from form
726 725
 		$valid_data = $this->checkout->current_step->valid_data();
727 726
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
728 727
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
729 728
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
730
-		if ( empty( $valid_data ))  {
729
+		if (empty($valid_data)) {
731 730
 			EE_Error::add_error(
732
-				__( 'No valid question responses were received.', 'event_espresso' ),
731
+				__('No valid question responses were received.', 'event_espresso'),
733 732
 				__FILE__,
734 733
 				__FUNCTION__,
735 734
 				__LINE__
736 735
 			);
737 736
 			return false;
738 737
 		}
739
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
738
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
740 739
 			EE_Error::add_error(
741
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
740
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
742 741
 				__FILE__,
743 742
 				__FUNCTION__,
744 743
 				__LINE__
@@ -746,11 +745,11 @@  discard block
 block discarded – undo
746 745
 			return false;
747 746
 		}
748 747
 		// get cached registrations
749
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
748
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
750 749
 		// verify we got the goods
751
-		if ( empty( $registrations )) {
750
+		if (empty($registrations)) {
752 751
 			EE_Error::add_error(
753
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
752
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
754 753
 				__FILE__,
755 754
 				__FUNCTION__,
756 755
 				__LINE__
@@ -758,15 +757,15 @@  discard block
 block discarded – undo
758 757
 			return false;
759 758
 		}
760 759
 		// extract attendee info from form data and save to model objects
761
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
760
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
762 761
 		// if first pass thru SPCO,
763 762
 		// then let's check processed registrations against the total number of tickets in the cart
764
-		if ( $registrations_processed === false ) {
763
+		if ($registrations_processed === false) {
765 764
 			// but return immediately if the previous step exited early due to errors
766 765
 			return false;
767
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
766
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
768 767
 			// generate a correctly translated string for all possible singular/plural combinations
769
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
768
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
770 769
 				$error_msg = sprintf(
771 770
 					__(
772 771
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -775,7 +774,7 @@  discard block
 block discarded – undo
775 774
 					$this->checkout->total_ticket_count,
776 775
 					$registrations_processed
777 776
 				);
778
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
777
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
779 778
 				$error_msg = sprintf(
780 779
 					__(
781 780
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -794,17 +793,17 @@  discard block
 block discarded – undo
794 793
 					$registrations_processed
795 794
 				);
796 795
 			}
797
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
796
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
798 797
 			return false;
799 798
 		}
800 799
 		// mark this reg step as completed
801 800
 		$this->set_completed();
802 801
 		$this->_set_success_message(
803
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
802
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
804 803
 		);
805 804
 		//do action in case a plugin wants to do something with the data submitted in step 1.
806 805
 		//passes EE_Single_Page_Checkout, and it's posted data
807
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
806
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
808 807
 		return true;
809 808
 	}
810 809
 
@@ -818,9 +817,9 @@  discard block
 block discarded – undo
818 817
 	 * @return boolean | int
819 818
 	 * @throws \EE_Error
820 819
 	 */
821
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
820
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
822 821
 		// load resources and set some defaults
823
-		EE_Registry::instance()->load_model( 'Attendee' );
822
+		EE_Registry::instance()->load_model('Attendee');
824 823
 		// holder for primary registrant attendee object
825 824
 		$this->checkout->primary_attendee_obj = NULL;
826 825
 		// array for tracking reg form data for the primary registrant
@@ -837,9 +836,9 @@  discard block
 block discarded – undo
837 836
 		// attendee counter
838 837
 		$att_nmbr = 0;
839 838
 		// grab the saved registrations from the transaction
840
-		foreach ( $registrations  as $registration ) {
839
+		foreach ($registrations  as $registration) {
841 840
 			// verify EE_Registration object
842
-			if ( ! $registration instanceof EE_Registration ) {
841
+			if ( ! $registration instanceof EE_Registration) {
843 842
 				EE_Error::add_error(
844 843
 					__(
845 844
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -854,12 +853,12 @@  discard block
 block discarded – undo
854 853
 			/** @var string $reg_url_link */
855 854
 			$reg_url_link = $registration->reg_url_link();
856 855
 			// reg_url_link exists ?
857
-			if ( ! empty( $reg_url_link ) ) {
856
+			if ( ! empty($reg_url_link)) {
858 857
 				// should this registration be processed during this visit ?
859
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
858
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
860 859
 					// if NOT revisiting, then let's save the registration now,
861 860
 					// so that we have a REG_ID to use when generating other objects
862
-					if ( ! $this->checkout->revisit ) {
861
+					if ( ! $this->checkout->revisit) {
863 862
 						$registration->save();
864 863
 					}
865 864
 					/**
@@ -869,7 +868,7 @@  discard block
 block discarded – undo
869 868
 					 * @var bool   if true is returned by the plugin then the
870 869
 					 *      		registration processing is halted.
871 870
 					 */
872
-					if ( apply_filters(
871
+					if (apply_filters(
873 872
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
874 873
 						false,
875 874
 						$att_nmbr,
@@ -877,38 +876,38 @@  discard block
 block discarded – undo
877 876
 						$registrations,
878 877
 						$valid_data,
879 878
 						$this
880
-					) ) {
879
+					)) {
881 880
 						return false;
882 881
 					}
883 882
 
884 883
 					// Houston, we have a registration!
885 884
 					$att_nmbr++;
886
-					$this->_attendee_data[ $reg_url_link ] = array();
885
+					$this->_attendee_data[$reg_url_link] = array();
887 886
 					// grab any existing related answer objects
888 887
 					$this->_registration_answers = $registration->answers();
889 888
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
890
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
889
+					if (isset($valid_data[$reg_url_link])) {
891 890
 						// do we need to copy basic info from primary attendee ?
892
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
893
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
891
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
892
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
894 893
 							? true
895 894
 							: false;
896 895
 						// filter form input data for this registration
897
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
896
+						$valid_data[$reg_url_link] = (array) apply_filters(
898 897
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
899
-							$valid_data[ $reg_url_link ]
898
+							$valid_data[$reg_url_link]
900 899
 						);
901 900
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
902
-						if ( isset( $valid_data['primary_attendee'] )) {
903
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
901
+						if (isset($valid_data['primary_attendee'])) {
902
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
904 903
 								? $valid_data['primary_attendee']
905 904
 								: false;
906
-							unset( $valid_data['primary_attendee'] );
905
+							unset($valid_data['primary_attendee']);
907 906
 						}
908 907
 						// now loop through our array of valid post data && process attendee reg forms
909
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
910
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
911
-								foreach ( $form_inputs as $form_input => $input_value ) {
908
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
909
+							if ( ! in_array($form_section, $non_input_form_sections)) {
910
+								foreach ($form_inputs as $form_input => $input_value) {
912 911
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
913 912
 									// check for critical inputs
914 913
 									if (
@@ -922,16 +921,16 @@  discard block
 block discarded – undo
922 921
 									// store a bit of data about the primary attendee
923 922
 									if (
924 923
 										$att_nmbr === 1
925
-										&& ! empty( $input_value )
924
+										&& ! empty($input_value)
926 925
 										&& $reg_url_link === $primary_registrant['line_item_id']
927 926
 									) {
928
-										$primary_registrant[ $form_input ] = $input_value;
927
+										$primary_registrant[$form_input] = $input_value;
929 928
 									} else if (
930 929
 										$copy_primary
931 930
 										&& $input_value === null
932
-										&& isset( $primary_registrant[ $form_input ] )
931
+										&& isset($primary_registrant[$form_input])
933 932
 									) {
934
-										$input_value = $primary_registrant[ $form_input ];
933
+										$input_value = $primary_registrant[$form_input];
935 934
 									}
936 935
 									// now attempt to save the input data
937 936
 									if (
@@ -973,57 +972,57 @@  discard block
 block discarded – undo
973 972
 						// have we met before?
974 973
 						$attendee = $this->_find_existing_attendee(
975 974
 							$registration,
976
-							$this->_attendee_data[ $reg_url_link ]
975
+							$this->_attendee_data[$reg_url_link]
977 976
 						);
978 977
 						// did we find an already existing record for this attendee ?
979
-						if ( $attendee instanceof EE_Attendee ) {
978
+						if ($attendee instanceof EE_Attendee) {
980 979
 							$attendee = $this->_update_existing_attendee_data(
981 980
 								$attendee,
982
-								$this->_attendee_data[ $reg_url_link ]
981
+								$this->_attendee_data[$reg_url_link]
983 982
 							);
984 983
 						} else {
985 984
 							// ensure critical details are set for additional attendees
986
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
985
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
987 986
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
988
-									$this->_attendee_data[ $reg_url_link ]
987
+									$this->_attendee_data[$reg_url_link]
989 988
 								)
990
-								: $this->_attendee_data[ $reg_url_link ];
989
+								: $this->_attendee_data[$reg_url_link];
991 990
 							$attendee = $this->_create_new_attendee(
992 991
 								$registration,
993
-								$this->_attendee_data[ $reg_url_link ]
992
+								$this->_attendee_data[$reg_url_link]
994 993
 							);
995 994
 						}
996 995
 						// who's #1 ?
997
-						if ( $att_nmbr === 1 ) {
996
+						if ($att_nmbr === 1) {
998 997
 							$this->checkout->primary_attendee_obj = $attendee;
999 998
 						}
1000 999
 					}
1001 1000
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1002 1001
 					// add relation to registration, set attendee ID, and cache attendee
1003
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1002
+					$this->_associate_attendee_with_registration($registration, $attendee);
1004 1003
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1005
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1006
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1004
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1005
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1007 1006
 						return false;
1008 1007
 					}
1009 1008
 					/** @type EE_Registration_Processor $registration_processor */
1010
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1009
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1011 1010
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1012
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1011
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1013 1012
 					/** @type EE_Transaction_Processor $transaction_processor */
1014
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1013
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1015 1014
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1016
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1015
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1017 1016
 					// if we've gotten this far, then let's save what we have
1018 1017
 					$registration->save();
1019 1018
 					// add relation between TXN and registration
1020
-					$this->_associate_registration_with_transaction( $registration );
1019
+					$this->_associate_registration_with_transaction($registration);
1021 1020
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1022 1021
 
1023
-			}  else {
1024
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1022
+			} else {
1023
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1025 1024
 				// remove malformed data
1026
-				unset( $valid_data[ $reg_url_link ] );
1025
+				unset($valid_data[$reg_url_link]);
1027 1026
 				return false;
1028 1027
 			}
1029 1028
 
@@ -1052,26 +1051,26 @@  discard block
 block discarded – undo
1052 1051
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1053 1052
 		// allow for plugins to hook in and do their own processing of the form input.
1054 1053
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1055
-		if ( apply_filters(
1054
+		if (apply_filters(
1056 1055
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1057 1056
 			false,
1058 1057
 			$registration,
1059 1058
 			$form_input,
1060 1059
 			$input_value,
1061 1060
 			$this
1062
-		) ) {
1061
+		)) {
1063 1062
 			return true;
1064 1063
 		}
1065 1064
 		// $answer_cache_id is the key used to find the EE_Answer we want
1066 1065
 		$answer_cache_id = $this->checkout->reg_url_link
1067 1066
 			? $form_input
1068
-			: $form_input . '-' . $registration->reg_url_link();
1069
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1070
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1067
+			: $form_input.'-'.$registration->reg_url_link();
1068
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1069
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1071 1070
 			? true
1072 1071
 			: false;
1073 1072
 		//rename form_inputs if they are EE_Attendee properties
1074
-		switch( (string)$form_input ) {
1073
+		switch ((string) $form_input) {
1075 1074
 
1076 1075
 			case 'state' :
1077 1076
 			case 'STA_ID' :
@@ -1086,32 +1085,32 @@  discard block
 block discarded – undo
1086 1085
 				break;
1087 1086
 
1088 1087
 			default :
1089
-				$ATT_input = 'ATT_' . $form_input;
1088
+				$ATT_input = 'ATT_'.$form_input;
1090 1089
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1091
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1092
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1090
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1091
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1093 1092
 		}
1094 1093
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1095 1094
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1096 1095
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1097 1096
 		// if this form input has a corresponding attendee property
1098
-		if ( $attendee_property ) {
1099
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1100
-			if ( $answer_is_obj ) {
1097
+		if ($attendee_property) {
1098
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1099
+			if ($answer_is_obj) {
1101 1100
 				// and delete the corresponding answer since we won't be storing this data in that object
1102
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1103
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1101
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1102
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1104 1103
 			}
1105 1104
 			return true;
1106
-		} elseif ( $answer_is_obj ) {
1105
+		} elseif ($answer_is_obj) {
1107 1106
 			// save this data to the answer object
1108
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1109
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1107
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1108
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1110 1109
 			return $result !== false ? true : false;
1111 1110
 		} else {
1112
-			foreach ( $this->_registration_answers as $answer ) {
1113
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1114
-					$answer->set_value( $input_value );
1111
+			foreach ($this->_registration_answers as $answer) {
1112
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1113
+					$answer->set_value($input_value);
1115 1114
 					$result = $answer->save();
1116 1115
 					return $result !== false ? true : false;
1117 1116
 				}
@@ -1133,15 +1132,15 @@  discard block
 block discarded – undo
1133 1132
 		$form_input = '',
1134 1133
 		$input_value = ''
1135 1134
 	) {
1136
-		if ( empty( $input_value ) ) {
1135
+		if (empty($input_value)) {
1137 1136
 			// if the form input isn't marked as being required, then just return
1138
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1137
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1139 1138
 				return true;
1140 1139
 			}
1141
-			switch ( $form_input ) {
1140
+			switch ($form_input) {
1142 1141
 				case 'fname' :
1143 1142
 					EE_Error::add_error(
1144
-						__( 'First Name is a required value.', 'event_espresso' ),
1143
+						__('First Name is a required value.', 'event_espresso'),
1145 1144
 						__FILE__,
1146 1145
 						__FUNCTION__,
1147 1146
 						__LINE__
@@ -1150,7 +1149,7 @@  discard block
 block discarded – undo
1150 1149
 					break;
1151 1150
 				case 'lname' :
1152 1151
 					EE_Error::add_error(
1153
-						__( 'Last Name is a required value.', 'event_espresso' ),
1152
+						__('Last Name is a required value.', 'event_espresso'),
1154 1153
 						__FILE__,
1155 1154
 						__FUNCTION__,
1156 1155
 						__LINE__
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
 					break;
1160 1159
 				case 'email' :
1161 1160
 					EE_Error::add_error(
1162
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1161
+						__('Please enter a valid email address.', 'event_espresso'),
1163 1162
 						__FILE__,
1164 1163
 						__FUNCTION__,
1165 1164
 						__LINE__
@@ -1192,21 +1191,21 @@  discard block
 block discarded – undo
1192 1191
 	 * @param array           $attendee_data
1193 1192
 	 * @return boolean
1194 1193
 	 */
1195
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1194
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1196 1195
 		$existing_attendee = null;
1197 1196
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1198
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1197
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1199 1198
 			? $attendee_data['ATT_fname']
1200 1199
 			: '';
1201
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1200
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1202 1201
 			? $attendee_data['ATT_lname']
1203 1202
 			: '';
1204
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1203
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1205 1204
 			? $attendee_data['ATT_email']
1206 1205
 			: '';
1207 1206
 		// but only if those have values
1208
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1209
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1207
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1208
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1210 1209
 				'ATT_fname' => $ATT_fname,
1211 1210
 				'ATT_lname' => $ATT_lname,
1212 1211
 				'ATT_email' => $ATT_email
@@ -1230,13 +1229,13 @@  discard block
 block discarded – undo
1230 1229
 	 * @return \EE_Attendee
1231 1230
 	 * @throws \EE_Error
1232 1231
 	 */
1233
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1232
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1234 1233
 		// first remove fname, lname, and email from attendee data
1235
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1234
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1236 1235
 		// now loop thru what's left and add to attendee CPT
1237
-		foreach ( $attendee_data as $property_name => $property_value ) {
1238
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1239
-				$existing_attendee->set( $property_name, $property_value );
1236
+		foreach ($attendee_data as $property_name => $property_value) {
1237
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1238
+				$existing_attendee->set($property_name, $property_value);
1240 1239
 			}
1241 1240
 		}
1242 1241
 		// better save that now
@@ -1254,11 +1253,11 @@  discard block
 block discarded – undo
1254 1253
 	 * @return void
1255 1254
 	 * @throws \EE_Error
1256 1255
 	 */
1257
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1256
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1258 1257
 		// add relation to attendee
1259
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1260
-		$registration->set_attendee_id( $attendee->ID() );
1261
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1258
+		$registration->_add_relation_to($attendee, 'Attendee');
1259
+		$registration->set_attendee_id($attendee->ID());
1260
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1262 1261
 	}
1263 1262
 
1264 1263
 
@@ -1270,10 +1269,10 @@  discard block
 block discarded – undo
1270 1269
 	 * @return void
1271 1270
 	 * @throws \EE_Error
1272 1271
 	 */
1273
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1272
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1274 1273
 		// add relation to attendee
1275
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1276
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1274
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1275
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1277 1276
 	}
1278 1277
 
1279 1278
 
@@ -1286,14 +1285,14 @@  discard block
 block discarded – undo
1286 1285
 	 * @return array
1287 1286
 	 * @throws \EE_Error
1288 1287
 	 */
1289
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1288
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1290 1289
 		// bare minimum critical details include first name, last name, email address
1291
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1290
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1292 1291
 		// add address info to critical details?
1293
-		if ( apply_filters(
1292
+		if (apply_filters(
1294 1293
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1295 1294
 			false
1296
-		) ) {
1295
+		)) {
1297 1296
 			$address_details = array(
1298 1297
 				'ATT_address',
1299 1298
 				'ATT_address2',
@@ -1303,13 +1302,13 @@  discard block
 block discarded – undo
1303 1302
 				'ATT_zip',
1304 1303
 				'ATT_phone'
1305 1304
 			);
1306
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1305
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1307 1306
 		}
1308
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1309
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1310
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1307
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1308
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1309
+			     || empty($attendee_data[$critical_attendee_detail])
1311 1310
 			) {
1312
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1311
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1313 1312
 					$critical_attendee_detail
1314 1313
 				);
1315 1314
 			}
@@ -1327,11 +1326,11 @@  discard block
 block discarded – undo
1327 1326
 	 * @return \EE_Attendee
1328 1327
 	 * @throws \EE_Error
1329 1328
 	 */
1330
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1329
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1331 1330
 		// create new attendee object
1332
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1331
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1333 1332
 		// set author to event creator
1334
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1333
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1335 1334
 		$new_attendee->save();
1336 1335
 		return $new_attendee;
1337 1336
 	}
@@ -1348,7 +1347,7 @@  discard block
 block discarded – undo
1348 1347
 	 */
1349 1348
 	public function update_reg_step() {
1350 1349
 		// save everything
1351
-		if ( $this->process_reg_step() ) {
1350
+		if ($this->process_reg_step()) {
1352 1351
 			$this->checkout->redirect = true;
1353 1352
 			$this->checkout->redirect_url = add_query_arg(
1354 1353
 				array(
@@ -1357,7 +1356,7 @@  discard block
 block discarded – undo
1357 1356
 				),
1358 1357
 				$this->checkout->thank_you_page_url
1359 1358
 			);
1360
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1359
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1361 1360
 			return true;
1362 1361
 		}
1363 1362
 		return false;
Please login to merge, or discard this patch.