Completed
Branch 2.0.0 (814c19)
by Jimmy
03:05
created
modules/my-account/view/frontend/form-login.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -16,17 +16,17 @@  discard block
 block discarded – undo
16 16
 
17 17
 namespace wpshop;
18 18
 
19
-defined( 'ABSPATH' ) || exit;
19
+defined('ABSPATH') || exit;
20 20
 
21 21
 global $post;
22 22
 
23
-do_action( 'wps_before_customer_login_form' ); ?>
23
+do_action('wps_before_customer_login_form'); ?>
24 24
 
25 25
 <?php
26
-$transient = get_transient( 'login_error_' . $_COOKIE['PHPSESSID'] );
27
-delete_transient( 'login_error_' . $_COOKIE['PHPSESSID'] );
26
+$transient = get_transient('login_error_' . $_COOKIE['PHPSESSID']);
27
+delete_transient('login_error_' . $_COOKIE['PHPSESSID']);
28 28
 
29
-if ( ! empty( $transient ) ) :
29
+if (!empty($transient)) :
30 30
 	?>
31 31
 	<div class="notice notice-error ">
32 32
 		<p><?php echo $transient; ?></p>
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 endif;
36 36
 ?>
37 37
 
38
-<form class="wpeo-form" action="<?php echo esc_attr( admin_url( 'admin-post.php' ) ); ?>" method="post">
39
-	<?php wp_nonce_field( 'handle_login' ); ?>
38
+<form class="wpeo-form" action="<?php echo esc_attr(admin_url('admin-post.php')); ?>" method="post">
39
+	<?php wp_nonce_field('handle_login'); ?>
40 40
 	<input type="hidden" name="action" value="wps_login" />
41
-	<input type="hidden" name="page" value="<?php echo Pages::g()->get_slug_link_shop_page( $post->ID ); ?>" />
42
-	<?php do_action( 'wps_login_form_start' ); ?>
41
+	<input type="hidden" name="page" value="<?php echo Pages::g()->get_slug_link_shop_page($post->ID); ?>" />
42
+	<?php do_action('wps_login_form_start'); ?>
43 43
 
44 44
 	<div class="form-element">
45
-		<span class="form-label"><?php esc_html_e( 'Username or email address', 'wpshop' ); ?></span>
45
+		<span class="form-label"><?php esc_html_e('Username or email address', 'wpshop'); ?></span>
46 46
 		<label class="form-field-container">
47 47
 			<input type="text" class="form-field" name="username" />
48 48
 		</label>
49 49
 	</div>
50 50
 
51 51
 	<div class="form-element">
52
-		<span class="form-label"><?php esc_html_e( 'Password', 'wpshop' ); ?></span>
52
+		<span class="form-label"><?php esc_html_e('Password', 'wpshop'); ?></span>
53 53
 		<label class="form-field-container">
54 54
 			<input type="password" class="form-field" name="password" />
55 55
 		</label>
56 56
 	</div>
57 57
 
58
-	<?php do_action( 'wps_login_form' ); ?>
58
+	<?php do_action('wps_login_form'); ?>
59 59
 
60
-	<input class="wpeo-button button-main" type="submit" value="<?php esc_attr_e( 'Log in', 'wphsop' ); ?>" />
61
-	<a class="wpeo-button button-grey" href="<?php echo wp_lostpassword_url(); ?>" title="Lost Password"><?php esc_html_e( 'Lost Password', 'wpshop' ); ?></a>
60
+	<input class="wpeo-button button-main" type="submit" value="<?php esc_attr_e('Log in', 'wphsop'); ?>" />
61
+	<a class="wpeo-button button-grey" href="<?php echo wp_lostpassword_url(); ?>" title="Lost Password"><?php esc_html_e('Lost Password', 'wpshop'); ?></a>
62 62
 
63
-	<?php do_action( 'wps_login_form_end' ); ?>
63
+	<?php do_action('wps_login_form_end'); ?>
64 64
 </form>
65 65
 
66
-<?php do_action( 'wps_after_customer_login_form' ); ?>
66
+<?php do_action('wps_after_customer_login_form'); ?>
Please login to merge, or discard this patch.
modules/doli-synchro/class/class-doli-synchro.php 1 patch
Spacing   +7 added lines, -7 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 Synchro Class.
@@ -47,37 +47,37 @@  discard block
 block discarded – undo
47 47
 	protected function construct() {
48 48
 		$this->sync_infos = array(
49 49
 			'third-parties' => array(
50
-				'title'    => __( 'Third parties', 'wpshop' ),
50
+				'title'    => __('Third parties', 'wpshop'),
51 51
 				'action'   => 'sync_third_parties',
52 52
 				'nonce'    => 'sync_third_parties',
53 53
 				'endpoint' => 'thirdparties?limit=-1',
54 54
 			),
55 55
 			'contacts'      => array(
56
-				'title'    => __( 'Contacts', 'wpshop' ),
56
+				'title'    => __('Contacts', 'wpshop'),
57 57
 				'action'   => 'sync_contacts',
58 58
 				'nonce'    => 'sync_contacts',
59 59
 				'endpoint' => 'contacts?limit=-1',
60 60
 			),
61 61
 			'products'      => array(
62
-				'title'    => __( 'Products', 'wpshop' ),
62
+				'title'    => __('Products', 'wpshop'),
63 63
 				'action'   => 'sync_products',
64 64
 				'nonce'    => 'sync_products',
65 65
 				'endpoint' => 'products?limit=-1',
66 66
 			),
67 67
 			'proposals'     => array(
68
-				'title'    => __( 'Proposals', 'wpshop' ),
68
+				'title'    => __('Proposals', 'wpshop'),
69 69
 				'action'   => 'sync_proposals',
70 70
 				'nonce'    => 'sync_proposals',
71 71
 				'endpoint' => 'proposals?limit=-1',
72 72
 			),
73 73
 			'orders'        => array(
74
-				'title'    => __( 'Orders', 'wpshop' ),
74
+				'title'    => __('Orders', 'wpshop'),
75 75
 				'action'   => 'sync_orders',
76 76
 				'nonce'    => 'sync_orders',
77 77
 				'endpoint' => 'orders?limit=-1',
78 78
 			),
79 79
 			'invoices'      => array(
80
-				'title'    => __( 'Invoices', 'wpshop' ),
80
+				'title'    => __('Invoices', 'wpshop'),
81 81
 				'action'   => 'sync_invoices',
82 82
 				'nonce'    => 'sync_invoices',
83 83
 				'endpoint' => 'invoices?limit=-1',
Please login to merge, or discard this patch.
modules/doli-synchro/action/class-doli-synchro-action.php 1 patch
Spacing   +158 added lines, -158 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 Synchro Action Class.
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'wp_ajax_load_modal_synchro', array( $this, 'load_modal_synchro' ) );
31
-		add_action( 'wp_ajax_load_synchro_modal_single', array( $this, 'load_modal_synchro_single' ) );
32
-		add_action( 'wp_ajax_associate_and_synchronize', array( $this, 'associate_and_synchronize' ) );
33
-
34
-		add_action( 'wp_ajax_sync_third_parties', array( $this, 'sync_third_parties' ) );
35
-		add_action( 'wp_ajax_sync_contacts', array( $this, 'sync_contacts' ) );
36
-		add_action( 'wp_ajax_sync_products', array( $this, 'sync_products' ) );
37
-		add_action( 'wp_ajax_sync_proposals', array( $this, 'sync_proposals' ) );
38
-		add_action( 'wp_ajax_sync_orders', array( $this, 'sync_orders' ) );
39
-		add_action( 'wp_ajax_sync_invoices', array( $this, 'sync_invoices' ) );
30
+		add_action('wp_ajax_load_modal_synchro', array($this, 'load_modal_synchro'));
31
+		add_action('wp_ajax_load_synchro_modal_single', array($this, 'load_modal_synchro_single'));
32
+		add_action('wp_ajax_associate_and_synchronize', array($this, 'associate_and_synchronize'));
33
+
34
+		add_action('wp_ajax_sync_third_parties', array($this, 'sync_third_parties'));
35
+		add_action('wp_ajax_sync_contacts', array($this, 'sync_contacts'));
36
+		add_action('wp_ajax_sync_products', array($this, 'sync_products'));
37
+		add_action('wp_ajax_sync_proposals', array($this, 'sync_proposals'));
38
+		add_action('wp_ajax_sync_orders', array($this, 'sync_orders'));
39
+		add_action('wp_ajax_sync_invoices', array($this, 'sync_invoices'));
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,30 +45,30 @@  discard block
 block discarded – undo
45 45
 	 * @since 2.0.0
46 46
 	 */
47 47
 	public function load_modal_synchro() {
48
-		check_ajax_referer( 'load_modal_synchro' );
48
+		check_ajax_referer('load_modal_synchro');
49 49
 		$sync_infos = Doli_Synchro::g()->sync_infos;
50 50
 
51
-		if ( ! empty( $sync_infos ) ) {
52
-			foreach ( $sync_infos as &$sync_info ) {
51
+		if (!empty($sync_infos)) {
52
+			foreach ($sync_infos as &$sync_info) {
53 53
 				$sync_info['total_number'] = 0;
54
-				if ( ! empty( $sync_info['endpoint'] ) ) {
55
-					$tmp = Request_Util::get( $sync_info['endpoint'] );
54
+				if (!empty($sync_info['endpoint'])) {
55
+					$tmp = Request_Util::get($sync_info['endpoint']);
56 56
 
57
-					if ( $tmp ) {
58
-						$sync_info['total_number'] = count( $tmp );
57
+					if ($tmp) {
58
+						$sync_info['total_number'] = count($tmp);
59 59
 					}
60 60
 				}
61 61
 			}
62 62
 		}
63 63
 
64 64
 		ob_start();
65
-		\eoxia\View_Util::exec( 'wpshop', 'doli-synchro', 'main', array(
65
+		\eoxia\View_Util::exec('wpshop', 'doli-synchro', 'main', array(
66 66
 			'sync_infos' => $sync_infos,
67
-		) );
67
+		));
68 68
 		$view = ob_get_clean();
69
-		wp_send_json_success( array(
69
+		wp_send_json_success(array(
70 70
 			'view' => $view,
71
-		) );
71
+		));
72 72
 	}
73 73
 
74 74
 	/**
@@ -77,52 +77,52 @@  discard block
 block discarded – undo
77 77
 	 * @since 2.0.0
78 78
 	 */
79 79
 	public function load_modal_synchro_single() {
80
-		check_ajax_referer( 'load_modal_synchro_single' );
80
+		check_ajax_referer('load_modal_synchro_single');
81 81
 
82
-		$wp_id        = ! empty( $_POST['id'] ) ? (int) $_POST['id'] : 0;
83
-		$doli_sync_id = ! empty( $_POST['entry_id'] ) ? (int) $_POST['entry_id'] : get_post_meta( $wp_id, '_external_id', true );
82
+		$wp_id        = !empty($_POST['id']) ? (int)$_POST['id'] : 0;
83
+		$doli_sync_id = !empty($_POST['entry_id']) ? (int)$_POST['entry_id'] : get_post_meta($wp_id, '_external_id', true);
84 84
 		$view         = '';
85 85
 		$buttons_view = '';
86 86
 
87
-		if ( empty( $doli_sync_id ) ) {
88
-			$third_parties = Request_Util::get( 'thirdparties?limit=-1' );
87
+		if (empty($doli_sync_id)) {
88
+			$third_parties = Request_Util::get('thirdparties?limit=-1');
89 89
 
90 90
 			ob_start();
91
-			\eoxia\View_Util::exec( 'wpshop', 'doli-synchro', 'single', array(
91
+			\eoxia\View_Util::exec('wpshop', 'doli-synchro', 'single', array(
92 92
 				'third_parties' => $third_parties,
93 93
 				'wp_id'         => $wp_id,
94
-			) );
94
+			));
95 95
 			$view = ob_get_clean();
96 96
 
97 97
 			ob_start();
98
-			\eoxia\View_Util::exec( 'wpshop', 'doli-synchro', 'single-footer' );
98
+			\eoxia\View_Util::exec('wpshop', 'doli-synchro', 'single-footer');
99 99
 			$buttons_view = ob_get_clean();
100 100
 
101
-			wp_send_json_success( array(
101
+			wp_send_json_success(array(
102 102
 				'view'         => $view,
103 103
 				'buttons_view' => $buttons_view,
104
-			) );
104
+			));
105 105
 		} else {
106
-			$doli_third_party   = Request_Util::get( 'thirdparties/' . $doli_sync_id );
107
-			$wp_third_party     = Third_Party::g()->get( array( 'id' => $wp_id ), true );
108
-			$modified_date_wp   = get_post_modified_time( 'U', false, $wp_id );
109
-			$modified_date_doli = ! empty( $doli_third_party->date_modification ) ? $doli_third_party->date_modification : $doli_third_party->date_creation;
106
+			$doli_third_party   = Request_Util::get('thirdparties/' . $doli_sync_id);
107
+			$wp_third_party     = Third_Party::g()->get(array('id' => $wp_id), true);
108
+			$modified_date_wp   = get_post_modified_time('U', false, $wp_id);
109
+			$modified_date_doli = !empty($doli_third_party->date_modification) ? $doli_third_party->date_modification : $doli_third_party->date_creation;
110 110
 
111 111
 			ob_start();
112
-			\eoxia\View_Util::exec( 'wpshop', 'doli-synchro', 'need-to-confirm', array(
112
+			\eoxia\View_Util::exec('wpshop', 'doli-synchro', 'need-to-confirm', array(
113 113
 				'date_wp'          => $modified_date_wp,
114 114
 				'date_doli'        => $modified_date_doli,
115 115
 				'doli_third_party' => $doli_third_party,
116 116
 				'wp_third_party'   => $wp_third_party,
117
-			) );
117
+			));
118 118
 			$view = ob_get_clean();
119 119
 
120
-			wp_send_json_success( array(
120
+			wp_send_json_success(array(
121 121
 				'namespace'        => 'wpshop',
122 122
 				'module'           => 'doliSynchro',
123 123
 				'callback_success' => 'loadedModalSynchroSingle',
124 124
 				'view'             => $view,
125
-			) );
125
+			));
126 126
 		}
127 127
 	}
128 128
 
@@ -134,53 +134,53 @@  discard block
 block discarded – undo
134 134
 	 * @since 2.0.0
135 135
 	 */
136 136
 	public function associate_and_synchronize() {
137
-		check_ajax_referer( 'associate_and_synchronize' );
138
-		$entry_id = ! empty( $_POST['entry_id'] ) ? (int) $_POST['entry_id'] : 0;
139
-		$wp_id    = ! empty( $_POST['wp_id'] ) ? (int) $_POST['wp_id'] : 0;
140
-		$from     = ! empty( $_POST['from'] ) ? sanitize_text_field( $_POST['from'] ) : '';
137
+		check_ajax_referer('associate_and_synchronize');
138
+		$entry_id = !empty($_POST['entry_id']) ? (int)$_POST['entry_id'] : 0;
139
+		$wp_id    = !empty($_POST['wp_id']) ? (int)$_POST['wp_id'] : 0;
140
+		$from     = !empty($_POST['from']) ? sanitize_text_field($_POST['from']) : '';
141 141
 
142
-		if ( empty( $entry_id ) || empty( $wp_id ) || empty( $from ) ) {
142
+		if (empty($entry_id) || empty($wp_id) || empty($from)) {
143 143
 			wp_send_json_error();
144 144
 		}
145 145
 
146
-		$post_type = get_post_type( $wp_id );
146
+		$post_type = get_post_type($wp_id);
147 147
 
148
-		switch ( $post_type ) {
148
+		switch ($post_type) {
149 149
 			case 'wps-third-party':
150
-				if ( 'dolibarr' === $from ) {
151
-					$doli_third_party = Request_Util::get( 'thirdparties/' . $entry_id );
152
-					$wp_third_party   = Third_Party::g()->get( array( 'id' => $wp_id ), true );
150
+				if ('dolibarr' === $from) {
151
+					$doli_third_party = Request_Util::get('thirdparties/' . $entry_id);
152
+					$wp_third_party   = Third_Party::g()->get(array('id' => $wp_id), true);
153 153
 
154
-					Doli_Third_Parties::g()->doli_to_wp( $doli_third_party, $wp_third_party );
154
+					Doli_Third_Parties::g()->doli_to_wp($doli_third_party, $wp_third_party);
155 155
 				}
156 156
 
157
-				if ( 'wp' === $from ) {
158
-					$wp_third_party   = Third_Party::g()->get( array( 'id' => $wp_id ), true );
159
-					$doli_third_party = Request_Util::get( 'thirdparties/' . $entry_id );
157
+				if ('wp' === $from) {
158
+					$wp_third_party   = Third_Party::g()->get(array('id' => $wp_id), true);
159
+					$doli_third_party = Request_Util::get('thirdparties/' . $entry_id);
160 160
 
161
-					Doli_Third_Parties::g()->wp_to_doli( $wp_third_party, $doli_third_party );
161
+					Doli_Third_Parties::g()->wp_to_doli($wp_third_party, $doli_third_party);
162 162
 				}
163 163
 				break;
164 164
 			case 'wps-product':
165
-				if ( 'dolibarr' === $from ) {
166
-					$doli_product = Request_Util::get( 'products/' . $entry_id );
167
-					$wp_product   = Product::g()->get( array( 'id' => $wp_id ), true );
165
+				if ('dolibarr' === $from) {
166
+					$doli_product = Request_Util::get('products/' . $entry_id);
167
+					$wp_product   = Product::g()->get(array('id' => $wp_id), true);
168 168
 
169
-					Doli_Products::g()->doli_to_wp( $doli_product, $wp_product );
169
+					Doli_Products::g()->doli_to_wp($doli_product, $wp_product);
170 170
 				}
171 171
 				break;
172 172
 			default:
173 173
 				break;
174 174
 		}
175 175
 
176
-		update_post_meta( $wp_id, '_last_sync', current_time( 'mysql' ) );
176
+		update_post_meta($wp_id, '_last_sync', current_time('mysql'));
177 177
 
178
-		wp_send_json_success( array(
178
+		wp_send_json_success(array(
179 179
 			'namespace'        => 'wpshop',
180 180
 			'module'           => 'doliSynchro',
181 181
 			'callback_success' => 'associatedAndSynchronized',
182 182
 			'from'             => $from,
183
-		) );
183
+		));
184 184
 	}
185 185
 
186 186
 	/**
@@ -191,45 +191,45 @@  discard block
 block discarded – undo
191 191
 	 * @since 2.0.0
192 192
 	 */
193 193
 	public function sync_third_parties() {
194
-		check_ajax_referer( 'sync_third_parties' );
194
+		check_ajax_referer('sync_third_parties');
195 195
 
196 196
 		$done         = false;
197
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
198
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
197
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
198
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
199 199
 
200
-		$doli_third_parties = Request_Util::get( 'thirdparties?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
200
+		$doli_third_parties = Request_Util::get('thirdparties?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
201 201
 
202
-		if ( ! empty( $doli_third_parties ) ) {
203
-			foreach ( $doli_third_parties as $doli_third_party ) {
204
-				$wp_third_party = Third_Party::g()->get( array(
202
+		if (!empty($doli_third_parties)) {
203
+			foreach ($doli_third_parties as $doli_third_party) {
204
+				$wp_third_party = Third_Party::g()->get(array(
205 205
 					'meta_key'   => '_external_id',
206
-					'meta_value' => (int) $doli_third_party->id,
207
-				), true );
206
+					'meta_value' => (int)$doli_third_party->id,
207
+				), true);
208 208
 
209
-				if ( empty( $wp_third_party ) ) {
210
-					$wp_third_party = Third_Party::g()->get( array( 'schema' => true ), true );
209
+				if (empty($wp_third_party)) {
210
+					$wp_third_party = Third_Party::g()->get(array('schema' => true), true);
211 211
 				}
212 212
 
213
-				Doli_Third_Parties::g()->doli_to_wp( $doli_third_party, $wp_third_party );
213
+				Doli_Third_Parties::g()->doli_to_wp($doli_third_party, $wp_third_party);
214 214
 
215 215
 				$done_number++;
216 216
 			}
217 217
 		}
218 218
 
219
-		if ( $done_number >= $total_number ) {
219
+		if ($done_number >= $total_number) {
220 220
 			$done_number = $total_number;
221 221
 			$done        = true;
222 222
 		}
223 223
 
224
-		wp_send_json_success( array(
224
+		wp_send_json_success(array(
225 225
 			'updateComplete'     => false,
226 226
 			'done'               => $done,
227 227
 			'progression'        => $done_number . '/' . $total_number,
228
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 0,
228
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 0,
229 229
 			'doneDescription'    => $done_number . '/' . $total_number,
230 230
 			'doneElementNumber'  => $done_number,
231 231
 			'errors'             => null,
232
-		) );
232
+		));
233 233
 	}
234 234
 
235 235
 	/**
@@ -240,45 +240,45 @@  discard block
 block discarded – undo
240 240
 	 * @since 2.0.0
241 241
 	 */
242 242
 	public function sync_contacts() {
243
-		check_ajax_referer( 'sync_contacts' );
243
+		check_ajax_referer('sync_contacts');
244 244
 
245 245
 		$done         = false;
246
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
247
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
246
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
247
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
248 248
 
249
-		$doli_contacts = Request_Util::get( 'contacts?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
249
+		$doli_contacts = Request_Util::get('contacts?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
250 250
 
251
-		if ( ! empty( $doli_contacts ) ) {
252
-			foreach ( $doli_contacts as $doli_contact ) {
253
-				$wp_contact = Contact::g()->get( array(
251
+		if (!empty($doli_contacts)) {
252
+			foreach ($doli_contacts as $doli_contact) {
253
+				$wp_contact = Contact::g()->get(array(
254 254
 					'meta_key'   => '_external_id',
255
-					'meta_value' => (int) $doli_contact->id,
256
-				), true );
255
+					'meta_value' => (int)$doli_contact->id,
256
+				), true);
257 257
 
258
-				if ( empty( $wp_contact ) ) {
259
-					$wp_contact = Contact::g()->get( array( 'schema' => true ), true );
258
+				if (empty($wp_contact)) {
259
+					$wp_contact = Contact::g()->get(array('schema' => true), true);
260 260
 				}
261 261
 
262
-				Doli_Contact::g()->doli_to_wp( $doli_contact, $wp_contact );
262
+				Doli_Contact::g()->doli_to_wp($doli_contact, $wp_contact);
263 263
 
264 264
 				$done_number++;
265 265
 			}
266 266
 		}
267 267
 
268
-		if ( $done_number >= $total_number ) {
268
+		if ($done_number >= $total_number) {
269 269
 			$done_number = $total_number;
270 270
 			$done        = true;
271 271
 		}
272 272
 
273
-		wp_send_json_success( array(
273
+		wp_send_json_success(array(
274 274
 			'updateComplete'     => false,
275 275
 			'done'               => $done,
276 276
 			'progression'        => $done_number . '/' . $total_number,
277
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 0,
277
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 0,
278 278
 			'doneDescription'    => $done_number . '/' . $total_number,
279 279
 			'doneElementNumber'  => $done_number,
280 280
 			'errors'             => null,
281
-		) );
281
+		));
282 282
 	}
283 283
 
284 284
 	/**
@@ -289,45 +289,45 @@  discard block
 block discarded – undo
289 289
 	 * @since 2.0.0
290 290
 	 */
291 291
 	public function sync_products() {
292
-		check_ajax_referer( 'sync_products' );
292
+		check_ajax_referer('sync_products');
293 293
 
294 294
 		$done         = false;
295
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
296
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
295
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
296
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
297 297
 
298
-		$doli_products = Request_Util::get( 'products?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
298
+		$doli_products = Request_Util::get('products?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
299 299
 
300
-		if ( ! empty( $doli_products ) ) {
301
-			foreach ( $doli_products as $doli_product ) {
302
-				$wp_product = Product::g()->get( array(
300
+		if (!empty($doli_products)) {
301
+			foreach ($doli_products as $doli_product) {
302
+				$wp_product = Product::g()->get(array(
303 303
 					'meta_key'   => '_external_id',
304
-					'meta_value' => (int) $doli_product->id,
305
-				), true );
304
+					'meta_value' => (int)$doli_product->id,
305
+				), true);
306 306
 
307
-				if ( empty( $wp_product ) ) {
308
-					$wp_product = Product::g()->get( array( 'schema' => true ), true );
307
+				if (empty($wp_product)) {
308
+					$wp_product = Product::g()->get(array('schema' => true), true);
309 309
 				}
310 310
 
311
-				Doli_Products::g()->doli_to_wp( $doli_product, $wp_product );
311
+				Doli_Products::g()->doli_to_wp($doli_product, $wp_product);
312 312
 
313 313
 				$done_number++;
314 314
 			}
315 315
 		}
316 316
 
317
-		if ( $done_number >= $total_number ) {
317
+		if ($done_number >= $total_number) {
318 318
 			$done_number = $total_number;
319 319
 			$done        = true;
320 320
 		}
321 321
 
322
-		wp_send_json_success( array(
322
+		wp_send_json_success(array(
323 323
 			'updateComplete'     => false,
324 324
 			'done'               => $done,
325 325
 			'progression'        => $done_number . '/' . $total_number,
326
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 100,
326
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 100,
327 327
 			'doneDescription'    => $done_number . '/' . $total_number,
328 328
 			'doneElementNumber'  => $done_number,
329 329
 			'errors'             => null,
330
-		) );
330
+		));
331 331
 	}
332 332
 
333 333
 	/**
@@ -338,45 +338,45 @@  discard block
 block discarded – undo
338 338
 	 * @since 2.0.0
339 339
 	 */
340 340
 	public function sync_proposals() {
341
-		check_ajax_referer( 'sync_proposals' );
341
+		check_ajax_referer('sync_proposals');
342 342
 
343 343
 		$done         = false;
344
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
345
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
344
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
345
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
346 346
 
347
-		$doli_proposals = Request_Util::get( 'proposals?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
347
+		$doli_proposals = Request_Util::get('proposals?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
348 348
 
349
-		if ( ! empty( $doli_proposals ) ) {
350
-			foreach ( $doli_proposals as $doli_proposal ) {
351
-				$wp_proposal = Proposals::g()->get( array(
349
+		if (!empty($doli_proposals)) {
350
+			foreach ($doli_proposals as $doli_proposal) {
351
+				$wp_proposal = Proposals::g()->get(array(
352 352
 					'meta_key'   => '_external_id',
353
-					'meta_value' => (int) $doli_proposal->id,
354
-				), true );
353
+					'meta_value' => (int)$doli_proposal->id,
354
+				), true);
355 355
 
356
-				if ( empty( $wp_proposal ) ) {
357
-					$wp_proposal = Proposals::g()->get( array( 'schema' => true ), true );
356
+				if (empty($wp_proposal)) {
357
+					$wp_proposal = Proposals::g()->get(array('schema' => true), true);
358 358
 				}
359 359
 
360
-				Doli_Proposals::g()->doli_to_wp( $doli_proposal, $wp_proposal );
360
+				Doli_Proposals::g()->doli_to_wp($doli_proposal, $wp_proposal);
361 361
 
362 362
 				$done_number++;
363 363
 			}
364 364
 		}
365 365
 
366
-		if ( $done_number >= $total_number ) {
366
+		if ($done_number >= $total_number) {
367 367
 			$done_number = $total_number;
368 368
 			$done        = true;
369 369
 		}
370 370
 
371
-		wp_send_json_success( array(
371
+		wp_send_json_success(array(
372 372
 			'updateComplete'     => false,
373 373
 			'done'               => $done,
374 374
 			'progression'        => $done_number . '/' . $total_number,
375
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 100,
375
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 100,
376 376
 			'doneDescription'    => $done_number . '/' . $total_number,
377 377
 			'doneElementNumber'  => $done_number,
378 378
 			'errors'             => null,
379
-		) );
379
+		));
380 380
 	}
381 381
 
382 382
 	/**
@@ -387,45 +387,45 @@  discard block
 block discarded – undo
387 387
 	 * @since 2.0.0
388 388
 	 */
389 389
 	public function sync_orders() {
390
-		check_ajax_referer( 'sync_orders' );
390
+		check_ajax_referer('sync_orders');
391 391
 
392 392
 		$done         = false;
393
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
394
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
393
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
394
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
395 395
 
396
-		$doli_orders = Request_Util::get( 'orders?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
396
+		$doli_orders = Request_Util::get('orders?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
397 397
 
398
-		if ( ! empty( $doli_orders ) ) {
399
-			foreach ( $doli_orders as $doli_order ) {
400
-				$wp_order = Doli_Order::g()->get( array(
398
+		if (!empty($doli_orders)) {
399
+			foreach ($doli_orders as $doli_order) {
400
+				$wp_order = Doli_Order::g()->get(array(
401 401
 					'meta_key'   => '_external_id',
402
-					'meta_value' => (int) $doli_order->id,
403
-				), true );
402
+					'meta_value' => (int)$doli_order->id,
403
+				), true);
404 404
 
405
-				if ( empty( $wp_order ) ) {
406
-					$wp_order = Doli_Order::g()->get( array( 'schema' => true ), true );
405
+				if (empty($wp_order)) {
406
+					$wp_order = Doli_Order::g()->get(array('schema' => true), true);
407 407
 				}
408 408
 
409
-				Doli_Order::g()->doli_to_wp( $doli_order, $wp_order );
409
+				Doli_Order::g()->doli_to_wp($doli_order, $wp_order);
410 410
 
411 411
 				$done_number++;
412 412
 			}
413 413
 		}
414 414
 
415
-		if ( $done_number >= $total_number ) {
415
+		if ($done_number >= $total_number) {
416 416
 			$done_number = $total_number;
417 417
 			$done        = true;
418 418
 		}
419 419
 
420
-		wp_send_json_success( array(
420
+		wp_send_json_success(array(
421 421
 			'updateComplete'     => false,
422 422
 			'done'               => $done,
423 423
 			'progression'        => $done_number . '/' . $total_number,
424
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 100,
424
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 100,
425 425
 			'doneDescription'    => $done_number . '/' . $total_number,
426 426
 			'doneElementNumber'  => $done_number,
427 427
 			'errors'             => null,
428
-		) );
428
+		));
429 429
 	}
430 430
 
431 431
 	/**
@@ -436,45 +436,45 @@  discard block
 block discarded – undo
436 436
 	 * @since 2.0.0
437 437
 	 */
438 438
 	public function sync_invoices() {
439
-		check_ajax_referer( 'sync_invoices' );
439
+		check_ajax_referer('sync_invoices');
440 440
 
441 441
 		$done         = false;
442
-		$done_number  = ! empty( $_POST['done_number'] ) ? (int) $_POST['done_number'] : 0;
443
-		$total_number = ! empty( $_POST['total_number'] ) ? (int) $_POST['total_number'] : 0;
442
+		$done_number  = !empty($_POST['done_number']) ? (int)$_POST['done_number'] : 0;
443
+		$total_number = !empty($_POST['total_number']) ? (int)$_POST['total_number'] : 0;
444 444
 
445
-		$doli_invoices = Request_Util::get( 'invoices?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request );
445
+		$doli_invoices = Request_Util::get('invoices?sortfield=t.rowid&sortorder=ASC&limit=' . Doli_Synchro::g()->limit_entries_by_request . '&page=' . $done_number / Doli_Synchro::g()->limit_entries_by_request);
446 446
 
447
-		if ( ! empty( $doli_invoices ) ) {
448
-			foreach ( $doli_invoices as $doli_invoice ) {
449
-				$wp_invoice = Doli_Invoice::g()->get( array(
447
+		if (!empty($doli_invoices)) {
448
+			foreach ($doli_invoices as $doli_invoice) {
449
+				$wp_invoice = Doli_Invoice::g()->get(array(
450 450
 					'meta_key'   => '_external_id',
451
-					'meta_value' => (int) $doli_invoice->id,
452
-				), true );
451
+					'meta_value' => (int)$doli_invoice->id,
452
+				), true);
453 453
 
454
-				if ( empty( $wp_invoice ) ) {
455
-					$wp_invoice = Doli_Invoice::g()->get( array( 'schema' => true ), true );
454
+				if (empty($wp_invoice)) {
455
+					$wp_invoice = Doli_Invoice::g()->get(array('schema' => true), true);
456 456
 				}
457 457
 
458
-				Doli_Invoice::g()->doli_to_wp( $doli_invoice, $wp_invoice );
458
+				Doli_Invoice::g()->doli_to_wp($doli_invoice, $wp_invoice);
459 459
 
460 460
 				$done_number++;
461 461
 			}
462 462
 		}
463 463
 
464
-		if ( $done_number >= $total_number ) {
464
+		if ($done_number >= $total_number) {
465 465
 			$done_number = $total_number;
466 466
 			$done        = true;
467 467
 		}
468 468
 
469
-		wp_send_json_success( array(
469
+		wp_send_json_success(array(
470 470
 			'updateComplete'     => false,
471 471
 			'done'               => $done,
472 472
 			'progression'        => $done_number . '/' . $total_number,
473
-			'progressionPerCent' => 0 !== $total_number ? ( ( $done_number * 100 ) / $total_number ) : 100,
473
+			'progressionPerCent' => 0 !== $total_number ? (($done_number * 100) / $total_number) : 100,
474 474
 			'doneDescription'    => $done_number . '/' . $total_number,
475 475
 			'doneElementNumber'  => $done_number,
476 476
 			'errors'             => null,
477
-		) );
477
+		));
478 478
 	}
479 479
 }
480 480
 
Please login to merge, or discard this patch.
modules/doli-synchro/view/main.view.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  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
 <div class="wpeo-gridlayout grid-3">
20 20
 	<?php
21
-	if ( ! empty( $sync_infos ) ) :
22
-		foreach ( $sync_infos as $key => $info ) :
21
+	if (!empty($sync_infos)) :
22
+		foreach ($sync_infos as $key => $info) :
23 23
 			$stats = '0 / ' . $info['total_number'];
24 24
 			?>
25 25
 			<div>
@@ -29,18 +29,18 @@  discard block
 block discarded – undo
29 29
 						<i class="icon dashicons" ></i>
30 30
 					</div>
31 31
 					<div class="item-container">
32
-						<form action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="POST">
33
-							<input type="hidden" name="action" value="<?php echo esc_attr( $info['action'] ); ?>" />
34
-							<?php wp_nonce_field( $info['nonce'] ); ?>
32
+						<form action="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" method="POST">
33
+							<input type="hidden" name="action" value="<?php echo esc_attr($info['action']); ?>" />
34
+							<?php wp_nonce_field($info['nonce']); ?>
35 35
 							<div class="item-content" >
36
-								<div class="item-title"><?php echo esc_attr( $info['title'] ); ?></div>
36
+								<div class="item-title"><?php echo esc_attr($info['title']); ?></div>
37 37
 							</div>
38 38
 							<div class="item-result" >
39
-								<input type="hidden" name="total_number" value="<?php echo ( null !== $info['total_number'] ? esc_attr( $info['total_number'] ) : 0 ); ?>" />
39
+								<input type="hidden" name="total_number" value="<?php echo (null !== $info['total_number'] ? esc_attr($info['total_number']) : 0); ?>" />
40 40
 								<input type="hidden" name="done_number" value="0" />
41 41
 								<div class="item-progress" >
42 42
 									<div class="item-progression" >&nbsp;</div>
43
-									<div class="item-stats" ><?php echo esc_html( $stats ); ?></div>
43
+									<div class="item-stats" ><?php echo esc_html($stats); ?></div>
44 44
 								</div>
45 45
 							</div>
46 46
 						</form>
Please login to merge, or discard this patch.
modules/doli-synchro/view/single-footer.view.php 1 patch
Spacing   +2 added lines, -2 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
 <div class="wpeo-button button-light modal-close">
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 <div class="wpeo-button button-main action-input"
25 25
 	data-action="load_synchro_modal_single"
26
-	data-nonce="<?php echo esc_attr( wp_create_nonce( 'load_modal_synchro_single' ) ); ?>"
26
+	data-nonce="<?php echo esc_attr(wp_create_nonce('load_modal_synchro_single')); ?>"
27 27
 	data-parent="wpeo-modal">
28 28
 	<span>Associer et synchroniser</span>
29 29
 </div>
Please login to merge, or discard this patch.
modules/dashboard/view/metaboxes/metabox-sync.view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 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="wpeo-button button-main wpeo-modal-event"
20 20
 	data-action="load_modal_synchro"
21
-	data-nonce="<?php echo esc_attr( wp_create_nonce( 'load_modal_synchro' ) ); ?>"
21
+	data-nonce="<?php echo esc_attr(wp_create_nonce('load_modal_synchro')); ?>"
22 22
 	data-class="modal-sync"
23
-	data-title="<?php echo esc_attr_e( 'Data synchronization', 'wpshop' ); ?>">
24
-	<span><?php esc_html_e( 'Synchronization', 'wpshop' ); ?></span>
23
+	data-title="<?php echo esc_attr_e('Data synchronization', 'wpshop'); ?>">
24
+	<span><?php esc_html_e('Synchronization', 'wpshop'); ?></span>
25 25
 </div>
Please login to merge, or discard this patch.
modules/paypal/class/class-paypal.php 1 patch
Spacing   +23 added lines, -23 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
  * PayPal Class.
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 	 * @param  Order_Model $order Les données de la commande.
45 45
 	 * @return array              L'URL pour aller à la page de paiement.
46 46
 	 */
47
-	public function process_payment( $order ) {
48
-		$paypal_options = Payment::g()->get_payment_option( 'paypal' );
47
+	public function process_payment($order) {
48
+		$paypal_options = Payment::g()->get_payment_option('paypal');
49 49
 
50 50
 		$this->request_url = $paypal_options['use_paypal_sandbox'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr?test_ipn=1&' : 'https://www.paypal.com/cgi-bin/webscr?';
51
-		$paypal_args       = $this->get_paypal_args( $order );
51
+		$paypal_args       = $this->get_paypal_args($order);
52 52
 
53 53
 		return array(
54
-			'url' => $this->request_url . http_build_query( $paypal_args, '', '&' ),
54
+			'url' => $this->request_url . http_build_query($paypal_args, '', '&'),
55 55
 		);
56 56
 	}
57 57
 
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return array              Les données IPN.
66 66
 	 */
67
-	protected function get_paypal_args( $order ) {
68
-		$paypal_args = apply_filters( 'wps_paypal_args', array_merge(
69
-			$this->get_transaction_args( $order ),
70
-			$this->get_line_item_args( $order )
71
-		), $order );
67
+	protected function get_paypal_args($order) {
68
+		$paypal_args = apply_filters('wps_paypal_args', array_merge(
69
+			$this->get_transaction_args($order),
70
+			$this->get_line_item_args($order)
71
+		), $order);
72 72
 
73 73
 		return $paypal_args;
74 74
 	}
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @return array              Les données IPN.
84 84
 	 */
85
-	protected function get_transaction_args( $order ) {
86
-		$payment_methods_option = get_option( 'wps_payment_methods', array(
85
+	protected function get_transaction_args($order) {
86
+		$payment_methods_option = get_option('wps_payment_methods', array(
87 87
 			'paypal' => array(),
88 88
 			'cheque' => array(),
89
-		) );
89
+		));
90 90
 
91
-		$third_party = Third_Party::g()->get( array( 'id' => $order->data['parent_id'] ), true );
92
-		$contact     = Contact::g()->get( array( 'id' => end( $third_party->data['contact_ids'] ) ), true );
91
+		$third_party = Third_Party::g()->get(array('id' => $order->data['parent_id']), true);
92
+		$contact     = Contact::g()->get(array('id' => end($third_party->data['contact_ids'])), true);
93 93
 
94 94
 		return array(
95 95
 			'cmd'           => '_cart',
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			'charset'       => 'utf-8',
103 103
 			'upload'        => 1,
104 104
 			'return'        => Pages::g()->get_valid_checkout_link() . '?order_id=' . $order->data['id'],
105
-			'notify_url'    => site_url( 'wp-json/wpshop/v2/wps_gateway_paypal' ),
105
+			'notify_url'    => site_url('wp-json/wpshop/v2/wps_gateway_paypal'),
106 106
 			'cancel_return' => '',
107 107
 			'email'         => $contact->data['email'],
108 108
 			'custom'        => $order->data['id'],
@@ -118,15 +118,15 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @return array              Les lignes pour le paiement PayPal.
120 120
 	 */
121
-	protected function get_line_item_args( $order ) {
121
+	protected function get_line_item_args($order) {
122 122
 		$line_item_args = array();
123 123
 
124
-		if ( ! empty( $order->data['lines'] ) ) {
125
-			foreach ( $order->data['lines'] as $index => $line ) {
126
-				$line_item_args[ 'item_name_' . ( $index + 1 ) ]   = $line['libelle'];
127
-				$line_item_args[ 'quantity_' . ( $index + 1 ) ]    = $line['qty'];
128
-				$line_item_args[ 'amount_' . ( $index + 1 ) ]      = number_format( $line['price_ttc'], 2 );
129
-				$line_item_args[ 'item_number_' . ( $index + 1 ) ] = $line['ref'];
124
+		if (!empty($order->data['lines'])) {
125
+			foreach ($order->data['lines'] as $index => $line) {
126
+				$line_item_args['item_name_' . ($index + 1)]   = $line['libelle'];
127
+				$line_item_args['quantity_' . ($index + 1)]    = $line['qty'];
128
+				$line_item_args['amount_' . ($index + 1)]      = number_format($line['price_ttc'], 2);
129
+				$line_item_args['item_number_' . ($index + 1)] = $line['ref'];
130 130
 			}
131 131
 		}
132 132
 
Please login to merge, or discard this patch.
modules/paypal/action/class-paypal-action.php 1 patch
Spacing   +35 added lines, -35 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
  * PayPal Action Class.
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 	 * @since 2.0.0
28 28
 	 */
29 29
 	public function __construct() {
30
-		add_action( 'wps_setting_payment_method_paypal', array( $this, 'callback_setting_payment_method' ), 10, 0 );
31
-		add_action( 'admin_post_wps_update_method_payment_paypal', array( $this, 'update_method_payment_paypal' ) );
30
+		add_action('wps_setting_payment_method_paypal', array($this, 'callback_setting_payment_method'), 10, 0);
31
+		add_action('admin_post_wps_update_method_payment_paypal', array($this, 'update_method_payment_paypal'));
32 32
 
33
-		add_action( 'wps_gateway_paypal', array( $this, 'callback_wps_gateway_paypal' ) );
34
-		add_action( 'wps_valid_paypal_standard_ipn_request', array( $this, 'callback_wps_valid_paypal_standard_ipn_request' ) );
33
+		add_action('wps_gateway_paypal', array($this, 'callback_wps_gateway_paypal'));
34
+		add_action('wps_valid_paypal_standard_ipn_request', array($this, 'callback_wps_valid_paypal_standard_ipn_request'));
35 35
 	}
36 36
 
37 37
 	/**
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * @since 2.0.0
41 41
 	 */
42 42
 	public function callback_setting_payment_method() {
43
-		$paypal_options = Payment::g()->get_payment_option( 'paypal' );
44
-		\eoxia\View_Util::exec( 'wpshop', 'paypal', 'form-setting', array(
43
+		$paypal_options = Payment::g()->get_payment_option('paypal');
44
+		\eoxia\View_Util::exec('wpshop', 'paypal', 'form-setting', array(
45 45
 			'paypal_options' => $paypal_options,
46
-		) );
46
+		));
47 47
 	}
48 48
 
49 49
 	/**
@@ -52,29 +52,29 @@  discard block
 block discarded – undo
52 52
 	 * @since 2.0.0
53 53
 	 */
54 54
 	public function update_method_payment_paypal() {
55
-		check_admin_referer( 'update_method_payment_paypal' );
55
+		check_admin_referer('update_method_payment_paypal');
56 56
 
57
-		if ( ! current_user_can( 'manage_options' ) ) {
57
+		if (!current_user_can('manage_options')) {
58 58
 			wp_die();
59 59
 		}
60 60
 
61
-		$title              = ! empty( $_POST['title'] ) ? sanitize_text_field( $_POST['title'] ) : '';
62
-		$description        = ! empty( $_POST['description'] ) ? sanitize_text_field( $_POST['description'] ) : '';
63
-		$paypal_email       = ! empty( $_POST['paypal_email'] ) ? sanitize_text_field( $_POST['paypal_email'] ) : '';
64
-		$use_paypal_sandbox = ( isset( $_POST['use_paypal_sandbox'] ) && 'on' == $_POST['use_paypal_sandbox'] ) ? true : false;
61
+		$title              = !empty($_POST['title']) ? sanitize_text_field($_POST['title']) : '';
62
+		$description        = !empty($_POST['description']) ? sanitize_text_field($_POST['description']) : '';
63
+		$paypal_email       = !empty($_POST['paypal_email']) ? sanitize_text_field($_POST['paypal_email']) : '';
64
+		$use_paypal_sandbox = (isset($_POST['use_paypal_sandbox']) && 'on' == $_POST['use_paypal_sandbox']) ? true : false;
65 65
 
66
-		$payment_methods_option = get_option( 'wps_payment_methods', Payment::g()->default_options );
66
+		$payment_methods_option = get_option('wps_payment_methods', Payment::g()->default_options);
67 67
 
68 68
 		$payment_methods_option['paypal']['title']              = $title;
69 69
 		$payment_methods_option['paypal']['description']        = $description;
70 70
 		$payment_methods_option['paypal']['paypal_email']       = $paypal_email;
71 71
 		$payment_methods_option['paypal']['use_paypal_sandbox'] = $use_paypal_sandbox;
72 72
 
73
-		update_option( 'wps_payment_methods', $payment_methods_option );
73
+		update_option('wps_payment_methods', $payment_methods_option);
74 74
 
75
-		set_transient( 'updated_wpshop_option_' . get_current_user_id(), __( 'Your settings have been saved.', 'wpshop' ), 30 );
75
+		set_transient('updated_wpshop_option_' . get_current_user_id(), __('Your settings have been saved.', 'wpshop'), 30);
76 76
 
77
-		wp_redirect( admin_url( 'admin.php?page=wps-settings&tab=payment_method&section=paypal' ) );
77
+		wp_redirect(admin_url('admin.php?page=wps-settings&tab=payment_method&section=paypal'));
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @param  array $data Les données reçu par PayPal.
86 86
 	 */
87
-	public function callback_wps_gateway_paypal( $data ) {
88
-		if ( ! empty( $data ) && $this->validate_ipn( $data ) ) { // WPCS: CSRF ok.
89
-			$posted = wp_unslash( $data );
90
-			do_action( 'wps_valid_paypal_standard_ipn_request', $posted );
87
+	public function callback_wps_gateway_paypal($data) {
88
+		if (!empty($data) && $this->validate_ipn($data)) { // WPCS: CSRF ok.
89
+			$posted = wp_unslash($data);
90
+			do_action('wps_valid_paypal_standard_ipn_request', $posted);
91 91
 		} else {
92
-			wp_die( 'No IPN' );
92
+			wp_die('No IPN');
93 93
 		}
94 94
 	}
95 95
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	 *
101 101
 	 * @param array $posted Les données reçu par PayPal vérifié.
102 102
 	 */
103
-	public function callback_wps_valid_paypal_standard_ipn_request( $posted ) {
104
-		if ( method_exists( $this, 'payment_status_' . strtolower( $posted['payment_status'] ) ) ) {
105
-			call_user_func( array( $this, 'payment_status_' . strtolower( $posted['payment_status'] ) ), $posted );
103
+	public function callback_wps_valid_paypal_standard_ipn_request($posted) {
104
+		if (method_exists($this, 'payment_status_' . strtolower($posted['payment_status']))) {
105
+			call_user_func(array($this, 'payment_status_' . strtolower($posted['payment_status'])), $posted);
106 106
 		}
107 107
 	}
108 108
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 	 * @param  array $data Les données reçu par PayPal.
115 115
 	 * @return boolean     True si OK, sinon false.
116 116
 	 */
117
-	public function validate_ipn( $data ) {
118
-		$paypal_options = Payment::g()->get_payment_option( 'paypal' );
117
+	public function validate_ipn($data) {
118
+		$paypal_options = Payment::g()->get_payment_option('paypal');
119 119
 
120
-		$validate_ipn        = wp_unslash( $data );
120
+		$validate_ipn        = wp_unslash($data);
121 121
 		$validate_ipn['cmd'] = '_notify-validate';
122 122
 
123 123
 		$params = array(
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 			'decompress'  => false,
129 129
 		);
130 130
 
131
-		$response = wp_safe_remote_post( $paypal_options['use_paypal_sandbox'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', $params );
131
+		$response = wp_safe_remote_post($paypal_options['use_paypal_sandbox'] ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr', $params);
132 132
 
133
-		if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 && strstr( $response['body'], 'VERIFIED' ) ) {
133
+		if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 && strstr($response['body'], 'VERIFIED')) {
134 134
 			return true;
135 135
 		}
136 136
 
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 * @param  array $posted Les données reçu par PayPal vérifié.
146 146
 	 */
147
-	private function payment_status_completed( $posted ) {
148
-		do_action( 'wps_payment_complete', $posted );
147
+	private function payment_status_completed($posted) {
148
+		do_action('wps_payment_complete', $posted);
149 149
 	}
150 150
 
151 151
 	/**
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 *
156 156
 	 * @param array $posted Les données reçu par Paypal vérifié.
157 157
 	 */
158
-	private function payment_status_failed( $posted ) {
159
-		do_action( 'wps_payment_failed', $posted );
158
+	private function payment_status_failed($posted) {
159
+		do_action('wps_payment_failed', $posted);
160 160
 	}
161 161
 }
162 162
 
Please login to merge, or discard this patch.
modules/paypal/view/form-setting.view.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,35 +14,35 @@
 block discarded – undo
14 14
 
15 15
 namespace wpshop;
16 16
 
17
-defined( 'ABSPATH' ) || exit; ?>
17
+defined('ABSPATH') || exit; ?>
18 18
 
19
-<form class="wpeo-form" action="<?php echo admin_url( 'admin-post.php' ); ?>" method="POST">
19
+<form class="wpeo-form" action="<?php echo admin_url('admin-post.php'); ?>" method="POST">
20 20
 	<input type="hidden" name="action" value="wps_update_method_payment_paypal" />
21
-	<?php wp_nonce_field( 'update_method_payment_paypal' ); ?>
21
+	<?php wp_nonce_field('update_method_payment_paypal'); ?>
22 22
 
23 23
 	<div class="form-element">
24
-		<span class="form-label"><?php esc_html_e( 'Title', 'wpshop' ); ?></span>
24
+		<span class="form-label"><?php esc_html_e('Title', 'wpshop'); ?></span>
25 25
 		<label class="form-field-container">
26
-			<input type="text" class="form-field" name="title" value="<?php echo esc_attr( $paypal_options['title'] ); ?>" />
26
+			<input type="text" class="form-field" name="title" value="<?php echo esc_attr($paypal_options['title']); ?>" />
27 27
 		</label>
28 28
 	</div>
29 29
 
30 30
 	<div class="form-element">
31
-		<span class="form-label"><?php esc_html_e( 'Paypal email', 'wpshop' ); ?></span>
31
+		<span class="form-label"><?php esc_html_e('Paypal email', 'wpshop'); ?></span>
32 32
 		<label class="form-field-container">
33
-			<input type="text" class="form-field" name="paypal_email" value="<?php echo esc_attr( $paypal_options['paypal_email'] ); ?>" />
33
+			<input type="text" class="form-field" name="paypal_email" value="<?php echo esc_attr($paypal_options['paypal_email']); ?>" />
34 34
 		</label>
35 35
 	</div>
36 36
 
37 37
 	<div class="form-element form-align-horizontal">
38 38
 		<div class="form-field-inline">
39 39
 			<input type="checkbox" id="use-paypal-sandbox" class="form-field" <?php echo $paypal_options['use_paypal_sandbox'] ? 'checked' : ''; ?> name="use_paypal_sandbox" />
40
-			<label for="use-paypal-sandbox"><?php esc_html_e( 'Paypal Sandbox', 'wpshop' ); ?></label>
40
+			<label for="use-paypal-sandbox"><?php esc_html_e('Paypal Sandbox', 'wpshop'); ?></label>
41 41
 		</div>
42 42
 	</div>
43 43
 
44 44
 	<div class="form-element">
45
-		<span class="form-label"><?php esc_html_e( 'Description', 'wpshop' ); ?></span>
45
+		<span class="form-label"><?php esc_html_e('Description', 'wpshop'); ?></span>
46 46
 		<label class="form-field-container">
47 47
 			<textarea name="description" class="form-field" rows="3" cols="20"><?php echo $paypal_options['description']; ?></textarea>
48 48
 		</label>
Please login to merge, or discard this patch.