Completed
Push — master ( 24f014...ee1ff0 )
by
unknown
13:44
created
wps_customer/templates/backend/customer_listtable/customer-contacts.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@
 block discarded – undo
9 9
  * @version 3.0.0.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if (!defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 $WPS_Customers_Contacts = new WPS_Customers_Contacts();
17
-$contacts = $WPS_Customers_Contacts->get_customer_contact_list( $customer_post );
17
+$contacts = $WPS_Customers_Contacts->get_customer_contact_list($customer_post);
18 18
 
19 19
 ?>
20
-<?php foreach ( $contacts as $user_id => $user ) : ?>
21
-<?php $current_user_datas = get_userdata( $user_id ); ?>
20
+<?php foreach ($contacts as $user_id => $user) : ?>
21
+<?php $current_user_datas = get_userdata($user_id); ?>
22 22
 <div class="wps-customer-name-container" >
23
-	<a target="_wps_wpuser_edition_page" href="<?php echo esc_url( admin_url( 'user-edit.php?user_id=' . $user_id ) ); ?>" ><?php echo esc_html( $current_user_datas->user_email ); ?></a>
23
+	<a target="_wps_wpuser_edition_page" href="<?php echo esc_url(admin_url('user-edit.php?user_id=' . $user_id)); ?>" ><?php echo esc_html($current_user_datas->user_email); ?></a>
24 24
 </div>
25 25
 
26 26
 <div class="row-actions" >
27
-	<?php if ( current_user_can( 'edit_users' ) ) : ?>
27
+	<?php if (current_user_can('edit_users')) : ?>
28 28
 	<?php //apply_filters( 'wps_filter_customer_list_actions', $post_id, $user_id ); ?>
29 29
 	<?php else : ?>
30
-	<?php printf( __( 'WP-User %d', 'wpshop' ), $user_id ); ?>
30
+	<?php printf(__('WP-User %d', 'wpshop'), $user_id); ?>
31 31
 	<?php endif; ?>
32 32
 </div>
33 33
 <?php endforeach; ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,11 @@
 block discarded – undo
26 26
 <div class="row-actions" >
27 27
 	<?php if ( current_user_can( 'edit_users' ) ) : ?>
28 28
 	<?php //apply_filters( 'wps_filter_customer_list_actions', $post_id, $user_id ); ?>
29
-	<?php else : ?>
30
-	<?php printf( __( 'WP-User %d', 'wpshop' ), $user_id ); ?>
29
+	<?php else {
30
+	: ?>
31
+	<?php printf( __( 'WP-User %d', 'wpshop' ), $user_id );
32
+}
33
+?>
31 34
 	<?php endif; ?>
32 35
 </div>
33 36
 <?php endforeach; ?>
Please login to merge, or discard this patch.
modules/wps_customer/templates/backend/customer_listtable/customer-name.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @version 3.0.0.0
10 10
  */
11 11
 
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if (!defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15
-?><a href="<?php echo admin_url( 'post.php?post=' . $post_id . '&amp;action=edit' ); ?>" ><?php echo $customer_post->post_title; ?></a>
15
+?><a href="<?php echo admin_url('post.php?post=' . $post_id . '&amp;action=edit'); ?>" ><?php echo $customer_post->post_title; ?></a>
Please login to merge, or discard this patch.
includes/modules/wps_customer/controller/wps_customer_ctr.php 2 patches
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage Customer
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -29,29 +29,29 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct() {
31 31
 		/** Create customer entity type on wordpress initilisation */
32
-		add_action( 'init', array( $this, 'create_customer_entity' ) );
32
+		add_action('init', array($this, 'create_customer_entity'));
33 33
 
34 34
 		// add_action( 'admin_init', array( $this, 'redirect_new_user' ) );
35 35
 
36 36
 		/** When a wordpress user is created, create a customer (post type) */
37
-		add_action( 'user_register', array( $this, 'create_entity_customer_when_user_is_created' ) );
38
-		add_action( 'edit_user_profile_update', array( $this, 'update_entity_customer_when_profile_user_is_update' ) );
37
+		add_action('user_register', array($this, 'create_entity_customer_when_user_is_created'));
38
+		add_action('edit_user_profile_update', array($this, 'update_entity_customer_when_profile_user_is_update'));
39 39
 
40 40
 		/** Add filters for customer list */
41
-		add_filter( 'bulk_actions-edit-' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, array( $this, 'customer_list_table_bulk_actions' ) );
42
-		add_filter( 'manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . '_columns', array( $this, 'list_table_header' ) );
43
-		add_action( 'manage_' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . '_posts_custom_column', array( $this, 'list_table_column_content' ), 10, 2 );
44
-		add_action( 'restrict_manage_posts', array( &$this, 'list_table_filters' ) );
45
-		add_filter( 'parse_query', array( &$this, 'list_table_filter_parse_query' ) );
41
+		add_filter('bulk_actions-edit-' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, array($this, 'customer_list_table_bulk_actions'));
42
+		add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . '_columns', array($this, 'list_table_header'));
43
+		add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . '_posts_custom_column', array($this, 'list_table_column_content'), 10, 2);
44
+		add_action('restrict_manage_posts', array(&$this, 'list_table_filters'));
45
+		add_filter('parse_query', array(&$this, 'list_table_filter_parse_query'));
46 46
 
47 47
 		/** Filter search for customers */
48 48
 		//add_filter( 'pre_get_posts', array( $this, 'customer_search' ) );
49 49
 
50 50
 		/** Customer options for the shop */
51
-		add_action( 'wsphop_options', array( &$this, 'declare_options' ), 8 );
52
-		add_action( 'wp_ajax_wps_customer_search', array( $this, 'ajax_search_customer' ) );
51
+		add_action('wsphop_options', array(&$this, 'declare_options'), 8);
52
+		add_action('wp_ajax_wps_customer_search', array($this, 'ajax_search_customer'));
53 53
 
54
-		add_action( 'wp_login', array( $this, 'hook_login_for_setting_customer_id' ), 10, 2 );
54
+		add_action('wp_login', array($this, 'hook_login_for_setting_customer_id'), 10, 2);
55 55
 	}
56 56
 
57 57
 	/**
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string L'affichage de la lsite déroulanet contenant les clients de la boutique / THe select list of customers
65 65
 	 */
66
-	public static function customer_select( $selected_user = 0, $multiple = false, $disabled = false ) {
66
+	public static function customer_select($selected_user = 0, $multiple = false, $disabled = false) {
67 67
 		$content_output = '';
68 68
 
69 69
 		$wps_customer_mdl = new wps_customer_mdl();
70 70
 		$customers = $wps_customer_mdl->get_customer_list( -1 );
71 71
 
72
-		require( wpshop_tools::get_template_part( WPS_ACCOUNT_DIR, WPS_ACCOUNT_TPL, 'common', 'customer', 'select' ) );
72
+		require(wpshop_tools::get_template_part(WPS_ACCOUNT_DIR, WPS_ACCOUNT_TPL, 'common', 'customer', 'select'));
73 73
 
74 74
 		return $content_output;
75 75
 	}
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 	 * @param	string		$user_login le nom d'utilisateur de l'utilisateur actuellement connecté / Username of current connected user.
81 81
 	 * @param	WP_Object $user			 l'objet WP_User correspond à l'utilisateur actuellement connecté / Current connected user WP_Object definition.
82 82
 	 */
83
-	public function hook_login_for_setting_customer_id( $user_login, $user ) {
84
-		 setcookie( 'wps_current_connected_customer', self::get_customer_id_by_author_id( $user->ID ), strtotime( '+30 days' ), SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl() );
83
+	public function hook_login_for_setting_customer_id($user_login, $user) {
84
+		 setcookie('wps_current_connected_customer', self::get_customer_id_by_author_id($user->ID), strtotime('+30 days'), SITECOOKIEPATH, COOKIE_DOMAIN, is_ssl());
85 85
 	}
86 86
 
87 87
 	/**
88 88
 	 * AJAX callback for customer search
89 89
 	 */
90 90
 	public function ajax_search_customer() {
91
-		check_ajax_referer( 'wps_customer_search' );
91
+		check_ajax_referer('wps_customer_search');
92 92
 
93
-		$term = ! empty( $_GET ) && ! empty( $_GET['term'] ) && is_string( (string) $_GET['term'] ) ? (string) $_GET['term'] : $term;
94
-		$list = $this->search_customer( $term );
93
+		$term = !empty($_GET) && !empty($_GET['term']) && is_string((string)$_GET['term']) ? (string)$_GET['term'] : $term;
94
+		$list = $this->search_customer($term);
95 95
 
96
-		wp_die( wp_json_encode( $list ) );
96
+		wp_die(wp_json_encode($list));
97 97
 	}
98 98
 
99 99
 	/**
@@ -101,22 +101,22 @@  discard block
 block discarded – undo
101 101
 	 *
102 102
 	 * @param string $term The term we have to search into database for getting existing users / Le terme qu'il faut rechercher pour retrouver les utilisateurs dans la base de données.
103 103
 	 */
104
-	public function search_customer( $term ) {
104
+	public function search_customer($term) {
105 105
 		$users = array();
106
-		$search_users = new WP_User_Query( array(
107
-			'search'				 => '*' . esc_attr( $term ) . '*',
108
-			'search_columns' => array( 'user_login', 'user_url', 'user_email', 'user_nicename', 'display_name' ),
109
-		) );
110
-		if ( ! empty( $search_users->get_results() ) ) {
111
-			foreach ( $search_users->get_results() as $user ) {
112
-				$users[ $user->ID ]['id'] = $user->ID;
113
-				$users[ $user->ID ]['display_name'] = $user->display_name;
114
-				$users[ $user->ID ]['email'] = $user->user_email;
115
-				$users[ $user->ID ]['last_name'] = $user->last_name;
116
-				$users[ $user->ID ]['first_name'] = $user->first_name;
106
+		$search_users = new WP_User_Query(array(
107
+			'search'				 => '*' . esc_attr($term) . '*',
108
+			'search_columns' => array('user_login', 'user_url', 'user_email', 'user_nicename', 'display_name'),
109
+		));
110
+		if (!empty($search_users->get_results())) {
111
+			foreach ($search_users->get_results() as $user) {
112
+				$users[$user->ID]['id'] = $user->ID;
113
+				$users[$user->ID]['display_name'] = $user->display_name;
114
+				$users[$user->ID]['email'] = $user->user_email;
115
+				$users[$user->ID]['last_name'] = $user->last_name;
116
+				$users[$user->ID]['first_name'] = $user->first_name;
117 117
 			}
118 118
 		}
119
-		$search_users_in_meta = new WP_User_Query( array(
119
+		$search_users_in_meta = new WP_User_Query(array(
120 120
 			'meta_query'		 => array(
121 121
 				'relation' => 'OR',
122 122
 				array(
@@ -130,20 +130,20 @@  discard block
 block discarded – undo
130 130
 					'compare' => 'LIKE',
131 131
 				),
132 132
 			),
133
-		) );
134
-		if ( ! empty( $search_users_in_meta->get_results() ) ) {
135
-			foreach ( $search_users_in_meta->get_results() as $user ) {
136
-				$users[ $user->ID ]['id'] = $user->ID;
137
-				$users[ $user->ID ]['display_name'] = $user->display_name;
138
-				$users[ $user->ID ]['email'] = $user->user_email;
139
-				$users[ $user->ID ]['last_name'] = $user->last_name;
140
-				$users[ $user->ID ]['first_name'] = $user->first_name;
133
+		));
134
+		if (!empty($search_users_in_meta->get_results())) {
135
+			foreach ($search_users_in_meta->get_results() as $user) {
136
+				$users[$user->ID]['id'] = $user->ID;
137
+				$users[$user->ID]['display_name'] = $user->display_name;
138
+				$users[$user->ID]['email'] = $user->user_email;
139
+				$users[$user->ID]['last_name'] = $user->last_name;
140
+				$users[$user->ID]['first_name'] = $user->first_name;
141 141
 			}
142 142
 		}
143
-		if ( empty( $users ) ) {
143
+		if (empty($users)) {
144 144
 			$users[] = array(
145 145
 				'id'		=> null,
146
-				'label'	=> __( 'Create a new user', 'digirisk' ),
146
+				'label'	=> __('Create a new user', 'digirisk'),
147 147
 			);
148 148
 		}
149 149
 
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
 	 *
158 158
 	 * @return int $customer_id
159 159
 	 */
160
-	public static function get_customer_id_by_author_id( $author_id ) {
161
-		if ( ! isset( self::$customer_user_identifier_cache[ $author_id ] ) ) {
162
-			$query = $GLOBALS['wpdb']->prepare( "SELECT ID FROM {$GLOBALS['wpdb']->posts} WHERE post_author = %d AND post_type = %s ORDER BY ID ASC", $author_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS );
163
-			self::$customer_user_identifier_cache[ $author_id ] = $GLOBALS['wpdb']->get_var( $query );
160
+	public static function get_customer_id_by_author_id($author_id) {
161
+		if (!isset(self::$customer_user_identifier_cache[$author_id])) {
162
+			$query = $GLOBALS['wpdb']->prepare("SELECT ID FROM {$GLOBALS['wpdb']->posts} WHERE post_author = %d AND post_type = %s ORDER BY ID ASC", $author_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
163
+			self::$customer_user_identifier_cache[$author_id] = $GLOBALS['wpdb']->get_var($query);
164 164
 		}
165 165
 
166
-		return self::$customer_user_identifier_cache[ $author_id ];
166
+		return self::$customer_user_identifier_cache[$author_id];
167 167
 	}
168 168
 
169 169
 	/**
@@ -174,15 +174,15 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @return int
176 176
 	 */
177
-	public static function get_author_id_by_customer_id( $customer_id ) {
178
-		$flipped = array_flip( self::$customer_user_identifier_cache );
179
-		if ( ! isset( $flipped[ $customer_id ] ) ) {
180
-			$author_id = $GLOBALS['wpdb']->get_var( $GLOBALS['wpdb']->prepare( "SELECT post_author FROM {$GLOBALS['wpdb']->posts} WHERE ID = %d", $customer_id ) );
181
-			self::$customer_user_identifier_cache[ $author_id ] = $customer_id;
182
-			$flipped[ $customer_id ] = $author_id;
177
+	public static function get_author_id_by_customer_id($customer_id) {
178
+		$flipped = array_flip(self::$customer_user_identifier_cache);
179
+		if (!isset($flipped[$customer_id])) {
180
+			$author_id = $GLOBALS['wpdb']->get_var($GLOBALS['wpdb']->prepare("SELECT post_author FROM {$GLOBALS['wpdb']->posts} WHERE ID = %d", $customer_id));
181
+			self::$customer_user_identifier_cache[$author_id] = $customer_id;
182
+			$flipped[$customer_id] = $author_id;
183 183
 		}
184 184
 
185
-		return $flipped[ $customer_id ];
185
+		return $flipped[$customer_id];
186 186
 	}
187 187
 
188 188
 	/**
@@ -190,26 +190,26 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function create_customer_entity() {
192 192
 		global $wpdb;
193
-		$query = $wpdb->prepare( "SELECT P.post_title, PM.meta_value FROM {$wpdb->posts} AS P INNER JOIN {$wpdb->postmeta} AS PM ON (PM.post_id = P.ID) WHERE P.post_name = %s AND PM.meta_key = %s", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, '_wpshop_entity_params' );
194
-		$customer_entity_definition = $wpdb->get_row( $query ); // WPCS: unprepared sql ok.
195
-		$current_entity_params = ! empty( $customer_entity_definition ) && ! empty( $customer_entity_definition->meta_value ) ? unserialize( $customer_entity_definition->meta_value ) : null;
193
+		$query = $wpdb->prepare("SELECT P.post_title, PM.meta_value FROM {$wpdb->posts} AS P INNER JOIN {$wpdb->postmeta} AS PM ON (PM.post_id = P.ID) WHERE P.post_name = %s AND PM.meta_key = %s", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, '_wpshop_entity_params');
194
+		$customer_entity_definition = $wpdb->get_row($query); // WPCS: unprepared sql ok.
195
+		$current_entity_params = !empty($customer_entity_definition) && !empty($customer_entity_definition->meta_value) ? unserialize($customer_entity_definition->meta_value) : null;
196 196
 
197 197
 		$post_type_params = array(
198 198
 			'labels' => array(
199
-				'name' => __( 'Customers', 'wpshop' ),
200
-				'singular_name' => __( 'Customer', 'wpshop' ),
201
-				'add_new_item' => __( 'New customer', 'wpshop' ),
202
-				'add_new' => __( 'New customer', 'wpshop' ),
203
-				'edit_item' => __( 'Edit customer', 'wpshop' ),
204
-				'new_item' => __( 'New customer', 'wpshop' ),
205
-				'view_item' => __( 'View customer', 'wpshop' ),
206
-				'search_items' => __( 'Search in customers', 'wpshop' ),
207
-				'not_found' => __( 'No customer found', 'wpshop' ),
208
-				'not_found_in_trash' => __( 'No customer founded in trash', 'wpshop' ),
199
+				'name' => __('Customers', 'wpshop'),
200
+				'singular_name' => __('Customer', 'wpshop'),
201
+				'add_new_item' => __('New customer', 'wpshop'),
202
+				'add_new' => __('New customer', 'wpshop'),
203
+				'edit_item' => __('Edit customer', 'wpshop'),
204
+				'new_item' => __('New customer', 'wpshop'),
205
+				'view_item' => __('View customer', 'wpshop'),
206
+				'search_items' => __('Search in customers', 'wpshop'),
207
+				'not_found' => __('No customer found', 'wpshop'),
208
+				'not_found_in_trash' => __('No customer founded in trash', 'wpshop'),
209 209
 				'parent_item_colon' => '',
210 210
 			),
211 211
 			'description' => '',
212
-			'supports' => ! empty( $current_entity_params['support'] ) ? $current_entity_params['support'] : array( 'title' ),
212
+			'supports' => !empty($current_entity_params['support']) ? $current_entity_params['support'] : array('title'),
213 213
 			'hierarchical' => false,
214 214
 			'public' => false,
215 215
 			'show_ui' => true,
@@ -234,22 +234,22 @@  discard block
 block discarded – undo
234 234
 			),
235 235
 		);
236 236
 
237
-		register_post_type( WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $post_type_params );
237
+		register_post_type(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $post_type_params);
238 238
 	}
239 239
 
240 240
 	/**
241 241
 	 * Customer options for the shop
242 242
 	 */
243 243
 	public static function declare_options() {
244
-		if ( WPSHOP_DEFINED_SHOP_TYPE == 'sale' ) {
245
-			$wpshop_shop_type = ! empty( $_POST['wpshop_shop_type'] ) ? sanitize_text_field( $_POST['wpshop_shop_type'] ) : '';
246
-			$old_wpshop_shop_type = ! empty( $_POST['old_wpshop_shop_type'] ) ? sanitize_text_field( $_POST['old_wpshop_shop_type'] ) : '';
244
+		if (WPSHOP_DEFINED_SHOP_TYPE == 'sale') {
245
+			$wpshop_shop_type = !empty($_POST['wpshop_shop_type']) ? sanitize_text_field($_POST['wpshop_shop_type']) : '';
246
+			$old_wpshop_shop_type = !empty($_POST['old_wpshop_shop_type']) ? sanitize_text_field($_POST['old_wpshop_shop_type']) : '';
247 247
 
248
-			if ( ( $wpshop_shop_type == '' || $wpshop_shop_type != 'presentation' )
249
-					&& ( $old_wpshop_shop_type == '' || $old_wpshop_shop_type != 'presentation' ) ) {
248
+			if (($wpshop_shop_type == '' || $wpshop_shop_type != 'presentation')
249
+					&& ($old_wpshop_shop_type == '' || $old_wpshop_shop_type != 'presentation')) {
250 250
 					/**		Add module option to wpshop general options		*/
251
-					register_setting( 'wpshop_options', 'wpshop_cart_option', array( 'wps_customer_ctr', 'wpshop_options_validate_customers_newsleters' ) );
252
-					add_settings_field( 'display_newsletters_subscriptions', __( 'Display newsletters subscriptions', 'wpshop' ), array( 'wps_customer_ctr', 'display_newsletters_subscriptions' ), 'wpshop_cart_info', 'wpshop_cart_info' );
251
+					register_setting('wpshop_options', 'wpshop_cart_option', array('wps_customer_ctr', 'wpshop_options_validate_customers_newsleters'));
252
+					add_settings_field('display_newsletters_subscriptions', __('Display newsletters subscriptions', 'wpshop'), array('wps_customer_ctr', 'display_newsletters_subscriptions'), 'wpshop_cart_info', 'wpshop_cart_info');
253 253
 			}
254 254
 		}
255 255
 	}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return array Les réglages des clients qui ont été vérifiés
263 263
 	 */
264
-	public static function wpshop_options_validate_customers_newsleters( $input ) {
264
+	public static function wpshop_options_validate_customers_newsleters($input) {
265 265
 			return $input;
266 266
 	}
267 267
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * Affichage des champs permettant les réglages concernant les newsletters des clients dans les réglages de la boutique
270 270
 	 */
271 271
 	public static function display_newsletters_subscriptions() {
272
-		$cart_option = get_option( 'wpshop_cart_option', array() );
272
+		$cart_option = get_option('wpshop_cart_option', array());
273 273
 		$output = '';
274 274
 
275 275
 		$input_def = array();
@@ -277,18 +277,18 @@  discard block
 block discarded – undo
277 277
 		$input_def['id'] = 'wpshop_cart_option_display_newsletter_site_subscription';
278 278
 		$input_def['type'] = 'checkbox';
279 279
 		$input_def['valueToPut'] = 'index';
280
-		$input_def['value'] = ! empty( $cart_option['display_newsletter']['site_subscription'] ) ? $cart_option['display_newsletter']['site_subscription'][0] : 'no';
280
+		$input_def['value'] = !empty($cart_option['display_newsletter']['site_subscription']) ? $cart_option['display_newsletter']['site_subscription'][0] : 'no';
281 281
 		$input_def['possible_value'] = 'yes';
282
-		$output .= wpshop_form::check_input_type( $input_def, 'wpshop_cart_option[display_newsletter][site_subscription]' ) . '<label for="' . $input_def['id'] . '">' . __( 'Newsletters of the site', 'wpshop' ) . '</label><a href="#" title="' . __( 'Check this box if you want display newsletter site subscription', 'wpshop' ) . '" class="wpshop_infobulle_marker">?</a><br>';
282
+		$output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[display_newsletter][site_subscription]') . '<label for="' . $input_def['id'] . '">' . __('Newsletters of the site', 'wpshop') . '</label><a href="#" title="' . __('Check this box if you want display newsletter site subscription', 'wpshop') . '" class="wpshop_infobulle_marker">?</a><br>';
283 283
 
284 284
 		$input_def = array();
285 285
 		$input_def['name'] = '';
286 286
 		$input_def['id'] = 'wpshop_cart_option_display_newsletter_partner_subscription';
287 287
 		$input_def['type'] = 'checkbox';
288 288
 		$input_def['valueToPut'] = 'index';
289
-		$input_def['value'] = ! empty( $cart_option['display_newsletter']['partner_subscription'] ) ? $cart_option['display_newsletter']['partner_subscription'][0] : 'no';
289
+		$input_def['value'] = !empty($cart_option['display_newsletter']['partner_subscription']) ? $cart_option['display_newsletter']['partner_subscription'][0] : 'no';
290 290
 		$input_def['possible_value'] = 'yes';
291
-		$output .= wpshop_form::check_input_type( $input_def, 'wpshop_cart_option[display_newsletter][partner_subscription]' ) . '<label for="' . $input_def['id'] . '">' . __( 'Newsletters of the partners', 'wpshop' ) . '</label><a href="#" title="' . __( 'Check this box if you want display newsletter partners subscription', 'wpshop' ) . '" class="wpshop_infobulle_marker">?</a><br>';
291
+		$output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[display_newsletter][partner_subscription]') . '<label for="' . $input_def['id'] . '">' . __('Newsletters of the partners', 'wpshop') . '</label><a href="#" title="' . __('Check this box if you want display newsletter partners subscription', 'wpshop') . '" class="wpshop_infobulle_marker">?</a><br>';
292 292
 
293 293
 		echo $output; // WPCS: XSS ok.
294 294
 	}
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		global $pagenow;
301 301
 
302 302
 		/* Check current admin page. */
303
-		if ( $pagenow != 'user-new.php' && isset( $_SESSION['redirect_to_customer'] ) ) {
303
+		if ($pagenow != 'user-new.php' && isset($_SESSION['redirect_to_customer'])) {
304 304
 			$redirect = $_SESSION['redirect_to_customer'];
305
-			unset( $_SESSION['redirect_to_customer'] );
306
-			if ( $pagenow == 'users.php' ) {
307
-					wp_redirect( admin_url( $redirect, 'http' ) );
305
+			unset($_SESSION['redirect_to_customer']);
306
+			if ($pagenow == 'users.php') {
307
+					wp_redirect(admin_url($redirect, 'http'));
308 308
 					exit;
309 309
 			}
310 310
 		}
311 311
 
312 312
 		/* Redirect to new user */
313
-		$post_type = ! empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
313
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
314 314
 		if ($pagenow == 'post-new.php' && isset($post_type) && $post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) {
315 315
 				$_SESSION['redirect_to_customer'] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS;
316 316
 				wp_redirect(admin_url('user-new.php', 'http'), 301);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 *
336 336
 	 * @param integer $user_id
337 337
 	 */
338
-	public static function create_entity_customer_when_user_is_created( $user_id ) {
338
+	public static function create_entity_customer_when_user_is_created($user_id) {
339 339
 		$user_data = get_userdata($user_id);
340 340
 		$user_info = array_merge(get_object_vars($user_data->data), array_map('self::array_map_create_entity_customer_when_user_is_created', get_user_meta($user_id)));
341 341
 		$customer_post_ID = wp_insert_post(array('post_type' => WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, 'post_author' => $user_id, 'post_title' => $user_data->user_nicename));
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 		/** Change metabox Hidden Nav Menu Definition to display WPShop categories' metabox **/
345 345
 		$usermeta = get_post_meta($user_id, 'metaboxhidden_nav-menus', true);
346
-		if (! empty($usermeta) && is_array($usermeta)) {
346
+		if (!empty($usermeta) && is_array($usermeta)) {
347 347
 			$data_to_delete = array_search('add-wpshop_product_category', $usermeta);
348 348
 			if ($data_to_delete !== false) {
349 349
 					unset($usermeta[$data_to_delete]);
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 			}
352 352
 		}
353 353
 	}
354
-	private static function array_map_create_entity_customer_when_user_is_created( $a ) {
354
+	private static function array_map_create_entity_customer_when_user_is_created($a) {
355 355
 			return $a[0];
356 356
 	}
357 357
 
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @param integer $user_id
362 362
 	 */
363
-	public static function update_entity_customer_when_profile_user_is_update( $user_id ) {
363
+	public static function update_entity_customer_when_profile_user_is_update($user_id) {
364 364
 			$user_data = get_userdata($user_id);
365 365
 			$user_info = array_merge(get_object_vars($user_data->data), array_map('self::array_map_create_entity_customer_when_user_is_created', get_user_meta($user_id)));
366 366
 			$customer_post_ID = self::get_customer_id_by_author_id($user_id);
367 367
 			self::save_customer_synchronize($customer_post_ID, $user_id, $user_info);
368 368
 	}
369 369
 
370
-	private static function array_map_update_entity_customer_when_profile_user_is_update( $a ) {
370
+	private static function array_map_update_entity_customer_when_profile_user_is_update($a) {
371 371
 			return $a[0];
372 372
 	}
373 373
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 		return false;
377 377
 	}
378 378
 
379
-	public static function save_customer_synchronize( $customer_post_ID, $user_id, $user_info ) {
379
+	public static function save_customer_synchronize($customer_post_ID, $user_id, $user_info) {
380 380
 		global $wpdb;
381 381
 		global $wpshop;
382 382
 		$exclude_user_meta = array('user_login', 'user_nicename', 'user_email', 'user_pass', 'user_url', 'user_registered', 'user_activation_key', 'user_status', 'display_name');
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 		$query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $element_id);
386 386
 		$attribute_set_id = $wpdb->get_var($query);
387 387
 		$attributes_default = array();
388
-		if (! empty($attribute_set_id)) {
388
+		if (!empty($attribute_set_id)) {
389 389
 			$group = wps_address::get_addresss_form_fields_by_type($attribute_set_id);
390 390
 			foreach ($group as $attribute_sets) {
391 391
 				foreach ($attribute_sets as $attribute_set_field) {
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
 			}
406 406
 		}
407 407
 		$user_info = array_merge($attributes_default, $user_info);
408
-		add_filter( 'send_password_change_email', array( get_class(), 'prevent_send_mail_from_wordpress' ) );
408
+		add_filter('send_password_change_email', array(get_class(), 'prevent_send_mail_from_wordpress'));
409 409
 		foreach ($user_info as $user_meta => $user_meta_value) {
410 410
 			$attribute_def = wpshop_attributes::getElement($user_meta, "'valid'", 'code');
411
-			if (! empty($attribute_def)) {
411
+			if (!empty($attribute_def)) {
412 412
 				//Save data in user meta
413 413
 				if (in_array($user_meta, $exclude_user_meta)) {
414 414
 					if ($user_meta == 'user_pass') {
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 				//Save data in attribute tables, ckeck first if exist to know if Insert or Update
425 425
 				$query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . strtolower($attribute_def->data_type) . ' WHERE entity_type_id = %d AND entity_id = %d AND attribute_id = %d', $element_id, $customer_post_ID, $attribute_def->id);
426 426
 				$checking_attribute_exist = $wpdb->get_results($query);
427
-				if (! empty($checking_attribute_exist)) {
427
+				if (!empty($checking_attribute_exist)) {
428 428
 					$wpdb->update(
429 429
 						WPSHOP_DBT_ATTRIBUTE_VALUES_PREFIX . strtolower($attribute_def->data_type),
430 430
 						array(
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				}
452 452
 			}
453 453
 		}
454
-		remove_filter( 'send_password_change_email', array( get_class(), 'prevent_send_mail_from_wordpress' ) );
454
+		remove_filter('send_password_change_email', array(get_class(), 'prevent_send_mail_from_wordpress'));
455 455
 	}
456 456
 
457 457
 	/**
@@ -461,17 +461,17 @@  discard block
 block discarded – undo
461 461
 	 *
462 462
 	 * @return array The new header to display
463 463
 	 */
464
-	public function list_table_header( $current_header ) {
465
-		unset( $current_header['title'] );
466
-		unset( $current_header['date'] );
464
+	public function list_table_header($current_header) {
465
+		unset($current_header['title']);
466
+		unset($current_header['date']);
467 467
 
468
-		$current_header['customer_identifier'] = __( 'Customer ID', 'wpshop' );
469
-		$current_header['customer-name'] = __( 'Customer name', 'wpshop' );
468
+		$current_header['customer_identifier'] = __('Customer ID', 'wpshop');
469
+		$current_header['customer-name'] = __('Customer name', 'wpshop');
470 470
 		// $current_header['customer_name'] = '<span class="wps-customer-last_name" >' . __('Last-name', 'wpshop') . '</span><span class="wps-customer-first_name" >' . __('First-name', 'wpshop') . '</span>';
471 471
 		// $current_header['customer_email'] = __('E-mail', 'wpshop');
472
-		$current_header['customer-contacts'] = __( 'Contacts', 'wpshop' );
473
-		$current_header['customer-orders'] = __( 'Customer last order', 'wpshop' );
474
-		$current_header['customer_date_subscription'] = __( 'Subscription', 'wpshop' );
472
+		$current_header['customer-contacts'] = __('Contacts', 'wpshop');
473
+		$current_header['customer-orders'] = __('Customer last order', 'wpshop');
474
+		$current_header['customer_date_subscription'] = __('Subscription', 'wpshop');
475 475
 		// $current_header['customer_date_lastlogin'] = __( 'Last login date', 'wpshop' );
476 476
 
477 477
 		return $current_header;
@@ -483,43 +483,43 @@  discard block
 block discarded – undo
483 483
 	 * @param string  $column THe column identifier to modify output for.
484 484
 	 * @param integer $post_id The current post identifier.
485 485
 	 */
486
-	public function list_table_column_content( $column, $post_id ) {
486
+	public function list_table_column_content($column, $post_id) {
487 487
 		global $wpdb;
488 488
 
489 489
 		/**		Get wp_users identifier from customer id		*/
490
-		$customer_post_author = self::get_author_id_by_customer_id( $post_id );
490
+		$customer_post_author = self::get_author_id_by_customer_id($post_id);
491 491
 
492 492
 		/**		Get current post informations		*/
493
-		$customer_post = get_post( $post_id );
493
+		$customer_post = get_post($post_id);
494 494
 
495 495
 		/**		Switch current column for custom case		*/
496 496
 		$use_template = true;
497
-		switch ( $column ) {
497
+		switch ($column) {
498 498
 			case 'customer_identifier' :
499 499
 				echo $post_id;
500 500
 				$use_template = false;
501 501
 			break;
502 502
 
503 503
 			case 'customer_date_subscription' :
504
-				echo mysql2date( get_option( 'date_format' ), $customer_post->post_date, true );
504
+				echo mysql2date(get_option('date_format'), $customer_post->post_date, true);
505 505
 				$use_template = false;
506 506
 			break;
507 507
 
508 508
 			case 'customer_date_lastlogin' :
509
-				$last_login = get_user_meta( $customer_post_author, 'last_login_time', true );
510
-				if ( ! empty( $last_login ) ) :
511
-					echo mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $last_login, true );
509
+				$last_login = get_user_meta($customer_post_author, 'last_login_time', true);
510
+				if (!empty($last_login)) :
511
+					echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $last_login, true);
512 512
 				else :
513
-					_e( 'Never logged in', 'wpshop' );
513
+					_e('Never logged in', 'wpshop');
514 514
 				endif;
515 515
 				$use_template = false;
516 516
 			break;
517 517
 		}
518 518
 
519 519
 		/**		Require the template for displaying the current column		*/
520
-		if ( $use_template ) {
520
+		if ($use_template) {
521 521
 			$template = wpshop_tools::get_template_part(WPS_ACCOUNT_DIR, WPS_ACCOUNT_PATH . WPS_ACCOUNT_DIR . '/templates/', 'backend', 'customer_listtable/' . $column);
522
-			if ( is_file( $template ) ) {
522
+			if (is_file($template)) {
523 523
 				require $template;
524 524
 			}
525 525
 		}
@@ -532,23 +532,23 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @return array The new action list to use into customer list table
534 534
 	 */
535
-	public function customer_list_table_bulk_actions( $actions ) {
536
-		unset( $actions['edit'] );
537
-		unset( $actions['trash'] );
535
+	public function customer_list_table_bulk_actions($actions) {
536
+		unset($actions['edit']);
537
+		unset($actions['trash']);
538 538
 
539 539
 		return $actions;
540 540
 	}
541 541
 
542 542
 		public function list_table_filters()
543 543
 		{
544
-				$post_type = ! empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
544
+				$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
545 545
 				if (isset($post_type)) {
546 546
 						if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS)) {
547 547
 								$filter_possibilities = array();
548 548
 								$filter_possibilities[''] = __('-- Select Filter --', 'wpshop');
549 549
 								$filter_possibilities['orders'] = __('List customers with orders', 'wpshop');
550 550
 								$filter_possibilities['no_orders'] = __('List customers without orders', 'wpshop');
551
-								echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, (! empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''), '', 'index');
551
+								echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, (!empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''), '', 'index');
552 552
 						}
553 553
 				}
554 554
 		}
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
 		public function list_table_filter_parse_query($query)
557 557
 		{
558 558
 				global $pagenow, $wpdb;
559
-				$post_type = ! empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
560
-				$entity_filter = ! empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
561
-				if (is_admin() && ($pagenow == 'edit.php') && ! empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) && ! empty($entity_filter)) {
559
+				$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
560
+				$entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : '';
561
+				if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) && !empty($entity_filter)) {
562 562
 						$check = null;
563 563
 						switch ($entity_filter) {
564 564
 								case 'orders':
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 										break;
598 598
 						}
599 599
 
600
-						if (! empty($check)) {
600
+						if (!empty($check)) {
601 601
 								$results = $wpdb->get_results($sql_query);
602 602
 								$user_id_list = array();
603 603
 								foreach ($results as $item) {
@@ -637,13 +637,13 @@  discard block
 block discarded – undo
637 637
 		public static function quick_add_customer($form)
638 638
 		{
639 639
 				$return = 1;
640
-				if (! empty($form)) {
640
+				if (!empty($form)) {
641 641
 						global $wpdb;
642 642
 						$customer_type_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS);
643 643
 						$query = $wpdb->prepare('SELECT id FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $customer_type_id);
644 644
 						$customer_entity_id = $wpdb->get_var($query);
645 645
 						$attributes_set = wpshop_attributes_set::getElement($customer_entity_id);
646
-						$account_attributes = wpshop_attributes_set::getAttributeSetDetails((! empty($attributes_set->id)) ? $attributes_set->id : '', "'valid'");
646
+						$account_attributes = wpshop_attributes_set::getAttributeSetDetails((!empty($attributes_set->id)) ? $attributes_set->id : '', "'valid'");
647 647
 
648 648
 						$customer_attributes_to_save = $customer_attributes_to_save_temp = array();
649 649
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -509,8 +509,10 @@
 block discarded – undo
509 509
 				$last_login = get_user_meta( $customer_post_author, 'last_login_time', true );
510 510
 				if ( ! empty( $last_login ) ) :
511 511
 					echo mysql2date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $last_login, true );
512
-				else :
512
+				else {
513
+					:
513 514
 					_e( 'Never logged in', 'wpshop' );
515
+				}
514 516
 				endif;
515 517
 				$use_template = false;
516 518
 			break;
Please login to merge, or discard this patch.