@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit('NO direct script access allowed'); } |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * ---------------------------------------------- |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | *@param array $settings_array |
| 98 | 98 | */ |
| 99 | - public function set_settings( $settings_array ) { |
|
| 99 | + public function set_settings($settings_array) { |
|
| 100 | 100 | parent::set_settings($settings_array); |
| 101 | 101 | // Redirect URL. |
| 102 | 102 | $this->_base_gateway_url = $this->_debug_mode |
@@ -115,19 +115,19 @@ discard block |
||
| 115 | 115 | * @return \EE_Payment|\EEI_Payment |
| 116 | 116 | * @throws \EE_Error |
| 117 | 117 | */ |
| 118 | - public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ) { |
|
| 119 | - if ( ! $payment instanceof EEI_Payment ) { |
|
| 120 | - $payment->set_gateway_response( __( 'Error. No associated payment was found.', 'event_espresso' ) ); |
|
| 121 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 118 | + public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) { |
|
| 119 | + if ( ! $payment instanceof EEI_Payment) { |
|
| 120 | + $payment->set_gateway_response(__('Error. No associated payment was found.', 'event_espresso')); |
|
| 121 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 122 | 122 | return $payment; |
| 123 | 123 | } |
| 124 | 124 | $transaction = $payment->transaction(); |
| 125 | - if ( ! $transaction instanceof EEI_Transaction ) { |
|
| 126 | - $payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) ); |
|
| 127 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 125 | + if ( ! $transaction instanceof EEI_Transaction) { |
|
| 126 | + $payment->set_gateway_response(__('Could not process this payment because it has no associated transaction.', 'event_espresso')); |
|
| 127 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 128 | 128 | return $payment; |
| 129 | 129 | } |
| 130 | - $order_description = substr( $this->_format_order_description($payment), 0, 127 ); |
|
| 130 | + $order_description = substr($this->_format_order_description($payment), 0, 127); |
|
| 131 | 131 | $primary_registration = $transaction->primary_registration(); |
| 132 | 132 | $primary_attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : false; |
| 133 | 133 | $locale = explode('-', get_bloginfo('language')); |
@@ -141,37 +141,37 @@ discard block |
||
| 141 | 141 | 'RETURNURL' => $return_url, |
| 142 | 142 | 'CANCELURL' => $cancel_url, |
| 143 | 143 | 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', |
| 144 | - 'SOLUTIONTYPE' => 'Sole', // Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional. |
|
| 145 | - 'BUTTONSOURCE' => 'EventEspresso_SP',//EE will blow up if you change this |
|
| 144 | + 'SOLUTIONTYPE' => 'Sole', // Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional. |
|
| 145 | + 'BUTTONSOURCE' => 'EventEspresso_SP', //EE will blow up if you change this |
|
| 146 | 146 | 'LOCALECODE' => $locale[1] // Locale of the pages displayed by PayPal during Express Checkout. |
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | // Show itemized list. |
| 150 | - if ( $this->_money->compare_floats( $payment->amount(), $transaction->total(), '==' ) ) { |
|
| 150 | + if ($this->_money->compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
| 151 | 151 | $item_num = 0; |
| 152 | 152 | $itemized_sum = 0; |
| 153 | 153 | $total_line_items = $transaction->total_line_item(); |
| 154 | 154 | // Go through each item in the list. |
| 155 | - foreach ( $total_line_items->get_items() as $line_item ) { |
|
| 156 | - if ( $line_item instanceof EE_Line_Item ) { |
|
| 155 | + foreach ($total_line_items->get_items() as $line_item) { |
|
| 156 | + if ($line_item instanceof EE_Line_Item) { |
|
| 157 | 157 | // PayPal doesn't like line items with 0.00 amount, so we may skip those. |
| 158 | - if ( EEH_Money::compare_floats( $line_item->total(), '0.00', '==' ) ) { |
|
| 158 | + if (EEH_Money::compare_floats($line_item->total(), '0.00', '==')) { |
|
| 159 | 159 | continue; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $unit_price = $line_item->unit_price(); |
| 163 | 163 | $line_item_quantity = $line_item->quantity(); |
| 164 | 164 | // This is a discount. |
| 165 | - if ( $line_item->is_percent() ) { |
|
| 165 | + if ($line_item->is_percent()) { |
|
| 166 | 166 | $unit_price = $line_item->total(); |
| 167 | 167 | $line_item_quantity = 1; |
| 168 | 168 | } |
| 169 | 169 | // Item Name. |
| 170 | - $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr($this->_format_line_item_name( $line_item, $payment), 0, 127); |
|
| 170 | + $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr($this->_format_line_item_name($line_item, $payment), 0, 127); |
|
| 171 | 171 | // Item description. |
| 172 | - $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = substr($this->_format_line_item_desc( $line_item, $payment), 0, 127); |
|
| 172 | + $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = substr($this->_format_line_item_desc($line_item, $payment), 0, 127); |
|
| 173 | 173 | // Cost of individual item. |
| 174 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency( $unit_price ); |
|
| 174 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency($unit_price); |
|
| 175 | 175 | // Item Number. |
| 176 | 176 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER'.$item_num] = $item_num + 1; |
| 177 | 177 | // Item quantity. |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | $token_request_dtls['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0'; |
| 189 | 189 | $token_request_dtls['PAYMENTREQUEST_0_HANDLINGAMT'] = '0'; |
| 190 | 190 | |
| 191 | - $itemized_sum_diff_from_txn_total = round( $transaction->total() - $itemized_sum - $total_line_items->get_total_tax(), 2 ); |
|
| 191 | + $itemized_sum_diff_from_txn_total = round($transaction->total() - $itemized_sum - $total_line_items->get_total_tax(), 2); |
|
| 192 | 192 | // If we were not able to recognize some item like promotion, surcharge or cancellation, |
| 193 | 193 | // add the difference as an extra line item. |
| 194 | - if ( $this->_money->compare_floats( $itemized_sum_diff_from_txn_total, 0, '!=' ) ) { |
|
| 194 | + if ($this->_money->compare_floats($itemized_sum_diff_from_txn_total, 0, '!=')) { |
|
| 195 | 195 | // Item Name. |
| 196 | - $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr( __( 'Other (promotion/surcharge/cancellation)', 'event_espresso' ), 0, 127 ); |
|
| 196 | + $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr(__('Other (promotion/surcharge/cancellation)', 'event_espresso'), 0, 127); |
|
| 197 | 197 | // Item description. |
| 198 | 198 | $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = ''; |
| 199 | 199 | // Cost of individual item. |
| 200 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency( $itemized_sum_diff_from_txn_total ); |
|
| 200 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total); |
|
| 201 | 201 | // Item Number. |
| 202 | 202 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER'.$item_num] = $item_num + 1; |
| 203 | 203 | // Item quantity. |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | } else { |
| 210 | 210 | // Just one Item. |
| 211 | 211 | // Item Name. |
| 212 | - $token_request_dtls['L_PAYMENTREQUEST_0_NAME0'] = substr( $this->_format_partial_payment_line_item_name($payment), 0, 127 ); |
|
| 212 | + $token_request_dtls['L_PAYMENTREQUEST_0_NAME0'] = substr($this->_format_partial_payment_line_item_name($payment), 0, 127); |
|
| 213 | 213 | // Item description. |
| 214 | - $token_request_dtls['L_PAYMENTREQUEST_0_DESC0'] = substr( $this->_format_partial_payment_line_item_desc($payment), 0, 127 ); |
|
| 214 | + $token_request_dtls['L_PAYMENTREQUEST_0_DESC0'] = substr($this->_format_partial_payment_line_item_desc($payment), 0, 127); |
|
| 215 | 215 | // Cost of individual item. |
| 216 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT0'] = $this->format_currency( $payment->amount() ); |
|
| 216 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT0'] = $this->format_currency($payment->amount()); |
|
| 217 | 217 | // Item Number. |
| 218 | 218 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER0'] = 1; |
| 219 | 219 | // Item quantity. |
@@ -221,14 +221,14 @@ discard block |
||
| 221 | 221 | // Digital item is sold. |
| 222 | 222 | $token_request_dtls['L_PAYMENTREQUEST_0_ITEMCATEGORY0'] = 'Physical'; |
| 223 | 223 | // Item's sales S/H and tax amount. |
| 224 | - $token_request_dtls['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_currency( $payment->amount() ); |
|
| 224 | + $token_request_dtls['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_currency($payment->amount()); |
|
| 225 | 225 | $token_request_dtls['PAYMENTREQUEST_0_TAXAMT'] = '0'; |
| 226 | 226 | $token_request_dtls['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0'; |
| 227 | 227 | $token_request_dtls['PAYMENTREQUEST_0_HANDLINGAMT'] = '0'; |
| 228 | 228 | } |
| 229 | 229 | // Automatically filling out shipping and contact information. |
| 230 | - if ( $this->_request_shipping_addr && $primary_attendee instanceof EEI_Attendee ) { |
|
| 231 | - $token_request_dtls['NOSHIPPING'] = '2'; // If you do not pass the shipping address, PayPal obtains it from the buyer's account profile. |
|
| 230 | + if ($this->_request_shipping_addr && $primary_attendee instanceof EEI_Attendee) { |
|
| 231 | + $token_request_dtls['NOSHIPPING'] = '2'; // If you do not pass the shipping address, PayPal obtains it from the buyer's account profile. |
|
| 232 | 232 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOSTREET'] = $primary_attendee->address(); |
| 233 | 233 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $primary_attendee->address2(); |
| 234 | 234 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOCITY'] = $primary_attendee->city(); |
@@ -237,14 +237,14 @@ discard block |
||
| 237 | 237 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOZIP'] = $primary_attendee->zip(); |
| 238 | 238 | $token_request_dtls['PAYMENTREQUEST_0_EMAIL'] = $primary_attendee->email(); |
| 239 | 239 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOPHONENUM'] = $primary_attendee->phone(); |
| 240 | - } elseif ( ! $this->_request_shipping_addr ) { |
|
| 240 | + } elseif ( ! $this->_request_shipping_addr) { |
|
| 241 | 241 | // Do not request shipping details on the PP Checkout page. |
| 242 | 242 | $token_request_dtls['NOSHIPPING'] = '1'; |
| 243 | 243 | $token_request_dtls['REQCONFIRMSHIPPING'] = '0'; |
| 244 | 244 | |
| 245 | 245 | } |
| 246 | 246 | // Used a business/personal logo on the PayPal page. |
| 247 | - if ( ! empty($this->_image_url) ) { |
|
| 247 | + if ( ! empty($this->_image_url)) { |
|
| 248 | 248 | $token_request_dtls['LOGOIMG'] = $this->_image_url; |
| 249 | 249 | } |
| 250 | 250 | $token_request_dtls = apply_filters( |
@@ -253,23 +253,23 @@ discard block |
||
| 253 | 253 | $this |
| 254 | 254 | ); |
| 255 | 255 | // Request PayPal token. |
| 256 | - $token_request_response = $this->_ppExpress_request( $token_request_dtls, 'Payment Token', $payment ); |
|
| 257 | - $token_rstatus = $this->_ppExpress_check_response( $token_request_response ); |
|
| 258 | - $response_args = ( isset($token_rstatus['args']) && is_array($token_rstatus['args']) ) ? $token_rstatus['args'] : array(); |
|
| 259 | - if ( $token_rstatus['status'] ) { |
|
| 256 | + $token_request_response = $this->_ppExpress_request($token_request_dtls, 'Payment Token', $payment); |
|
| 257 | + $token_rstatus = $this->_ppExpress_check_response($token_request_response); |
|
| 258 | + $response_args = (isset($token_rstatus['args']) && is_array($token_rstatus['args'])) ? $token_rstatus['args'] : array(); |
|
| 259 | + if ($token_rstatus['status']) { |
|
| 260 | 260 | // We got the Token so we may continue with the payment and redirect the client. |
| 261 | - $payment->set_details( $response_args ); |
|
| 261 | + $payment->set_details($response_args); |
|
| 262 | 262 | |
| 263 | 263 | $gateway_url = $this->_debug_mode ? 'https://www.sandbox.paypal.com' : 'https://www.paypal.com'; |
| 264 | - $payment->set_redirect_url( $gateway_url . '/checkoutnow?useraction=commit&cmd=_express-checkout&token=' . $response_args['TOKEN'] ); |
|
| 264 | + $payment->set_redirect_url($gateway_url.'/checkoutnow?useraction=commit&cmd=_express-checkout&token='.$response_args['TOKEN']); |
|
| 265 | 265 | } else { |
| 266 | - if ( isset($response_args['L_ERRORCODE']) ) { |
|
| 267 | - $payment->set_gateway_response( $response_args['L_ERRORCODE'] . '; ' . $response_args['L_SHORTMESSAGE'] ); |
|
| 266 | + if (isset($response_args['L_ERRORCODE'])) { |
|
| 267 | + $payment->set_gateway_response($response_args['L_ERRORCODE'].'; '.$response_args['L_SHORTMESSAGE']); |
|
| 268 | 268 | } else { |
| 269 | - $payment->set_gateway_response( __( 'Error occurred while trying to setup the Express Checkout.', 'event_espresso' ) ); |
|
| 269 | + $payment->set_gateway_response(__('Error occurred while trying to setup the Express Checkout.', 'event_espresso')); |
|
| 270 | 270 | } |
| 271 | - $payment->set_details( $response_args ); |
|
| 272 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 271 | + $payment->set_details($response_args); |
|
| 272 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return $payment; |
@@ -285,22 +285,22 @@ discard block |
||
| 285 | 285 | * @param EEI_Transaction $transaction |
| 286 | 286 | * @return EEI_Payment |
| 287 | 287 | */ |
| 288 | - public function handle_payment_update( $update_info, $transaction ) { |
|
| 288 | + public function handle_payment_update($update_info, $transaction) { |
|
| 289 | 289 | $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : null; |
| 290 | 290 | |
| 291 | - if ( $payment instanceof EEI_Payment ) { |
|
| 292 | - $this->log( array( 'Return from Authorization' => $update_info ), $payment ); |
|
| 291 | + if ($payment instanceof EEI_Payment) { |
|
| 292 | + $this->log(array('Return from Authorization' => $update_info), $payment); |
|
| 293 | 293 | $transaction = $payment->transaction(); |
| 294 | - if ( ! $transaction instanceof EEI_Transaction ) { |
|
| 295 | - $payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) ); |
|
| 296 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 294 | + if ( ! $transaction instanceof EEI_Transaction) { |
|
| 295 | + $payment->set_gateway_response(__('Could not process this payment because it has no associated transaction.', 'event_espresso')); |
|
| 296 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 297 | 297 | return $payment; |
| 298 | 298 | } |
| 299 | 299 | $primary_registrant = $transaction->primary_registration(); |
| 300 | 300 | $payment_details = $payment->details(); |
| 301 | 301 | // Check if we still have the token. |
| 302 | - if ( ! isset($payment_details['TOKEN']) || empty($payment_details['TOKEN']) ) { |
|
| 303 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 302 | + if ( ! isset($payment_details['TOKEN']) || empty($payment_details['TOKEN'])) { |
|
| 303 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 304 | 304 | return $payment; |
| 305 | 305 | } |
| 306 | 306 | |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | 'TOKEN' => $payment_details['TOKEN'] |
| 310 | 310 | ); |
| 311 | 311 | // Request Customer Details. |
| 312 | - $cdetails_request_response = $this->_ppExpress_request( $cdetails_request_dtls, 'Customer Details', $payment ); |
|
| 313 | - $cdetails_rstatus = $this->_ppExpress_check_response( $cdetails_request_response ); |
|
| 314 | - $cdata_response_args = ( isset($cdetails_rstatus['args']) && is_array($cdetails_rstatus['args']) ) ? $cdetails_rstatus['args'] : array(); |
|
| 315 | - if ( $cdetails_rstatus['status'] ) { |
|
| 312 | + $cdetails_request_response = $this->_ppExpress_request($cdetails_request_dtls, 'Customer Details', $payment); |
|
| 313 | + $cdetails_rstatus = $this->_ppExpress_check_response($cdetails_request_response); |
|
| 314 | + $cdata_response_args = (isset($cdetails_rstatus['args']) && is_array($cdetails_rstatus['args'])) ? $cdetails_rstatus['args'] : array(); |
|
| 315 | + if ($cdetails_rstatus['status']) { |
|
| 316 | 316 | // We got the PayerID so now we can Complete the transaction. |
| 317 | 317 | $docheckout_request_dtls = array( |
| 318 | 318 | 'METHOD' => 'DoExpressCheckoutPayment', |
@@ -323,39 +323,39 @@ discard block |
||
| 323 | 323 | 'PAYMENTREQUEST_0_CURRENCYCODE' => $payment->currency_code() |
| 324 | 324 | ); |
| 325 | 325 | // Payment Checkout/Capture. |
| 326 | - $docheckout_request_response = $this->_ppExpress_request( $docheckout_request_dtls, 'Do Payment', $payment ); |
|
| 327 | - $docheckout_rstatus = $this->_ppExpress_check_response( $docheckout_request_response ); |
|
| 328 | - $docheckout_response_args = ( isset($docheckout_rstatus['args']) && is_array($docheckout_rstatus['args']) ) ? $docheckout_rstatus['args'] : array(); |
|
| 329 | - if ( $docheckout_rstatus['status'] ) { |
|
| 326 | + $docheckout_request_response = $this->_ppExpress_request($docheckout_request_dtls, 'Do Payment', $payment); |
|
| 327 | + $docheckout_rstatus = $this->_ppExpress_check_response($docheckout_request_response); |
|
| 328 | + $docheckout_response_args = (isset($docheckout_rstatus['args']) && is_array($docheckout_rstatus['args'])) ? $docheckout_rstatus['args'] : array(); |
|
| 329 | + if ($docheckout_rstatus['status']) { |
|
| 330 | 330 | // All is well, payment approved. |
| 331 | 331 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
| 332 | - $payment->set_extra_accntng( $primary_registration_code ); |
|
| 333 | - $payment->set_amount( isset($docheckout_response_args['PAYMENTINFO_0_AMT']) ? (float) $docheckout_response_args['PAYMENTINFO_0_AMT'] : 0 ); |
|
| 334 | - $payment->set_txn_id_chq_nmbr( isset( $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] ) ? $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] : null ); |
|
| 335 | - $payment->set_details( $cdata_response_args ); |
|
| 336 | - $payment->set_gateway_response( isset( $docheckout_response_args['PAYMENTINFO_0_ACK'] ) ? $docheckout_response_args['PAYMENTINFO_0_ACK'] : '' ); |
|
| 337 | - $payment->set_status( $this->_pay_model->approved_status() ); |
|
| 332 | + $payment->set_extra_accntng($primary_registration_code); |
|
| 333 | + $payment->set_amount(isset($docheckout_response_args['PAYMENTINFO_0_AMT']) ? (float) $docheckout_response_args['PAYMENTINFO_0_AMT'] : 0); |
|
| 334 | + $payment->set_txn_id_chq_nmbr(isset($docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID']) ? $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] : null); |
|
| 335 | + $payment->set_details($cdata_response_args); |
|
| 336 | + $payment->set_gateway_response(isset($docheckout_response_args['PAYMENTINFO_0_ACK']) ? $docheckout_response_args['PAYMENTINFO_0_ACK'] : ''); |
|
| 337 | + $payment->set_status($this->_pay_model->approved_status()); |
|
| 338 | 338 | } else { |
| 339 | - if ( isset($docheckout_response_args['L_ERRORCODE']) ) { |
|
| 340 | - $payment->set_gateway_response( $docheckout_response_args['L_ERRORCODE'] . '; ' . $docheckout_response_args['L_SHORTMESSAGE'] ); |
|
| 339 | + if (isset($docheckout_response_args['L_ERRORCODE'])) { |
|
| 340 | + $payment->set_gateway_response($docheckout_response_args['L_ERRORCODE'].'; '.$docheckout_response_args['L_SHORTMESSAGE']); |
|
| 341 | 341 | } else { |
| 342 | - $payment->set_gateway_response( __( 'Error occurred while trying to Capture the funds.', 'event_espresso' ) ); |
|
| 342 | + $payment->set_gateway_response(__('Error occurred while trying to Capture the funds.', 'event_espresso')); |
|
| 343 | 343 | } |
| 344 | - $payment->set_details( $docheckout_response_args ); |
|
| 345 | - $payment->set_status( $this->_pay_model->declined_status() ); |
|
| 344 | + $payment->set_details($docheckout_response_args); |
|
| 345 | + $payment->set_status($this->_pay_model->declined_status()); |
|
| 346 | 346 | } |
| 347 | 347 | } else { |
| 348 | - if ( isset($cdata_response_args['L_ERRORCODE']) ) { |
|
| 349 | - $payment->set_gateway_response( $cdata_response_args['L_ERRORCODE'] . '; ' . $cdata_response_args['L_SHORTMESSAGE'] ); |
|
| 348 | + if (isset($cdata_response_args['L_ERRORCODE'])) { |
|
| 349 | + $payment->set_gateway_response($cdata_response_args['L_ERRORCODE'].'; '.$cdata_response_args['L_SHORTMESSAGE']); |
|
| 350 | 350 | } else { |
| 351 | - $payment->set_gateway_response( __( 'Error occurred while trying to get payment Details from PayPal.', 'event_espresso' ) ); |
|
| 351 | + $payment->set_gateway_response(__('Error occurred while trying to get payment Details from PayPal.', 'event_espresso')); |
|
| 352 | 352 | } |
| 353 | - $payment->set_details( $cdata_response_args ); |
|
| 354 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 353 | + $payment->set_details($cdata_response_args); |
|
| 354 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 355 | 355 | } |
| 356 | 356 | } else { |
| 357 | - $payment->set_gateway_response( __( 'Error occurred while trying to process the payment.', 'event_espresso' ) ); |
|
| 358 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
| 357 | + $payment->set_gateway_response(__('Error occurred while trying to process the payment.', 'event_espresso')); |
|
| 358 | + $payment->set_status($this->_pay_model->failed_status()); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | return $payment; |
@@ -370,16 +370,16 @@ discard block |
||
| 370 | 370 | * @param EEI_Payment $payment |
| 371 | 371 | * @return mixed |
| 372 | 372 | */ |
| 373 | - public function _ppExpress_request( $request_params, $request_text, $payment ) { |
|
| 373 | + public function _ppExpress_request($request_params, $request_text, $payment) { |
|
| 374 | 374 | $request_dtls = array( |
| 375 | 375 | 'VERSION' => '204.0', |
| 376 | - 'USER' => urlencode( $this->_api_username ), |
|
| 377 | - 'PWD' => urlencode( $this->_api_password ), |
|
| 378 | - 'SIGNATURE' => urlencode( $this->_api_signature ) |
|
| 376 | + 'USER' => urlencode($this->_api_username), |
|
| 377 | + 'PWD' => urlencode($this->_api_password), |
|
| 378 | + 'SIGNATURE' => urlencode($this->_api_signature) |
|
| 379 | 379 | ); |
| 380 | - $dtls = array_merge( $request_dtls, $request_params ); |
|
| 380 | + $dtls = array_merge($request_dtls, $request_params); |
|
| 381 | 381 | |
| 382 | - $this->_log_clean_request( $dtls, $payment, $request_text . ' Request' ); |
|
| 382 | + $this->_log_clean_request($dtls, $payment, $request_text.' Request'); |
|
| 383 | 383 | // Request Customer Details. |
| 384 | 384 | $request_response = wp_remote_post( |
| 385 | 385 | $this->_base_gateway_url, |
@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | 'httpversion' => '1.1', |
| 390 | 390 | 'cookies' => array(), |
| 391 | 391 | 'headers' => array(), |
| 392 | - 'body' => http_build_query( $dtls ) |
|
| 392 | + 'body' => http_build_query($dtls) |
|
| 393 | 393 | ) |
| 394 | 394 | ); |
| 395 | 395 | // Log the response. |
| 396 | - $this->log( array( $request_text . ' Response' => $request_response), $payment ); |
|
| 396 | + $this->log(array($request_text.' Response' => $request_response), $payment); |
|
| 397 | 397 | |
| 398 | 398 | return $request_response; |
| 399 | 399 | } |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | * @param mixed $request_response |
| 406 | 406 | * @return array |
| 407 | 407 | */ |
| 408 | - public function _ppExpress_check_response( $request_response ) { |
|
| 409 | - if ( is_wp_error( $request_response ) || empty($request_response['body']) ) { |
|
| 408 | + public function _ppExpress_check_response($request_response) { |
|
| 409 | + if (is_wp_error($request_response) || empty($request_response['body'])) { |
|
| 410 | 410 | // If we got here then there was an error in this request. |
| 411 | 411 | return array('status' => false, 'args' => $request_response); |
| 412 | 412 | } |
| 413 | 413 | $response_args = array(); |
| 414 | - parse_str( urldecode($request_response['body']), $response_args ); |
|
| 414 | + parse_str(urldecode($request_response['body']), $response_args); |
|
| 415 | 415 | if ( ! isset($response_args['ACK'])) { |
| 416 | 416 | return array('status' => false, 'args' => $request_response); |
| 417 | 417 | } |
@@ -441,10 +441,10 @@ discard block |
||
| 441 | 441 | * @param string $info |
| 442 | 442 | * @return void |
| 443 | 443 | */ |
| 444 | - private function _log_clean_request($request, $payment, $info ) { |
|
| 444 | + private function _log_clean_request($request, $payment, $info) { |
|
| 445 | 445 | $cleaned_request_data = $request; |
| 446 | 446 | unset($cleaned_request_data['PWD'], $cleaned_request_data['USER'], $cleaned_request_data['SIGNATURE']); |
| 447 | - $this->log( array($info => $cleaned_request_data), $payment ); |
|
| 447 | + $this->log(array($info => $cleaned_request_data), $payment); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
@@ -454,10 +454,10 @@ discard block |
||
| 454 | 454 | * @param array $data_array |
| 455 | 455 | * @return array |
| 456 | 456 | */ |
| 457 | - private function _get_errors( $data_array ) { |
|
| 457 | + private function _get_errors($data_array) { |
|
| 458 | 458 | $errors = array(); |
| 459 | 459 | $n = 0; |
| 460 | - while ( isset($data_array["L_ERRORCODE{$n}"]) ) { |
|
| 460 | + while (isset($data_array["L_ERRORCODE{$n}"])) { |
|
| 461 | 461 | $l_error_code = isset($data_array["L_ERRORCODE{$n}"]) |
| 462 | 462 | ? $data_array["L_ERRORCODE{$n}"] |
| 463 | 463 | : ''; |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | ? $data_array["L_LONGMESSAGE{$n}"] |
| 472 | 472 | : ''; |
| 473 | 473 | |
| 474 | - if ( $n === 0 ) { |
|
| 474 | + if ($n === 0) { |
|
| 475 | 475 | $errors = array( |
| 476 | 476 | 'L_ERRORCODE' => $l_error_code, |
| 477 | 477 | 'L_SHORTMESSAGE' => $l_short_message, |
@@ -479,10 +479,10 @@ discard block |
||
| 479 | 479 | 'L_SEVERITYCODE' => $l_severity_code |
| 480 | 480 | ); |
| 481 | 481 | } else { |
| 482 | - $errors['L_ERRORCODE'] .= ', ' . $l_error_code; |
|
| 483 | - $errors['L_SHORTMESSAGE'] .= ', ' . $l_short_message; |
|
| 484 | - $errors['L_LONGMESSAGE'] .= ', ' . $l_long_message; |
|
| 485 | - $errors['L_SEVERITYCODE'] .= ', ' . $l_severity_code; |
|
| 482 | + $errors['L_ERRORCODE'] .= ', '.$l_error_code; |
|
| 483 | + $errors['L_SHORTMESSAGE'] .= ', '.$l_short_message; |
|
| 484 | + $errors['L_LONGMESSAGE'] .= ', '.$l_long_message; |
|
| 485 | + $errors['L_SEVERITYCODE'] .= ', '.$l_severity_code; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | $n++; |
@@ -44,77 +44,76 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | protected $_image_url; |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * gateway URL variable |
|
| 49 | - * |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 52 | - protected $_base_gateway_url = ''; |
|
| 53 | - |
|
| 54 | - |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * EEG_Paypal_Express constructor. |
|
| 58 | - */ |
|
| 59 | - public function __construct() |
|
| 60 | - { |
|
| 61 | - $this->_currencies_supported = array( |
|
| 62 | - 'USD', |
|
| 63 | - 'AUD', |
|
| 64 | - 'BRL', |
|
| 65 | - 'CAD', |
|
| 66 | - 'CZK', |
|
| 67 | - 'DKK', |
|
| 68 | - 'EUR', |
|
| 69 | - 'HKD', |
|
| 70 | - 'HUF', |
|
| 71 | - 'ILS', |
|
| 72 | - 'JPY', |
|
| 73 | - 'MYR', |
|
| 74 | - 'MXN', |
|
| 75 | - 'NOK', |
|
| 76 | - 'NZD', |
|
| 77 | - 'PHP', |
|
| 78 | - 'PLN', |
|
| 79 | - 'GBP', |
|
| 80 | - 'RUB', |
|
| 81 | - 'SGD', |
|
| 82 | - 'SEK', |
|
| 83 | - 'CHF', |
|
| 84 | - 'TWD', |
|
| 85 | - 'THB', |
|
| 86 | - 'TRY' |
|
| 87 | - ); |
|
| 88 | - parent::__construct(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Sets the gateway URL variable based on whether debug mode is enabled or not. |
|
| 47 | + /** |
|
| 48 | + * gateway URL variable |
|
| 49 | + * |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | + protected $_base_gateway_url = ''; |
|
| 53 | + |
|
| 54 | + |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * EEG_Paypal_Express constructor. |
|
| 58 | + */ |
|
| 59 | + public function __construct() |
|
| 60 | + { |
|
| 61 | + $this->_currencies_supported = array( |
|
| 62 | + 'USD', |
|
| 63 | + 'AUD', |
|
| 64 | + 'BRL', |
|
| 65 | + 'CAD', |
|
| 66 | + 'CZK', |
|
| 67 | + 'DKK', |
|
| 68 | + 'EUR', |
|
| 69 | + 'HKD', |
|
| 70 | + 'HUF', |
|
| 71 | + 'ILS', |
|
| 72 | + 'JPY', |
|
| 73 | + 'MYR', |
|
| 74 | + 'MXN', |
|
| 75 | + 'NOK', |
|
| 76 | + 'NZD', |
|
| 77 | + 'PHP', |
|
| 78 | + 'PLN', |
|
| 79 | + 'GBP', |
|
| 80 | + 'RUB', |
|
| 81 | + 'SGD', |
|
| 82 | + 'SEK', |
|
| 83 | + 'CHF', |
|
| 84 | + 'TWD', |
|
| 85 | + 'THB', |
|
| 86 | + 'TRY' |
|
| 87 | + ); |
|
| 88 | + parent::__construct(); |
|
| 89 | + } |
|
| 90 | + |
|
| 95 | 91 | |
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Sets the gateway URL variable based on whether debug mode is enabled or not. |
|
| 96 | 95 | * |
| 97 | 96 | *@param array $settings_array |
| 98 | 97 | */ |
| 99 | 98 | public function set_settings( $settings_array ) { |
| 100 | 99 | parent::set_settings($settings_array); |
| 101 | 100 | // Redirect URL. |
| 102 | - $this->_base_gateway_url = $this->_debug_mode |
|
| 103 | - ? 'https://api-3t.sandbox.paypal.com/nvp' |
|
| 104 | - : 'https://api-3t.paypal.com/nvp'; |
|
| 101 | + $this->_base_gateway_url = $this->_debug_mode |
|
| 102 | + ? 'https://api-3t.sandbox.paypal.com/nvp' |
|
| 103 | + : 'https://api-3t.paypal.com/nvp'; |
|
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | |
| 108 | 107 | |
| 109 | - /** |
|
| 110 | - * @param EEI_Payment $payment |
|
| 111 | - * @param array $billing_info |
|
| 112 | - * @param string $return_url |
|
| 113 | - * @param string $notify_url |
|
| 114 | - * @param string $cancel_url |
|
| 115 | - * @return \EE_Payment|\EEI_Payment |
|
| 116 | - * @throws \EE_Error |
|
| 117 | - */ |
|
| 108 | + /** |
|
| 109 | + * @param EEI_Payment $payment |
|
| 110 | + * @param array $billing_info |
|
| 111 | + * @param string $return_url |
|
| 112 | + * @param string $notify_url |
|
| 113 | + * @param string $cancel_url |
|
| 114 | + * @return \EE_Payment|\EEI_Payment |
|
| 115 | + * @throws \EE_Error |
|
| 116 | + */ |
|
| 118 | 117 | public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ) { |
| 119 | 118 | if ( ! $payment instanceof EEI_Payment ) { |
| 120 | 119 | $payment->set_gateway_response( __( 'Error. No associated payment was found.', 'event_espresso' ) ); |
@@ -202,9 +201,9 @@ discard block |
||
| 202 | 201 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER'.$item_num] = $item_num + 1; |
| 203 | 202 | // Item quantity. |
| 204 | 203 | $token_request_dtls['L_PAYMENTREQUEST_0_QTY'.$item_num] = 1; |
| 205 | - // Digital item is sold. |
|
| 206 | - $token_request_dtls['L_PAYMENTREQUEST_0_ITEMCATEGORY'.$item_num] = 'Physical'; |
|
| 207 | - $item_num++; |
|
| 204 | + // Digital item is sold. |
|
| 205 | + $token_request_dtls['L_PAYMENTREQUEST_0_ITEMCATEGORY'.$item_num] = 'Physical'; |
|
| 206 | + $item_num++; |
|
| 208 | 207 | } |
| 209 | 208 | } else { |
| 210 | 209 | // Just one Item. |
@@ -277,7 +276,6 @@ discard block |
||
| 277 | 276 | |
| 278 | 277 | |
| 279 | 278 | /** |
| 280 | - |
|
| 281 | 279 | * @param array $update_info { |
| 282 | 280 | * @type string $gateway_txn_id |
| 283 | 281 | * @type string status an EEMI_Payment status |
@@ -297,8 +295,8 @@ discard block |
||
| 297 | 295 | return $payment; |
| 298 | 296 | } |
| 299 | 297 | $primary_registrant = $transaction->primary_registration(); |
| 300 | - $payment_details = $payment->details(); |
|
| 301 | - // Check if we still have the token. |
|
| 298 | + $payment_details = $payment->details(); |
|
| 299 | + // Check if we still have the token. |
|
| 302 | 300 | if ( ! isset($payment_details['TOKEN']) || empty($payment_details['TOKEN']) ) { |
| 303 | 301 | $payment->set_status( $this->_pay_model->failed_status() ); |
| 304 | 302 | return $payment; |
@@ -407,36 +405,36 @@ discard block |
||
| 407 | 405 | */ |
| 408 | 406 | public function _ppExpress_check_response( $request_response ) { |
| 409 | 407 | if ( is_wp_error( $request_response ) || empty($request_response['body']) ) { |
| 410 | - // If we got here then there was an error in this request. |
|
| 411 | - return array('status' => false, 'args' => $request_response); |
|
| 412 | - } |
|
| 413 | - $response_args = array(); |
|
| 414 | - parse_str( urldecode($request_response['body']), $response_args ); |
|
| 415 | - if ( ! isset($response_args['ACK'])) { |
|
| 416 | - return array('status' => false, 'args' => $request_response); |
|
| 417 | - } |
|
| 418 | - if ( |
|
| 419 | - $response_args['ACK'] === 'Success' |
|
| 420 | - && ( |
|
| 421 | - isset($response_args['PAYERID']) |
|
| 422 | - || isset($response_args['PAYMENTINFO_0_TRANSACTIONID']) |
|
| 423 | - || (isset($response_args['PAYMENTSTATUS']) && $response_args['PAYMENTSTATUS'] === 'Completed') |
|
| 424 | - || isset($response_args['TOKEN']) |
|
| 425 | - ) |
|
| 426 | - ) { |
|
| 427 | - // Response status OK, return response parameters for further processing. |
|
| 428 | - return array('status' => true, 'args' => $response_args); |
|
| 429 | - } else { |
|
| 430 | - $errors = $this->_get_errors($response_args); |
|
| 431 | - return array('status' => false, 'args' => $errors); |
|
| 432 | - } |
|
| 408 | + // If we got here then there was an error in this request. |
|
| 409 | + return array('status' => false, 'args' => $request_response); |
|
| 410 | + } |
|
| 411 | + $response_args = array(); |
|
| 412 | + parse_str( urldecode($request_response['body']), $response_args ); |
|
| 413 | + if ( ! isset($response_args['ACK'])) { |
|
| 414 | + return array('status' => false, 'args' => $request_response); |
|
| 415 | + } |
|
| 416 | + if ( |
|
| 417 | + $response_args['ACK'] === 'Success' |
|
| 418 | + && ( |
|
| 419 | + isset($response_args['PAYERID']) |
|
| 420 | + || isset($response_args['PAYMENTINFO_0_TRANSACTIONID']) |
|
| 421 | + || (isset($response_args['PAYMENTSTATUS']) && $response_args['PAYMENTSTATUS'] === 'Completed') |
|
| 422 | + || isset($response_args['TOKEN']) |
|
| 423 | + ) |
|
| 424 | + ) { |
|
| 425 | + // Response status OK, return response parameters for further processing. |
|
| 426 | + return array('status' => true, 'args' => $response_args); |
|
| 427 | + } else { |
|
| 428 | + $errors = $this->_get_errors($response_args); |
|
| 429 | + return array('status' => false, 'args' => $errors); |
|
| 430 | + } |
|
| 433 | 431 | } |
| 434 | 432 | |
| 435 | 433 | |
| 436 | 434 | /** |
| 437 | - * Log a "Cleared" request. |
|
| 438 | - * |
|
| 439 | - * @param array $request |
|
| 435 | + * Log a "Cleared" request. |
|
| 436 | + * |
|
| 437 | + * @param array $request |
|
| 440 | 438 | * @param EEI_Payment $payment |
| 441 | 439 | * @param string $info |
| 442 | 440 | * @return void |
@@ -459,17 +457,17 @@ discard block |
||
| 459 | 457 | $n = 0; |
| 460 | 458 | while ( isset($data_array["L_ERRORCODE{$n}"]) ) { |
| 461 | 459 | $l_error_code = isset($data_array["L_ERRORCODE{$n}"]) |
| 462 | - ? $data_array["L_ERRORCODE{$n}"] |
|
| 463 | - : ''; |
|
| 460 | + ? $data_array["L_ERRORCODE{$n}"] |
|
| 461 | + : ''; |
|
| 464 | 462 | $l_severity_code = isset($data_array["L_SEVERITYCODE{$n}"]) |
| 465 | - ? $data_array["L_SEVERITYCODE{$n}"] |
|
| 466 | - : ''; |
|
| 463 | + ? $data_array["L_SEVERITYCODE{$n}"] |
|
| 464 | + : ''; |
|
| 467 | 465 | $l_short_message = isset($data_array["L_SHORTMESSAGE{$n}"]) |
| 468 | - ? $data_array["L_SHORTMESSAGE{$n}"] |
|
| 469 | - : ''; |
|
| 466 | + ? $data_array["L_SHORTMESSAGE{$n}"] |
|
| 467 | + : ''; |
|
| 470 | 468 | $l_long_message = isset($data_array["L_LONGMESSAGE{$n}"]) |
| 471 | - ? $data_array["L_LONGMESSAGE{$n}"] |
|
| 472 | - : ''; |
|
| 469 | + ? $data_array["L_LONGMESSAGE{$n}"] |
|
| 470 | + : ''; |
|
| 473 | 471 | |
| 474 | 472 | if ( $n === 0 ) { |
| 475 | 473 | $errors = array( |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
| 41 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
| 42 | 42 | * or an array of capability strings |
| 43 | 43 | * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
| 44 | 44 | * @param int $ID - (optional) ID for item where current_user_can is being called from |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
| 5 | 5 | |
| 6 | 6 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 7 | - exit('No direct script access allowed'); |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | |
@@ -20,72 +20,72 @@ discard block |
||
| 20 | 20 | class CapCheck implements CapCheckInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var string|array $capability |
|
| 25 | - */ |
|
| 26 | - private $capability; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * @var string $context |
|
| 30 | - */ |
|
| 31 | - private $context; |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * @var int|string $ID |
|
| 35 | - */ |
|
| 36 | - private $ID; |
|
| 37 | - |
|
| 38 | - |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
| 42 | - * or an array of capability strings |
|
| 43 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
| 44 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
| 45 | - * @throws InvalidDataTypeException |
|
| 46 | - */ |
|
| 47 | - public function __construct($capability, $context, $ID = 0) |
|
| 48 | - { |
|
| 49 | - if ( ! is_string($capability)) { |
|
| 50 | - throw new InvalidDataTypeException('$capability', $capability, 'string'); |
|
| 51 | - } |
|
| 52 | - if ( ! is_string($context)) { |
|
| 53 | - throw new InvalidDataTypeException('$context', $context, 'string'); |
|
| 54 | - } |
|
| 55 | - $this->capability = $capability; |
|
| 56 | - $this->context = strtolower(str_replace(' ', '_', $context)); |
|
| 57 | - $this->ID = $ID; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @return string|array |
|
| 64 | - */ |
|
| 65 | - public function capability() |
|
| 66 | - { |
|
| 67 | - return $this->capability; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * @return string |
|
| 74 | - */ |
|
| 75 | - public function context() |
|
| 76 | - { |
|
| 77 | - return $this->context; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @return int|string |
|
| 84 | - */ |
|
| 85 | - public function ID() |
|
| 86 | - { |
|
| 87 | - return $this->ID; |
|
| 88 | - } |
|
| 23 | + /** |
|
| 24 | + * @var string|array $capability |
|
| 25 | + */ |
|
| 26 | + private $capability; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * @var string $context |
|
| 30 | + */ |
|
| 31 | + private $context; |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * @var int|string $ID |
|
| 35 | + */ |
|
| 36 | + private $ID; |
|
| 37 | + |
|
| 38 | + |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations', |
|
| 42 | + * or an array of capability strings |
|
| 43 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
| 44 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
| 45 | + * @throws InvalidDataTypeException |
|
| 46 | + */ |
|
| 47 | + public function __construct($capability, $context, $ID = 0) |
|
| 48 | + { |
|
| 49 | + if ( ! is_string($capability)) { |
|
| 50 | + throw new InvalidDataTypeException('$capability', $capability, 'string'); |
|
| 51 | + } |
|
| 52 | + if ( ! is_string($context)) { |
|
| 53 | + throw new InvalidDataTypeException('$context', $context, 'string'); |
|
| 54 | + } |
|
| 55 | + $this->capability = $capability; |
|
| 56 | + $this->context = strtolower(str_replace(' ', '_', $context)); |
|
| 57 | + $this->ID = $ID; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @return string|array |
|
| 64 | + */ |
|
| 65 | + public function capability() |
|
| 66 | + { |
|
| 67 | + return $this->capability; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @return string |
|
| 74 | + */ |
|
| 75 | + public function context() |
|
| 76 | + { |
|
| 77 | + return $this->context; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @return int|string |
|
| 84 | + */ |
|
| 85 | + public function ID() |
|
| 86 | + { |
|
| 87 | + return $this->ID; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | 90 | |
| 91 | 91 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\services\commands; |
| 4 | 4 | |
| 5 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 6 | 6 | exit('No direct script access allowed'); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | namespace EventEspresso\core\services\commands; |
| 4 | 4 | |
| 5 | 5 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
| 6 | - exit('No direct script access allowed'); |
|
| 6 | + exit('No direct script access allowed'); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | |
@@ -16,22 +16,22 @@ discard block |
||
| 16 | 16 | interface CommandHandlerManagerInterface |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @param CommandHandlerInterface $command_handler |
|
| 21 | - * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
| 22 | - * @return void |
|
| 23 | - * @throws InvalidCommandHandlerException |
|
| 24 | - */ |
|
| 25 | - public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
| 19 | + /** |
|
| 20 | + * @param CommandHandlerInterface $command_handler |
|
| 21 | + * @param string $fqcn_for_command Fully Qualified ClassName for Command |
|
| 22 | + * @return void |
|
| 23 | + * @throws InvalidCommandHandlerException |
|
| 24 | + */ |
|
| 25 | + public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = ''); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @param CommandInterface $command |
|
| 31 | - * @param CommandBusInterface $command_bus |
|
| 32 | - * @return mixed |
|
| 33 | - */ |
|
| 34 | - public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
| 29 | + /** |
|
| 30 | + * @param CommandInterface $command |
|
| 31 | + * @param CommandBusInterface $command_bus |
|
| 32 | + * @return mixed |
|
| 33 | + */ |
|
| 34 | + public function getCommandHandler(CommandInterface $command, CommandBusInterface $command_bus = null); |
|
| 35 | 35 | |
| 36 | 36 | } |
| 37 | 37 | // End of file CommandHandlerManagerInterface.php |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use EventEspresso\core\services\commands\CommandInterface; |
| 6 | 6 | |
| 7 | 7 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 8 | - exit('No direct script access allowed'); |
|
| 8 | + exit('No direct script access allowed'); |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | interface CommandBusMiddlewareInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @param CommandInterface $command |
|
| 23 | - * @param Closure $next |
|
| 24 | - * @return mixed |
|
| 25 | - */ |
|
| 26 | - public function handle(CommandInterface $command, Closure $next); |
|
| 21 | + /** |
|
| 22 | + * @param CommandInterface $command |
|
| 23 | + * @param Closure $next |
|
| 24 | + * @return mixed |
|
| 25 | + */ |
|
| 26 | + public function handle(CommandInterface $command, Closure $next); |
|
| 27 | 27 | |
| 28 | 28 | } |
| 29 | 29 | // End of file CommandBusMiddlewareInterface.php |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | */ |
| 56 | 56 | public function handle(CommandInterface $command, Closure $next) |
| 57 | 57 | { |
| 58 | - if ( $command instanceof CommandRequiresCapCheckInterface) { |
|
| 58 | + if ($command instanceof CommandRequiresCapCheckInterface) { |
|
| 59 | 59 | $this->capabilities_checker->processCapCheck( |
| 60 | 60 | $command->getCapCheck() |
| 61 | 61 | ); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use EventEspresso\core\services\commands\CommandRequiresCapCheckInterface; |
| 8 | 8 | |
| 9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 10 | - exit('No direct script access allowed'); |
|
| 10 | + exit('No direct script access allowed'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | |
@@ -27,41 +27,41 @@ discard block |
||
| 27 | 27 | class CapChecker implements CommandBusMiddlewareInterface |
| 28 | 28 | { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @type CapabilitiesCheckerInterface $capabilities_checker |
|
| 32 | - */ |
|
| 33 | - private $capabilities_checker; |
|
| 30 | + /** |
|
| 31 | + * @type CapabilitiesCheckerInterface $capabilities_checker |
|
| 32 | + */ |
|
| 33 | + private $capabilities_checker; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * CapChecker constructor |
|
| 39 | - * |
|
| 40 | - * @param CapabilitiesCheckerInterface $capabilities_checker |
|
| 41 | - */ |
|
| 42 | - public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
| 43 | - { |
|
| 44 | - $this->capabilities_checker = $capabilities_checker; |
|
| 45 | - } |
|
| 37 | + /** |
|
| 38 | + * CapChecker constructor |
|
| 39 | + * |
|
| 40 | + * @param CapabilitiesCheckerInterface $capabilities_checker |
|
| 41 | + */ |
|
| 42 | + public function __construct(CapabilitiesCheckerInterface $capabilities_checker) |
|
| 43 | + { |
|
| 44 | + $this->capabilities_checker = $capabilities_checker; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param CommandInterface $command |
|
| 51 | - * @param Closure $next |
|
| 52 | - * @return mixed |
|
| 53 | - * @throws \EventEspresso\core\exceptions\InsufficientPermissionsException |
|
| 54 | - * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
| 55 | - */ |
|
| 56 | - public function handle(CommandInterface $command, Closure $next) |
|
| 57 | - { |
|
| 58 | - if ( $command instanceof CommandRequiresCapCheckInterface) { |
|
| 59 | - $this->capabilities_checker->processCapCheck( |
|
| 60 | - $command->getCapCheck() |
|
| 61 | - ); |
|
| 62 | - } |
|
| 63 | - return $next($command); |
|
| 64 | - } |
|
| 49 | + /** |
|
| 50 | + * @param CommandInterface $command |
|
| 51 | + * @param Closure $next |
|
| 52 | + * @return mixed |
|
| 53 | + * @throws \EventEspresso\core\exceptions\InsufficientPermissionsException |
|
| 54 | + * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
| 55 | + */ |
|
| 56 | + public function handle(CommandInterface $command, Closure $next) |
|
| 57 | + { |
|
| 58 | + if ( $command instanceof CommandRequiresCapCheckInterface) { |
|
| 59 | + $this->capabilities_checker->processCapCheck( |
|
| 60 | + $command->getCapCheck() |
|
| 61 | + ); |
|
| 62 | + } |
|
| 63 | + return $next($command); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | } |
@@ -20,24 +20,24 @@ |
||
| 20 | 20 | class AddActionHook implements CommandBusMiddlewareInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @param CommandInterface $command |
|
| 25 | - * @param Closure $next |
|
| 26 | - * @return mixed |
|
| 27 | - */ |
|
| 28 | - public function handle(CommandInterface $command, Closure $next) |
|
| 29 | - { |
|
| 30 | - do_action( |
|
| 31 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
| 32 | - $command |
|
| 33 | - ); |
|
| 34 | - $results = $next($command); |
|
| 35 | - do_action( |
|
| 36 | - 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
| 37 | - $command |
|
| 38 | - ); |
|
| 39 | - return $results; |
|
| 40 | - } |
|
| 23 | + /** |
|
| 24 | + * @param CommandInterface $command |
|
| 25 | + * @param Closure $next |
|
| 26 | + * @return mixed |
|
| 27 | + */ |
|
| 28 | + public function handle(CommandInterface $command, Closure $next) |
|
| 29 | + { |
|
| 30 | + do_action( |
|
| 31 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__before', |
|
| 32 | + $command |
|
| 33 | + ); |
|
| 34 | + $results = $next($command); |
|
| 35 | + do_action( |
|
| 36 | + 'AHEE__EventEspresso_core_services_commands_middleware_AddActionHook__handle__after', |
|
| 37 | + $command |
|
| 38 | + ); |
|
| 39 | + return $results; |
|
| 40 | + } |
|
| 41 | 41 | } |
| 42 | 42 | // End of file AddActionHook.php |
| 43 | 43 | // Location: EventEspresso\core\services\commands\middleware/AddActionHook.php |
| 44 | 44 | \ No newline at end of file |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EventEspresso\core\services\commands; |
| 4 | 4 | |
| 5 | -if (! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 6 | 6 | exit('No direct script access allowed'); |
| 7 | 7 | } |
| 8 | 8 | |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | namespace EventEspresso\core\services\commands; |
| 4 | 4 | |
| 5 | 5 | if (! defined('EVENT_ESPRESSO_VERSION')) { |
| 6 | - exit('No direct script access allowed'); |
|
| 6 | + exit('No direct script access allowed'); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | |
@@ -21,59 +21,59 @@ discard block |
||
| 21 | 21 | abstract class CompositeCommandHandler extends CommandHandler |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @type CommandBusInterface $command_bus |
|
| 26 | - */ |
|
| 27 | - private $command_bus; |
|
| 24 | + /** |
|
| 25 | + * @type CommandBusInterface $command_bus |
|
| 26 | + */ |
|
| 27 | + private $command_bus; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @type CommandFactoryInterface $command_factory |
|
| 31 | - */ |
|
| 32 | - private $command_factory; |
|
| 29 | + /** |
|
| 30 | + * @type CommandFactoryInterface $command_factory |
|
| 31 | + */ |
|
| 32 | + private $command_factory; |
|
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * CompositeCommandHandler constructor. |
|
| 38 | - * |
|
| 39 | - * @param CommandBusInterface $command_bus |
|
| 40 | - * @param CommandFactoryInterface $command_factory |
|
| 41 | - */ |
|
| 42 | - public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory) |
|
| 43 | - { |
|
| 44 | - $this->command_bus = $command_bus; |
|
| 45 | - $this->command_factory = $command_factory; |
|
| 46 | - } |
|
| 36 | + /** |
|
| 37 | + * CompositeCommandHandler constructor. |
|
| 38 | + * |
|
| 39 | + * @param CommandBusInterface $command_bus |
|
| 40 | + * @param CommandFactoryInterface $command_factory |
|
| 41 | + */ |
|
| 42 | + public function __construct(CommandBusInterface $command_bus, CommandFactoryInterface $command_factory) |
|
| 43 | + { |
|
| 44 | + $this->command_bus = $command_bus; |
|
| 45 | + $this->command_factory = $command_factory; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @param CommandBusInterface $command_bus |
|
| 52 | - */ |
|
| 53 | - public function setCommandBus(CommandBusInterface $command_bus) |
|
| 54 | - { |
|
| 55 | - $this->command_bus = $command_bus; |
|
| 56 | - } |
|
| 50 | + /** |
|
| 51 | + * @param CommandBusInterface $command_bus |
|
| 52 | + */ |
|
| 53 | + public function setCommandBus(CommandBusInterface $command_bus) |
|
| 54 | + { |
|
| 55 | + $this->command_bus = $command_bus; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return CommandBusInterface |
|
| 62 | - */ |
|
| 63 | - public function commandBus() |
|
| 64 | - { |
|
| 65 | - return $this->command_bus; |
|
| 66 | - } |
|
| 60 | + /** |
|
| 61 | + * @return CommandBusInterface |
|
| 62 | + */ |
|
| 63 | + public function commandBus() |
|
| 64 | + { |
|
| 65 | + return $this->command_bus; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @return CommandFactoryInterface |
|
| 72 | - */ |
|
| 73 | - public function commandFactory() |
|
| 74 | - { |
|
| 75 | - return $this->command_factory; |
|
| 76 | - } |
|
| 70 | + /** |
|
| 71 | + * @return CommandFactoryInterface |
|
| 72 | + */ |
|
| 73 | + public function commandFactory() |
|
| 74 | + { |
|
| 75 | + return $this->command_factory; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
@@ -14,72 +14,72 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | abstract class ConstantsAbstract |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * Equivalent to `__FILE__` for main plugin file. |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 21 | - private static $plugin_file =''; |
|
| 22 | - |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * String indicating version for plugin |
|
| 26 | - * @var string |
|
| 27 | - */ |
|
| 28 | - private static $version = ''; |
|
| 29 | - |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Initializes internal static properties. |
|
| 33 | - * @param $plugin_file |
|
| 34 | - * @param $version |
|
| 35 | - */ |
|
| 36 | - public static function init($plugin_file, $version) |
|
| 37 | - { |
|
| 38 | - self::$plugin_file = $plugin_file; |
|
| 39 | - self::$version = $version; |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * @return string |
|
| 45 | - */ |
|
| 46 | - public static function pluginFile() |
|
| 47 | - { |
|
| 48 | - return self::$plugin_file; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @return string |
|
| 53 | - */ |
|
| 54 | - public static function pluginBasename() |
|
| 55 | - { |
|
| 56 | - return plugin_basename(self::$plugin_file); |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - public static function pluginPath() |
|
| 63 | - { |
|
| 64 | - return plugin_dir_path(self::$plugin_file); |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return string |
|
| 70 | - */ |
|
| 71 | - public static function pluginUrl() |
|
| 72 | - { |
|
| 73 | - return plugin_dir_url(self::$plugin_file); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @return string |
|
| 79 | - */ |
|
| 80 | - public static function version() |
|
| 81 | - { |
|
| 82 | - return self::$version; |
|
| 83 | - } |
|
| 17 | + /** |
|
| 18 | + * Equivalent to `__FILE__` for main plugin file. |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | + private static $plugin_file =''; |
|
| 22 | + |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * String indicating version for plugin |
|
| 26 | + * @var string |
|
| 27 | + */ |
|
| 28 | + private static $version = ''; |
|
| 29 | + |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Initializes internal static properties. |
|
| 33 | + * @param $plugin_file |
|
| 34 | + * @param $version |
|
| 35 | + */ |
|
| 36 | + public static function init($plugin_file, $version) |
|
| 37 | + { |
|
| 38 | + self::$plugin_file = $plugin_file; |
|
| 39 | + self::$version = $version; |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @return string |
|
| 45 | + */ |
|
| 46 | + public static function pluginFile() |
|
| 47 | + { |
|
| 48 | + return self::$plugin_file; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @return string |
|
| 53 | + */ |
|
| 54 | + public static function pluginBasename() |
|
| 55 | + { |
|
| 56 | + return plugin_basename(self::$plugin_file); |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + public static function pluginPath() |
|
| 63 | + { |
|
| 64 | + return plugin_dir_path(self::$plugin_file); |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return string |
|
| 70 | + */ |
|
| 71 | + public static function pluginUrl() |
|
| 72 | + { |
|
| 73 | + return plugin_dir_url(self::$plugin_file); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @return string |
|
| 79 | + */ |
|
| 80 | + public static function version() |
|
| 81 | + { |
|
| 82 | + return self::$version; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | 85 | } |
| 86 | 86 | \ No newline at end of file |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * Equivalent to `__FILE__` for main plugin file. |
| 19 | 19 | * @var string |
| 20 | 20 | */ |
| 21 | - private static $plugin_file =''; |
|
| 21 | + private static $plugin_file = ''; |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -20,26 +20,26 @@ |
||
| 20 | 20 | interface CapabilitiesCheckerInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
| 25 | - * If any of the individual capability checks fails, then the command will NOT be executed. |
|
| 26 | - * |
|
| 27 | - * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
| 28 | - * @return bool |
|
| 29 | - * @throws InvalidClassException |
|
| 30 | - * @throws InsufficientPermissionsException |
|
| 31 | - */ |
|
| 32 | - public function processCapCheck($cap_check); |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
| 38 | - * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
| 39 | - * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
| 40 | - * @return bool |
|
| 41 | - * @throws InsufficientPermissionsException |
|
| 42 | - * @throws InvalidClassException |
|
| 43 | - */ |
|
| 44 | - public function process($capability, $context, $ID = 0); |
|
| 23 | + /** |
|
| 24 | + * Verifies that the current user has ALL of the capabilities listed in the CapCheck DTO. |
|
| 25 | + * If any of the individual capability checks fails, then the command will NOT be executed. |
|
| 26 | + * |
|
| 27 | + * @param CapCheckInterface|CapCheckInterface[] $cap_check |
|
| 28 | + * @return bool |
|
| 29 | + * @throws InvalidClassException |
|
| 30 | + * @throws InsufficientPermissionsException |
|
| 31 | + */ |
|
| 32 | + public function processCapCheck($cap_check); |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param string $capability - the capability to be checked, like: 'ee_edit_registrations' |
|
| 38 | + * @param string $context - what the user is attempting to do, like: 'Edit Registration' |
|
| 39 | + * @param int $ID - (optional) ID for item where current_user_can is being called from |
|
| 40 | + * @return bool |
|
| 41 | + * @throws InsufficientPermissionsException |
|
| 42 | + * @throws InvalidClassException |
|
| 43 | + */ |
|
| 44 | + public function process($capability, $context, $ID = 0); |
|
| 45 | 45 | } |