Passed
Branch master (17122c)
by Mehul
08:20 queued 03:53
created
Category
includes/admin/settings.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @return array
22 22
  */
23
-function paiementpro4give_register_section( $sections ) {
24
-	$sections['paiementpro'] = __( 'PaiementPro', 'paiementpro4give-for-give' );
23
+function paiementpro4give_register_section($sections) {
24
+	$sections['paiementpro'] = __('PaiementPro', 'paiementpro4give-for-give');
25 25
 
26 26
 	return $sections;
27 27
 }
28 28
 
29
-add_filter( 'give_get_sections_gateways', 'paiementpro4give_register_section' );
29
+add_filter('give_get_sections_gateways', 'paiementpro4give_register_section');
30 30
 
31 31
 /**
32 32
  * Register Admin Settings.
@@ -38,33 +38,33 @@  discard block
 block discarded – undo
38 38
  *
39 39
  * @return array
40 40
  */
41
-function paiementpro4give_register_settings( $settings ) {
41
+function paiementpro4give_register_settings($settings) {
42 42
 
43 43
 	$current_section = give_get_current_setting_section();
44 44
 
45
-	switch ( $current_section ) {
45
+	switch ($current_section) {
46 46
 		case 'paiementpro':
47 47
 			$settings = array(
48 48
 				array(
49 49
 					'type' => 'title',
50 50
 					'id'   => 'give_title_gateway_settings_paiementpro',
51
-					'desc' => esc_html__( 'This plugin does not support test mode. So, please process the donations with LIVE mode.', 'paiementpro-for-give' ),
51
+					'desc' => esc_html__('This plugin does not support test mode. So, please process the donations with LIVE mode.', 'paiementpro-for-give'),
52 52
 				),
53 53
 				array(
54
-					'name' => esc_html__( 'Merchant ID', 'paiementpro-for-give' ),
55
-					'desc' => esc_html__( 'Please enter the Merchant ID from your PaiementPro account.', 'paiementpro-for-give' ),
54
+					'name' => esc_html__('Merchant ID', 'paiementpro-for-give'),
55
+					'desc' => esc_html__('Please enter the Merchant ID from your PaiementPro account.', 'paiementpro-for-give'),
56 56
 					'id'   => 'paiementpro_live_merchant_id',
57 57
 					'type' => 'text',
58 58
 				),
59 59
 				array(
60
-					'name' => esc_html__( 'Credential ID', 'paiementpro-for-give' ),
61
-					'desc' => esc_html__( 'Please enter the Credential ID from your PaiementPro account.', 'paiementpro-for-give' ),
60
+					'name' => esc_html__('Credential ID', 'paiementpro-for-give'),
61
+					'desc' => esc_html__('Please enter the Credential ID from your PaiementPro account.', 'paiementpro-for-give'),
62 62
 					'id'   => 'paiementpro_live_credential_id',
63 63
 					'type' => 'text',
64 64
 				),
65 65
 				array(
66
-					'name' => esc_html__( 'API URL', 'paiementpro-for-give' ),
67
-					'desc' => esc_html__( 'Please enter the API URL from your PaiementPro account.', 'paiementpro-for-give' ),
66
+					'name' => esc_html__('API URL', 'paiementpro-for-give'),
67
+					'desc' => esc_html__('Please enter the API URL from your PaiementPro account.', 'paiementpro-for-give'),
68 68
 					'id'   => 'paiementpro_live_api_url',
69 69
 					'type' => 'text',
70 70
 				),
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	return $settings;
79 79
 }
80 80
 
81
-add_filter( 'give_get_settings_gateways', 'paiementpro4give_register_settings' );
81
+add_filter('give_get_settings_gateways', 'paiementpro4give_register_settings');
82 82
 
83 83
 /**
84 84
  * This function is used to add settings page link on plugins page.
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
  *
91 91
  * @return array
92 92
  */
93
-function paiementpro4give_add_plugin_links( $links ) {
93
+function paiementpro4give_add_plugin_links($links) {
94 94
 
95 95
 	$links['settings'] = sprintf(
96 96
 		'<a href="%1$s">%2$s</a>',
97
-		esc_url_raw( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paiementpro' ) ),
98
-		__( 'Settings', 'paiementpro-for-give' )
97
+		esc_url_raw(admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paiementpro')),
98
+		__('Settings', 'paiementpro-for-give')
99 99
 	);
100 100
 
101
-	asort( $links );
101
+	asort($links);
102 102
 
103 103
 	return $links;
104 104
 }
105 105
 
106
-add_filter( 'plugin_action_links_' . MGMFG_PLUGIN_BASENAME, 'paiementpro4give_add_plugin_links' );
106
+add_filter('plugin_action_links_' . MGMFG_PLUGIN_BASENAME, 'paiementpro4give_add_plugin_links');
Please login to merge, or discard this patch.
includes/filters.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,28 +6,28 @@
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13
-function paiementpro4give_register_gateway( $gateways ) {
13
+function paiementpro4give_register_gateway($gateways) {
14 14
 
15 15
 	$gateways['paiementpro_mtn_money'] = [
16
-		'admin_label'    => esc_html__( 'PaiementPro - MTN Money', 'paiementpro-for-give' ),
17
-		'checkout_label' => esc_html__( 'MTN Money', 'paiementpro-for-give' ),
16
+		'admin_label'    => esc_html__('PaiementPro - MTN Money', 'paiementpro-for-give'),
17
+		'checkout_label' => esc_html__('MTN Money', 'paiementpro-for-give'),
18 18
 	];
19 19
 
20 20
 	$gateways['paiementpro_moov_money'] = [
21
-		'admin_label'    => esc_html__( 'PaiementPro - Moov Money', 'paiementpro-for-give' ),
22
-		'checkout_label' => esc_html__( 'Moov Money', 'paiementpro-for-give' ),
21
+		'admin_label'    => esc_html__('PaiementPro - Moov Money', 'paiementpro-for-give'),
22
+		'checkout_label' => esc_html__('Moov Money', 'paiementpro-for-give'),
23 23
 	];
24 24
 
25 25
 	$gateways['paiementpro_orange_money'] = [
26
-		'admin_label'    => esc_html__( 'PaiementPro - Orange Money', 'paiementpro-for-give' ),
27
-		'checkout_label' => esc_html__( 'Orange Money', 'paiementpro-for-give' ),
26
+		'admin_label'    => esc_html__('PaiementPro - Orange Money', 'paiementpro-for-give'),
27
+		'checkout_label' => esc_html__('Orange Money', 'paiementpro-for-give'),
28 28
 	];
29 29
 
30 30
 	return $gateways;
31 31
 }
32 32
 
33
-add_filter( 'give_payment_gateways', 'paiementpro4give_register_gateway' );
34 33
\ No newline at end of file
34
+add_filter('give_payment_gateways', 'paiementpro4give_register_gateway');
35 35
\ No newline at end of file
Please login to merge, or discard this patch.
includes/helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  * @return string
19 19
  */
20 20
 function paiementpro4give_get_merchant_id() {
21
-	return give_get_option( 'paiementpro_live_merchant_id' );
21
+	return give_get_option('paiementpro_live_merchant_id');
22 22
 }
23 23
 
24 24
 /**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  * @return string
30 30
  */
31 31
 function paiementpro4give_get_credential_id() {
32
-	return give_get_option( 'paiementpro_live_credential_id' );
32
+	return give_get_option('paiementpro_live_credential_id');
33 33
 }
34 34
 
35 35
 /**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  * @return string
41 41
  */
42 42
 function paiementpro4give_get_api_url() {
43
-	return give_get_option( 'paiementpro_live_api_url' );
43
+	return give_get_option('paiementpro_live_api_url');
44 44
 }
45 45
 
46 46
 /**
Please login to merge, or discard this patch.
includes/actions.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function paiementpro4give_verify_payment() {
21 21
 
22
-	$getData       = give_clean( $_GET );
23
-	$donationId    = ! empty( $getData['order_id'] ) ? $getData['order_id'] : false;
24
-	$transactionId = ! empty( $getData['pp_status'] ) ? $getData['pp_status'] : '';
22
+	$getData       = give_clean($_GET);
23
+	$donationId    = ! empty($getData['order_id']) ? $getData['order_id'] : false;
24
+	$transactionId = ! empty($getData['pp_status']) ? $getData['pp_status'] : '';
25 25
 
26 26
 	// Bailout, if donation id not received from paiementpro gateway.
27
-	if ( ! $donationId ) {
27
+	if ( ! $donationId) {
28 28
 		return;
29 29
 	}
30 30
 
31
-	$donationGateway   = give_get_payment_gateway( $donationId );
31
+	$donationGateway   = give_get_payment_gateway($donationId);
32 32
 	$supportedGateways = paiementpro4give_get_supported_payment_methods();
33 33
 
34 34
 	// Bailout, if not `$donationGateway` payment gateway.
35
-	if ( ! in_array( $donationGateway, $supportedGateways, true ) ) {
35
+	if ( ! in_array($donationGateway, $supportedGateways, true)) {
36 36
 		return;
37 37
 	}
38 38
 
39 39
 	$credentialId  = paiementpro4give_get_credential_id();
40 40
 	$merchantId    = paiementpro4give_get_merchant_id();
41
-	$successStatus = sha1("{$donationId}success{$merchantId}{$credentialId}" );
41
+	$successStatus = sha1("{$donationId}success{$merchantId}{$credentialId}");
42 42
 
43 43
 	// Success, if transaction id exists, else failed.
44
-	if ( ! empty( $transactionId ) && $transactionId === $successStatus ) {
45
-		give_update_payment_status( $donationId, 'publish' );
44
+	if ( ! empty($transactionId) && $transactionId === $successStatus) {
45
+		give_update_payment_status($donationId, 'publish');
46 46
 	} else {
47
-		give_update_payment_status( $donationId, 'failed' );
47
+		give_update_payment_status($donationId, 'failed');
48 48
 	}
49 49
 }
50 50
 
51
-add_action( 'init', 'paiementpro4give_verify_payment' );
52 51
\ No newline at end of file
52
+add_action('init', 'paiementpro4give_verify_payment');
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
includes/payment-methods/class-paiementpro4give-moov-money.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 class PaiementPro4Give_Moov_Money {
14 14
 	public function __construct() {
15
-		add_action( 'give_gateway_paiementpro_moov_money', [ $this, 'process_donation' ] );
16
-		add_action( 'give_paiementpro_moov_money_cc_form', '__return_false' );
15
+		add_action('give_gateway_paiementpro_moov_money', [$this, 'process_donation']);
16
+		add_action('give_paiementpro_moov_money_cc_form', '__return_false');
17 17
 	}
18 18
 
19
-	public function process_donation( $data ) {
19
+	public function process_donation($data) {
20 20
 		// Check for any stored errors.
21 21
 		$errors = give_get_errors();
22 22
 
23
-		if ( ! $errors ) {
23
+		if ( ! $errors) {
24 24
 
25
-			$form_id         = ! empty( $data['post_data']['give-form-id'] ) ? intval( $data['post_data']['give-form-id'] ) : false;
26
-			$first_name      = ! empty( $data['post_data']['give_first'] ) ? $data['post_data']['give_first'] : '';
27
-			$last_name       = ! empty( $data['post_data']['give_last'] ) ? $data['post_data']['give_last'] : '';
28
-			$email           = ! empty( $data['post_data']['give_email'] ) ? $data['post_data']['give_email'] : '';
29
-			$donation_key    = ! empty( $data['purchase_key'] ) ? $data['purchase_key'] : '';
30
-			$currency        = give_get_currency( $form_id );
25
+			$form_id         = ! empty($data['post_data']['give-form-id']) ? intval($data['post_data']['give-form-id']) : false;
26
+			$first_name      = ! empty($data['post_data']['give_first']) ? $data['post_data']['give_first'] : '';
27
+			$last_name       = ! empty($data['post_data']['give_last']) ? $data['post_data']['give_last'] : '';
28
+			$email           = ! empty($data['post_data']['give_email']) ? $data['post_data']['give_email'] : '';
29
+			$donation_key    = ! empty($data['purchase_key']) ? $data['purchase_key'] : '';
30
+			$currency        = give_get_currency($form_id);
31 31
 
32 32
 			// Setup the donation details.
33 33
 			$data_to_send = array(
34 34
 				'price'           => $data['price'],
35 35
 				'give_form_title' => $data['post_data']['give-form-title'],
36 36
 				'give_form_id'    => $form_id,
37
-				'give_price_id'   => isset( $data['post_data']['give-price-id'] ) ? $data['post_data']['give-price-id'] : '',
37
+				'give_price_id'   => isset($data['post_data']['give-price-id']) ? $data['post_data']['give-price-id'] : '',
38 38
 				'date'            => $data['date'],
39 39
 				'user_email'      => $email,
40 40
 				'purchase_key'    => $data['purchase_key'],
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 			);
46 46
 
47 47
 			// Record the pending payment.
48
-			$donation_id = give_insert_payment( $data_to_send );
48
+			$donation_id = give_insert_payment($data_to_send);
49 49
 
50 50
 			// Verify donation payment.
51
-			if ( ! $donation_id ) {
51
+			if ( ! $donation_id) {
52 52
 
53 53
 				// Record the error.
54 54
 				give_record_gateway_error(
55
-					__( 'Payment Error', 'paiementpro-for-give' ),
55
+					__('Payment Error', 'paiementpro-for-give'),
56 56
 					sprintf(
57 57
 					/* translators: %s: payment data */
58
-						__( 'Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give' ),
59
-						wp_json_encode( $data )
58
+						__('Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give'),
59
+						wp_json_encode($data)
60 60
 					),
61 61
 					$donation_id
62 62
 				);
63 63
 
64 64
 				// Problems? Send back.
65
-				give_send_back_to_checkout( '?payment-mode=' . $data['post_data']['payment-mode'] );
65
+				give_send_back_to_checkout('?payment-mode=' . $data['post_data']['payment-mode']);
66 66
 			}
67 67
 
68 68
 			// Auto set payment to abandoned in one hour if donor is not able to donate in that time.
69
-			wp_schedule_single_event( current_time( 'timestamp', 1 ) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [ $donation_id ] );
69
+			wp_schedule_single_event(current_time('timestamp', 1) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [$donation_id]);
70 70
 
71 71
 
72 72
 			$url         = paiementpro4give_get_api_url();
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 					'phone_mobile'    => '9876543210',
89 89
 					'referenceNumber' => $donation_key,
90 90
 					'notificationURL' => give_get_success_page_uri(),
91
-					'returnContext'   => wp_json_encode( [
91
+					'returnContext'   => wp_json_encode([
92 92
 						'id_order' => $donation_id,
93
-					] ),
93
+					]),
94 94
 				],
95 95
 			];
96
-			$response     = wp_remote_post( "{$url}init2.php", $args );
97
-			$responseBody = wp_remote_retrieve_body( $response );
98
-			$responseCode = wp_remote_retrieve_response_code( $response );
96
+			$response     = wp_remote_post("{$url}init2.php", $args);
97
+			$responseBody = wp_remote_retrieve_body($response);
98
+			$responseCode = wp_remote_retrieve_response_code($response);
99 99
 
100
-			if ( 200 === $responseCode ) {
100
+			if (200 === $responseCode) {
101 101
 
102
-				$responseBodyParts = explode( '|', $responseBody );
102
+				$responseBodyParts = explode('|', $responseBody);
103 103
 				$sessionId         = $responseBodyParts[1];
104 104
 
105 105
 				$redirect_to_url = add_query_arg(
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 
113 113
 			} else {
114 114
 				// Send user to failed page and change donation status to failed as well.
115
-				give_update_payment_status( $donation_id, 'failed' );
115
+				give_update_payment_status($donation_id, 'failed');
116 116
 				$redirect_to_url = give_get_failed_transaction_uri();
117 117
 			}
118 118
 
119
-			wp_redirect( $redirect_to_url );
119
+			wp_redirect($redirect_to_url);
120 120
 			give_die();
121 121
 		}
122 122
 	}
Please login to merge, or discard this patch.
includes/payment-methods/class-paiementpro4give-mtn-money.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 class PaiementPro4Give_MTN_Money {
14 14
 	public function __construct() {
15
-		add_action( 'give_gateway_paiementpro_mtn_money', [ $this, 'process_donation' ] );
16
-		add_action( 'give_paiementpro_mtn_money_cc_form', '__return_false' );
15
+		add_action('give_gateway_paiementpro_mtn_money', [$this, 'process_donation']);
16
+		add_action('give_paiementpro_mtn_money_cc_form', '__return_false');
17 17
 	}
18 18
 
19
-	public function process_donation( $data ) {
19
+	public function process_donation($data) {
20 20
 		// Check for any stored errors.
21 21
 		$errors = give_get_errors();
22 22
 
23
-		if ( ! $errors ) {
23
+		if ( ! $errors) {
24 24
 
25
-			$form_id         = ! empty( $data['post_data']['give-form-id'] ) ? intval( $data['post_data']['give-form-id'] ) : false;
26
-			$first_name      = ! empty( $data['post_data']['give_first'] ) ? $data['post_data']['give_first'] : '';
27
-			$last_name       = ! empty( $data['post_data']['give_last'] ) ? $data['post_data']['give_last'] : '';
28
-			$email           = ! empty( $data['post_data']['give_email'] ) ? $data['post_data']['give_email'] : '';
29
-			$donation_key    = ! empty( $data['purchase_key'] ) ? $data['purchase_key'] : '';
30
-			$currency        = give_get_currency( $form_id );
25
+			$form_id         = ! empty($data['post_data']['give-form-id']) ? intval($data['post_data']['give-form-id']) : false;
26
+			$first_name      = ! empty($data['post_data']['give_first']) ? $data['post_data']['give_first'] : '';
27
+			$last_name       = ! empty($data['post_data']['give_last']) ? $data['post_data']['give_last'] : '';
28
+			$email           = ! empty($data['post_data']['give_email']) ? $data['post_data']['give_email'] : '';
29
+			$donation_key    = ! empty($data['purchase_key']) ? $data['purchase_key'] : '';
30
+			$currency        = give_get_currency($form_id);
31 31
 
32 32
 			// Setup the donation details.
33 33
 			$data_to_send = array(
34 34
 				'price'           => $data['price'],
35 35
 				'give_form_title' => $data['post_data']['give-form-title'],
36 36
 				'give_form_id'    => $form_id,
37
-				'give_price_id'   => isset( $data['post_data']['give-price-id'] ) ? $data['post_data']['give-price-id'] : '',
37
+				'give_price_id'   => isset($data['post_data']['give-price-id']) ? $data['post_data']['give-price-id'] : '',
38 38
 				'date'            => $data['date'],
39 39
 				'user_email'      => $email,
40 40
 				'purchase_key'    => $data['purchase_key'],
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 			);
46 46
 
47 47
 			// Record the pending payment.
48
-			$donation_id = give_insert_payment( $data_to_send );
48
+			$donation_id = give_insert_payment($data_to_send);
49 49
 
50 50
 			// Verify donation payment.
51
-			if ( ! $donation_id ) {
51
+			if ( ! $donation_id) {
52 52
 
53 53
 				// Record the error.
54 54
 				give_record_gateway_error(
55
-					__( 'Payment Error', 'paiementpro-for-give' ),
55
+					__('Payment Error', 'paiementpro-for-give'),
56 56
 					sprintf(
57 57
 					/* translators: %s: payment data */
58
-						__( 'Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give' ),
59
-						wp_json_encode( $data )
58
+						__('Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give'),
59
+						wp_json_encode($data)
60 60
 					),
61 61
 					$donation_id
62 62
 				);
63 63
 
64 64
 				// Problems? Send back.
65
-				give_send_back_to_checkout( '?payment-mode=' . $data['post_data']['payment-mode'] );
65
+				give_send_back_to_checkout('?payment-mode=' . $data['post_data']['payment-mode']);
66 66
 			}
67 67
 
68 68
 			// Auto set payment to abandoned in one hour if donor is not able to donate in that time.
69
-			wp_schedule_single_event( current_time( 'timestamp', 1 ) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [ $donation_id ] );
69
+			wp_schedule_single_event(current_time('timestamp', 1) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [$donation_id]);
70 70
 
71 71
 
72 72
 			$url         = paiementpro4give_get_api_url();
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 					'phone_mobile'    => '9876543210',
89 89
 					'referenceNumber' => $donation_key,
90 90
 					'notificationURL' => give_get_success_page_uri(),
91
-					'returnContext'   => wp_json_encode( [
91
+					'returnContext'   => wp_json_encode([
92 92
 						'id_order' => $donation_id,
93
-					] ),
93
+					]),
94 94
 				],
95 95
 			];
96
-			$response     = wp_remote_post( "{$url}init2.php", $args );
97
-			$responseBody = wp_remote_retrieve_body( $response );
98
-			$responseCode = wp_remote_retrieve_response_code( $response );
96
+			$response     = wp_remote_post("{$url}init2.php", $args);
97
+			$responseBody = wp_remote_retrieve_body($response);
98
+			$responseCode = wp_remote_retrieve_response_code($response);
99 99
 
100
-			if ( 200 === $responseCode ) {
100
+			if (200 === $responseCode) {
101 101
 
102
-				$responseBodyParts = explode( '|', $responseBody );
102
+				$responseBodyParts = explode('|', $responseBody);
103 103
 				$sessionId         = $responseBodyParts[1];
104 104
 
105 105
 				$redirect_to_url = add_query_arg(
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 
113 113
 			} else {
114 114
 				// Send user to failed page and change donation status to failed as well.
115
-				give_update_payment_status( $donation_id, 'failed' );
115
+				give_update_payment_status($donation_id, 'failed');
116 116
 				$redirect_to_url = give_get_failed_transaction_uri();
117 117
 			}
118 118
 
119
-			wp_redirect( $redirect_to_url );
119
+			wp_redirect($redirect_to_url);
120 120
 			give_die();
121 121
 		}
122 122
 	}
Please login to merge, or discard this patch.
includes/payment-methods/class-paiementpro4give-orange-money.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,35 +6,35 @@  discard block
 block discarded – undo
6 6
  */
7 7
 
8 8
 // Bailout, if accessed directly.
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13 13
 class PaiementPro4Give_Orange_Money {
14 14
 	public function __construct() {
15
-		add_action( 'give_gateway_paiementpro_orange_money', [ $this, 'process_donation' ] );
16
-		add_action( 'give_paiementpro_orange_money_cc_form', '__return_false' );
15
+		add_action('give_gateway_paiementpro_orange_money', [$this, 'process_donation']);
16
+		add_action('give_paiementpro_orange_money_cc_form', '__return_false');
17 17
 	}
18 18
 
19
-	public function process_donation( $data ) {
19
+	public function process_donation($data) {
20 20
 		// Check for any stored errors.
21 21
 		$errors = give_get_errors();
22 22
 
23
-		if ( ! $errors ) {
23
+		if ( ! $errors) {
24 24
 
25
-			$form_id         = ! empty( $data['post_data']['give-form-id'] ) ? intval( $data['post_data']['give-form-id'] ) : false;
26
-			$first_name      = ! empty( $data['post_data']['give_first'] ) ? $data['post_data']['give_first'] : '';
27
-			$last_name       = ! empty( $data['post_data']['give_last'] ) ? $data['post_data']['give_last'] : '';
28
-			$email           = ! empty( $data['post_data']['give_email'] ) ? $data['post_data']['give_email'] : '';
29
-			$donation_key    = ! empty( $data['purchase_key'] ) ? $data['purchase_key'] : '';
30
-			$currency        = give_get_currency( $form_id );
25
+			$form_id         = ! empty($data['post_data']['give-form-id']) ? intval($data['post_data']['give-form-id']) : false;
26
+			$first_name      = ! empty($data['post_data']['give_first']) ? $data['post_data']['give_first'] : '';
27
+			$last_name       = ! empty($data['post_data']['give_last']) ? $data['post_data']['give_last'] : '';
28
+			$email           = ! empty($data['post_data']['give_email']) ? $data['post_data']['give_email'] : '';
29
+			$donation_key    = ! empty($data['purchase_key']) ? $data['purchase_key'] : '';
30
+			$currency        = give_get_currency($form_id);
31 31
 
32 32
 			// Setup the donation details.
33 33
 			$data_to_send = array(
34 34
 				'price'           => $data['price'],
35 35
 				'give_form_title' => $data['post_data']['give-form-title'],
36 36
 				'give_form_id'    => $form_id,
37
-				'give_price_id'   => isset( $data['post_data']['give-price-id'] ) ? $data['post_data']['give-price-id'] : '',
37
+				'give_price_id'   => isset($data['post_data']['give-price-id']) ? $data['post_data']['give-price-id'] : '',
38 38
 				'date'            => $data['date'],
39 39
 				'user_email'      => $email,
40 40
 				'purchase_key'    => $data['purchase_key'],
@@ -45,28 +45,28 @@  discard block
 block discarded – undo
45 45
 			);
46 46
 
47 47
 			// Record the pending payment.
48
-			$donation_id = give_insert_payment( $data_to_send );
48
+			$donation_id = give_insert_payment($data_to_send);
49 49
 
50 50
 			// Verify donation payment.
51
-			if ( ! $donation_id ) {
51
+			if ( ! $donation_id) {
52 52
 
53 53
 				// Record the error.
54 54
 				give_record_gateway_error(
55
-					__( 'Payment Error', 'paiementpro-for-give' ),
55
+					__('Payment Error', 'paiementpro-for-give'),
56 56
 					sprintf(
57 57
 					/* translators: %s: payment data */
58
-						__( 'Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give' ),
59
-						wp_json_encode( $data )
58
+						__('Payment creation failed before processing payment via PaiementPro. Payment data: %s', 'paiementpro-for-give'),
59
+						wp_json_encode($data)
60 60
 					),
61 61
 					$donation_id
62 62
 				);
63 63
 
64 64
 				// Problems? Send back.
65
-				give_send_back_to_checkout( '?payment-mode=' . $data['post_data']['payment-mode'] );
65
+				give_send_back_to_checkout('?payment-mode=' . $data['post_data']['payment-mode']);
66 66
 			}
67 67
 
68 68
 			// Auto set payment to abandoned in one hour if donor is not able to donate in that time.
69
-			wp_schedule_single_event( current_time( 'timestamp', 1 ) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [ $donation_id ] );
69
+			wp_schedule_single_event(current_time('timestamp', 1) + HOUR_IN_SECONDS, 'paiementpro4give_set_donation_abandoned', [$donation_id]);
70 70
 
71 71
 
72 72
 			$url         = paiementpro4give_get_api_url();
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 					'phone_mobile'    => '9876543210',
89 89
 					'referenceNumber' => $donation_key,
90 90
 					'notificationURL' => give_get_success_page_uri(),
91
-					'returnContext'   => wp_json_encode( [
91
+					'returnContext'   => wp_json_encode([
92 92
 						'id_order' => $donation_id,
93
-					] ),
93
+					]),
94 94
 				],
95 95
 			];
96
-			$response     = wp_remote_post( "{$url}init2.php", $args );
97
-			$responseBody = wp_remote_retrieve_body( $response );
98
-			$responseCode = wp_remote_retrieve_response_code( $response );
96
+			$response     = wp_remote_post("{$url}init2.php", $args);
97
+			$responseBody = wp_remote_retrieve_body($response);
98
+			$responseCode = wp_remote_retrieve_response_code($response);
99 99
 
100
-			if ( 200 === $responseCode ) {
100
+			if (200 === $responseCode) {
101 101
 
102
-				$responseBodyParts = explode( '|', $responseBody );
102
+				$responseBodyParts = explode('|', $responseBody);
103 103
 				$sessionId         = $responseBodyParts[1];
104 104
 
105 105
 				$redirect_to_url = add_query_arg(
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 
113 113
 			} else {
114 114
 				// Send user to failed page and change donation status to failed as well.
115
-				give_update_payment_status( $donation_id, 'failed' );
115
+				give_update_payment_status($donation_id, 'failed');
116 116
 				$redirect_to_url = give_get_failed_transaction_uri();
117 117
 			}
118 118
 
119
-			wp_redirect( $redirect_to_url );
119
+			wp_redirect($redirect_to_url);
120 120
 			give_die();
121 121
 		}
122 122
 	}
Please login to merge, or discard this patch.
paiementpro-for-give.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
  * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
14 14
  */
15 15
 
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
20
-if ( ! class_exists( 'PaiementPro4Give' ) ) {
20
+if ( ! class_exists('PaiementPro4Give')) {
21 21
 
22 22
 	final class PaiementPro4Give {
23 23
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		 *
58 58
 		 */
59 59
 		static function get_instance() {
60
-			if ( null === static::$instance ) {
60
+			if (null === static::$instance) {
61 61
 				self::$instance = new self();
62 62
 				self::$instance->setup();
63 63
 			}
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 			$this->setup_constants();
80 80
 
81 81
 			// Give init hook.
82
-			add_action( 'plugins_loaded', [ $this, 'init' ], 101 );
83
-			add_action( 'admin_init', array( $this, 'check_environment' ), 999 );
84
-			add_action( 'admin_notices', array( $this, 'admin_notices' ), 15 );
82
+			add_action('plugins_loaded', [$this, 'init'], 101);
83
+			add_action('admin_init', array($this, 'check_environment'), 999);
84
+			add_action('admin_notices', array($this, 'admin_notices'), 15);
85 85
 		}
86 86
 
87 87
 		/**
@@ -94,28 +94,28 @@  discard block
 block discarded – undo
94 94
 		 */
95 95
 		public function setup_constants() {
96 96
 
97
-			if ( ! defined( 'PAIEMENTPRO4GIVE_VERSION' ) ) {
98
-				define( 'PAIEMENTPRO4GIVE_VERSION', '1.0.0' );
97
+			if ( ! defined('PAIEMENTPRO4GIVE_VERSION')) {
98
+				define('PAIEMENTPRO4GIVE_VERSION', '1.0.0');
99 99
 			}
100 100
 
101
-			if ( ! defined( 'PAIEMENTPRO4GIVE_MIN_GIVE_VER' ) ) {
102
-				define( 'PAIEMENTPRO4GIVE_MIN_GIVE_VER', '2.5.0' );
101
+			if ( ! defined('PAIEMENTPRO4GIVE_MIN_GIVE_VER')) {
102
+				define('PAIEMENTPRO4GIVE_MIN_GIVE_VER', '2.5.0');
103 103
 			}
104 104
 
105
-			if ( ! defined( 'PAIEMENTPRO4GIVE_PLUGIN_FILE' ) ) {
106
-				define( 'PAIEMENTPRO4GIVE_PLUGIN_FILE', __FILE__ );
105
+			if ( ! defined('PAIEMENTPRO4GIVE_PLUGIN_FILE')) {
106
+				define('PAIEMENTPRO4GIVE_PLUGIN_FILE', __FILE__);
107 107
 			}
108 108
 
109
-			if ( ! defined( 'PAIEMENTPRO4GIVE_PLUGIN_BASENAME' ) ) {
110
-				define( 'PAIEMENTPRO4GIVE_PLUGIN_BASENAME', plugin_basename( PAIEMENTPRO4GIVE_PLUGIN_FILE ) );
109
+			if ( ! defined('PAIEMENTPRO4GIVE_PLUGIN_BASENAME')) {
110
+				define('PAIEMENTPRO4GIVE_PLUGIN_BASENAME', plugin_basename(PAIEMENTPRO4GIVE_PLUGIN_FILE));
111 111
 			}
112 112
 
113
-			if ( ! defined( 'PAIEMENTPRO4GIVE_PLUGIN_DIR' ) ) {
114
-				define( 'PAIEMENTPRO4GIVE_PLUGIN_DIR', plugin_dir_path( PAIEMENTPRO4GIVE_PLUGIN_FILE ) );
113
+			if ( ! defined('PAIEMENTPRO4GIVE_PLUGIN_DIR')) {
114
+				define('PAIEMENTPRO4GIVE_PLUGIN_DIR', plugin_dir_path(PAIEMENTPRO4GIVE_PLUGIN_FILE));
115 115
 			}
116 116
 
117
-			if ( ! defined( 'PAIEMENTPRO4GIVE_PLUGIN_URL' ) ) {
118
-				define( 'PAIEMENTPRO4GIVE_PLUGIN_URL', plugin_dir_url( PAIEMENTPRO4GIVE_PLUGIN_FILE ) );
117
+			if ( ! defined('PAIEMENTPRO4GIVE_PLUGIN_URL')) {
118
+				define('PAIEMENTPRO4GIVE_PLUGIN_URL', plugin_dir_url(PAIEMENTPRO4GIVE_PLUGIN_FILE));
119 119
 			}
120 120
 		}
121 121
 
@@ -130,24 +130,24 @@  discard block
 block discarded – undo
130 130
 		public function load_textdomain() {
131 131
 
132 132
 			// Set filter for plugin's languages directory.
133
-			$lang_dir = dirname( PAIEMENTPRO4GIVE_PLUGIN_BASENAME ) . '/languages/';
134
-			$lang_dir = apply_filters( 'paiementpro4give_languages_directory', $lang_dir );
133
+			$lang_dir = dirname(PAIEMENTPRO4GIVE_PLUGIN_BASENAME) . '/languages/';
134
+			$lang_dir = apply_filters('paiementpro4give_languages_directory', $lang_dir);
135 135
 
136 136
 			// Traditional WordPress plugin locale filter.
137
-			$locale  = apply_filters( 'plugin_locale', get_locale(), 'paiementpro-for-give' );
138
-			$mo_file = sprintf( '%1$s-%2$s.mo', 'paiementpro-for-give', $locale );
137
+			$locale  = apply_filters('plugin_locale', get_locale(), 'paiementpro-for-give');
138
+			$mo_file = sprintf('%1$s-%2$s.mo', 'paiementpro-for-give', $locale);
139 139
 
140 140
 			// Setup paths to current locale file.
141 141
 			$local_mo_file  = $lang_dir . $mo_file;
142 142
 			$global_mo_file = WP_LANG_DIR . '/paiementpro-for-give/' . $mo_file;
143 143
 
144
-			if ( file_exists( $global_mo_file ) ) {
145
-				load_textdomain( 'paiementpro-for-give', $global_mo_file );
146
-			} elseif ( file_exists( $local_mo_file ) ) {
147
-				load_textdomain( 'paiementpro-for-give', $local_mo_file );
144
+			if (file_exists($global_mo_file)) {
145
+				load_textdomain('paiementpro-for-give', $global_mo_file);
146
+			} elseif (file_exists($local_mo_file)) {
147
+				load_textdomain('paiementpro-for-give', $local_mo_file);
148 148
 			} else {
149 149
 				// Load the default language files.
150
-				load_plugin_textdomain( 'paiementpro-for-give', false, $lang_dir );
150
+				load_plugin_textdomain('paiementpro-for-give', false, $lang_dir);
151 151
 			}
152 152
 
153 153
 		}
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		 */
163 163
 		public function init() {
164 164
 
165
-			if ( ! $this->get_environment_warning() ) {
165
+			if ( ! $this->get_environment_warning()) {
166 166
 				return;
167 167
 			}
168 168
 
@@ -192,17 +192,17 @@  discard block
 block discarded – undo
192 192
 			$is_working = true;
193 193
 
194 194
 			// Load plugin helper functions.
195
-			if ( ! function_exists( 'is_plugin_active' ) ) {
195
+			if ( ! function_exists('is_plugin_active')) {
196 196
 				require_once ABSPATH . '/wp-admin/includes/plugin.php';
197 197
 			}
198 198
 
199 199
 			/* Check to see if Give is activated, if it isn't deactivate and show a banner. */
200 200
 			// Check for if give plugin activate or not.
201
-			$is_give_active = defined( 'GIVE_PLUGIN_BASENAME' ) ? is_plugin_active( GIVE_PLUGIN_BASENAME ) : false;
201
+			$is_give_active = defined('GIVE_PLUGIN_BASENAME') ? is_plugin_active(GIVE_PLUGIN_BASENAME) : false;
202 202
 
203
-			if ( empty( $is_give_active ) ) {
203
+			if (empty($is_give_active)) {
204 204
 				// Show admin notice.
205
-				$this->add_admin_notice( 'prompt_give_activate', 'error', sprintf( __( '<strong>Activation Error:</strong> You must have the <a href="%s" target="_blank">Give</a> plugin installed and activated for "iPay88 for Give" to activate.', 'paiementpro-for-give' ), 'https://givewp.com' ) );
205
+				$this->add_admin_notice('prompt_give_activate', 'error', sprintf(__('<strong>Activation Error:</strong> You must have the <a href="%s" target="_blank">Give</a> plugin installed and activated for "iPay88 for Give" to activate.', 'paiementpro-for-give'), 'https://givewp.com'));
206 206
 				$is_working = false;
207 207
 			}
208 208
 
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 
224 224
 			// Verify dependency cases.
225 225
 			if (
226
-				defined( 'GIVE_VERSION' )
227
-				&& version_compare( GIVE_VERSION, PAIEMENTPRO4GIVE_MIN_GIVE_VER, '<' )
226
+				defined('GIVE_VERSION')
227
+				&& version_compare(GIVE_VERSION, PAIEMENTPRO4GIVE_MIN_GIVE_VER, '<')
228 228
 			) {
229 229
 
230 230
 				/* Min. Give. plugin version. */
231 231
 				// Show admin notice.
232
-				$this->add_admin_notice( 'prompt_give_incompatible', 'error', sprintf( __( '<strong>Activation Error:</strong> You must have the <a href="%s" target="_blank">Give</a> core version %s for the "iPay88 for Give" add-on to activate.', 'paiementpro-for-give' ), 'https://givewp.com', PAIEMENTPRO4GIVE_MIN_GIVE_VER ) );
232
+				$this->add_admin_notice('prompt_give_incompatible', 'error', sprintf(__('<strong>Activation Error:</strong> You must have the <a href="%s" target="_blank">Give</a> core version %s for the "iPay88 for Give" add-on to activate.', 'paiementpro-for-give'), 'https://givewp.com', PAIEMENTPRO4GIVE_MIN_GIVE_VER));
233 233
 
234 234
 				$is_working = false;
235 235
 			}
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
 		 * @since 1.0.0
248 248
 		 *
249 249
 		 */
250
-		public function add_admin_notice( $slug, $class, $message ) {
251
-			$this->notices[ $slug ] = array(
250
+		public function add_admin_notice($slug, $class, $message) {
251
+			$this->notices[$slug] = array(
252 252
 				'class'   => $class,
253 253
 				'message' => $message,
254 254
 			);
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 				'strong' => array(),
277 277
 			);
278 278
 
279
-			foreach ( (array) $this->notices as $notice_key => $notice ) {
280
-				echo "<div class='" . esc_attr( $notice['class'] ) . "'><p>";
281
-				echo wp_kses( $notice['message'], $allowed_tags );
279
+			foreach ((array) $this->notices as $notice_key => $notice) {
280
+				echo "<div class='" . esc_attr($notice['class']) . "'><p>";
281
+				echo wp_kses($notice['message'], $allowed_tags);
282 282
 				echo '</p></div>';
283 283
 			}
284 284
 
Please login to merge, or discard this patch.