Completed
Branch 2.0.0 (fb6d70)
by Jimmy
02:28
created
modules/emails/action/class-emails-action.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Emails Action Class.
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'admin_post_wps_copy_email_template', array( $this, 'callback_copy_email_template' ) );
30
+		add_action('admin_post_wps_copy_email_template', array($this, 'callback_copy_email_template'));
31 31
 
32
-		add_action( 'wps_email_order_details', array( $this, 'order_details' ) );
33
-		add_action( 'wps_email_order_details', array( $this, 'type_payment' ), 20, 1 );
32
+		add_action('wps_email_order_details', array($this, 'order_details'));
33
+		add_action('wps_email_order_details', array($this, 'type_payment'), 20, 1);
34 34
 	}
35 35
 
36 36
 	/**
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 	 * @since 2.0.0
40 40
 	 */
41 41
 	public function callback_copy_email_template() {
42
-		check_admin_referer( 'callback_copy_email_template' );
42
+		check_admin_referer('callback_copy_email_template');
43 43
 
44 44
 		$tab          = 'emails';
45
-		$section      = ! empty( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : '';
46
-		$email        = Emails::g()->emails[ $section ];
45
+		$section      = !empty($_GET['section']) ? sanitize_text_field($_GET['section']) : '';
46
+		$email        = Emails::g()->emails[$section];
47 47
 		$file_to_copy = \eoxia\Config_Util::$init['wpshop']->emails->path . '/view/' . $email['filename_template'];
48 48
 		$path         = get_template_directory() . '/wpshop/emails/view/' . $email['filename_template'];
49 49
 
50
-		if ( wp_mkdir_p( dirname( $path ) ) && ! file_exists( $path ) ) {
51
-			copy( $file_to_copy, $path );
50
+		if (wp_mkdir_p(dirname($path)) && !file_exists($path)) {
51
+			copy($file_to_copy, $path);
52 52
 		}
53 53
 
54
-		wp_redirect( admin_url( 'admin.php?page=wps-settings&tab= ' . $tab . '&section=' . $section ) );
54
+		wp_redirect(admin_url('admin.php?page=wps-settings&tab= ' . $tab . '&section=' . $section));
55 55
 	}
56 56
 
57 57
 	/**
@@ -64,29 +64,29 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param Order_Model $order Les données de la commande.
66 66
 	 */
67
-	public function order_details( $order ) {
67
+	public function order_details($order) {
68 68
 		$tva_lines = array();
69 69
 
70
-		if ( ! empty( $order->lines ) ) {
71
-			foreach ( $order->lines as &$line ) {
72
-				if ( empty( $tva_lines[ $line->tva_tx ] ) ) {
73
-					$tva_lines[ $line->tva_tx ] = 0;
70
+		if (!empty($order->lines)) {
71
+			foreach ($order->lines as &$line) {
72
+				if (empty($tva_lines[$line->tva_tx])) {
73
+					$tva_lines[$line->tva_tx] = 0;
74 74
 				}
75 75
 
76
-				$tva_lines[ $line->tva_tx ] += $line->total_tva;
76
+				$tva_lines[$line->tva_tx] += $line->total_tva;
77 77
 
78
-				$wp_product = Product::g()->get( array(
78
+				$wp_product = Product::g()->get(array(
79 79
 					'meta_key'   => '_external_id',
80
-					'meta_value' => (int) $line->fk_product,
81
-				), true );
80
+					'meta_value' => (int)$line->fk_product,
81
+				), true);
82 82
 
83 83
 				$line->wp_id = $wp_product->data['id'];
84 84
 			}
85 85
 		}
86 86
 
87
-		unset( $line );
87
+		unset($line);
88 88
 
89
-		include( Template_Util::get_template_part( 'emails', 'order-details' ) );
89
+		include(Template_Util::get_template_part('emails', 'order-details'));
90 90
 	}
91 91
 
92 92
 	/**
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @param Order_Model $order Les données de la commande.
101 101
 	 */
102
-	public function type_payment( $order ) {
103
-		$payment_methods = get_option( 'wps_payment_methods', Payment::g()->default_options );
102
+	public function type_payment($order) {
103
+		$payment_methods = get_option('wps_payment_methods', Payment::g()->default_options);
104 104
 
105
-		include( Template_Util::get_template_part( 'emails', 'type-payment' ) );
105
+		include(Template_Util::get_template_part('emails', 'type-payment'));
106 106
 	}
107 107
 }
108 108
 
Please login to merge, or discard this patch.
modules/doli-payment/class/class-doli-payment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
132 132
 	 *
133 133
 	 * @param  string $payment_method Méthode de paiement venant de Dolibarr.
134 134
 	 *
135
-	 * @return mixed                  Texte lisible ou null
135
+	 * @return string                  Texte lisible ou null
136 136
 	 */
137 137
 	public function convert_to_wp( $payment_method ) {
138 138
 		if ( empty( $payment_method ) ) {
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Doli Payment Class.
@@ -84,15 +84,15 @@  discard block
 block discarded – undo
84 84
 	 * @param stdClass $doli_payment  Les données de dolibarr.
85 85
 	 * @param Payment  $wp_payment    Les données de WP.
86 86
 	 */
87
-	public function doli_to_wp( $wp_invoice_id, $doli_payment, $wp_payment ) {
87
+	public function doli_to_wp($wp_invoice_id, $doli_payment, $wp_payment) {
88 88
 		$wp_payment->data['title']        = $doli_payment->ref;
89 89
 		$wp_payment->data['amount']       = $doli_payment->amount;
90 90
 		$wp_payment->data['date']         = $doli_payment->date;
91
-		$wp_payment->data['parent_id']    = (int) $wp_invoice_id;
91
+		$wp_payment->data['parent_id']    = (int)$wp_invoice_id;
92 92
 		$wp_payment->data['payment_type'] = $doli_payment->type;
93 93
 		$wp_payment->data['status']       = 'publish';
94 94
 
95
-		Doli_Payment::g()->update( $wp_payment->data );
95
+		Doli_Payment::g()->update($wp_payment->data);
96 96
 	}
97 97
 
98 98
 	/**
@@ -104,15 +104,15 @@  discard block
 block discarded – undo
104 104
 	 *
105 105
 	 * @return integer l'ID de dolibarr.
106 106
 	 */
107
-	public function convert_to_doli_id( $payment_method ) {
108
-		$payment_methods_option = get_option( 'wps_payment_methods', Payment::g()->default_options );
109
-		$method                 = $payment_methods_option[ $payment_method ];
107
+	public function convert_to_doli_id($payment_method) {
108
+		$payment_methods_option = get_option('wps_payment_methods', Payment::g()->default_options);
109
+		$method                 = $payment_methods_option[$payment_method];
110 110
 
111
-		$payment_types = Request_Util::get( 'setup/dictionary/payment_types' );
111
+		$payment_types = Request_Util::get('setup/dictionary/payment_types');
112 112
 
113
-		if ( ! empty( $payment_types ) ) {
114
-			foreach ( $payment_types as $element ) {
115
-				if ( $element->code == $method['doli_type'] ) {
113
+		if (!empty($payment_types)) {
114
+			foreach ($payment_types as $element) {
115
+				if ($element->code == $method['doli_type']) {
116 116
 					return $element->id;
117 117
 				}
118 118
 			}
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @return mixed                  Texte lisible ou null
132 132
 	 */
133
-	public function convert_to_wp( $payment_method ) {
134
-		if ( empty( $payment_method ) ) {
133
+	public function convert_to_wp($payment_method) {
134
+		if (empty($payment_method)) {
135 135
 			return '';
136 136
 		}
137 137
 
138
-		$payment_methods_option = get_option( 'wps_payment_methods', Payment::g()->default_options );
138
+		$payment_methods_option = get_option('wps_payment_methods', Payment::g()->default_options);
139 139
 
140
-		if ( 'CB' === $payment_method ) {
140
+		if ('CB' === $payment_method) {
141 141
 			return 'paypal';
142
-		} elseif ( 'STR' === $payment_method ) {
142
+		} elseif ('STR' === $payment_method) {
143 143
 			return 'stripe';
144
-		} elseif ( 'CHQ' === $payment_method ) {
144
+		} elseif ('CHQ' === $payment_method) {
145 145
 			return 'cheque';
146
-		} elseif ( 'LIQ' === $payment_method ) {
146
+		} elseif ('LIQ' === $payment_method) {
147 147
 			return 'espece';
148 148
 		}
149 149
 
Please login to merge, or discard this patch.
modules/third-parties/view/single.view.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,10 +24,12 @@
 block discarded – undo
24 24
 				\eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title-edit', array(
25 25
 					'third_party' => $third_party,
26 26
 				) );
27
-			else :
27
+			else {
28
+				:
28 29
 				\eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title', array(
29 30
 					'third_party' => $third_party,
30 31
 				) );
32
+			}
31 33
 			endif;
32 34
 			?>
33 35
 		</h2>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19 19
 <div class="wrap wpeo-wrap page-single">
20 20
 	<div class="page-header">
21 21
 		<h2>
22 22
 			<?php
23
-			if ( 0 === $third_party->data['id'] ) :
24
-				\eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title-edit', array(
23
+			if (0 === $third_party->data['id']) :
24
+				\eoxia\View_Util::exec('wpshop', 'third-parties', 'single-title-edit', array(
25 25
 					'third_party' => $third_party,
26
-				) );
26
+				));
27 27
 			else :
28
-				\eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title', array(
28
+				\eoxia\View_Util::exec('wpshop', 'third-parties', 'single-title', array(
29 29
 					'third_party' => $third_party,
30
-				) );
30
+				));
31 31
 			endif;
32 32
 			?>
33 33
 		</h2>
34 34
 	</div>
35 35
 
36 36
 	<div class="wps-page-content wpeo-gridlayout grid-6">
37
-		<?php do_action( 'wps_third_party', $third_party ); ?>
37
+		<?php do_action('wps_third_party', $third_party); ?>
38 38
 	</div>
39 39
 </div>
Please login to merge, or discard this patch.
modules/third-parties/view/metaboxes/metabox-contacts.view.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -14,27 +14,27 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19 19
 <div class="wps-metabox wps-billing-address view gridw-3">
20
-	<h3 class="metabox-title"><?php esc_html_e( 'Contacts', 'wpshop' ); ?></h3>
20
+	<h3 class="metabox-title"><?php esc_html_e('Contacts', 'wpshop'); ?></h3>
21 21
 
22 22
 	<div class="wpeo-table table-flex table-5">
23 23
 		<div class="table-row table-header">
24
-			<div class="table-cell"><?php esc_html_e( 'Name', 'wpshop' ); ?></div>
25
-			<div class="table-cell"><?php esc_html_e( 'Firstname', 'wpshop' ); ?></div>
24
+			<div class="table-cell"><?php esc_html_e('Name', 'wpshop'); ?></div>
25
+			<div class="table-cell"><?php esc_html_e('Firstname', 'wpshop'); ?></div>
26 26
 			<div class="table-cell"><i class="fas fa-envelope"></i></div>
27 27
 			<div class="table-cell"><i class="fas fa-phone"></i></div>
28 28
 			<div class="table-cell"></div>
29 29
 		</div>
30 30
 
31 31
 		<?php
32
-		if ( ! empty( $contacts ) ) :
33
-			foreach ( $contacts as $contact ) :
34
-				\eoxia\View_Util::exec( 'wpshop', 'third-parties', 'metaboxes/metabox-contacts-item', array(
32
+		if (!empty($contacts)) :
33
+			foreach ($contacts as $contact) :
34
+				\eoxia\View_Util::exec('wpshop', 'third-parties', 'metaboxes/metabox-contacts-item', array(
35 35
 					'third_party_id' => $third_party->data['id'],
36 36
 					'contact'        => $contact,
37
-				) );
37
+				));
38 38
 			endforeach;
39 39
 		endif;
40 40
 		?>
Please login to merge, or discard this patch.
modules/third-parties/view/metaboxes/metabox-activities.view.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19 19
 <div class="wps-metabox wps-billing-address view gridw-3">
20 20
 	<table class="wpeo-table">
Please login to merge, or discard this patch.
modules/third-parties/view/metaboxes/metabox-billing-address-edit.view.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,25 +14,25 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19 19
 <div class="wps-metabox wps-billing-address edit gridw-3">
20
-	<h3 class="metabox-title"><?php esc_html_e( 'Billing Address', 'wpshop' ); ?></h3>
20
+	<h3 class="metabox-title"><?php esc_html_e('Billing Address', 'wpshop'); ?></h3>
21 21
 
22 22
 	<div data-parent="inside"
23 23
 		data-action="third_party_save_address"
24
-		data-third-party_id="<?php echo esc_attr( $third_party->data['id'] ); ?>"
24
+		data-third-party_id="<?php echo esc_attr($third_party->data['id']); ?>"
25 25
 		class="action-input metabox-edit wpeo-button button-green button-square-30 button-rounded">
26 26
 		<i class="button-icon fas fa-save"></i>
27 27
 	</div>
28 28
 
29 29
 	<ul class="wpeo-gridlayout grid-2">
30
-		<li><span><?php esc_html_e( 'Name', 'wpshop' ); ?></span> <input type="text" name="third_party[title]" value="<?php echo esc_attr( $third_party->data['title'] ); ?>" /></li>
31
-		<li><span><?php esc_html_e( 'Address', 'wpshop' ); ?></span> <input type="text" name="third_party[address]" value="<?php echo esc_attr( $third_party->data['address'] ); ?>" /></li>
32
-		<li><span><?php esc_html_e( 'ZIP Code', 'wpshop' ); ?></span> <input type="text" name="third_party[zip]" value="<?php echo esc_attr( $third_party->data['zip'] ); ?>" /></li>
33
-		<li><span><?php esc_html_e( 'City', 'wpshop' ); ?></span> <input type="text" name="third_party[town]" value="<?php echo esc_attr( $third_party->data['town'] ); ?>" /></li>
34
-		<li><span><?php esc_html_e( 'Phone', 'wpshop' ); ?></span> <input type="text" name="third_party[phone]" value="<?php echo esc_attr( $third_party->data['phone'] ); ?>" /></li>
30
+		<li><span><?php esc_html_e('Name', 'wpshop'); ?></span> <input type="text" name="third_party[title]" value="<?php echo esc_attr($third_party->data['title']); ?>" /></li>
31
+		<li><span><?php esc_html_e('Address', 'wpshop'); ?></span> <input type="text" name="third_party[address]" value="<?php echo esc_attr($third_party->data['address']); ?>" /></li>
32
+		<li><span><?php esc_html_e('ZIP Code', 'wpshop'); ?></span> <input type="text" name="third_party[zip]" value="<?php echo esc_attr($third_party->data['zip']); ?>" /></li>
33
+		<li><span><?php esc_html_e('City', 'wpshop'); ?></span> <input type="text" name="third_party[town]" value="<?php echo esc_attr($third_party->data['town']); ?>" /></li>
34
+		<li><span><?php esc_html_e('Phone', 'wpshop'); ?></span> <input type="text" name="third_party[phone]" value="<?php echo esc_attr($third_party->data['phone']); ?>" /></li>
35 35
 	</ul>
36 36
 </div>
37 37
 
38
-<?php wp_nonce_field( 'save_billing_address' ); ?>
38
+<?php wp_nonce_field('save_billing_address'); ?>
Please login to merge, or discard this patch.
modules/third-parties/view/metaboxes/metabox-informations.view.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19 19
 <div class="wps-metabox wps-billing-address view gridw-3">
20 20
 	<ul>
Please login to merge, or discard this patch.
modules/third-parties/view/metaboxes/metabox-contacts-edit.view.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19
-<div class="table-row <?php echo empty( $contact->data['id'] ) ? 'new' : 'edit'; ?>">
20
-	<div class="table-cell"><input type="text" name="contact[lastname]" placeholder="<?php esc_html_e( 'Name', 'wpshop' ); ?>" value="<?php echo esc_attr( $contact->data['lastname'] ); ?>" /></div>
21
-	<div class="table-cell"><input type="text" name="contact[firstname]" placeholder="<?php esc_html_e( 'Firstname', 'wpshop' ); ?>" value="<?php echo esc_attr( $contact->data['firstname'] ); ?>" /></div>
22
-	<div class="table-cell"><input type="text" name="contact[email]" placeholder="<?php esc_html_e( 'Email', 'wpshop' ); ?>" value="<?php echo esc_attr( $contact->data['email'] ); ?>" /></div>
23
-	<div class="table-cell"><input type="text" name="contact[phone]" placeholder="<?php esc_html_e( 'Phone', 'wpshop' ); ?>" value="<?php echo esc_attr( $contact->data['phone'] ); ?>" /></div>
19
+<div class="table-row <?php echo empty($contact->data['id']) ? 'new' : 'edit'; ?>">
20
+	<div class="table-cell"><input type="text" name="contact[lastname]" placeholder="<?php esc_html_e('Name', 'wpshop'); ?>" value="<?php echo esc_attr($contact->data['lastname']); ?>" /></div>
21
+	<div class="table-cell"><input type="text" name="contact[firstname]" placeholder="<?php esc_html_e('Firstname', 'wpshop'); ?>" value="<?php echo esc_attr($contact->data['firstname']); ?>" /></div>
22
+	<div class="table-cell"><input type="text" name="contact[email]" placeholder="<?php esc_html_e('Email', 'wpshop'); ?>" value="<?php echo esc_attr($contact->data['email']); ?>" /></div>
23
+	<div class="table-cell"><input type="text" name="contact[phone]" placeholder="<?php esc_html_e('Phone', 'wpshop'); ?>" value="<?php echo esc_attr($contact->data['phone']); ?>" /></div>
24 24
 	<div class="table-cell table-end">
25
-		<input type="hidden" name="contact[id]" value="<?php echo esc_attr( $contact->data['id'] ); ?>" />
25
+		<input type="hidden" name="contact[id]" value="<?php echo esc_attr($contact->data['id']); ?>" />
26 26
 		<div data-parent="row"
27
-			data-parent-id="<?php echo esc_attr( $third_party_id ); ?>"
27
+			data-parent-id="<?php echo esc_attr($third_party_id); ?>"
28 28
 			data-action="third_party_save_contact"
29
-			data-nonce="<?php echo esc_attr( wp_create_nonce( 'save_and_associate_contact' ) ); ?>"
30
-			class="action-input wpeo-button button-square-30 button-rounded <?php echo ! empty( $contact->data['id'] ) ? 'button-green' : 'button-main'; ?>">
31
-			<i class="button-icon fas <?php echo ! empty( $contact->data['id'] ) ? 'fa-save' : 'fa-plus'; ?>"></i>
29
+			data-nonce="<?php echo esc_attr(wp_create_nonce('save_and_associate_contact')); ?>"
30
+			class="action-input wpeo-button button-square-30 button-rounded <?php echo !empty($contact->data['id']) ? 'button-green' : 'button-main'; ?>">
31
+			<i class="button-icon fas <?php echo !empty($contact->data['id']) ? 'fa-save' : 'fa-plus'; ?>"></i>
32 32
 		</div>
33 33
 	</div>
34 34
 </div>
Please login to merge, or discard this patch.
modules/third-parties/model/class-third-party-model.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit;
17
+defined('ABSPATH') || exit;
18 18
 
19 19
 /**
20 20
  * Class Third Party model.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @param Third_Party $object     Les données de l'objet.
30 30
 	 * @param string      $req_method La méthode de la requête.
31 31
 	 */
32
-	public function __construct( $object, $req_method = null ) {
32
+	public function __construct($object, $req_method = null) {
33 33
 		$this->schema['external_id'] = array(
34 34
 			'type'        => 'integer',
35 35
 			'meta_type'   => 'single',
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 			'field'       => '_date_last_synchro',
131 131
 			'since'       => '2.0.0',
132 132
 			'description' => 'La date de la dernière synchronisation.',
133
-			'context'     => array( 'GET' ),
133
+			'context'     => array('GET'),
134 134
 		);
135 135
 
136
-		parent::__construct( $object, $req_method );
136
+		parent::__construct($object, $req_method);
137 137
 	}
138 138
 }
Please login to merge, or discard this patch.