Completed
Branch BUG-10434-reg-cancel-shortcode... (f76056)
by
unknown
14:04
created
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 	 *
96 96
 	 * @param  EE_Event $event 	EE event object
97 97
 	 * @param  array    $data   The request data from the form
98
-	 * @return bool     		success or fail
98
+	 * @return integer     		success or fail
99 99
 	 */
100 100
 	public function attach_evt_message_templates( $event, $data ) {
101 101
 		//first we remove all existing relations on the Event for message types.
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @param \EE_Admin_Page $admin_page
24 24
 	 */
25
-	public function __construct( EE_Admin_Page $admin_page ) {
25
+	public function __construct(EE_Admin_Page $admin_page) {
26 26
 		/**
27 27
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
28 28
 		 */
29 29
 		if (
30
-			! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' )
30
+			! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')
31 31
 		) {
32 32
 			return;
33 33
 		}
34 34
 		add_filter(
35 35
 			'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks',
36
-			array( $this, 'caf_updates' ),
36
+			array($this, 'caf_updates'),
37 37
 			10
38 38
 		);
39
-		parent::__construct( $admin_page );
39
+		parent::__construct($admin_page);
40 40
 	}
41 41
 
42 42
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 				),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 				)
76 76
 			),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 	 * @param  array    $data   The request data from the form
98 98
 	 * @return bool     		success or fail
99 99
 	 */
100
-	public function attach_evt_message_templates( $event, $data ) {
100
+	public function attach_evt_message_templates($event, $data) {
101 101
 		//first we remove all existing relations on the Event for message types.
102 102
 		$event->_remove_relations('Message_Template_Group');
103 103
 		//now let's just loop through the selected templates and add relations!
104
-		if ( isset( $data[ 'event_message_templates_relation' ] ) ) {
105
-			foreach ( $data[ 'event_message_templates_relation' ] as $grp_ID ) {
106
-				$event->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		if (isset($data['event_message_templates_relation'])) {
105
+			foreach ($data['event_message_templates_relation'] as $grp_ID) {
106
+				$event->_add_relation_to($grp_ID, 'Message_Template_Group');
107 107
 			}
108 108
 		}
109 109
 		//now save
@@ -118,25 +118,25 @@  discard block
 block discarded – undo
118 118
 	 * @return string
119 119
 	 * @throws \EE_Error
120 120
 	 */
121
-	public function messages_metabox( $event, $callback_args ) {
121
+	public function messages_metabox($event, $callback_args) {
122 122
 		//let's get the active messengers (b/c messenger objects have the active message templates)
123 123
 		//convert 'evt_id' to 'EVT_ID'
124
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
125
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] )
124
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
125
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID'])
126 126
 			? $this->_req_data['post']
127 127
 			: $this->_req_data['EVT_ID'];
128 128
 
129
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] )
129
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id'])
130 130
 			? $this->_req_data['evt_id']
131 131
 			: $this->_req_data['EVT_ID'];
132 132
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
133
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
133
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
134 134
 		$active_messengers = $message_resource_manager->active_messengers();
135 135
 		$tabs = array();
136 136
 
137 137
 		//empty messengers?
138 138
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
139
-		if ( empty( $active_messengers ) ) {
139
+		if (empty($active_messengers)) {
140 140
 			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(
141 141
 				array('action' => 'settings'),
142 142
 				EE_MSG_ADMIN_URL
@@ -145,11 +145,11 @@  discard block
 block discarded – undo
145 145
 				__('There are no active messengers. So no notifications will go out for %1$sany%2$s events.  You will want to %3$sActivate a Messenger%4$s.', 'event_espresso'),
146 146
 				'<strong>',
147 147
 				'</strong>',
148
-				'<a href="' . $msg_activate_url . '">',
148
+				'<a href="'.$msg_activate_url.'">',
149 149
 				'</a>'
150 150
 			);
151
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
152
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
151
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
152
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
153 153
 
154 154
 			echo $error_content;
155 155
 			echo $internal_content;
@@ -158,20 +158,20 @@  discard block
 block discarded – undo
158 158
 
159 159
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
160 160
 		//get content for active messengers
161
-		foreach ( $active_messengers as $name => $messenger ) {
161
+		foreach ($active_messengers as $name => $messenger) {
162 162
 			//first check if there are any active message types for this messenger.
163
-			$active_mts = $message_resource_manager->get_active_message_types_for_messenger( $name );
164
-			if ( empty( $active_mts ) ) {
163
+			$active_mts = $message_resource_manager->get_active_message_types_for_messenger($name);
164
+			if (empty($active_mts)) {
165 165
 				continue;
166 166
 			}
167 167
 
168 168
 			$tab_content = $messenger->get_messenger_admin_page_content(
169 169
 				'events',
170 170
 				'edit',
171
-				array( 'event' => $event_id )
171
+				array('event' => $event_id)
172 172
 			);
173 173
 
174
-			if ( ! empty( $tab_content ) ) {
174
+			if ( ! empty($tab_content)) {
175 175
 				$tabs[$name] = $tab_content;
176 176
 			}
177 177
 		}
@@ -179,23 +179,23 @@  discard block
 block discarded – undo
179 179
 
180 180
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
181 181
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
182
-		if ( $tabbed_content instanceof WP_Error ) {
182
+		if ($tabbed_content instanceof WP_Error) {
183 183
 			$tabbed_content = $tabbed_content->get_error_message();
184 184
 		}
185 185
 
186 186
 		$notices = '
187 187
 	<div id="espresso-ajax-loading" class="ajax-loader-grey">
188
-		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
188
+		<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
189 189
 	</div>
190 190
 	<div class="ee-notices"></div>';
191 191
 
192
-		if ( defined('DOING_AJAX' ) ) {
192
+		if (defined('DOING_AJAX')) {
193 193
 			return $tabbed_content;
194 194
 		}
195 195
 
196
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
197
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
198
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
196
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
197
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
198
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
199 199
 
200 200
 	}
201 201
 
@@ -210,15 +210,15 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	public function create_new_custom() {
212 212
 
213
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
214
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
213
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
214
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
215 215
 		}
216 216
 
217 217
 		//let's clean up the _POST global a bit for downstream usage of name and description.
218
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] )
218
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name'])
219 219
 			? $this->_req_data['custom_template_args']['MTP_name']
220 220
 			: '';
221
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] )
221
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description'])
222 222
 			? $this->_req_data['custom_template_args']['MTP_description']
223 223
 			: '';
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$this->_set_page_object();
228 228
 
229 229
 		// is this a template switch if so EE_Admin_Page child needs this object
230
-		$this->_page_object->set_hook_object( $this );
230
+		$this->_page_object->set_hook_object($this);
231 231
 
232 232
 		$this->_page_object->add_message_template(
233 233
 			$this->_req_data['messageType'],
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	public function edit_admin_footer() {
253 253
 		EEH_Template::display_template(
254
-			EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php'
254
+			EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php'
255 255
 		);
256 256
 	}
257 257
 
Please login to merge, or discard this patch.
caffeinated/payment_methods/Mijireh/EEG_Mijireh.gateway.php 3 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -99,45 +99,45 @@
 block discarded – undo
99 99
 		'body'=>  json_encode($order)
100 100
 		);
101 101
 		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
102
-                $problems_string = false;
102
+				$problems_string = false;
103 103
 		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
104 104
 		if( ! $response instanceof WP_Error ){
105 105
 			$response_body = json_decode($response['body']);
106 106
 			if($response_body && isset($response_body->checkout_url)){
107
-                            $payment->set_redirect_url($response_body->checkout_url);
108
-                            $payment->set_txn_id_chq_nmbr($response_body->order_number);
109
-                            $payment->set_details($response['body']);
107
+							$payment->set_redirect_url($response_body->checkout_url);
108
+							$payment->set_txn_id_chq_nmbr($response_body->order_number);
109
+							$payment->set_details($response['body']);
110 110
 			} else {
111
-                           if( is_array( $response_body ) || is_object( $response_body)){
112
-                                    $response_body_as_array = (array)$response_body;
113
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
114
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
-                                    }
116
-                            }else{
117
-                                    $problems_string = $response['body'];
118
-                            }
119
-                            if( ! $problems_string ) {
120
-                                //no message to show? wack
121
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
124
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
-                                }
126
-                            }
127
-                        }
111
+						   if( is_array( $response_body ) || is_object( $response_body)){
112
+									$response_body_as_array = (array)$response_body;
113
+									foreach($response_body_as_array as $problem_parameter => $problems){
114
+											$problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115
+									}
116
+							}else{
117
+									$problems_string = $response['body'];
118
+							}
119
+							if( ! $problems_string ) {
120
+								//no message to show? wack
121
+								if( isset( $response[ 'headers' ][ 'status' ] ) ){
122
+										$problems_string = $response[ 'headers' ][ 'status' ];
123
+								}else{
124
+										$problems_string = __( 'No response from Mijireh', 'event_espresso' );
125
+								}
126
+							}
127
+						}
128 128
 		}else{
129
-                    $problems_string = implode( ",", $response->get_error_messages() );
129
+					$problems_string = implode( ",", $response->get_error_messages() );
130 130
 		}
131 131
                 
132
-                if( $problems_string ) {
133
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
-                    $payment->set_details( $response );
135
-                    $payment->set_redirect_url( null );
136
-                    //even though the payment's status is failed at this point anyways,
137
-                    //let's be explicit about it. The fact that the redirect url is null
138
-                    //should be enough to client code that they can't redirect the user
139
-                    $payment->set_status( $this->_pay_model->failed_status() );
140
-                }
132
+				if( $problems_string ) {
133
+					$payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
134
+					$payment->set_details( $response );
135
+					$payment->set_redirect_url( null );
136
+					//even though the payment's status is failed at this point anyways,
137
+					//let's be explicit about it. The fact that the redirect url is null
138
+					//should be enough to client code that they can't redirect the user
139
+					$payment->set_status( $this->_pay_model->failed_status() );
140
+				}
141 141
 		return $payment;
142 142
 	}
143 143
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 					'quantity'=>$line_item->quantity()
49 49
 				);
50 50
 			}
51
-		}else{//its a partial payment
51
+		} else{//its a partial payment
52 52
 			$tax_total = 0;
53 53
 			//partial payment, so just add 1 item
54 54
 			$items[] = array(
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
                                     foreach($response_body_as_array as $problem_parameter => $problems){
114 114
                                             $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
115 115
                                     }
116
-                            }else{
116
+                            } else{
117 117
                                     $problems_string = $response['body'];
118 118
                             }
119 119
                             if( ! $problems_string ) {
120 120
                                 //no message to show? wack
121 121
                                 if( isset( $response[ 'headers' ][ 'status' ] ) ){
122 122
                                         $problems_string = $response[ 'headers' ][ 'status' ];
123
-                                }else{
123
+                                } else{
124 124
                                         $problems_string = __( 'No response from Mijireh', 'event_espresso' );
125 125
                                 }
126 126
                             }
127 127
                         }
128
-		}else{
128
+		} else{
129 129
                     $problems_string = implode( ",", $response->get_error_messages() );
130 130
 		}
131 131
                 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 				$prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum );
157 157
 			}
158 158
 			return $prepared_data;
159
-		}elseif(is_string( $data ) ){
159
+		} elseif(is_string( $data ) ){
160 160
 			return str_replace( '%', 'percent', $data );
161
-		}else{
161
+		} else{
162 162
 			return $data;
163 163
 		}
164 164
 	}
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @author				Mike Nelson
9 9
  *
10 10
  */
11
-class EEG_Mijireh extends EE_Offsite_Gateway{
11
+class EEG_Mijireh extends EE_Offsite_Gateway {
12 12
 
13 13
 	protected $_access_key;
14 14
 
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 		$primary_attendee = $primary_registrant->attendee();
38 38
 		$items = array();
39 39
 		//if we're are charging for the full amount, show the normal line items
40
-		if( $this->_can_easily_itemize_transaction_for( $payment )){
40
+		if ($this->_can_easily_itemize_transaction_for($payment)) {
41 41
 			$total_line_item = $transaction->total_line_item();
42 42
 			$tax_total = $total_line_item->get_total_tax();
43
-			foreach($total_line_item->get_items() as $line_item){
43
+			foreach ($total_line_item->get_items() as $line_item) {
44 44
 				$items[] = array(
45 45
 					'name'=>apply_filters(
46 46
 						'FHEE__EEG_Mijireh__set_redirection_info__full_amount_line_item_name',
47
-						$this->_format_line_item_name( $line_item, $payment ),
47
+						$this->_format_line_item_name($line_item, $payment),
48 48
 						$line_item,
49 49
 						$payment,
50 50
 						$primary_registrant
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 					'quantity'=>$line_item->quantity()
55 55
 				);
56 56
 			}
57
-		}else{//its a partial payment
57
+		} else {//its a partial payment
58 58
 			$tax_total = 0;
59 59
 			//partial payment, so just add 1 item
60 60
 			$items[] = array(
61 61
 				'name'=> apply_filters(
62 62
 					'FHEE__EEG_Mijireh__set_redirection_info__partial_amount_line_item_name',
63
-					$this->_format_partial_payment_line_item_name( $payment ),
63
+					$this->_format_partial_payment_line_item_name($payment),
64 64
 					$payment,
65 65
 					$primary_registrant
66 66
 				),
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 		$order = array(
73 73
 			'total'=>$this->format_currency($payment->amount()),
74 74
 			'return_url'=>$return_url,
75
-			'items'=>$this->_prepare_for_mijireh( $items ),
75
+			'items'=>$this->_prepare_for_mijireh($items),
76 76
 			'email'=>$primary_attendee->email(),
77 77
 			'first_name'=>$primary_attendee->fname(),
78 78
 			'last_name'=>$primary_attendee->lname(),
79 79
 			'tax'=>$this->format_currency($tax_total),
80 80
 			'partner_id'=>'ee');
81 81
 		//setup address?
82
-		if(		$primary_attendee->address()  &&
83
-				$primary_attendee->city()  &&
84
-				$primary_attendee->state_ID()  &&
85
-				$primary_attendee->country_ID()  &&
86
-				$primary_attendee->zip()  ){
82
+		if ($primary_attendee->address() &&
83
+				$primary_attendee->city() &&
84
+				$primary_attendee->state_ID() &&
85
+				$primary_attendee->country_ID() &&
86
+				$primary_attendee->zip()) {
87 87
 			$shipping_address = array(
88 88
 				'first_name'=>$primary_attendee->fname(),
89 89
 				'last_name'=>$primary_attendee->lname(),
@@ -93,62 +93,62 @@  discard block
 block discarded – undo
93 93
 				'zip_code' => $primary_attendee->zip(),
94 94
 				'country' => $primary_attendee->country_ID()
95 95
 			);
96
-			if( $primary_attendee->address2() ){
97
-				$shipping_address[ 'apt_suite' ] = $primary_attendee->address2();
96
+			if ($primary_attendee->address2()) {
97
+				$shipping_address['apt_suite'] = $primary_attendee->address2();
98 98
 			}
99
-			if( $primary_attendee->phone() ){
100
-				$shipping_address[ 'phone' ] = $primary_attendee->phone();
99
+			if ($primary_attendee->phone()) {
100
+				$shipping_address['phone'] = $primary_attendee->phone();
101 101
 			}
102
-			$order[ 'shipping_address' ] = $shipping_address;
102
+			$order['shipping_address'] = $shipping_address;
103 103
 		}
104
-		$order = apply_filters( 'FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant );
105
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)) );
104
+		$order = apply_filters('FHEE__EEG_Mijireh__set_redirection_info__order_arguments', $order, $payment, $primary_registrant);
105
+		do_action('AHEE_log', __FILE__, __FUNCTION__, serialize(get_object_vars($this)));
106 106
 		$args = array(
107 107
 			'headers' => array(
108
-				'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
108
+				'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
109 109
 				'Accept'=>'application/json'
110 110
 			),
111 111
 			'body'=>  json_encode($order)
112 112
 		);
113
-		$response = wp_remote_post( $this->_mijireh_api_orders_url, $args );
113
+		$response = wp_remote_post($this->_mijireh_api_orders_url, $args);
114 114
                 $problems_string = false;
115
-		$this->log(array('get checkout url request_args' => $args, 'response' => $response ), $payment);
116
-		if( ! $response instanceof WP_Error ){
115
+		$this->log(array('get checkout url request_args' => $args, 'response' => $response), $payment);
116
+		if ( ! $response instanceof WP_Error) {
117 117
 			$response_body = json_decode($response['body']);
118
-			if($response_body && isset($response_body->checkout_url)){
118
+			if ($response_body && isset($response_body->checkout_url)) {
119 119
                             $payment->set_redirect_url($response_body->checkout_url);
120 120
                             $payment->set_txn_id_chq_nmbr($response_body->order_number);
121 121
                             $payment->set_details($response['body']);
122 122
 			} else {
123
-                           if( is_array( $response_body ) || is_object( $response_body)){
124
-                                    $response_body_as_array = (array)$response_body;
125
-                                    foreach($response_body_as_array as $problem_parameter => $problems){
126
-                                            $problems_string.= sprintf(__('\nProblems with %s: %s','event_espresso'),$problem_parameter,implode(", ",$problems));
123
+                           if (is_array($response_body) || is_object($response_body)) {
124
+                                    $response_body_as_array = (array) $response_body;
125
+                                    foreach ($response_body_as_array as $problem_parameter => $problems) {
126
+                                            $problems_string .= sprintf(__('\nProblems with %s: %s', 'event_espresso'), $problem_parameter, implode(", ", $problems));
127 127
                                     }
128
-                            }else{
128
+                            } else {
129 129
                                     $problems_string = $response['body'];
130 130
                             }
131
-                            if( ! $problems_string ) {
131
+                            if ( ! $problems_string) {
132 132
                                 //no message to show? wack
133
-                                if( isset( $response[ 'headers' ][ 'status' ] ) ){
134
-                                        $problems_string = $response[ 'headers' ][ 'status' ];
135
-                                }else{
136
-                                        $problems_string = __( 'No response from Mijireh', 'event_espresso' );
133
+                                if (isset($response['headers']['status'])) {
134
+                                        $problems_string = $response['headers']['status'];
135
+                                } else {
136
+                                        $problems_string = __('No response from Mijireh', 'event_espresso');
137 137
                                 }
138 138
                             }
139 139
                         }
140
-		}else{
141
-                    $problems_string = implode( ",", $response->get_error_messages() );
140
+		} else {
141
+                    $problems_string = implode(",", $response->get_error_messages());
142 142
 		}
143 143
                 
144
-                if( $problems_string ) {
145
-                    $payment->set_gateway_response( sprintf( __( 'Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string ) );
146
-                    $payment->set_details( $response );
147
-                    $payment->set_redirect_url( null );
144
+                if ($problems_string) {
145
+                    $payment->set_gateway_response(sprintf(__('Errors occurred communicating with Mijireh: %1$s', 'event_espresso'), $problems_string));
146
+                    $payment->set_details($response);
147
+                    $payment->set_redirect_url(null);
148 148
                     //even though the payment's status is failed at this point anyways,
149 149
                     //let's be explicit about it. The fact that the redirect url is null
150 150
                     //should be enough to client code that they can't redirect the user
151
-                    $payment->set_status( $this->_pay_model->failed_status() );
151
+                    $payment->set_status($this->_pay_model->failed_status());
152 152
                 }
153 153
 		return $payment;
154 154
 	}
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 	 * @param mixed $data
162 162
 	 * @return mixed same type as $data
163 163
 	 */
164
-	private function _prepare_for_mijireh( $data ){
165
-		if( is_array( $data ) ){
164
+	private function _prepare_for_mijireh($data) {
165
+		if (is_array($data)) {
166 166
 			$prepared_data = array();
167
-			foreach($data as $key => $datum ){
168
-				$prepared_data[ $key ] = $this->_prepare_for_mijireh( $datum );
167
+			foreach ($data as $key => $datum) {
168
+				$prepared_data[$key] = $this->_prepare_for_mijireh($datum);
169 169
 			}
170 170
 			return $prepared_data;
171
-		}elseif(is_string( $data ) ){
172
-			return str_replace( '%', 'percent', $data );
173
-		}else{
171
+		}elseif (is_string($data)) {
172
+			return str_replace('%', 'percent', $data);
173
+		} else {
174 174
 			return $data;
175 175
 		}
176 176
 	}
@@ -191,30 +191,30 @@  discard block
 block discarded – undo
191 191
 
192 192
 		$payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL;
193 193
 
194
-		if ( ! $payment instanceof EEI_Payment ){
195
-			throw new EE_Error( sprintf( __( "Could not find Mijireh payment for transaction %s", 'event_espresso' ), $transaction->ID() ) );
194
+		if ( ! $payment instanceof EEI_Payment) {
195
+			throw new EE_Error(sprintf(__("Could not find Mijireh payment for transaction %s", 'event_espresso'), $transaction->ID()));
196 196
 		}
197 197
 
198 198
 		$request_args = array(
199 199
 			'headers' => array(
200
-				'Authorization' => 'Basic ' . base64_encode( $this->_access_key . ':' ),
200
+				'Authorization' => 'Basic '.base64_encode($this->_access_key.':'),
201 201
 				'Accept'=>'application/json'
202 202
 			)
203 203
 		);
204 204
 
205 205
 		$response = wp_remote_get(
206
-			$this->_mijireh_api_orders_url . '/' . $payment->txn_id_chq_nmbr(),
206
+			$this->_mijireh_api_orders_url.'/'.$payment->txn_id_chq_nmbr(),
207 207
 			$request_args
208 208
 		);
209 209
 
210 210
 		$this->log(
211
-			array( 'get payment status request_args' => $request_args, 'response' => $response ),
211
+			array('get payment status request_args' => $request_args, 'response' => $response),
212 212
 			$payment
213 213
 		);
214 214
 		// validate response
215
-		$response_body = isset( $response[ 'body' ] ) ? json_decode( $response[ 'body' ] ) : '';
216
-		if( $response && $response_body ){
217
-			switch( $response_body->status ){
215
+		$response_body = isset($response['body']) ? json_decode($response['body']) : '';
216
+		if ($response && $response_body) {
217
+			switch ($response_body->status) {
218 218
 				case 'paid':
219 219
 					$payment->set_status($this->_pay_model->approved_status());
220 220
 					break;
@@ -226,9 +226,9 @@  discard block
 block discarded – undo
226 226
 			}
227 227
 
228 228
 		} else {
229
-			$payment->set_gateway_response( __( 'Response from Mijireh could not be understood.', 'event_espresso' ) );
230
-			$payment->set_details( $response );
231
-			$payment->set_status( $this->_pay_model->failed_status() );
229
+			$payment->set_gateway_response(__('Response from Mijireh could not be understood.', 'event_espresso'));
230
+			$payment->set_details($response);
231
+			$payment->set_status($this->_pay_model->failed_status());
232 232
 		}
233 233
 		// the following is ONLY for testing the Mijireh IPN and should NEVER be uncommented for real usage
234 234
 //		$payment->set_status( $this->_pay_model->pending_status() );
Please login to merge, or discard this patch.
payment_methods/Mijireh/templates/mijireh_settings_after_form.template.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('No direct script access allowed');
3 3
 /**
4
- * mijireh_settings_after_form
5
- *
6
- * @package			Event Espresso
7
- * @subpackage
8
- * @author				Mike Nelson
9
- */
4
+	 * mijireh_settings_after_form
5
+	 *
6
+	 * @package			Event Espresso
7
+	 * @subpackage
8
+	 * @author				Mike Nelson
9
+	 */
10 10
 do_action('AHEE__EE_Mijireh__settings_end');
11 11
 ?><br/><?php
12 12
 // End of file mijireh_settings_after_form.template.php
13 13
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION'))
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION'))
2 2
 	exit('No direct script access allowed');
3 3
 /**
4 4
  * mijireh_settings_after_form
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,6 @@
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION'))
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2 2
 	exit('No direct script access allowed');
3
+}
3 4
 /**
4 5
  * mijireh_settings_after_form
5 6
  *
Please login to merge, or discard this patch.
core/db_classes/EE_Post_Meta.class.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 	 * @param array $props_n_values
31 31
 	 * @return EE_Post_Meta|mixed
32 32
 	 */
33
-	public static function new_instance( $props_n_values = array() ) {
34
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
35
-		return $has_object ? $has_object : new self( $props_n_values );
33
+	public static function new_instance($props_n_values = array()) {
34
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
35
+		return $has_object ? $has_object : new self($props_n_values);
36 36
 	}
37 37
 
38 38
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
 	 * @param array $props_n_values
42 42
 	 * @return EE_Post_Meta
43 43
 	 */
44
-	public static function new_instance_from_db( $props_n_values = array() ) {
45
-		return new self( $props_n_values, TRUE );
44
+	public static function new_instance_from_db($props_n_values = array()) {
45
+		return new self($props_n_values, TRUE);
46 46
 	}
47 47
 
48 48
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 * @return int
53 53
 	 */
54 54
 	function meta_id() {
55
-		return $this->get( 'meta_id' );
55
+		return $this->get('meta_id');
56 56
 	}
57 57
 
58 58
 
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 	 * @param int $meta_id
63 63
 	 * @return boolean
64 64
 	 */
65
-	function set_meta_id( $meta_id) {
66
-		return $this->set( 'meta_id', $meta_id);
65
+	function set_meta_id($meta_id) {
66
+		return $this->set('meta_id', $meta_id);
67 67
 	}
68 68
 	/**
69 69
 	 * Gets post_id
70 70
 	 * @return int
71 71
 	 */
72 72
 	function post_id() {
73
-		return $this->get( 'post_id' );
73
+		return $this->get('post_id');
74 74
 	}
75 75
 
76 76
 
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 	 * @param int $post_id
81 81
 	 * @return boolean
82 82
 	 */
83
-	function set_post_id( $post_id) {
84
-		return $this->set( 'post_id', $post_id);
83
+	function set_post_id($post_id) {
84
+		return $this->set('post_id', $post_id);
85 85
 	}
86 86
 	/**
87 87
 	 * Gets meta_key
88 88
 	 * @return string
89 89
 	 */
90 90
 	function meta_key() {
91
-		return $this->get( 'meta_key' );
91
+		return $this->get('meta_key');
92 92
 	}
93 93
 
94 94
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 * @param string $meta_key
99 99
 	 * @return boolean
100 100
 	 */
101
-	function set_meta_key( $meta_key) {
102
-		return $this->set( 'meta_key', $meta_key);
101
+	function set_meta_key($meta_key) {
102
+		return $this->set('meta_key', $meta_key);
103 103
 	}
104 104
 	/**
105 105
 	 * Gets meta_value
106 106
 	 * @return mixed
107 107
 	 */
108 108
 	function meta_value() {
109
-		return $this->get( 'meta_value' );
109
+		return $this->get('meta_value');
110 110
 	}
111 111
 
112 112
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 	 * @param mixed $meta_value
117 117
 	 * @return boolean
118 118
 	 */
119
-	function set_meta_value( $meta_value) {
120
-		return $this->set( 'meta_value', $meta_value);
119
+	function set_meta_value($meta_value) {
120
+		return $this->set('meta_value', $meta_value);
121 121
 	}
122 122
 
123 123
 
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	/**
61 61
 	 * Sets meta_id
62 62
 	 * @param int $meta_id
63
-	 * @return boolean
63
+	 * @return boolean|null
64 64
 	 */
65 65
 	function set_meta_id( $meta_id) {
66 66
 		return $this->set( 'meta_id', $meta_id);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	/**
79 79
 	 * Sets post_id
80 80
 	 * @param int $post_id
81
-	 * @return boolean
81
+	 * @return boolean|null
82 82
 	 */
83 83
 	function set_post_id( $post_id) {
84 84
 		return $this->set( 'post_id', $post_id);
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * Sets meta_key
98 98
 	 * @param string $meta_key
99
-	 * @return boolean
99
+	 * @return boolean|null
100 100
 	 */
101 101
 	function set_meta_key( $meta_key) {
102 102
 		return $this->set( 'meta_key', $meta_key);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	/**
115 115
 	 * Sets meta_value
116 116
 	 * @param mixed $meta_value
117
-	 * @return boolean
117
+	 * @return boolean|null
118 118
 	 */
119 119
 	function set_meta_value( $meta_value) {
120 120
 		return $this->set( 'meta_value', $meta_value);
Please login to merge, or discard this patch.
core/db_models/EEM_Answer.model.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,14 +125,14 @@
 block discarded – undo
125 125
 	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128
-                //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
130
-                    //find this question's QST_system value
131
-                    $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
-                } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
-                }
128
+				//backward compat: we still want to find the question's ID
129
+				if( is_numeric( $question_system_id ) ) {
130
+					//find this question's QST_system value
131
+					$question_id = $question_system_id;
132
+					$question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
+				} else {
134
+					$question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
+				}
136 136
 		//only bother checking if the registration has an attendee
137 137
 		if( $registration->attendee() instanceof EE_Attendee ) {
138 138
 			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * 	constructor
53 53
 	 */
54
-	protected function __construct( $timezone = NULL ){
55
-		$this->singular_item = __('Answer','event_espresso');
56
-		$this->plural_item = __('Answers','event_espresso');
54
+	protected function __construct($timezone = NULL) {
55
+		$this->singular_item = __('Answer', 'event_espresso');
56
+		$this->plural_item = __('Answers', 'event_espresso');
57 57
 		$this->_tables = array(
58 58
 			'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID')
59 59
 		);
60 60
 		$this->_fields = array(
61 61
 			'Answer'=>array(
62
-				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')),
63
-				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'),
64
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
65
-				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '')
62
+				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')),
63
+				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
64
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
65
+				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')
66 66
 			));
67 67
 		$this->_model_relations = array(
68 68
 			'Registration'=>new EE_Belongs_To_Relation(),
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		);
71 71
 		$this->_model_chain_to_wp_user = 'Registration.Event';
72 72
 		$this->_caps_slug = 'registrations';
73
-		parent::__construct( $timezone );
73
+		parent::__construct($timezone);
74 74
 	}
75 75
 
76 76
 
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 	 * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value'
84 84
 	 * @return string
85 85
 	 */
86
-	public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){
87
-		$value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer );
88
-		if (  $value === NULL ){
89
-			$answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer );
90
-			if( $answer_obj instanceof EE_Answer ){
91
-				if($pretty_answer){
86
+	public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
87
+		$value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer);
88
+		if ($value === NULL) {
89
+			$answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer);
90
+			if ($answer_obj instanceof EE_Answer) {
91
+				if ($pretty_answer) {
92 92
 					$value = $answer_obj->pretty_value();
93
-				}else{
93
+				} else {
94 94
 					$value = $answer_obj->value();
95 95
 				}
96 96
 			}
97 97
 		}
98
-		return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id );
98
+		return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id);
99 99
 	}
100 100
 
101 101
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 * @param int $question_id
107 107
 	 * @return EE_Answer
108 108
 	 */
109
-	public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){
110
-		$answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() )));
111
-		return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id );
109
+	public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) {
110
+		$answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID())));
111
+		return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id);
112 112
 	}
113 113
 
114 114
 
@@ -122,39 +122,39 @@  discard block
 block discarded – undo
122 122
 	 * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for 
123 123
 	 * a question corresponding to an attendee field, returns null)
124 124
 	 */
125
-	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
125
+	public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) {
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128 128
                 //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
129
+                if (is_numeric($question_system_id)) {
130 130
                     //find this question's QST_system value
131 131
                     $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
132
+                    $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system');
133 133
                 } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
134
+                    $question_id = intval(EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID'));
135 135
                 }
136 136
 		//only bother checking if the registration has an attendee
137
-		if( $registration->attendee() instanceof EE_Attendee ) {
138
-			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
139
-			if( $field_name ) {
140
-				if( $pretty_answer ) {
141
-					if( $field_name == 'STA_ID' ) {
137
+		if ($registration->attendee() instanceof EE_Attendee) {
138
+			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id);
139
+			if ($field_name) {
140
+				if ($pretty_answer) {
141
+					if ($field_name == 'STA_ID') {
142 142
 						$state = $registration->attendee()->state_obj();
143
-						$value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() );
144
-					} else if($field_name == 'CNT_ISO') {
143
+						$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID());
144
+					} else if ($field_name == 'CNT_ISO') {
145 145
 						$country = $registration->attendee()->country_obj();
146
-						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
146
+						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID());
147 147
 					} else {
148
-						$value = $registration->attendee()->get_pretty( $field_name );
148
+						$value = $registration->attendee()->get_pretty($field_name);
149 149
 					}
150 150
 					//if field name is blank, leave the value as null too
151
-				}else{
152
-					$value = $registration->attendee()->get( $field_name );
151
+				} else {
152
+					$value = $registration->attendee()->get($field_name);
153 153
 				}
154 154
 			}
155 155
 			//if no field was found, leave value blank
156 156
 		}
157
-		return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id );
157
+		return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id);
158 158
 	}
159 159
 
160 160
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -90,7 +92,7 @@  discard block
 block discarded – undo
90 92
 			if( $answer_obj instanceof EE_Answer ){
91 93
 				if($pretty_answer){
92 94
 					$value = $answer_obj->pretty_value();
93
-				}else{
95
+				} else{
94 96
 					$value = $answer_obj->value();
95 97
 				}
96 98
 			}
@@ -148,7 +150,7 @@  discard block
 block discarded – undo
148 150
 						$value = $registration->attendee()->get_pretty( $field_name );
149 151
 					}
150 152
 					//if field name is blank, leave the value as null too
151
-				}else{
153
+				} else{
152 154
 					$value = $registration->attendee()->get( $field_name );
153 155
 				}
154 156
 			}
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,36 +35,36 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Ticket','event_espresso');
40
-		$this->plural_item = __('Tickets','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Ticket', 'event_espresso');
40
+		$this->plural_item = __('Tickets', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Ticket'=>array(
47
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
48
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
47
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
48
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
49 49
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
50
-				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
51
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
52
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
53
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
54
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ),
50
+				'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
51
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
52
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
53
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
54
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF),
55 55
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
56 56
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
57
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF),
58
-				'TKT_reserved'=>new EE_Integer_Field('TKT_reserved', __('Quantity of this ticket that is reserved, but not yet fully purchased','event_espresso'), false, 0 ),
59
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ),
60
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
61
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
62
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
57
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF),
58
+				'TKT_reserved'=>new EE_Integer_Field('TKT_reserved', __('Quantity of this ticket that is reserved, but not yet fully purchased', 'event_espresso'), false, 0),
59
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF),
60
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
61
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
62
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
63 63
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
64
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
64
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
65 65
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
66
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
67
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
66
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
67
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
68 68
 			));
69 69
 		$this->_model_relations = array(
70 70
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 		);
77 77
 
78 78
 		//this model is generally available for reading
79
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
80 80
 		//account for default tickets in the caps
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
84
-		parent::__construct( $timezone );
81
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
84
+		parent::__construct($timezone);
85 85
 	}
86 86
 
87 87
 
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function get_all_default_tickets() {
94 94
 		/** @type EE_Ticket[] $tickets */
95
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) );
95
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')));
96 96
 		//we need to set the start date and end date to today's date and the start of the default dtt
97
-		return $this->_set_default_dates( $tickets );
97
+		return $this->_set_default_dates($tickets);
98 98
 	}
99 99
 
100 100
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
 	 * @param EE_Ticket[] $tickets
105 105
 	 * @return EE_Ticket[]
106 106
 	 */
107
-	private function _set_default_dates( $tickets ) {
108
-		foreach ( $tickets as $ticket ) {
109
-			$ticket->set('TKT_start_date', (int)$this->current_time_for_query('TKT_start_date', true) );
110
-			$ticket->set('TKT_end_date', (int)$this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) );
111
-			$ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) );
107
+	private function _set_default_dates($tickets) {
108
+		foreach ($tickets as $ticket) {
109
+			$ticket->set('TKT_start_date', (int) $this->current_time_for_query('TKT_start_date', true));
110
+			$ticket->set('TKT_end_date', (int) $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30));
111
+			$ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone));
112 112
 		}
113 113
 
114 114
 		return $tickets;
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @param array $query_params
124 124
 	 * @return int
125 125
 	 */
126
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
127
-		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params );
126
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
127
+		return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params);
128 128
 	}
129 129
 
130 130
 
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param EE_Ticket[] $tickets
135 135
 	 * @return void
136 136
 	 */
137
-	public function update_tickets_sold($tickets){
138
-		foreach($tickets as $ticket){
137
+	public function update_tickets_sold($tickets) {
138
+		foreach ($tickets as $ticket) {
139 139
 			/* @var  $ticket EE_Ticket */
140 140
 			$ticket->update_tickets_sold();
141 141
 		}
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/email_main_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 	<!-- Facebook sharing information tags -->
8 8
 	<meta property="og:title" content="<?php echo $subject; ?>" />
9 9
 	<title><?php echo $subject; ?></title>
10
-	<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?>
10
+	<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?>
11 11
 </head>
12
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?>
12
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?>
13 13
 <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
14
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?>
14
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?>
15 15
 <?php echo $main_body; ?>
16
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?>
16
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?>
17 17
 </body>
18
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?>
18
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?>
19 19
 </html>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_main_wrapper.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 		<!-- Primary Style Sheet -->
28 28
 		<link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" />
29 29
 		<!-- Make sure the buttons don't print -->
30
-		<?php if ( isset( $extra_css )) : ?>
30
+		<?php if (isset($extra_css)) : ?>
31 31
 		<!-- Additional Style Sheet -->
32 32
 		<link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" />
33 33
 		<?php endif; ?>
34 34
 		<style type="text/css">
35 35
 		@media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }}
36 36
 		</style>
37
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
37
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
38 38
 	</head>
39
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
39
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
40 40
 	<body>
41
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
41
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
42 42
 		<?php echo $main_body; ?>
43
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
43
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
44 44
 	</body>
45
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
45
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
46 46
 	<?php wp_footer(); ?>
47 47
 </html>
48 48
\ No newline at end of file
Please login to merge, or discard this patch.