Completed
Push — master ( 24f014...ee1ff0 )
by
unknown
13:44
created
includes/modules/wps_customer_contacts/templates/backend/contact.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,16 +30,22 @@
 block discarded – undo
30 30
 
31 31
 		<?php if ( true === $user['is_default'] ) : ?>
32 32
 			<i title="<?php esc_attr_e( 'This is the main contact / customer creator', 'wpshop' ); ?>" class="dashicons dashicons-star-filled" ></i>
33
-		<?php else : ?>
34
-			<i title="<?php esc_attr_e( 'Change to default customer', 'wpshop' ); ?>" class="dashicons dashicons-star-empty" ></i>
33
+		<?php else {
34
+	: ?>
35
+			<i title="<?php esc_attr_e( 'Change to default customer', 'wpshop' );
36
+}
37
+?>" class="dashicons dashicons-star-empty" ></i>
35 38
 		<?php endif; ?>
36 39
 
37 40
 		<!-- <a title="<?php esc_attr_e( 'User account edition', 'wpshop' ); ?>" href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=load_user_account_form&_wpnonce=' . wp_create_nonce( 'load_user_account_form' ) . '&user_id=' . $user_id ) ); ?>" class="thickbox" ><i class="dashicons dashicons-edit" ></i></a> -->
38 41
 
39 42
 		<?php if ( true === $user['is_default'] ) : ?>
40 43
 			<i title="<?php esc_attr_e( 'This is the main contact, you can\'t unlink it', 'wpshop' ); ?>" class="dashicons dashicons-lock" ></i>
41
-		<?php else : ?>
42
-			<i title="<?php esc_attr_e( 'Unlink this user', 'wpshop' ); ?>" class="dashicons dashicons-editor-unlink" ></i>
44
+		<?php else {
45
+	: ?>
46
+			<i title="<?php esc_attr_e( 'Unlink this user', 'wpshop' );
47
+}
48
+?>" class="dashicons dashicons-editor-unlink" ></i>
43 49
 		<?php endif; ?>
44 50
 		</td>
45 51
 	</tr>
Please login to merge, or discard this patch.
includes/modules/wps_address/templates/frontend/address-container.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2
- if ( !defined( 'ABSPATH' ) ) exit;
3
-?><div class="wps-<?php echo esc_attr( $address_type ); ?>-address" <?php if ( ! empty( $first_address_checking ) && ! is_admin() && ( 'billing' === $address_type ) ) { echo 'style="display: none;"'; } ?>>
2
+ if ( !defined( 'ABSPATH' ) ) {
3
+ 	exit;
4
+ }
5
+ ?><div class="wps-<?php echo esc_attr( $address_type ); ?>-address" <?php if ( ! empty( $first_address_checking ) && ! is_admin() && ( 'billing' === $address_type ) ) { echo 'style="display: none;"'; } ?>>
4 6
 	<div class="wps-gridwrapper">
5 7
 		<div class="wps-grid4x6"><span class="wps-h3"><?php echo esc_html( $address_title ); ?></span></div>
6 8
 	</div>
Please login to merge, or discard this patch.
includes/modules/wps_address/controller/wps_address_ctr.php 1 patch
Braces   +47 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * File defining class for addresses initialisation
4 6
  *
@@ -266,8 +268,9 @@  discard block
 block discarded – undo
266 268
 
267 269
 	function admin_scripts() {
268 270
 		global $current_screen;
269
-	    if ( ! in_array( $current_screen->post_type, array( WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ), true ) )
270
-	        return;
271
+	    if ( ! in_array( $current_screen->post_type, array( WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ), true ) ) {
272
+	    	        return;
273
+	    }
271 274
 
272 275
 		wp_enqueue_script( 'wps_address_js',  WPS_ADDRESS_URL . '/assets/backend/js/wps_address.js', array( 'jquery', 'jquery-form' ) );
273 276
 		wp_register_style( 'wps_address_backend_css', WPS_ADDRESS_URL . '/assets/backend/css/backend.css'/*, array( '' )*/ );
@@ -361,8 +364,7 @@  discard block
 block discarded – undo
361 364
 						$display_model =  $shipping_option['display_model'];
362 365
 						$has_model = true;
363 366
 
364
-					}
365
-					else {
367
+					} else {
366 368
 						$billing_option = get_option( 'wpshop_billing_address' );
367 369
 						if ( !empty($billing_option) && !empty($billing_option['choice']) && $billing_option['choice'] == $address_type && !empty($billing_option['display_model']) ) {
368 370
 							$display_model =  $billing_option['display_model'];
@@ -384,11 +386,9 @@  discard block
 block discarded – undo
384 386
 									if ( $attribute_def->frontend_input == 'select' ) {
385 387
 										$query = $wpdb->prepare( 'SELECT value FROM '.WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS. ' WHERE id = %d',$address[ $attribute_def->code] );
386 388
 										$output .= '<strong>'.__( $attribute_def->frontend_label, 'wpshop').' :</strong> '.__( $wpdb->get_var( $query ), 'wpshop' ).' ';
387
-									}
388
-									elseif( $attribute_def->frontend_verification == 'country' ) {
389
+									} elseif( $attribute_def->frontend_verification == 'country' ) {
389 390
 										$output .= ( !empty($countries[ $address[ $attribute_def->code] ]) ) ? '<strong>'.__( $attribute_def->frontend_label, 'wpshop').' :</strong> '.__( $countries[ $address[ $attribute_def->code] ], 'wpshop' ).' ' : '';
390
-									}
391
-									else {
391
+									} else {
392 392
 										$output .= ( !empty($address[ $attribute_def->code]) ) ? '<strong>'.__( $attribute_def->frontend_label, 'wpshop').' :</strong> '.$address[ $attribute_def->code].' ' : ' ';
393 393
 									}
394 394
 								}
@@ -402,8 +402,7 @@  discard block
 block discarded – undo
402 402
 						}
403 403
 					}
404 404
 				}
405
-			}
406
-			else {
405
+			} else {
407 406
 				if( !empty($address_type) ) {
408 407
 					$tmp_array = array();
409 408
 					$address_entity_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS );
@@ -419,13 +418,11 @@  discard block
 block discarded – undo
419 418
 
420 419
 										if( $attribute_def->frontend_verification == 'country' ) {
421 420
 											$tmp_array[ $attribute_def->code]['value'] =  ( !empty($countries[ $address[ $attribute_def->code] ]) ) ? stripslashes( __( $countries[ $address[ $attribute_def->code] ], 'wpshop' ) ) : stripslashes( $address[ $attribute_def->code ] );
422
-										}
423
-										elseif( in_array( $attribute_def->frontend_input, array('select', 'checkbox') ) ) {
421
+										} elseif( in_array( $attribute_def->frontend_input, array('select', 'checkbox') ) ) {
424 422
 											$query = $wpdb->prepare( 'SELECT label FROM '. WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS. ' WHERE id = %d', $address[ $attribute_def->code] );
425 423
 											$value = $wpdb->get_var( $query );
426 424
 											$tmp_array[ $attribute_def->code]['value'] = ( !empty($value) ) ? stripslashes(  __( $value, 'wpshop' ) ) : '';
427
-										}
428
-										else {
425
+										} else {
429 426
 											$tmp_array[ $attribute_def->code]['value'] = stripslashes(   __( $address[ $attribute_def->code ], 'wpshop' ) );
430 427
 										}
431 428
 									}
@@ -438,8 +435,7 @@  discard block
 block discarded – undo
438 435
 				foreach( $address as $element_code => $element_value ) {
439 436
 					if( is_array($element_value) ) {
440 437
 						$output .= '<span class="wps-'.$element_code.'"><strong>' .stripslashes( $element_value['label'] ). ' :</strong> ' .stripslashes( $element_value['value'] ). '</span>';
441
-					}
442
-					else {
438
+					} else {
443 439
 						$output .= '<span class="wps-'.$element_code.'">' .stripslashes( $element_value ). '</span>';
444 440
 					}
445 441
 				}
@@ -465,12 +461,10 @@  discard block
 block discarded – undo
465 461
 			$post = get_post( $post );
466 462
 			if ( !empty($post->post_parent) ) {
467 463
 				$customer_id = $post->post_parent;
468
-			}
469
-			else {
464
+			} else {
470 465
 				$customer_id = $post->post_author;
471 466
 			}
472
-		}
473
-		else {
467
+		} else {
474 468
 			$customer_id = get_current_user_id();
475 469
 		}
476 470
 
@@ -494,8 +488,7 @@  discard block
 block discarded – undo
494 488
 		$tpl_component['ADDRESS_BUTTONS'] = '';
495 489
 		if( count($addresses) > 0 ) {
496 490
 			$tpl_component['ADD_NEW_ADDRESS_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?')===false ? '?' : '&amp;'). 'action=add_address&type=' .$address_type_id;
497
-		}
498
-		else {
491
+		} else {
499 492
 			$tpl_component['ADD_NEW_ADDRESS_LINK'] = get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))) . (strpos(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id'))), '?')===false ? '?' : '&amp;'). 'action=add_address&type=' .$address_type_id .'&first';
500 493
 		}
501 494
 		$tpl_component['ADDRESS_TYPE'] = ( !empty($address_type_title) && ($address_type_title == __('Shipping address', 'wpshop'))) ? 'shipping_address' : 'billing_address';
@@ -517,8 +510,7 @@  discard block
 block discarded – undo
517 510
 					if ( !is_admin() ) {
518 511
 						$_SESSION[$tpl_component['ADDRESS_TYPE']] = $address->ID;
519 512
 					}
520
-				}
521
-				else {
513
+				} else {
522 514
 					$address_id = ( !empty($_SESSION[$tpl_component['ADDRESS_TYPE']]) )  ? $_SESSION[$tpl_component['ADDRESS_TYPE']] : '';
523 515
 				}
524 516
 				$address_selected_infos = get_post_meta($address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true);
@@ -548,8 +540,7 @@  discard block
 block discarded – undo
548 540
 			if ( !is_admin() ) {
549 541
 				$tpl_component['ADDRESS_COMBOBOX'] = (!empty($tpl_component['ADDRESS_COMBOBOX_OPTION']) && ($nb_of_addresses > 1)) ? wpshop_display::display_template_element('addresses_type_combobox', $tpl_component) : '';
550 542
 			}
551
-		}
552
-		else {
543
+		} else {
553 544
 			if ( !empty($args) && !empty($args['first']) && $args['first'] ) {
554 545
 				$tpl_component['ADDRESS_TYPE'] = 'first_address';
555 546
 			}
@@ -626,8 +617,7 @@  discard block
 block discarded – undo
626 617
 						if(!empty($attribute->id)) {
627 618
 							if ( !empty( $submit_billing_and_shipping_info ) ) {
628 619
 								$value = $attribute[$typeof][$attribute->data_type][$attribute->code];
629
-							}
630
-							else {
620
+							} else {
631 621
 								$value = wpshop_attributes::getAttributeValueForEntityInSet($attribute->data_type, $attribute->id, wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS), (int)$id, array('intrinsic' => $attribute->is_intrinsic, 'backend_input' => $attribute->backend_input));
632 622
 							}
633 623
 							$attribute_output_def = wpshop_attributes::get_attribute_field_definition( $attribute, $value, array() );
@@ -773,8 +763,7 @@  discard block
 block discarded – undo
773 763
 		/** Check if it's shipping or billing **/
774 764
 		if ( $type == $choosen_address['choice'] ) {
775 765
 			$form_model =  ( !empty($choosen_address['display_model']) ) ? $choosen_address['display_model'] : null;
776
-		}
777
-		elseif( $type == $shipping_address['choice'] ) {
766
+		} elseif( $type == $shipping_address['choice'] ) {
778 767
 			$form_model = ( !empty($shipping_address['display_model']) ) ? $shipping_address['display_model'] : null;
779 768
 		}
780 769
 
@@ -786,7 +775,9 @@  discard block
 block discarded – undo
786 775
 		$current_item_edited = !empty($id) ? (int)$id : null;
787 776
 
788 777
 		foreach ( $form as $group_id => $group_fields) {
789
-			if ( empty($options) || (!empty($options) && ($options['title']))) $output_form_fields .= '<h2>'.__( $group_fields['name'], 'wpshop' ).'</h2>';
778
+			if ( empty($options) || (!empty($options) && ($options['title']))) {
779
+				$output_form_fields .= '<h2>'.__( $group_fields['name'], 'wpshop' ).'</h2>';
780
+			}
790 781
 			$end_line_indicator = 0; $fields_limit_per_line = -1;
791 782
 			foreach ( $group_fields['content'] as $key => $field) {
792 783
 				$attribute_def = wpshop_attributes::getElement( $field['name'], $element_status = "'valid'", $field_to_search = 'code' );
@@ -811,8 +802,7 @@  discard block
 block discarded – undo
811 802
 						if ( !empty($fields_limit_per_line) && $fields_limit_per_line != -1 ) {
812 803
 							if ( $fields_limit_per_line == 1 ) {
813 804
 								$output_form_fields .= '<div class="wps-row">';
814
-							}
815
-							else {
805
+							} else {
816 806
 								$output_form_fields .= '<div class="wps-row wps-gridwrapper' .$fields_limit_per_line. '-padded">';
817 807
 							}
818 808
 						}
@@ -843,8 +833,7 @@  discard block
 block discarded – undo
843 833
 											if ( !empty($address_type) ){
844 834
 												if ( !empty( $shipping_address_choice['choice'] ) && $address_type == $shipping_address_choice['choice'] ) {
845 835
 													$shipping_address_count++;
846
-												}
847
-												else{
836
+												} else{
848 837
 													$billing_address_count++;
849 838
 												}
850 839
 											}
@@ -888,8 +877,7 @@  discard block
 block discarded – undo
888 877
 
889 878
 					if( $field['name'] == 'address_title' && !empty($first) && $type == __('Billing address', 'wpshop') ) {
890 879
 						$value = __('Billing address', 'wpshop');
891
-					}
892
-					elseif( $field['name'] == 'address_title' && !empty($first) && $type == __('Shipping address', 'wpshop') ) {
880
+					} elseif( $field['name'] == 'address_title' && !empty($first) && $type == __('Shipping address', 'wpshop') ) {
893 881
 						$value = __('Shipping address', 'wpshop');
894 882
 					}
895 883
 
@@ -986,7 +974,9 @@  discard block
 block discarded – undo
986 974
 
987 975
 		$output_form_fields .= ( $user_id != get_current_user_id() ) ? '<input type="hidden" name="user[customer_id]" value="' .$user_id. '" />' : '';
988 976
 
989
-		if ( empty($first) ) $output_form_fields = wpshop_display::display_template_element('wpshop_customer_addresses_form', array('CUSTOMER_ADDRESSES_FORM_CONTENT' => $output_form_fields, 'CUSTOMER_ADDRESSES_FORM_BUTTONS' => ''));
977
+		if ( empty($first) ) {
978
+			$output_form_fields = wpshop_display::display_template_element('wpshop_customer_addresses_form', array('CUSTOMER_ADDRESSES_FORM_CONTENT' => $output_form_fields, 'CUSTOMER_ADDRESSES_FORM_BUTTONS' => ''));
979
+		}
990 980
 
991 981
 		return $output_form_fields;
992 982
 	}
@@ -1153,8 +1143,9 @@  discard block
 block discarded – undo
1153 1143
 	function display_addresses_list() {
1154 1144
 		$_wpnonce = ( !empty( $_REQUEST['_wpnonce'] ) ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
1155 1145
 
1156
-		if ( !wp_verify_nonce( $_wpnonce, 'display_addresses_list' ) )
1157
-			die();
1146
+		if ( !wp_verify_nonce( $_wpnonce, 'display_addresses_list' ) ) {
1147
+					die();
1148
+		}
1158 1149
 
1159 1150
 		$post_id = (int) $_POST['post_id'];
1160 1151
 		$addresses = $this->get_addresses_list( $post_id );
@@ -1170,8 +1161,9 @@  discard block
 block discarded – undo
1170 1161
 	function display_address() {
1171 1162
 		$_wpnonce = ( !empty( $_REQUEST['_wpnonce'] ) ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
1172 1163
 
1173
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_address_display_an_address' ) )
1174
-			die();
1164
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_address_display_an_address' ) ) {
1165
+					die();
1166
+		}
1175 1167
 
1176 1168
 		$adress_id = (int) $_POST['address_id'];
1177 1169
 		$address_post_meta = get_post_meta( $adress_id, '_wpshop_address_metadata', true);
@@ -1199,8 +1191,9 @@  discard block
 block discarded – undo
1199 1191
 
1200 1192
 		$_wpnonce = ( !empty( $_REQUEST['_wpnonce'] ) ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
1201 1193
 
1202
-		if ( !wp_verify_nonce( $_wpnonce, 'display_address_adding_form' ) )
1203
-			die();
1194
+		if ( !wp_verify_nonce( $_wpnonce, 'display_address_adding_form' ) ) {
1195
+					die();
1196
+		}
1204 1197
 
1205 1198
 		$address_id = 0;
1206 1199
 		$post_ID = (int)$_POST[ 'post_id' ];
@@ -1213,12 +1206,10 @@  discard block
 block discarded – undo
1213 1206
 			if ( count( $attached_addresses ) == 1 ) {
1214 1207
 				$address_type_id = $attached_addresses[ 0 ];
1215 1208
 				require_once( wpshop_tools::get_template_part( WPS_ADDRESS_DIR, WPS_LOCALISATION_TEMPLATES_MAIN_DIR, "backend", "address", "form" ) );
1216
-			}
1217
-			else {
1209
+			} else {
1218 1210
 				require_once( wpshop_tools::get_template_part( WPS_ADDRESS_DIR, WPS_LOCALISATION_TEMPLATES_MAIN_DIR, "backend", "addresses", "types" ) );
1219 1211
 			}
1220
-		}
1221
-		else {
1212
+		} else {
1222 1213
 			printf( __( 'No addresses are attached to this element type %s', 'wpeo_geoloc' ), $element->post_type);
1223 1214
 		}
1224 1215
 
@@ -1233,8 +1224,9 @@  discard block
 block discarded – undo
1233 1224
 	function load_address_edition_form() {
1234 1225
 		$_wpnonce = ( !empty( $_REQUEST['_wpnonce'] ) ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
1235 1226
 
1236
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_address_edition_form_load' ) )
1237
-			die();
1227
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_address_edition_form_load' ) ) {
1228
+					die();
1229
+		}
1238 1230
 
1239 1231
 		$address_id = (int)$_POST[ 'element_id' ];
1240 1232
 		$post_ID = (int)$_POST[ 'post_id' ];
@@ -1254,8 +1246,9 @@  discard block
 block discarded – undo
1254 1246
 	function wps_delete_an_address() {
1255 1247
 		$_wpnonce = ( !empty( $_REQUEST['_wpnonce'] ) ) ? sanitize_text_field( $_REQUEST['_wpnonce'] ) : '';
1256 1248
 
1257
-		if ( !wp_verify_nonce( $_wpnonce, 'wps_delete_an_address' ) )
1258
-			die();
1249
+		if ( !wp_verify_nonce( $_wpnonce, 'wps_delete_an_address' ) ) {
1250
+					die();
1251
+		}
1259 1252
 
1260 1253
 		$status = false; $response = '';
1261 1254
 		$address_id = ( !empty( $_POST['address_id']) ) ? (int) $_POST['address_id'] : null;
@@ -1286,8 +1279,7 @@  discard block
 block discarded – undo
1286 1279
 			$billing_option = get_option( 'wpshop_billing_address' );
1287 1280
 			if ( !empty($billing_option) && !empty($billing_option['choice']) && $billing_option['choice'] == $address_type ) {
1288 1281
 				$type = 'billing';
1289
-			}
1290
-			else {
1282
+			} else {
1291 1283
 				$type = 'shipping';
1292 1284
 			}
1293 1285
 			$query = $wpdb->prepare( 'SELECT name FROM '.WPSHOP_DBT_ATTRIBUTE_SET .' WHERE id = %d ', $address_type );
Please login to merge, or discard this patch.
wps_customer/templates/backend/customer_listtable/customer-orders.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 
3 5
 	/**	Get customer orders list for statistic displaying	*/
4 6
 	$wps_orders_mdl = new wps_orders_mdl();
@@ -21,6 +23,9 @@  discard block
 block discarded – undo
21 23
 		break;
22 24
 	endforeach;
23 25
 ?>
24
-<?php else : ?>
26
+<?php else {
27
+	: ?>
25 28
 	&mdash;
26
-<?php endif; ?>
29
+<?php endif;
30
+}
31
+?>
Please login to merge, or discard this patch.
wps_customer/templates/backend/customer_listtable/customer-contacts.php 1 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.
includes/modules/wps_customer/controller/wps_customer_ctr.php 1 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.