@@ -14,8 +14,8 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | -<h3><a href="<?php echo admin_url( 'admin.php?page=wps-settings&tab=payment_method' ); ?>">Mode de paiements</a> -> <?php echo $payment['title']; ?></h3> |
|
19 | +<h3><a href="<?php echo admin_url('admin.php?page=wps-settings&tab=payment_method'); ?>">Mode de paiements</a> -> <?php echo $payment['title']; ?></h3> |
|
20 | 20 | |
21 | -<?php do_action( 'wps_setting_payment_method_' . $section ); ?> |
|
21 | +<?php do_action('wps_setting_payment_method_' . $section); ?> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | namespace wpshop; |
18 | 18 | |
19 | -defined( 'ABSPATH' ) || exit; |
|
19 | +defined('ABSPATH') || exit; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Transfert Data Action Class. |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * @since 2.0.0 |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'admin_menu', array( $this, 'callback_admin_menu' ) ); |
|
33 | - add_action( 'wp_ajax_wps_transfert_data', array( $this, 'callback_transfert_data' ) ); |
|
32 | + add_action('admin_menu', array($this, 'callback_admin_menu')); |
|
33 | + add_action('wp_ajax_wps_transfert_data', array($this, 'callback_transfert_data')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * @since 2.0.0 |
40 | 40 | */ |
41 | 41 | public function callback_admin_menu() { |
42 | - add_submenu_page( 'wps-order', __( 'Transfert data', 'wpshop' ), __( 'Transfert data', 'wpshop' ), 'manage_options', 'wps-transfert-data', array( $this, 'callback_add_menu_page' ) ); |
|
42 | + add_submenu_page('wps-order', __('Transfert data', 'wpshop'), __('Transfert data', 'wpshop'), 'manage_options', 'wps-transfert-data', array($this, 'callback_add_menu_page')); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * @since 2.0.0 |
49 | 49 | */ |
50 | 50 | public function callback_add_menu_page() { |
51 | - $count_posts = wp_count_posts( 'wpshop_customers' ); |
|
51 | + $count_posts = wp_count_posts('wpshop_customers'); |
|
52 | 52 | $number_customers = $count_posts->draft; |
53 | 53 | |
54 | - \eoxia\View_Util::exec( 'wpshop', 'transfert-data', 'main', array( |
|
54 | + \eoxia\View_Util::exec('wpshop', 'transfert-data', 'main', array( |
|
55 | 55 | 'number_customers' => $number_customers, |
56 | - ) ); |
|
56 | + )); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -64,39 +64,39 @@ discard block |
||
64 | 64 | * @since 2.0.0 |
65 | 65 | */ |
66 | 66 | public function callback_transfert_data() { |
67 | - define( 'SAVEQUERIES', true ); |
|
67 | + define('SAVEQUERIES', true); |
|
68 | 68 | global $wpdb; |
69 | 69 | |
70 | - check_ajax_referer( 'wps_transfert_data' ); |
|
70 | + check_ajax_referer('wps_transfert_data'); |
|
71 | 71 | |
72 | - $number_customers = ! empty( $_POST['number_customers'] ) ? (int) $_POST['number_customers'] : 0; // WPCS: Input var okay. |
|
73 | - $index = ! empty( $_POST['index'] ) ? (int) $_POST['index'] : 0; // WPCS: Input var okay. |
|
74 | - $index_error = ! empty( $_POST['index_error'] ) ? (int) $_POST['index_error'] : 0; // WPCS: Input var okay. |
|
75 | - $key_query = ! empty( $_POST['key_query'] ) ? (int) $_POST['key_query'] : 1; // WPCS: Input var okay. |
|
72 | + $number_customers = !empty($_POST['number_customers']) ? (int)$_POST['number_customers'] : 0; // WPCS: Input var okay. |
|
73 | + $index = !empty($_POST['index']) ? (int)$_POST['index'] : 0; // WPCS: Input var okay. |
|
74 | + $index_error = !empty($_POST['index_error']) ? (int)$_POST['index_error'] : 0; // WPCS: Input var okay. |
|
75 | + $key_query = !empty($_POST['key_query']) ? (int)$_POST['key_query'] : 1; // WPCS: Input var okay. |
|
76 | 76 | $done = false; |
77 | 77 | $output = ''; |
78 | 78 | $errors = ''; |
79 | 79 | |
80 | - $results = new \WP_Query( array( |
|
80 | + $results = new \WP_Query(array( |
|
81 | 81 | 'posts_per_page' => 20, |
82 | 82 | 'post_type' => 'wpshop_customers', |
83 | 83 | 'offset' => $index, |
84 | 84 | 'post_status' => 'draft', |
85 | - ) ); |
|
85 | + )); |
|
86 | 86 | |
87 | 87 | $customers = $results->posts; |
88 | 88 | |
89 | - if ( ! empty( $customers ) ) { |
|
90 | - foreach ( $customers as $customer ) { |
|
91 | - $results = new \WP_Query( array( |
|
89 | + if (!empty($customers)) { |
|
90 | + foreach ($customers as $customer) { |
|
91 | + $results = new \WP_Query(array( |
|
92 | 92 | 'meta_key' => 'old_id', |
93 | 93 | 'meta_value' => $customer->ID, |
94 | 94 | 'post_type' => 'wps-third-party', |
95 | 95 | 'post_status' => 'publish', |
96 | 96 | 'posts_per_page' => 1, |
97 | - ) ); // WPCS: slow query ok. |
|
97 | + )); // WPCS: slow query ok. |
|
98 | 98 | |
99 | - if ( ! empty( $results->posts ) ) { |
|
99 | + if (!empty($results->posts)) { |
|
100 | 100 | $new_customer = $results->posts[0]; |
101 | 101 | } |
102 | 102 | |
@@ -108,79 +108,79 @@ discard block |
||
108 | 108 | 'post_status' => 'publish', |
109 | 109 | ); |
110 | 110 | |
111 | - if ( ! empty( $new_customer ) ) { |
|
111 | + if (!empty($new_customer)) { |
|
112 | 112 | $data['ID'] = $new_customer->ID; |
113 | 113 | } |
114 | 114 | |
115 | - $post_id = wp_insert_post( $data ); |
|
115 | + $post_id = wp_insert_post($data); |
|
116 | 116 | |
117 | - $old_id = get_post_meta( $post_id, 'old_id', true ); |
|
117 | + $old_id = get_post_meta($post_id, 'old_id', true); |
|
118 | 118 | |
119 | - if ( empty( $old_id ) ) { |
|
120 | - add_post_meta( $post_id, 'old_id', $customer->ID ); |
|
119 | + if (empty($old_id)) { |
|
120 | + add_post_meta($post_id, 'old_id', $customer->ID); |
|
121 | 121 | } |
122 | 122 | |
123 | - $contact_ids = update_post_meta( $post_id, '_contact_ids', array() ); |
|
123 | + $contact_ids = update_post_meta($post_id, '_contact_ids', array()); |
|
124 | 124 | |
125 | - $results = new \WP_Query( array( |
|
125 | + $results = new \WP_Query(array( |
|
126 | 126 | 'post_type' => 'wpshop_address', |
127 | 127 | 'post_status' => 'draft', |
128 | 128 | 'posts_per_page' => 1, |
129 | 129 | 'post_parent' => $customer->ID, |
130 | - ) ); |
|
130 | + )); |
|
131 | 131 | |
132 | - if ( ! empty( $results->posts ) ) { |
|
132 | + if (!empty($results->posts)) { |
|
133 | 133 | $address = $results->posts[0]; |
134 | - $address_meta = get_post_meta( $address->ID, '_wpshop_address_metadata', true ); |
|
134 | + $address_meta = get_post_meta($address->ID, '_wpshop_address_metadata', true); |
|
135 | 135 | |
136 | - update_post_meta( $post_id, '_address', $address_meta['address'] ); |
|
137 | - update_post_meta( $post_id, '_zip', $address_meta['postcode'] ); |
|
138 | - update_post_meta( $post_id, '_town', $address_meta['city'] ); |
|
139 | - update_post_meta( $post_id, '_country', $address_meta['country'] ); |
|
136 | + update_post_meta($post_id, '_address', $address_meta['address']); |
|
137 | + update_post_meta($post_id, '_zip', $address_meta['postcode']); |
|
138 | + update_post_meta($post_id, '_town', $address_meta['city']); |
|
139 | + update_post_meta($post_id, '_country', $address_meta['country']); |
|
140 | 140 | } |
141 | 141 | |
142 | - $users_id = get_post_meta( $customer->ID, '_wpscrm_associated_user', true ); |
|
142 | + $users_id = get_post_meta($customer->ID, '_wpscrm_associated_user', true); |
|
143 | 143 | |
144 | - if ( empty( $users_id ) ) { |
|
144 | + if (empty($users_id)) { |
|
145 | 145 | $users_id = array(); |
146 | 146 | } |
147 | 147 | |
148 | - if ( ! in_array( $customer->post_author, $users_id, true ) ) { |
|
149 | - $users_id = array_merge( $users_id, array( $customer->post_author ) ); |
|
148 | + if (!in_array($customer->post_author, $users_id, true)) { |
|
149 | + $users_id = array_merge($users_id, array($customer->post_author)); |
|
150 | 150 | } |
151 | 151 | |
152 | - if ( ! empty( $users_id ) ) { |
|
153 | - $users = get_users( array( |
|
152 | + if (!empty($users_id)) { |
|
153 | + $users = get_users(array( |
|
154 | 154 | 'include' => $users_id, |
155 | - ) ); |
|
155 | + )); |
|
156 | 156 | |
157 | - if ( ! empty( $users ) ) { |
|
158 | - foreach ( $users as $user ) { |
|
159 | - $phone = get_user_meta( $user->ID, 't_l_phone__1684463909', true ); |
|
157 | + if (!empty($users)) { |
|
158 | + foreach ($users as $user) { |
|
159 | + $phone = get_user_meta($user->ID, 't_l_phone__1684463909', true); |
|
160 | 160 | |
161 | - if ( empty( $phone ) ) { |
|
162 | - $phone = get_user_meta( $user->ID, 'wps_phone', true ); |
|
161 | + if (empty($phone)) { |
|
162 | + $phone = get_user_meta($user->ID, 'wps_phone', true); |
|
163 | 163 | } |
164 | 164 | |
165 | - update_user_meta( $user->ID, '_phone', $phone ); |
|
165 | + update_user_meta($user->ID, '_phone', $phone); |
|
166 | 166 | |
167 | - $third_party_id = get_user_meta( $user->ID, '_third_party_id', true ); |
|
167 | + $third_party_id = get_user_meta($user->ID, '_third_party_id', true); |
|
168 | 168 | |
169 | - if ( empty( $third_party_id ) ) { |
|
170 | - update_user_meta( $user->ID, '_third_party_id', $post_id ); |
|
169 | + if (empty($third_party_id)) { |
|
170 | + update_user_meta($user->ID, '_third_party_id', $post_id); |
|
171 | 171 | |
172 | - $contact_ids = json_decode( get_post_meta( $post_id, '_contact_ids', true ) ); |
|
172 | + $contact_ids = json_decode(get_post_meta($post_id, '_contact_ids', true)); |
|
173 | 173 | |
174 | - if ( empty( $contact_ids ) ) { |
|
174 | + if (empty($contact_ids)) { |
|
175 | 175 | $contact_ids = array(); |
176 | 176 | } |
177 | 177 | |
178 | 178 | $contact_ids[] = $user->ID; |
179 | 179 | |
180 | - update_post_meta( $post_id, '_contact_ids', json_encode( $contact_ids ) ); |
|
180 | + update_post_meta($post_id, '_contact_ids', json_encode($contact_ids)); |
|
181 | 181 | } else { |
182 | 182 | // translators: <li><strong>1</strong>Contact #1 is already affected to another third party #2</li>. |
183 | - $errors .= sprintf( __( '<li><strong>%1$d</strong>Contact #%2$d is already affected to another third party #%3$d</li>', 'wpshop' ), $index_error, $user->ID, $third_party_id ); |
|
183 | + $errors .= sprintf(__('<li><strong>%1$d</strong>Contact #%2$d is already affected to another third party #%3$d</li>', 'wpshop'), $index_error, $user->ID, $third_party_id); |
|
184 | 184 | $index_error++; |
185 | 185 | } |
186 | 186 | } |
@@ -192,29 +192,29 @@ discard block |
||
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
195 | - if ( ! empty( $wpdb->queries ) ) { |
|
196 | - foreach ( $wpdb->queries as $key => $element ) { |
|
197 | - $output .= '<li><strong>' . ( $key + $key_query ) . '</strong> ' . $element[0] . '</li>'; |
|
195 | + if (!empty($wpdb->queries)) { |
|
196 | + foreach ($wpdb->queries as $key => $element) { |
|
197 | + $output .= '<li><strong>' . ($key + $key_query) . '</strong> ' . $element[0] . '</li>'; |
|
198 | 198 | |
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | $key_query = $key + $key_query; |
203 | 203 | |
204 | - if ( $index >= $number_customers ) { |
|
204 | + if ($index >= $number_customers) { |
|
205 | 205 | $done = true; |
206 | 206 | |
207 | 207 | $output .= '<li>Done</li>'; |
208 | 208 | } |
209 | 209 | |
210 | - wp_send_json_success( array( |
|
210 | + wp_send_json_success(array( |
|
211 | 211 | 'done' => $done, |
212 | 212 | 'index' => $index, |
213 | 213 | 'index_error' => $index_error, |
214 | 214 | 'key_query' => $key_query, |
215 | 215 | 'output' => $output, |
216 | 216 | 'errors' => $errors, |
217 | - ) ); |
|
217 | + )); |
|
218 | 218 | } |
219 | 219 | } |
220 | 220 |
@@ -15,10 +15,10 @@ |
||
15 | 15 | |
16 | 16 | namespace wpshop; |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; ?> |
|
18 | +defined('ABSPATH') || exit; ?> |
|
19 | 19 | |
20 | 20 | <div class="wrap transfert-data"> |
21 | - <input type="hidden" name="number_customers" value="<?php echo esc_attr( $number_customers ); ?>" /> |
|
21 | + <input type="hidden" name="number_customers" value="<?php echo esc_attr($number_customers); ?>" /> |
|
22 | 22 | <input type="hidden" name="key_query" value="1" /> |
23 | 23 | <input type="hidden" name="index" value="0" /> |
24 | 24 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; |
|
17 | +defined('ABSPATH') || exit; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Dashboard Action Class. |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | * @since 2.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'admin_menu', array( $this, 'callback_admin_menu' ) ); |
|
31 | - add_action( 'load-toplevel_page_wps-third-party', array( $this, 'callback_load' ) ); |
|
30 | + add_action('admin_menu', array($this, 'callback_admin_menu')); |
|
31 | + add_action('load-toplevel_page_wps-third-party', array($this, 'callback_load')); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @since 2.0.0 |
38 | 38 | */ |
39 | 39 | public function callback_admin_menu() { |
40 | - add_submenu_page( 'wps-order', __( 'Dashboard', 'wpshop' ), __( 'Dashboard', 'wpshop' ), 'manage_options', 'wps-dashboard', array( $this, 'callback_add_menu_page' ) ); |
|
40 | + add_submenu_page('wps-order', __('Dashboard', 'wpshop'), __('Dashboard', 'wpshop'), 'manage_options', 'wps-dashboard', array($this, 'callback_add_menu_page')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * @since 2.0.0 |
47 | 47 | */ |
48 | 48 | public function callback_add_menu_page() { |
49 | - add_meta_box( 'wps-dashboard-sync', __( 'Synchronization', 'wpshop' ), array( $this, 'metabox_sync' ), 'wps-dashboard', 'normal', 'default' ); |
|
49 | + add_meta_box('wps-dashboard-sync', __('Synchronization', 'wpshop'), array($this, 'metabox_sync'), 'wps-dashboard', 'normal', 'default'); |
|
50 | 50 | |
51 | - \eoxia\View_Util::exec( 'wpshop', 'dashboard', 'main' ); |
|
51 | + \eoxia\View_Util::exec('wpshop', 'dashboard', 'main'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @since 2.0.0 |
58 | 58 | */ |
59 | 59 | public function callback_load() { |
60 | - wp_enqueue_script( 'common' ); |
|
61 | - wp_enqueue_script( 'wp-lists' ); |
|
62 | - wp_enqueue_script( 'postbox' ); |
|
60 | + wp_enqueue_script('common'); |
|
61 | + wp_enqueue_script('wp-lists'); |
|
62 | + wp_enqueue_script('postbox'); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @since 2.0.0 |
69 | 69 | */ |
70 | 70 | public function metabox_sync() { |
71 | - \eoxia\View_Util::exec( 'wpshop', 'dashboard', 'metaboxes/metabox-sync' ); |
|
71 | + \eoxia\View_Util::exec('wpshop', 'dashboard', 'metaboxes/metabox-sync'); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 |
@@ -14,10 +14,10 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | <div class="wrap"> |
20 | - <h2><?php esc_html_e( 'Dashboard', 'wpshop' ); ?></h2> |
|
20 | + <h2><?php esc_html_e('Dashboard', 'wpshop'); ?></h2> |
|
21 | 21 | |
22 | - <?php do_meta_boxes( 'wps-dashboard', 'normal', '' ); ?> |
|
22 | + <?php do_meta_boxes('wps-dashboard', 'normal', ''); ?> |
|
23 | 23 | </div> |
@@ -14,6 +14,6 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | Stats |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; |
|
17 | +defined('ABSPATH') || exit; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Contact class. |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param Third_Party_Model $third_party Les données du tier. |
75 | 75 | */ |
76 | - public function display( $third_party ) { |
|
76 | + public function display($third_party) { |
|
77 | 77 | $contacts = array(); |
78 | 78 | |
79 | - if ( ! empty( $third_party->data['contact_ids'] ) ) { |
|
80 | - $contacts = $this->get( array( |
|
79 | + if (!empty($third_party->data['contact_ids'])) { |
|
80 | + $contacts = $this->get(array( |
|
81 | 81 | 'include' => $third_party->data['contact_ids'], |
82 | - ) ); |
|
82 | + )); |
|
83 | 83 | } |
84 | 84 | |
85 | - \eoxia\View_Util::exec( 'wpshop', 'contacts', 'list', array( |
|
85 | + \eoxia\View_Util::exec('wpshop', 'contacts', 'list', array( |
|
86 | 86 | 'contacts' => $contacts, |
87 | - ) ); |
|
87 | + )); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; |
|
17 | +defined('ABSPATH') || exit; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Class Contact model. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param Contact $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', |
@@ -53,6 +53,6 @@ discard block |
||
53 | 53 | 'field' => '_third_party_id', |
54 | 54 | ); |
55 | 55 | |
56 | - parent::__construct( $object, $req_method ); |
|
56 | + parent::__construct($object, $req_method); |
|
57 | 57 | } |
58 | 58 | } |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | |
20 | 20 | <ul> |
21 | 21 | <?php |
22 | - if ( ! empty( $contacts ) ) : |
|
22 | + if (!empty($contacts)) : |
|
23 | 23 | ?> |
24 | - <p><?php esc_html_e( 'Associated contact', 'wpshop' ); ?></p> |
|
24 | + <p><?php esc_html_e('Associated contact', 'wpshop'); ?></p> |
|
25 | 25 | <?php |
26 | - foreach ( $contacts as $contact ) : |
|
27 | - \eoxia\View_Util::exec( 'wpshop', 'contacts', 'item', array( |
|
26 | + foreach ($contacts as $contact) : |
|
27 | + \eoxia\View_Util::exec('wpshop', 'contacts', 'item', array( |
|
28 | 28 | 'contact' => $contact, |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | endforeach; |
31 | 31 | endif; |
32 | 32 | ?> |