@@ -1,16 +1,16 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper3-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-boxed"> |
6 | - <span class="wps-h5"><?php _e( 'Choose an user', 'wpshop'); ?></span> |
|
6 | + <span class="wps-h5"><?php _e('Choose an user', 'wpshop'); ?></span> |
|
7 | 7 | <div class="wps-gridwrapper2-padded"> |
8 | 8 | <div><?php echo $customer_lists; ?></div> |
9 | - <div><a href="#" class="wps-bton-mini-rounded-first" role="button" data-nonce="<?php echo wp_create_nonce( 'wps_order_choose_customer' ); ?>" id="wps_order_choose_customer"><?php _e( 'Choose this customer', 'wpshop')?></a></div> |
|
9 | + <div><a href="#" class="wps-bton-mini-rounded-first" role="button" data-nonce="<?php echo wp_create_nonce('wps_order_choose_customer'); ?>" id="wps_order_choose_customer"><?php _e('Choose this customer', 'wpshop')?></a></div> |
|
10 | 10 | </div> |
11 | 11 | <input type="hidden" name="wps_customer_id" value="" id="wps_customer_id" /> |
12 | 12 | </div> |
13 | - <!-- <div><?php _e( 'OR', 'wpshop'); ?> <a href="#" class="wps-bton-mini-rounded-first" role="button"><?php _e( 'Create a customer', 'wpshop')?></a></div> --> |
|
13 | + <!-- <div><?php _e('OR', 'wpshop'); ?> <a href="#" class="wps-bton-mini-rounded-first" role="button"><?php _e('Create a customer', 'wpshop')?></a></div> --> |
|
14 | 14 | |
15 | 15 | </div> |
16 | 16 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wps-gridwrapper3-padded"> |
4 | 6 | <div> |
@@ -1,26 +1,26 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-customer-quick-add-alert-box wps-alert hidden" ></div> |
4 | 4 | <form id="create_new_customer_pos_addon" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post" > |
5 | 5 | <input type="hidden" name="action" value="wps-customer-quick-add" /> |
6 | - <?php wp_nonce_field( 'create_customer' ); ?> |
|
6 | + <?php wp_nonce_field('create_customer'); ?> |
|
7 | 7 | <input type="hidden" name="wps-customer-account-set-id" value="wps-customer-quick-add" /> |
8 | 8 | |
9 | - <?php if ( !empty( $customer_attributes ) ) : ?> |
|
10 | - <?php foreach ( $customer_attributes as $customer_attribute_group ) : ?> |
|
9 | + <?php if (!empty($customer_attributes)) : ?> |
|
10 | + <?php foreach ($customer_attributes as $customer_attribute_group) : ?> |
|
11 | 11 | <div class="wps-boxed"> |
12 | - <span class="wps-h5"><?php echo stripslashes( $customer_attribute_group['name'] ); ?></span> |
|
12 | + <span class="wps-h5"><?php echo stripslashes($customer_attribute_group['name']); ?></span> |
|
13 | 13 | <?php |
14 | - foreach ( $customer_attribute_group[ 'attribut' ] as $attribute ) : |
|
15 | - $output = wpshop_attributes::display_attribute( $attribute->code ); |
|
16 | - echo $output[ 'field' ]; |
|
14 | + foreach ($customer_attribute_group['attribut'] as $attribute) : |
|
15 | + $output = wpshop_attributes::display_attribute($attribute->code); |
|
16 | + echo $output['field']; |
|
17 | 17 | endforeach; |
18 | 18 | ?> |
19 | 19 | </div> |
20 | 20 | <?php endforeach; ?> |
21 | 21 | <?php endif; ?> |
22 | 22 | |
23 | - <button class="wps-bton-first-mini-rounded alignRight" ><?php _e( 'Add customer', 'wpshop'); ?></button> |
|
23 | + <button class="wps-bton-first-mini-rounded alignRight" ><?php _e('Add customer', 'wpshop'); ?></button> |
|
24 | 24 | </form> |
25 | 25 | <script type="text/javascript" > |
26 | 26 | jQuery( document ).ready( function() { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | } |
36 | 36 | if ( has_error ) { |
37 | - alert( wpshopConvertAccentTojs( "<?php _e( 'Please fill all fields mark as required', 'wpshop' ); ?>" ) ); |
|
37 | + alert( wpshopConvertAccentTojs( "<?php _e('Please fill all fields mark as required', 'wpshop'); ?>" ) ); |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | }, |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wps-customer-quick-add-alert-box wps-alert hidden" ></div> |
4 | 6 | <form id="create_new_customer_pos_addon" action="<?php echo admin_url('admin-ajax.php'); ?>" method="post" > |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Fichier du controlleur principal du module de création de client rapide / Controller file for quick customer creation |
4 | 4 | * |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function __construct() { |
21 | 21 | /** Affiche un formulaire permettant de créer un client / Display a form allowing to add a new customer */ |
22 | - add_action( 'wp_ajax_wps-customer-quick-creation', array( $this, 'customer_creation' ) ); |
|
23 | - add_action( 'wp_ajax_wps-customer-quick-add', array( $this, 'create_customer' ) ); |
|
22 | + add_action('wp_ajax_wps-customer-quick-creation', array($this, 'customer_creation')); |
|
23 | + add_action('wp_ajax_wps-customer-quick-add', array($this, 'create_customer')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | * AJAX - Charge le fomulaire d'ajout rapide d'un client / Load the form for new customer quick add |
29 | 29 | */ |
30 | 30 | function customer_creation() { |
31 | - $_wpnonce = sanitize_key( $_REQUEST['wps-nonce'] ); |
|
32 | - if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) ) |
|
31 | + $_wpnonce = sanitize_key($_REQUEST['wps-nonce']); |
|
32 | + if (!wp_verify_nonce($_wpnonce, 'wps-customer-quick-nonce')) |
|
33 | 33 | wp_die(); |
34 | 34 | global $wpdb; |
35 | 35 | |
36 | - $customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); |
|
37 | - $query = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, get_current_user_id() ); |
|
38 | - $cid = $wpdb->get_var( $query ); |
|
36 | + $customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
37 | + $query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_type = %s AND post_author = %d", WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, get_current_user_id()); |
|
38 | + $cid = $wpdb->get_var($query); |
|
39 | 39 | |
40 | - $customer_attribute_set = !empty( $_GET ) && !empty( $_GET[ 'customer_set_id' ] ) ? (int)$_GET[ 'customer_set_id' ] : null; |
|
40 | + $customer_attribute_set = !empty($_GET) && !empty($_GET['customer_set_id']) ? (int)$_GET['customer_set_id'] : null; |
|
41 | 41 | |
42 | - $customer_attributes = wpshop_attributes_set::getAttributeSetDetails( $customer_attribute_set, "'valid'"); |
|
42 | + $customer_attributes = wpshop_attributes_set::getAttributeSetDetails($customer_attribute_set, "'valid'"); |
|
43 | 43 | |
44 | - require_once( wpshop_tools::get_template_part( WPSCLTQUICK_DIR, WPSCLTQUICK_TEMPLATES_MAIN_DIR, "backend", "customer", "creation" ) ); |
|
44 | + require_once(wpshop_tools::get_template_part(WPSCLTQUICK_DIR, WPSCLTQUICK_TEMPLATES_MAIN_DIR, "backend", "customer", "creation")); |
|
45 | 45 | wp_die( ); |
46 | 46 | } |
47 | 47 | |
@@ -50,41 +50,41 @@ discard block |
||
50 | 50 | * AJAX - Création d'un nouveau client / Create a new customer |
51 | 51 | */ |
52 | 52 | function create_customer() { |
53 | - $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
|
53 | + $_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : ''; |
|
54 | 54 | |
55 | - if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) ) |
|
55 | + if (!wp_verify_nonce($_wpnonce, 'create_customer')) |
|
56 | 56 | wp_die(); |
57 | 57 | |
58 | 58 | |
59 | 59 | global $wpdb; |
60 | 60 | $response = array( |
61 | 61 | 'status' => false, |
62 | - 'output' => __( 'An error occured while saving customer', 'wpshop' ), |
|
62 | + 'output' => __('An error occured while saving customer', 'wpshop'), |
|
63 | 63 | 'customer_id' => -1, |
64 | 64 | ); |
65 | 65 | |
66 | 66 | /** Check if a attribute set id have been sended in order to check if therer are some check to do on sended input */ |
67 | - $customer_attributes = wpshop_attributes_set::getAttributeSetDetails( (int)$_POST[ 'wps-customer-account-set-id' ], "'valid'"); |
|
68 | - $attribute = !empty( $_POST['attribute'] ) ? (array)$_POST['attribute'] : array(); |
|
67 | + $customer_attributes = wpshop_attributes_set::getAttributeSetDetails((int)$_POST['wps-customer-account-set-id'], "'valid'"); |
|
68 | + $attribute = !empty($_POST['attribute']) ? (array)$_POST['attribute'] : array(); |
|
69 | 69 | /** Read sended values for checking */ |
70 | 70 | $email_founded = false; |
71 | 71 | $email_field = $last_name_field = $first_name_field = ''; |
72 | 72 | |
73 | - foreach ( $attribute as $attribute_type => $attributes ) { |
|
74 | - foreach ( $attributes as $attribute_code => $attribute_value ) { |
|
75 | - $query = $wpdb->prepare( "SELECT frontend_verification FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE code = %s", $attribute_code ); |
|
76 | - $current_attribute = $wpdb->get_var( $query ); |
|
73 | + foreach ($attribute as $attribute_type => $attributes) { |
|
74 | + foreach ($attributes as $attribute_code => $attribute_value) { |
|
75 | + $query = $wpdb->prepare("SELECT frontend_verification FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE code = %s", $attribute_code); |
|
76 | + $current_attribute = $wpdb->get_var($query); |
|
77 | 77 | |
78 | - if ( 'email' == $current_attribute ) { |
|
78 | + if ('email' == $current_attribute) { |
|
79 | 79 | $email_founded = true; |
80 | 80 | $email_field = $attribute_code; |
81 | 81 | $email_field_type = $attribute_type; |
82 | 82 | } |
83 | - else if ( strpos( $attribute_code, 'last_name')) { |
|
83 | + else if (strpos($attribute_code, 'last_name')) { |
|
84 | 84 | $last_name_field = $attribute_code; |
85 | 85 | $last_name_field_type = $attribute_type; |
86 | 86 | } |
87 | - else if ( strpos( $attribute_code, 'first_name')) { |
|
87 | + else if (strpos($attribute_code, 'first_name')) { |
|
88 | 88 | $first_name_field = $attribute_code; |
89 | 89 | $first_name_field_type = $attribute_type; |
90 | 90 | } |
@@ -92,57 +92,57 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | /** Define customer email field value */ |
95 | - $customer_email = sanitize_email( $attribute[ $email_field_type ][ $email_field ] ); |
|
96 | - $customer_last_name = !empty( $attribute ) && !empty( $attribute[ $last_name_field_type ] ) && !empty( $attribute[ $last_name_field_type ][ $last_name_field ] ) ? sanitize_text_field( $attribute[ $last_name_field_type ][ $last_name_field ] ) : ''; |
|
97 | - $customer_first_name = !empty( $attribute ) && !empty( $attribute[ $first_name_field_type ] ) && !empty( $attribute[ $first_name_field_type ][ $first_name_field ] ) ? sanitize_text_field( $attribute[ $first_name_field_type ][ $first_name_field ] ) : ''; |
|
95 | + $customer_email = sanitize_email($attribute[$email_field_type][$email_field]); |
|
96 | + $customer_last_name = !empty($attribute) && !empty($attribute[$last_name_field_type]) && !empty($attribute[$last_name_field_type][$last_name_field]) ? sanitize_text_field($attribute[$last_name_field_type][$last_name_field]) : ''; |
|
97 | + $customer_first_name = !empty($attribute) && !empty($attribute[$first_name_field_type]) && !empty($attribute[$first_name_field_type][$first_name_field]) ? sanitize_text_field($attribute[$first_name_field_type][$first_name_field]) : ''; |
|
98 | 98 | |
99 | - if ( $email_founded && is_email( $customer_email ) ) { |
|
99 | + if ($email_founded && is_email($customer_email)) { |
|
100 | 100 | /** Check if current e-mail address does not already exists */ |
101 | - $user_id = username_exists( $customer_email ); |
|
102 | - if ( empty( $user_id ) ) { |
|
101 | + $user_id = username_exists($customer_email); |
|
102 | + if (empty($user_id)) { |
|
103 | 103 | |
104 | 104 | /** Create the user with a random password */ |
105 | - $random_password = wp_generate_password( 12, false ); |
|
106 | - $user_id = wp_create_user( $customer_email, $random_password, $customer_email ); |
|
105 | + $random_password = wp_generate_password(12, false); |
|
106 | + $user_id = wp_create_user($customer_email, $random_password, $customer_email); |
|
107 | 107 | |
108 | - if ( !is_wp_error( $user_id ) ) { |
|
109 | - update_user_meta( $user_id, 'last_name', $customer_last_name ); |
|
110 | - update_user_meta( $user_id, 'first_name', $customer_first_name ); |
|
108 | + if (!is_wp_error($user_id)) { |
|
109 | + update_user_meta($user_id, 'last_name', $customer_last_name); |
|
110 | + update_user_meta($user_id, 'first_name', $customer_first_name); |
|
111 | 111 | |
112 | 112 | /** Build a response for customer first letter - Specific action (POS) */ |
113 | - if ( !empty($customer_last_name) ) { |
|
113 | + if (!empty($customer_last_name)) { |
|
114 | 114 | $field_for_letter = $customer_last_name; |
115 | 115 | } |
116 | - elseif( !empty($customer_first_name) ) { |
|
116 | + elseif (!empty($customer_first_name)) { |
|
117 | 117 | $field_for_letter = $customer_first_name; |
118 | 118 | } |
119 | 119 | else { |
120 | 120 | $field_for_letter = $customer_email; |
121 | 121 | } |
122 | - $response[ 'letter' ] = substr( $field_for_letter, 0, 1); |
|
122 | + $response['letter'] = substr($field_for_letter, 0, 1); |
|
123 | 123 | |
124 | 124 | /** Build response */ |
125 | - $response[ 'status' ] = true; |
|
126 | - $response[ 'output' ] = __('Customer created succesfully', 'wpshop'); |
|
125 | + $response['status'] = true; |
|
126 | + $response['output'] = __('Customer created succesfully', 'wpshop'); |
|
127 | 127 | |
128 | 128 | /** Create customer address from sended data **/ |
129 | 129 | // $_REQUEST['user']['customer_id'] = (int)$user_id; |
130 | 130 | $attribute_to_save = $attribute; |
131 | - $wps_customer_account_set_id = !empty( $_POST[ 'wps-customer-account-set-id' ] ) ? (int) $_POST[ 'wps-customer-account-set-id' ] : 0; |
|
132 | - $attribute[ $wps_customer_account_set_id ] = $attribute_to_save; |
|
133 | - wps_address::save_address_infos( $wps_customer_account_set_id ); |
|
131 | + $wps_customer_account_set_id = !empty($_POST['wps-customer-account-set-id']) ? (int)$_POST['wps-customer-account-set-id'] : 0; |
|
132 | + $attribute[$wps_customer_account_set_id] = $attribute_to_save; |
|
133 | + wps_address::save_address_infos($wps_customer_account_set_id); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | else { |
137 | - $response[ 'output' ] = __('An account is already created with this e-mail address', 'wpshop'); |
|
137 | + $response['output'] = __('An account is already created with this e-mail address', 'wpshop'); |
|
138 | 138 | } |
139 | - $response[ 'customer_id' ] = $user_id; |
|
139 | + $response['customer_id'] = $user_id; |
|
140 | 140 | } |
141 | 141 | else { |
142 | - $response[ 'output' ] = __('An email address is required', 'wpshop'); |
|
142 | + $response['output'] = __('An email address is required', 'wpshop'); |
|
143 | 143 | } |
144 | 144 | |
145 | - wp_die( json_encode( $response ) ); |
|
145 | + wp_die(json_encode($response)); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier du controlleur principal du module de création de client rapide / Controller file for quick customer creation |
4 | 6 | * |
@@ -29,8 +31,9 @@ discard block |
||
29 | 31 | */ |
30 | 32 | function customer_creation() { |
31 | 33 | $_wpnonce = sanitize_key( $_REQUEST['wps-nonce'] ); |
32 | - if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) ) |
|
33 | - wp_die(); |
|
34 | + if ( !wp_verify_nonce( $_wpnonce, 'wps-customer-quick-nonce' ) ) { |
|
35 | + wp_die(); |
|
36 | + } |
|
34 | 37 | global $wpdb; |
35 | 38 | |
36 | 39 | $customer_entity_type_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); |
@@ -52,8 +55,9 @@ discard block |
||
52 | 55 | function create_customer() { |
53 | 56 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
54 | 57 | |
55 | - if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) ) |
|
56 | - wp_die(); |
|
58 | + if ( !wp_verify_nonce( $_wpnonce, 'create_customer' ) ) { |
|
59 | + wp_die(); |
|
60 | + } |
|
57 | 61 | |
58 | 62 | |
59 | 63 | global $wpdb; |
@@ -79,12 +83,10 @@ discard block |
||
79 | 83 | $email_founded = true; |
80 | 84 | $email_field = $attribute_code; |
81 | 85 | $email_field_type = $attribute_type; |
82 | - } |
|
83 | - else if ( strpos( $attribute_code, 'last_name')) { |
|
86 | + } else if ( strpos( $attribute_code, 'last_name')) { |
|
84 | 87 | $last_name_field = $attribute_code; |
85 | 88 | $last_name_field_type = $attribute_type; |
86 | - } |
|
87 | - else if ( strpos( $attribute_code, 'first_name')) { |
|
89 | + } else if ( strpos( $attribute_code, 'first_name')) { |
|
88 | 90 | $first_name_field = $attribute_code; |
89 | 91 | $first_name_field_type = $attribute_type; |
90 | 92 | } |
@@ -112,11 +114,9 @@ discard block |
||
112 | 114 | /** Build a response for customer first letter - Specific action (POS) */ |
113 | 115 | if ( !empty($customer_last_name) ) { |
114 | 116 | $field_for_letter = $customer_last_name; |
115 | - } |
|
116 | - elseif( !empty($customer_first_name) ) { |
|
117 | + } elseif( !empty($customer_first_name) ) { |
|
117 | 118 | $field_for_letter = $customer_first_name; |
118 | - } |
|
119 | - else { |
|
119 | + } else { |
|
120 | 120 | $field_for_letter = $customer_email; |
121 | 121 | } |
122 | 122 | $response[ 'letter' ] = substr( $field_for_letter, 0, 1); |
@@ -132,13 +132,11 @@ discard block |
||
132 | 132 | $attribute[ $wps_customer_account_set_id ] = $attribute_to_save; |
133 | 133 | wps_address::save_address_infos( $wps_customer_account_set_id ); |
134 | 134 | } |
135 | - } |
|
136 | - else { |
|
135 | + } else { |
|
137 | 136 | $response[ 'output' ] = __('An account is already created with this e-mail address', 'wpshop'); |
138 | 137 | } |
139 | 138 | $response[ 'customer_id' ] = $user_id; |
140 | - } |
|
141 | - else { |
|
139 | + } else { |
|
142 | 140 | $response[ 'output' ] = __('An email address is required', 'wpshop'); |
143 | 141 | } |
144 | 142 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | if( !empty($products) ) : ?> |
3 | 5 | <?php $tab_def = array(); ?> |
4 | 6 | <?php |
@@ -63,6 +65,9 @@ discard block |
||
63 | 65 | <script type="text/javascript" >jQuery( document ).ready( function(){ |
64 | 66 | jQuery("select.chosen_select").chosen( WPSHOP_CHOSEN_ATTRS ); |
65 | 67 | } );</script> |
66 | -<?php else: ?> |
|
67 | - <div class="wps-alert-info"><?php _e( 'You don\'t have any product for the moment', 'wpshop' ); ?></div> |
|
68 | +<?php else { |
|
69 | + : ?> |
|
70 | + <div class="wps-alert-info"><?php _e( 'You don\'t have any product for the moment', 'wpshop' ); |
|
71 | +} |
|
72 | +?></div> |
|
68 | 73 | <?php endif; ?> |
@@ -1,27 +1,27 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - if( !empty($products) ) : ?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + if (!empty($products)) : ?> |
|
3 | 3 | <?php $tab_def = array(); ?> |
4 | 4 | <?php |
5 | - foreach( $quick_add_form_attributes as $id_att => $att ) { |
|
5 | + foreach ($quick_add_form_attributes as $id_att => $att) { |
|
6 | 6 | $tab_def[$id_att]['name'] = $att['frontend_label']; |
7 | 7 | } |
8 | 8 | ?> |
9 | 9 | |
10 | - <form method="post" id="wps_mass_edit_product_form" action="<?php echo admin_url( 'admin-ajax.php' ); ?>"> |
|
10 | + <form method="post" id="wps_mass_edit_product_form" action="<?php echo admin_url('admin-ajax.php'); ?>"> |
|
11 | 11 | <input type="hidden" name="action" value="wps_mass_edit_product_save_action" /> |
12 | - <?php wp_nonce_field( 'wps_save_product_quick_interface' ); ?> |
|
12 | + <?php wp_nonce_field('wps_save_product_quick_interface'); ?> |
|
13 | 13 | <table class="wp-list-table widefat wps-product-mass-interface-table"> |
14 | 14 | <thead> |
15 | 15 | <tr> |
16 | 16 | <th class="check-column manage-column column-cb check-column"> |
17 | 17 | <input type="checkbox" class="wps-save-product-checkbox" name="wps_product_quick_save_checkbox_column" /> |
18 | 18 | </th> |
19 | - <th><?php _e( 'Picture', 'wpshop'); ?></th> |
|
20 | - <th class="title"><?php _e( 'Title', 'wpshop'); ?></th> |
|
21 | - <th class="description"><?php _e( 'Description', 'wpshop'); ?></th> |
|
19 | + <th><?php _e('Picture', 'wpshop'); ?></th> |
|
20 | + <th class="title"><?php _e('Title', 'wpshop'); ?></th> |
|
21 | + <th class="description"><?php _e('Description', 'wpshop'); ?></th> |
|
22 | 22 | <?php /*<th width="80"><?php _e( 'Files', 'wpshop'); ?></th>*/ ?> |
23 | - <?php if( !empty($tab_def) ) : ?> |
|
24 | - <?php foreach( $tab_def as $col ) : ?> |
|
23 | + <?php if (!empty($tab_def)) : ?> |
|
24 | + <?php foreach ($tab_def as $col) : ?> |
|
25 | 25 | <th ><?php echo $col['name']; ?></th> |
26 | 26 | <?php endforeach; ?> |
27 | 27 | <?php endif; ?> |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | |
32 | 32 | <?php |
33 | 33 | $count_product = 1; |
34 | - foreach( $products as $product ) : |
|
35 | - $product_attribute_set_id = get_post_meta( $product['post_datas']->ID, '_wpshop_product_attribute_set_id', true ); |
|
34 | + foreach ($products as $product) : |
|
35 | + $product_attribute_set_id = get_post_meta($product['post_datas']->ID, '_wpshop_product_attribute_set_id', true); |
|
36 | 36 | $class = ($count_product % 2) ? 'alternate' : ''; |
37 | 37 | ?> |
38 | 38 | |
39 | - <?php require( wpshop_tools::get_template_part( WPS_PDCT_MASS_DIR, WPS_PDCT_MASS_TEMPLATES_MAIN_DIR, "backend", "quick_add_interface", "product_line" ) ); ?> |
|
39 | + <?php require(wpshop_tools::get_template_part(WPS_PDCT_MASS_DIR, WPS_PDCT_MASS_TEMPLATES_MAIN_DIR, "backend", "quick_add_interface", "product_line")); ?> |
|
40 | 40 | |
41 | 41 | <?php |
42 | 42 | $count_product++; |
@@ -47,12 +47,12 @@ discard block |
||
47 | 47 | <th class="check-column manage-column column-cb check-column"> |
48 | 48 | <input type="checkbox" class="wps-save-product-checkbox" name="wps_product_quick_save_checkbox_column" /> |
49 | 49 | </th> |
50 | - <th><?php _e( 'Picture', 'wpshop'); ?></th> |
|
51 | - <th><?php _e( 'Title', 'wpshop'); ?></th> |
|
52 | - <th><?php _e( 'Description', 'wpshop'); ?></th> |
|
50 | + <th><?php _e('Picture', 'wpshop'); ?></th> |
|
51 | + <th><?php _e('Title', 'wpshop'); ?></th> |
|
52 | + <th><?php _e('Description', 'wpshop'); ?></th> |
|
53 | 53 | <?php /*<th width="80"><?php _e( 'Files', 'wpshop'); ?></th>*/ ?> |
54 | - <?php if( !empty($tab_def) ) : ?> |
|
55 | - <?php foreach( $tab_def as $col ) : ?> |
|
54 | + <?php if (!empty($tab_def)) : ?> |
|
55 | + <?php foreach ($tab_def as $col) : ?> |
|
56 | 56 | <th><?php echo $col['name']; ?></th> |
57 | 57 | <?php endforeach; ?> |
58 | 58 | <?php endif; ?> |
@@ -64,5 +64,5 @@ discard block |
||
64 | 64 | jQuery("select.chosen_select").chosen( WPSHOP_CHOSEN_ATTRS ); |
65 | 65 | } );</script> |
66 | 66 | <?php else: ?> |
67 | - <div class="wps-alert-info"><?php _e( 'You don\'t have any product for the moment', 'wpshop' ); ?></div> |
|
67 | + <div class="wps-alert-info"><?php _e('You don\'t have any product for the moment', 'wpshop'); ?></div> |
|
68 | 68 | <?php endif; ?> |
@@ -1,5 +1,5 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | -<div class="wps-cart-resume" id="wps_resume_cart_container" data-nonce="<?php echo wp_create_nonce( 'wps_reload_summary_cart' ); ?>" > |
|
3 | +<div class="wps-cart-resume" id="wps_resume_cart_container" data-nonce="<?php echo wp_create_nonce('wps_reload_summary_cart'); ?>" > |
|
4 | 4 | <?php echo $cart_summary_content; ?> |
5 | 5 | </div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <div class="wps-cart-resume" id="wps_resume_cart_container" data-nonce="<?php echo wp_create_nonce( 'wps_reload_summary_cart' ); ?>" > |
4 | 6 | <?php echo $cart_summary_content; ?> |
@@ -1,21 +1,21 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <!-- <div class="wps-gridwrapper">--> |
4 | 4 | <?php |
5 | 5 | $wps_coupon_ctr = new wps_coupon_ctr(); |
6 | 6 | $results = $wps_coupon_ctr->getCoupons(); |
7 | 7 | unset($wps_coupon_ctr); |
8 | -if( !empty($results) ) : |
|
8 | +if (!empty($results)) : |
|
9 | 9 | ?> |
10 | 10 | <div class="wps-coupon"> |
11 | 11 | <div class="wps-form-group-inline"> |
12 | 12 | <label for="wps_coupon_code"> |
13 | - <?php _e( 'Coupon', 'wpshop'); ?> |
|
13 | + <?php _e('Coupon', 'wpshop'); ?> |
|
14 | 14 | </label> |
15 | 15 | <div class="wps-form-inliner"> |
16 | 16 | <input type="text" value="" id="wps_coupon_code" /> |
17 | - <button id="wps_apply_coupon" data-nonce="<?php echo wp_create_nonce( 'wps_apply_coupon' ); ?>" class="wps-bton-first wpsjs-apply-coupon"> |
|
18 | - <?php _e( 'Apply', 'wpshop' ); ?> |
|
17 | + <button id="wps_apply_coupon" data-nonce="<?php echo wp_create_nonce('wps_apply_coupon'); ?>" class="wps-bton-first wpsjs-apply-coupon"> |
|
18 | + <?php _e('Apply', 'wpshop'); ?> |
|
19 | 19 | </button> |
20 | 20 | </div> <!-- wps-form-inliner --> |
21 | 21 | </div> <!-- wps-form-group-inline --> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <div></div> |
31 | 31 | </div> |
32 | 32 | <?php foreach ($results as $key => $result) : ?> |
33 | - <?php $data = get_post_meta( $result->ID ) ?> |
|
33 | + <?php $data = get_post_meta($result->ID) ?> |
|
34 | 34 | <div> |
35 | 35 | <div> |
36 | 36 | <?php echo $data['wpshop_coupon_code'][0]; ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <!-- <div class="wps-gridwrapper">--> |
4 | 6 | <?php |
@@ -1,3 +1,3 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | -<input type="button" data-id="<?php echo get_the_ID(); ?>" data-nonce="<?php echo wp_create_nonce( 'reset_bubble_all_user' ); ?>" class="button-secondary wpeo-reset-bubble-all-user" value="<?php _e("Reset this bubble for all users", self::$name_i18n); ?>" /> |
|
3 | +<input type="button" data-id="<?php echo get_the_ID(); ?>" data-nonce="<?php echo wp_create_nonce('reset_bubble_all_user'); ?>" class="button-secondary wpeo-reset-bubble-all-user" value="<?php _e("Reset this bubble for all users", self::$name_i18n); ?>" /> |
@@ -1,3 +1,5 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | ?> |
3 | 5 | <input type="button" data-id="<?php echo get_the_ID(); ?>" data-nonce="<?php echo wp_create_nonce( 'reset_bubble_all_user' ); ?>" class="button-secondary wpeo-reset-bubble-all-user" value="<?php _e("Reset this bubble for all users", self::$name_i18n); ?>" /> |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Main controller file for bubble module |
4 | 4 | * |
@@ -37,20 +37,20 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function register_post_type() { |
39 | 39 | $labels = array( |
40 | - 'name' => _x( 'Bubbles', 'post type general name', self::$name_i18n ), |
|
41 | - 'singular_name' => _x( 'Bubble', 'post type singular name', self::$name_i18n ), |
|
42 | - 'menu_name' => _x( 'Bubbles', 'admin menu', self::$name_i18n ), |
|
43 | - 'name_admin_bar' => _x( 'Bubble', 'add new on admin bar', self::$name_i18n ), |
|
44 | - 'add_new' => _x( 'Add New', 'bubble', self::$name_i18n ), |
|
45 | - 'add_new_item' => __( 'Add New Bubble', self::$name_i18n ), |
|
46 | - 'new_item' => __( 'New Bubble', self::$name_i18n ), |
|
47 | - 'edit_item' => __( 'Edit Bubble', self::$name_i18n ), |
|
48 | - 'view_item' => __( 'View Bubble', self::$name_i18n ), |
|
49 | - 'all_items' => __( 'All Bubbles', self::$name_i18n ), |
|
50 | - 'search_items' => __( 'Search Bubbles', self::$name_i18n ), |
|
51 | - 'parent_item_colon' => __( 'Parent Bubbles:', self::$name_i18n ), |
|
52 | - 'not_found' => __( 'No bubble found.', self::$name_i18n ), |
|
53 | - 'not_found_in_trash' => __( 'No bubble found in Trash.', self::$name_i18n ) |
|
40 | + 'name' => _x('Bubbles', 'post type general name', self::$name_i18n), |
|
41 | + 'singular_name' => _x('Bubble', 'post type singular name', self::$name_i18n), |
|
42 | + 'menu_name' => _x('Bubbles', 'admin menu', self::$name_i18n), |
|
43 | + 'name_admin_bar' => _x('Bubble', 'add new on admin bar', self::$name_i18n), |
|
44 | + 'add_new' => _x('Add New', 'bubble', self::$name_i18n), |
|
45 | + 'add_new_item' => __('Add New Bubble', self::$name_i18n), |
|
46 | + 'new_item' => __('New Bubble', self::$name_i18n), |
|
47 | + 'edit_item' => __('Edit Bubble', self::$name_i18n), |
|
48 | + 'view_item' => __('View Bubble', self::$name_i18n), |
|
49 | + 'all_items' => __('All Bubbles', self::$name_i18n), |
|
50 | + 'search_items' => __('Search Bubbles', self::$name_i18n), |
|
51 | + 'parent_item_colon' => __('Parent Bubbles:', self::$name_i18n), |
|
52 | + 'not_found' => __('No bubble found.', self::$name_i18n), |
|
53 | + 'not_found_in_trash' => __('No bubble found in Trash.', self::$name_i18n) |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $args = array( |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | 'show_ui' => false, |
61 | 61 | 'show_in_menu' => false, |
62 | 62 | 'query_var' => true, |
63 | - 'rewrite' => array( 'slug' => $this->post_type ), |
|
63 | + 'rewrite' => array('slug' => $this->post_type), |
|
64 | 64 | 'capability_type' => 'post', |
65 | 65 | 'exclude_from_search' => true, |
66 | 66 | 'has_archive' => true, |
67 | 67 | 'hierarchical' => false, |
68 | 68 | 'menu_position' => null, |
69 | 69 | 'menu_icon' => 'dashicons-format-status', |
70 | - 'supports' => array( 'title', 'editor' ) |
|
70 | + 'supports' => array('title', 'editor') |
|
71 | 71 | |
72 | 72 | ); |
73 | 73 | |
74 | - register_post_type( $this->post_type, $args ); |
|
74 | + register_post_type($this->post_type, $args); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function save_custom($post_id) { |
94 | 94 | /** Eviter l'auto save pour ne pas vider les champs personnalisés */ |
95 | - if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
95 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
96 | 96 | return; |
97 | 97 | |
98 | - $meta = !empty( $_POST['meta'] ) ? (array) $_POST['meta'] : false; |
|
99 | - if(!$meta) |
|
98 | + $meta = !empty($_POST['meta']) ? (array)$_POST['meta'] : false; |
|
99 | + if (!$meta) |
|
100 | 100 | return; |
101 | 101 | |
102 | 102 | // Rework the URL meta |
103 | 103 | $tmp_array_urls = array(); |
104 | - if(!empty($meta['urls'])) { |
|
105 | - for($i = 0; $i < count($meta['urls']['paramater']); $i++) { |
|
106 | - $tmp_array_urls[$i]['paramater'] = sanitize_text_field( $meta['urls']['paramater'][$i] ); |
|
107 | - $tmp_array_urls[$i]['value'] = (!empty($meta['urls']['value']) && !empty($meta['urls']['value'][$i])) ? sanitize_text_field( $meta['urls']['value'][$i] ) : ""; |
|
104 | + if (!empty($meta['urls'])) { |
|
105 | + for ($i = 0; $i < count($meta['urls']['paramater']); $i++) { |
|
106 | + $tmp_array_urls[$i]['paramater'] = sanitize_text_field($meta['urls']['paramater'][$i]); |
|
107 | + $tmp_array_urls[$i]['value'] = (!empty($meta['urls']['value']) && !empty($meta['urls']['value'][$i])) ? sanitize_text_field($meta['urls']['value'][$i]) : ""; |
|
108 | 108 | } |
109 | 109 | $meta['urls'] = array(); |
110 | 110 | $meta['urls'] = $tmp_array_urls; |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | $tmp_menu = array(); |
125 | 125 | $tmp_menu["all"] = __("All pages", self::$name_i18n); |
126 | 126 | |
127 | - foreach($menu as $array_menu) { |
|
128 | - if(!empty($array_menu[0])) |
|
127 | + foreach ($menu as $array_menu) { |
|
128 | + if (!empty($array_menu[0])) |
|
129 | 129 | $tmp_menu[$array_menu[2]] = $array_menu[0]; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $array_pages = array_merge($tmp_menu, $_parent_pages); |
133 | 133 | |
134 | - foreach($array_pages as $key => $pages) { |
|
135 | - if(empty($pages)) |
|
134 | + foreach ($array_pages as $key => $pages) { |
|
135 | + if (empty($pages)) |
|
136 | 136 | $array_pages[$key] = $key; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
140 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'position')); |
|
140 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'position')); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | 'orderby' => 'title', |
154 | 154 | 'post_type' => $this->post_type, |
155 | 155 | )); |
156 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'actions')); |
|
156 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'actions')); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function metabox_conditions($post) { |
165 | 165 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
166 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'conditions')); |
|
166 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'conditions')); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function metabox_url($post) { |
175 | 175 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
176 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'url')); |
|
176 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'url')); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function metabox_advanced($post) { |
185 | 185 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
186 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'advanced')); |
|
186 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'advanced')); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function admin_enqueue_scripts() { |
193 | 193 | /** Css */ |
194 | - wp_register_style( 'wpeo-bubble-css', WPS_GUIDED_URL . '/assets/css/backend.css', '', WPS_GUIDED_VERSION ); |
|
195 | - wp_enqueue_style( 'wpeo-bubble-css' ); |
|
194 | + wp_register_style('wpeo-bubble-css', WPS_GUIDED_URL . '/assets/css/backend.css', '', WPS_GUIDED_VERSION); |
|
195 | + wp_enqueue_style('wpeo-bubble-css'); |
|
196 | 196 | |
197 | 197 | /** For use pointer */ |
198 | - wp_enqueue_script( 'wp-pointer' ); |
|
199 | - wp_enqueue_style( 'wp-pointer' ); |
|
198 | + wp_enqueue_script('wp-pointer'); |
|
199 | + wp_enqueue_style('wp-pointer'); |
|
200 | 200 | |
201 | 201 | /** My js */ |
202 | - wp_enqueue_script( 'wpeo-bubble-js', WPS_GUIDED_URL . '/assets/js/backend.js', array("jquery"), WPS_GUIDED_VERSION ); |
|
202 | + wp_enqueue_script('wpeo-bubble-js', WPS_GUIDED_URL . '/assets/js/backend.js', array("jquery"), WPS_GUIDED_VERSION); |
|
203 | 203 | /** Bottom of page */ |
204 | - add_action( 'admin_print_footer_scripts', array(&$this, 'custom_admin_pointers_footer'), 50); |
|
204 | + add_action('admin_print_footer_scripts', array(&$this, 'custom_admin_pointers_footer'), 50); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -219,30 +219,30 @@ discard block |
||
219 | 219 | |
220 | 220 | $dismiss_pointer = explode(',', get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)); |
221 | 221 | |
222 | - foreach($this->array_bubble as $key => $bubble) { |
|
222 | + foreach ($this->array_bubble as $key => $bubble) { |
|
223 | 223 | $meta = get_post_meta($bubble->ID, $this->post_metakey, true); |
224 | 224 | $this->array_bubble[$key]->post_meta = $meta; |
225 | 225 | |
226 | 226 | /** On vérifie si la bubble à déjà était fermer ou pas */ |
227 | 227 | $slug = "wpeo_bubble_" . $bubble->post_name; |
228 | - if(in_array($slug, $dismiss_pointer)) |
|
228 | + if (in_array($slug, $dismiss_pointer)) |
|
229 | 229 | unset($this->array_bubble[$key]); |
230 | 230 | |
231 | 231 | /** On vérifie si on est sur la bonne page de la bubble */ |
232 | - if(!$this->check_page_bubble((!empty($meta) && !empty($meta['position'])) ? $meta['position'] : array())) |
|
232 | + if (!$this->check_page_bubble((!empty($meta) && !empty($meta['position'])) ? $meta['position'] : array())) |
|
233 | 233 | unset($this->array_bubble[$key]); |
234 | 234 | |
235 | 235 | /** On vérifie si y'a pas des conditions */ |
236 | - if(!$this->check_condition_bubble((!empty($meta) && !empty($meta['conditions'])) ? $meta['conditions'] : array())) |
|
236 | + if (!$this->check_condition_bubble((!empty($meta) && !empty($meta['conditions'])) ? $meta['conditions'] : array())) |
|
237 | 237 | unset($this->array_bubble[$key]); |
238 | 238 | |
239 | 239 | /** On vérifie les $_GET */ |
240 | - if(!$this->check_url_bubble((!empty($meta) && !empty($meta['urls'])) ? $meta['urls'] : array())) |
|
240 | + if (!$this->check_url_bubble((!empty($meta) && !empty($meta['urls'])) ? $meta['urls'] : array())) |
|
241 | 241 | unset($this->array_bubble[$key]); |
242 | 242 | } |
243 | 243 | sort($this->array_bubble); |
244 | 244 | |
245 | - require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'pointer')); |
|
245 | + require_once(wpsBubbleTemplate_ctr::get_template_part(WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'pointer')); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | * @return boolean true is the bubble is in page or false if not. |
253 | 253 | */ |
254 | 254 | public function check_page_bubble($position) { |
255 | - if(empty($position['page'])) |
|
255 | + if (empty($position['page'])) |
|
256 | 256 | return true; |
257 | 257 | |
258 | - if("all" === $position['page']) |
|
258 | + if ("all" === $position['page']) |
|
259 | 259 | return true; |
260 | 260 | |
261 | - if(get_current_screen()->parent_file === $position['page']) |
|
261 | + if (get_current_screen()->parent_file === $position['page']) |
|
262 | 262 | return true; |
263 | 263 | |
264 | 264 | return false; |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | * @return boolean true is the bubble respect the condition or false if not. |
272 | 272 | */ |
273 | 273 | public function check_condition_bubble($conditions) { |
274 | - if(empty($conditions) || empty($conditions['option_name'])) |
|
274 | + if (empty($conditions) || empty($conditions['option_name'])) |
|
275 | 275 | return true; |
276 | 276 | |
277 | 277 | $option = get_option($conditions['option_name']); |
278 | 278 | |
279 | - if(empty($option) || $option == "") |
|
279 | + if (empty($option) || $option == "") |
|
280 | 280 | return true; |
281 | 281 | |
282 | - if(!is_array($option) && $option == $conditions['option_value']) { |
|
282 | + if (!is_array($option) && $option == $conditions['option_value']) { |
|
283 | 283 | return true; |
284 | 284 | } |
285 | - else if(is_array($option) && $conditions['option_value'] == $option[$conditions['data_name']]) { |
|
285 | + else if (is_array($option) && $conditions['option_value'] == $option[$conditions['data_name']]) { |
|
286 | 286 | return true; |
287 | 287 | } |
288 | 288 | return false; |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function check_url_bubble($urls) { |
298 | 298 | // Il faut que ça respecte au moins 1 $_GET |
299 | - if ( !empty( $urls ) ) { |
|
300 | - foreach ($urls as $url ) { |
|
301 | - $url = !empty( $_GET[$url['paramater']] ) ? sanitize_text_field( $_GET[$url['paramater']] ) : ''; |
|
302 | - if ( !empty( $url ) && $url == $url['value']) { |
|
299 | + if (!empty($urls)) { |
|
300 | + foreach ($urls as $url) { |
|
301 | + $url = !empty($_GET[$url['paramater']]) ? sanitize_text_field($_GET[$url['paramater']]) : ''; |
|
302 | + if (!empty($url) && $url == $url['value']) { |
|
303 | 303 | return true; |
304 | 304 | } |
305 | - else if(empty($url['paramater']) && empty($url['value'])) { |
|
305 | + else if (empty($url['paramater']) && empty($url['value'])) { |
|
306 | 306 | return true; |
307 | 307 | } |
308 | 308 | } |
@@ -319,17 +319,17 @@ discard block |
||
319 | 319 | * @param int post_ID - The bubble ID |
320 | 320 | */ |
321 | 321 | public function reset_bubble_all_user() { |
322 | - $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
|
322 | + $_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : ''; |
|
323 | 323 | |
324 | - if ( !wp_verify_nonce( $_wpnonce, 'reset_bubble_all_user' ) ) |
|
324 | + if (!wp_verify_nonce($_wpnonce, 'reset_bubble_all_user')) |
|
325 | 325 | wp_die(); |
326 | 326 | |
327 | 327 | $post = get_post((int)$_POST['post_ID']); |
328 | 328 | $post_name = $post->post_name; |
329 | 329 | |
330 | 330 | $array_users = get_users(); |
331 | - if(!empty($array_users)) { |
|
332 | - foreach($array_users as $user) { |
|
331 | + if (!empty($array_users)) { |
|
332 | + foreach ($array_users as $user) { |
|
333 | 333 | // User id $user->data->ID; |
334 | 334 | $meta = get_user_meta($user->data->ID, 'dismissed_wp_pointers', true); |
335 | 335 | $meta = explode(',', $meta); |
@@ -349,24 +349,24 @@ discard block |
||
349 | 349 | * @param string $_POST['pointer'] The sanitize name of the pointer |
350 | 350 | */ |
351 | 351 | public function dismiss_my_pointer() { |
352 | - $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
|
352 | + $_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : ''; |
|
353 | 353 | |
354 | - if ( !wp_verify_nonce( $_wpnonce, 'dismiss_my_pointer' ) ) |
|
354 | + if (!wp_verify_nonce($_wpnonce, 'dismiss_my_pointer')) |
|
355 | 355 | wp_die(); |
356 | 356 | |
357 | - $pointer = sanitize_key( $_POST['pointer'] ); |
|
358 | - if ( $pointer != sanitize_key( $pointer ) ) |
|
357 | + $pointer = sanitize_key($_POST['pointer']); |
|
358 | + if ($pointer != sanitize_key($pointer)) |
|
359 | 359 | wp_die(0); |
360 | 360 | |
361 | - $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); |
|
361 | + $dismissed = array_filter(explode(',', (string)get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true))); |
|
362 | 362 | |
363 | - if(in_array($pointer, $dismissed)) |
|
363 | + if (in_array($pointer, $dismissed)) |
|
364 | 364 | wp_die(0); |
365 | 365 | |
366 | 366 | $dismissed[] = $pointer; |
367 | - $dismissed = implode( ',', $dismissed ); |
|
367 | + $dismissed = implode(',', $dismissed); |
|
368 | 368 | |
369 | - update_user_meta( get_current_user_id(), 'dismissed_wp_pointers', $dismissed ); |
|
369 | + update_user_meta(get_current_user_id(), 'dismissed_wp_pointers', $dismissed); |
|
370 | 370 | wp_die(1); |
371 | 371 | } |
372 | 372 | |
@@ -376,10 +376,10 @@ discard block |
||
376 | 376 | * @param string $string The string |
377 | 377 | */ |
378 | 378 | private function format_string_php_to_js($string) { |
379 | - $string = str_replace(CHR(13).CHR(10),"<br />",$string); |
|
379 | + $string = str_replace(CHR(13) . CHR(10), "<br />", $string); |
|
380 | 380 | $string = str_replace("'", "'", $string); |
381 | 381 | $string = nl2br($string); |
382 | - $string = preg_replace( "/\r|\n/", "", $string ); |
|
382 | + $string = preg_replace("/\r|\n/", "", $string); |
|
383 | 383 | return trim($string); |
384 | 384 | } |
385 | 385 | |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * @return array |
391 | 391 | */ |
392 | 392 | static public function xml_2_array($xml_object, $out = array()) { |
393 | - foreach((array) $xml_object as $index => $node) { |
|
393 | + foreach ((array)$xml_object as $index => $node) { |
|
394 | 394 | $out[$index] = (is_object($node)) ? xml_2_array($node) : $node; |
395 | 395 | } |
396 | 396 | |
@@ -412,34 +412,34 @@ discard block |
||
412 | 412 | ); |
413 | 413 | |
414 | 414 | /** Get the default datas for installation - sample products */ |
415 | - $sample_datas = file_get_contents( WPS_GUIDED_PATH . '/assets/data/default-data-guided-tour.xml' ); |
|
416 | - $defined_sample_datas = new SimpleXMLElement( $sample_datas, LIBXML_NOCDATA ); |
|
415 | + $sample_datas = file_get_contents(WPS_GUIDED_PATH . '/assets/data/default-data-guided-tour.xml'); |
|
416 | + $defined_sample_datas = new SimpleXMLElement($sample_datas, LIBXML_NOCDATA); |
|
417 | 417 | |
418 | 418 | $namespaces = $defined_sample_datas->getDocNamespaces(); |
419 | - if ( ! isset( $namespaces['wp'] ) ) |
|
419 | + if (!isset($namespaces['wp'])) |
|
420 | 420 | $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; |
421 | - if ( ! isset( $namespaces['excerpt'] ) ) |
|
421 | + if (!isset($namespaces['excerpt'])) |
|
422 | 422 | $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; |
423 | 423 | |
424 | - foreach ( $defined_sample_datas->xpath( '//item' ) as $product ) { |
|
425 | - $dc = $product->children( 'http://purl.org/dc/elements/1.1/' ); |
|
426 | - $content = $product->children( 'http://purl.org/rss/1.0/modules/content/' ); |
|
427 | - $excerpt = $product->children( $namespaces['excerpt'] ); |
|
428 | - $wp = $product->children( $namespaces['wp'] ); |
|
424 | + foreach ($defined_sample_datas->xpath('//item') as $product) { |
|
425 | + $dc = $product->children('http://purl.org/dc/elements/1.1/'); |
|
426 | + $content = $product->children('http://purl.org/rss/1.0/modules/content/'); |
|
427 | + $excerpt = $product->children($namespaces['excerpt']); |
|
428 | + $wp = $product->children($namespaces['wp']); |
|
429 | 429 | |
430 | - $product_args = wp_parse_args( array( |
|
430 | + $product_args = wp_parse_args(array( |
|
431 | 431 | 'post_title' => __((string)$product->title, self::$name_i18n), |
432 | - 'post_name' => (string) $wp->post_name, |
|
433 | - 'post_content' => __((string) $content->encoded, self::$name_i18n), |
|
434 | - 'post_excerpt' => (string) $excerpt->encoded, |
|
435 | - 'post_type' => (string) $wp->post_type, |
|
436 | - ), $product_default_args ); |
|
437 | - |
|
438 | - $product_id = wp_insert_post( $product_args ); |
|
439 | - foreach ( $wp->postmeta as $meta ) { |
|
432 | + 'post_name' => (string)$wp->post_name, |
|
433 | + 'post_content' => __((string)$content->encoded, self::$name_i18n), |
|
434 | + 'post_excerpt' => (string)$excerpt->encoded, |
|
435 | + 'post_type' => (string)$wp->post_type, |
|
436 | + ), $product_default_args); |
|
437 | + |
|
438 | + $product_id = wp_insert_post($product_args); |
|
439 | + foreach ($wp->postmeta as $meta) { |
|
440 | 440 | $m = self::xml_2_array($meta->meta_value); |
441 | 441 | $m = maybe_unserialize($m[0]); |
442 | - update_post_meta( $product_id, (string)$meta->meta_key, $m); |
|
442 | + update_post_meta($product_id, (string)$meta->meta_key, $m); |
|
443 | 443 | } |
444 | 444 | } |
445 | 445 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Main controller file for bubble module |
4 | 6 | * |
@@ -92,12 +94,14 @@ discard block |
||
92 | 94 | */ |
93 | 95 | public function save_custom($post_id) { |
94 | 96 | /** Eviter l'auto save pour ne pas vider les champs personnalisés */ |
95 | - if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
|
96 | - return; |
|
97 | + if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
98 | + return; |
|
99 | + } |
|
97 | 100 | |
98 | 101 | $meta = !empty( $_POST['meta'] ) ? (array) $_POST['meta'] : false; |
99 | - if(!$meta) |
|
100 | - return; |
|
102 | + if(!$meta) { |
|
103 | + return; |
|
104 | + } |
|
101 | 105 | |
102 | 106 | // Rework the URL meta |
103 | 107 | $tmp_array_urls = array(); |
@@ -125,15 +129,17 @@ discard block |
||
125 | 129 | $tmp_menu["all"] = __("All pages", self::$name_i18n); |
126 | 130 | |
127 | 131 | foreach($menu as $array_menu) { |
128 | - if(!empty($array_menu[0])) |
|
129 | - $tmp_menu[$array_menu[2]] = $array_menu[0]; |
|
132 | + if(!empty($array_menu[0])) { |
|
133 | + $tmp_menu[$array_menu[2]] = $array_menu[0]; |
|
134 | + } |
|
130 | 135 | } |
131 | 136 | |
132 | 137 | $array_pages = array_merge($tmp_menu, $_parent_pages); |
133 | 138 | |
134 | 139 | foreach($array_pages as $key => $pages) { |
135 | - if(empty($pages)) |
|
136 | - $array_pages[$key] = $key; |
|
140 | + if(empty($pages)) { |
|
141 | + $array_pages[$key] = $key; |
|
142 | + } |
|
137 | 143 | } |
138 | 144 | |
139 | 145 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
@@ -225,20 +231,24 @@ discard block |
||
225 | 231 | |
226 | 232 | /** On vérifie si la bubble à déjà était fermer ou pas */ |
227 | 233 | $slug = "wpeo_bubble_" . $bubble->post_name; |
228 | - if(in_array($slug, $dismiss_pointer)) |
|
229 | - unset($this->array_bubble[$key]); |
|
234 | + if(in_array($slug, $dismiss_pointer)) { |
|
235 | + unset($this->array_bubble[$key]); |
|
236 | + } |
|
230 | 237 | |
231 | 238 | /** On vérifie si on est sur la bonne page de la bubble */ |
232 | - if(!$this->check_page_bubble((!empty($meta) && !empty($meta['position'])) ? $meta['position'] : array())) |
|
233 | - unset($this->array_bubble[$key]); |
|
239 | + if(!$this->check_page_bubble((!empty($meta) && !empty($meta['position'])) ? $meta['position'] : array())) { |
|
240 | + unset($this->array_bubble[$key]); |
|
241 | + } |
|
234 | 242 | |
235 | 243 | /** On vérifie si y'a pas des conditions */ |
236 | - if(!$this->check_condition_bubble((!empty($meta) && !empty($meta['conditions'])) ? $meta['conditions'] : array())) |
|
237 | - unset($this->array_bubble[$key]); |
|
244 | + if(!$this->check_condition_bubble((!empty($meta) && !empty($meta['conditions'])) ? $meta['conditions'] : array())) { |
|
245 | + unset($this->array_bubble[$key]); |
|
246 | + } |
|
238 | 247 | |
239 | 248 | /** On vérifie les $_GET */ |
240 | - if(!$this->check_url_bubble((!empty($meta) && !empty($meta['urls'])) ? $meta['urls'] : array())) |
|
241 | - unset($this->array_bubble[$key]); |
|
249 | + if(!$this->check_url_bubble((!empty($meta) && !empty($meta['urls'])) ? $meta['urls'] : array())) { |
|
250 | + unset($this->array_bubble[$key]); |
|
251 | + } |
|
242 | 252 | } |
243 | 253 | sort($this->array_bubble); |
244 | 254 | |
@@ -252,14 +262,17 @@ discard block |
||
252 | 262 | * @return boolean true is the bubble is in page or false if not. |
253 | 263 | */ |
254 | 264 | public function check_page_bubble($position) { |
255 | - if(empty($position['page'])) |
|
256 | - return true; |
|
265 | + if(empty($position['page'])) { |
|
266 | + return true; |
|
267 | + } |
|
257 | 268 | |
258 | - if("all" === $position['page']) |
|
259 | - return true; |
|
269 | + if("all" === $position['page']) { |
|
270 | + return true; |
|
271 | + } |
|
260 | 272 | |
261 | - if(get_current_screen()->parent_file === $position['page']) |
|
262 | - return true; |
|
273 | + if(get_current_screen()->parent_file === $position['page']) { |
|
274 | + return true; |
|
275 | + } |
|
263 | 276 | |
264 | 277 | return false; |
265 | 278 | } |
@@ -271,18 +284,19 @@ discard block |
||
271 | 284 | * @return boolean true is the bubble respect the condition or false if not. |
272 | 285 | */ |
273 | 286 | public function check_condition_bubble($conditions) { |
274 | - if(empty($conditions) || empty($conditions['option_name'])) |
|
275 | - return true; |
|
287 | + if(empty($conditions) || empty($conditions['option_name'])) { |
|
288 | + return true; |
|
289 | + } |
|
276 | 290 | |
277 | 291 | $option = get_option($conditions['option_name']); |
278 | 292 | |
279 | - if(empty($option) || $option == "") |
|
280 | - return true; |
|
293 | + if(empty($option) || $option == "") { |
|
294 | + return true; |
|
295 | + } |
|
281 | 296 | |
282 | 297 | if(!is_array($option) && $option == $conditions['option_value']) { |
283 | 298 | return true; |
284 | - } |
|
285 | - else if(is_array($option) && $conditions['option_value'] == $option[$conditions['data_name']]) { |
|
299 | + } else if(is_array($option) && $conditions['option_value'] == $option[$conditions['data_name']]) { |
|
286 | 300 | return true; |
287 | 301 | } |
288 | 302 | return false; |
@@ -301,14 +315,13 @@ discard block |
||
301 | 315 | $url = !empty( $_GET[$url['paramater']] ) ? sanitize_text_field( $_GET[$url['paramater']] ) : ''; |
302 | 316 | if ( !empty( $url ) && $url == $url['value']) { |
303 | 317 | return true; |
304 | - } |
|
305 | - else if(empty($url['paramater']) && empty($url['value'])) { |
|
318 | + } else if(empty($url['paramater']) && empty($url['value'])) { |
|
306 | 319 | return true; |
307 | 320 | } |
308 | 321 | } |
322 | + } else { |
|
323 | + return true; |
|
309 | 324 | } |
310 | - else |
|
311 | - return true; |
|
312 | 325 | |
313 | 326 | return false; |
314 | 327 | } |
@@ -321,8 +334,9 @@ discard block |
||
321 | 334 | public function reset_bubble_all_user() { |
322 | 335 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
323 | 336 | |
324 | - if ( !wp_verify_nonce( $_wpnonce, 'reset_bubble_all_user' ) ) |
|
325 | - wp_die(); |
|
337 | + if ( !wp_verify_nonce( $_wpnonce, 'reset_bubble_all_user' ) ) { |
|
338 | + wp_die(); |
|
339 | + } |
|
326 | 340 | |
327 | 341 | $post = get_post((int)$_POST['post_ID']); |
328 | 342 | $post_name = $post->post_name; |
@@ -351,17 +365,20 @@ discard block |
||
351 | 365 | public function dismiss_my_pointer() { |
352 | 366 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
353 | 367 | |
354 | - if ( !wp_verify_nonce( $_wpnonce, 'dismiss_my_pointer' ) ) |
|
355 | - wp_die(); |
|
368 | + if ( !wp_verify_nonce( $_wpnonce, 'dismiss_my_pointer' ) ) { |
|
369 | + wp_die(); |
|
370 | + } |
|
356 | 371 | |
357 | 372 | $pointer = sanitize_key( $_POST['pointer'] ); |
358 | - if ( $pointer != sanitize_key( $pointer ) ) |
|
359 | - wp_die(0); |
|
373 | + if ( $pointer != sanitize_key( $pointer ) ) { |
|
374 | + wp_die(0); |
|
375 | + } |
|
360 | 376 | |
361 | 377 | $dismissed = array_filter( explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ) ); |
362 | 378 | |
363 | - if(in_array($pointer, $dismissed)) |
|
364 | - wp_die(0); |
|
379 | + if(in_array($pointer, $dismissed)) { |
|
380 | + wp_die(0); |
|
381 | + } |
|
365 | 382 | |
366 | 383 | $dismissed[] = $pointer; |
367 | 384 | $dismissed = implode( ',', $dismissed ); |
@@ -416,10 +433,12 @@ discard block |
||
416 | 433 | $defined_sample_datas = new SimpleXMLElement( $sample_datas, LIBXML_NOCDATA ); |
417 | 434 | |
418 | 435 | $namespaces = $defined_sample_datas->getDocNamespaces(); |
419 | - if ( ! isset( $namespaces['wp'] ) ) |
|
420 | - $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; |
|
421 | - if ( ! isset( $namespaces['excerpt'] ) ) |
|
422 | - $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; |
|
436 | + if ( ! isset( $namespaces['wp'] ) ) { |
|
437 | + $namespaces['wp'] = 'http://wordpress.org/export/1.1/'; |
|
438 | + } |
|
439 | + if ( ! isset( $namespaces['excerpt'] ) ) { |
|
440 | + $namespaces['excerpt'] = 'http://wordpress.org/export/1.1/excerpt/'; |
|
441 | + } |
|
423 | 442 | |
424 | 443 | foreach ( $defined_sample_datas->xpath( '//item' ) as $product ) { |
425 | 444 | $dc = $product->children( 'http://purl.org/dc/elements/1.1/' ); |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * Register post type (Bubbles) |
|
37 | - */ |
|
36 | + * Register post type (Bubbles) |
|
37 | + */ |
|
38 | 38 | public function register_post_type() { |
39 | 39 | $labels = array( |
40 | 40 | 'name' => _x( 'Bubbles', 'post type general name', self::$name_i18n ), |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * For add_meta_box (position, actions, conditions, url, advanced) |
|
79 | - */ |
|
78 | + * For add_meta_box (position, actions, conditions, url, advanced) |
|
79 | + */ |
|
80 | 80 | public function admin_init() { |
81 | 81 | add_meta_box("wpeo-bubble-metabox-position", __("Position", self::$name_i18n), array(&$this, "metabox_position"), $this->post_type, "normal", "low"); |
82 | 82 | add_meta_box("wpeo-bubble-metabox-actions", __("Actions", self::$name_i18n), array(&$this, "metabox_actions"), $this->post_type, "normal", "low"); |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Update post meta of post ID, rework the meta URL and save the meta |
|
90 | - * |
|
91 | - * @param int $post_id The id of the post being saved |
|
92 | - */ |
|
89 | + * Update post meta of post ID, rework the meta URL and save the meta |
|
90 | + * |
|
91 | + * @param int $post_id The id of the post being saved |
|
92 | + */ |
|
93 | 93 | public function save_custom($post_id) { |
94 | 94 | /** Eviter l'auto save pour ne pas vider les champs personnalisés */ |
95 | 95 | if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Get all pages of the backend, get current meta for this post, and call the template for display the metabox position. |
|
119 | - * |
|
120 | - * @param WP_Post $post The object for the current post/page. |
|
121 | - */ |
|
118 | + * Get all pages of the backend, get current meta for this post, and call the template for display the metabox position. |
|
119 | + * |
|
120 | + * @param WP_Post $post The object for the current post/page. |
|
121 | + */ |
|
122 | 122 | public function metabox_position($post) { |
123 | 123 | global $menu, $_parent_pages; |
124 | 124 | $tmp_menu = array(); |
@@ -141,10 +141,10 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
144 | - * Get current meta for this post, declare the array type next, get all bubble posts and display the template metabox actions. |
|
145 | - * |
|
146 | - * @param WP_Post $post The object for the current post/page. |
|
147 | - */ |
|
144 | + * Get current meta for this post, declare the array type next, get all bubble posts and display the template metabox actions. |
|
145 | + * |
|
146 | + * @param WP_Post $post The object for the current post/page. |
|
147 | + */ |
|
148 | 148 | public function metabox_actions($post) { |
149 | 149 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
150 | 150 | $array_type_next = array("link", "bubble"); |
@@ -157,46 +157,46 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
160 | - * Get current meta for this $post and display the template metabox conditions |
|
161 | - * |
|
162 | - * @param WP_Post $post The object for the current post/page. |
|
163 | - */ |
|
160 | + * Get current meta for this $post and display the template metabox conditions |
|
161 | + * |
|
162 | + * @param WP_Post $post The object for the current post/page. |
|
163 | + */ |
|
164 | 164 | public function metabox_conditions($post) { |
165 | 165 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
166 | 166 | require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'conditions')); |
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
170 | - * Get current meta for this $post and display template metabox url. |
|
171 | - * |
|
172 | - * @param WP_Post $post The object for the current post/page. |
|
173 | - */ |
|
170 | + * Get current meta for this $post and display template metabox url. |
|
171 | + * |
|
172 | + * @param WP_Post $post The object for the current post/page. |
|
173 | + */ |
|
174 | 174 | public function metabox_url($post) { |
175 | 175 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
176 | 176 | require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'url')); |
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Get current meta for this $post and display template metabox advanced. |
|
181 | - * |
|
182 | - * @param WP_Post $post The object for the current post/page. |
|
183 | - */ |
|
180 | + * Get current meta for this $post and display template metabox advanced. |
|
181 | + * |
|
182 | + * @param WP_Post $post The object for the current post/page. |
|
183 | + */ |
|
184 | 184 | public function metabox_advanced($post) { |
185 | 185 | $meta = get_post_meta($post->ID, $this->post_metakey, true); |
186 | 186 | require_once( wpsBubbleTemplate_ctr::get_template_part( WPS_GUIDED_DIR, WPS_GUIDED_TEMPLATES_MAIN_DIR, 'backend', 'metabox', 'advanced')); |
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * Register my css and my js bubble, add wp-pointer and add action admin_print_footer_scripts. |
|
191 | - */ |
|
190 | + * Register my css and my js bubble, add wp-pointer and add action admin_print_footer_scripts. |
|
191 | + */ |
|
192 | 192 | public function admin_enqueue_scripts() { |
193 | 193 | /** Css */ |
194 | 194 | wp_register_style( 'wpeo-bubble-css', WPS_GUIDED_URL . '/assets/css/backend.css', '', WPS_GUIDED_VERSION ); |
195 | 195 | wp_enqueue_style( 'wpeo-bubble-css' ); |
196 | 196 | |
197 | 197 | /** For use pointer */ |
198 | - wp_enqueue_script( 'wp-pointer' ); |
|
199 | - wp_enqueue_style( 'wp-pointer' ); |
|
198 | + wp_enqueue_script( 'wp-pointer' ); |
|
199 | + wp_enqueue_style( 'wp-pointer' ); |
|
200 | 200 | |
201 | 201 | /** My js */ |
202 | 202 | wp_enqueue_script( 'wpeo-bubble-js', WPS_GUIDED_URL . '/assets/js/backend.js', array("jquery"), WPS_GUIDED_VERSION ); |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * Get all bubble, rework the array bubble for check if the bubble is dismiss, in this page and respects the conditions (url and database) |
|
209 | - * and display it. |
|
210 | - */ |
|
208 | + * Get all bubble, rework the array bubble for check if the bubble is dismiss, in this page and respects the conditions (url and database) |
|
209 | + * and display it. |
|
210 | + */ |
|
211 | 211 | public function custom_admin_pointers_footer() { |
212 | 212 | $this->array_bubble = get_posts( |
213 | 213 | array( |
@@ -246,11 +246,11 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Check the current page for the bubble |
|
250 | - * |
|
251 | - * @param array $position (page, anchor_id) |
|
252 | - * @return boolean true is the bubble is in page or false if not. |
|
253 | - */ |
|
249 | + * Check the current page for the bubble |
|
250 | + * |
|
251 | + * @param array $position (page, anchor_id) |
|
252 | + * @return boolean true is the bubble is in page or false if not. |
|
253 | + */ |
|
254 | 254 | public function check_page_bubble($position) { |
255 | 255 | if(empty($position['page'])) |
256 | 256 | return true; |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
268 | - * Check condition in database for the bubble |
|
269 | - * |
|
270 | - * @param Array $conditions The array (option_name, data_name, option_value) |
|
271 | - * @return boolean true is the bubble respect the condition or false if not. |
|
272 | - */ |
|
268 | + * Check condition in database for the bubble |
|
269 | + * |
|
270 | + * @param Array $conditions The array (option_name, data_name, option_value) |
|
271 | + * @return boolean true is the bubble respect the condition or false if not. |
|
272 | + */ |
|
273 | 273 | public function check_condition_bubble($conditions) { |
274 | 274 | if(empty($conditions) || empty($conditions['option_name'])) |
275 | 275 | return true; |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
292 | - * Check $_GET in url for the bubble |
|
293 | - * |
|
294 | - * @param array $url The array (paramater, value). |
|
295 | - * @return boolean true is the bubble is checked in URL or false if not. |
|
296 | - */ |
|
292 | + * Check $_GET in url for the bubble |
|
293 | + * |
|
294 | + * @param array $url The array (paramater, value). |
|
295 | + * @return boolean true is the bubble is checked in URL or false if not. |
|
296 | + */ |
|
297 | 297 | public function check_url_bubble($urls) { |
298 | 298 | // Il faut que ça respecte au moins 1 $_GET |
299 | 299 | if ( !empty( $urls ) ) { |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | - * Reset the bubble id for all user |
|
318 | - * |
|
319 | - * @param int post_ID - The bubble ID |
|
320 | - */ |
|
317 | + * Reset the bubble id for all user |
|
318 | + * |
|
319 | + * @param int post_ID - The bubble ID |
|
320 | + */ |
|
321 | 321 | public function reset_bubble_all_user() { |
322 | 322 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
323 | 323 | |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
347 | - * Dismiss the pointer if not already dismissed |
|
348 | - * |
|
349 | - * @param string $_POST['pointer'] The sanitize name of the pointer |
|
350 | - */ |
|
347 | + * Dismiss the pointer if not already dismissed |
|
348 | + * |
|
349 | + * @param string $_POST['pointer'] The sanitize name of the pointer |
|
350 | + */ |
|
351 | 351 | public function dismiss_my_pointer() { |
352 | 352 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
353 | 353 | |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
374 | - * Replace quote, simple quote, backline |
|
375 | - * |
|
376 | - * @param string $string The string |
|
377 | - */ |
|
374 | + * Replace quote, simple quote, backline |
|
375 | + * |
|
376 | + * @param string $string The string |
|
377 | + */ |
|
378 | 378 | private function format_string_php_to_js($string) { |
379 | 379 | $string = str_replace(CHR(13).CHR(10),"<br />",$string); |
380 | 380 | $string = str_replace("'", "'", $string); |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
401 | - * For import the base XML when install or update wpshop |
|
402 | - */ |
|
401 | + * For import the base XML when install or update wpshop |
|
402 | + */ |
|
403 | 403 | static public function import_xml() { |
404 | 404 | global $wpdb, $wp_rewrite; |
405 | 405 |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | /** |
292 | 292 | * Check $_GET in url for the bubble |
293 | 293 | * |
294 | - * @param array $url The array (paramater, value). |
|
294 | + * @param array $urls The array (paramater, value). |
|
295 | 295 | * @return boolean true is the bubble is checked in URL or false if not. |
296 | 296 | */ |
297 | 297 | public function check_url_bubble($urls) { |
@@ -346,7 +346,6 @@ discard block |
||
346 | 346 | /** |
347 | 347 | * Dismiss the pointer if not already dismissed |
348 | 348 | * |
349 | - * @param string $_POST['pointer'] The sanitize name of the pointer |
|
350 | 349 | */ |
351 | 350 | public function dismiss_my_pointer() { |
352 | 351 | $_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : ''; |
@@ -1,24 +1,24 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - do_action( 'wpshop_account_custom_hook'); ?> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + do_action('wpshop_account_custom_hook'); ?> |
|
3 | 3 | <div class="wps-gridwrapper"> |
4 | - <span class="wps-h3"><?php _e( 'Shipping method', 'wpshop'); ?></span> |
|
4 | + <span class="wps-h3"><?php _e('Shipping method', 'wpshop'); ?></span> |
|
5 | 5 | </div> |
6 | 6 | <div> |
7 | - <?php if( $no_shipping_mode_for_area ) : ?> |
|
8 | - <div class="wps-alert-error"><?php _e( 'Sorry ! You can\'t order on this shop, because we don\'t ship in your area', 'wpshop' ); ?> </div> |
|
7 | + <?php if ($no_shipping_mode_for_area) : ?> |
|
8 | + <div class="wps-alert-error"><?php _e('Sorry ! You can\'t order on this shop, because we don\'t ship in your area', 'wpshop'); ?> </div> |
|
9 | 9 | <?php else : ?> |
10 | - <?php if( !empty($shipping_modes) && !empty($shipping_modes['modes']) ) : ?> |
|
11 | - <ul class="wps-itemList" id="wps-shipping-method-list-container" data-nonce="<?php echo wp_create_nonce( 'wps_load_shipping_methods' ); ?>"> |
|
10 | + <?php if (!empty($shipping_modes) && !empty($shipping_modes['modes'])) : ?> |
|
11 | + <ul class="wps-itemList" id="wps-shipping-method-list-container" data-nonce="<?php echo wp_create_nonce('wps_load_shipping_methods'); ?>"> |
|
12 | 12 | <?php |
13 | 13 | $i = 0; |
14 | - foreach( $shipping_modes['modes'] as $shipping_mode_id => $shipping_mode ) : |
|
15 | - require( wpshop_tools::get_template_part( WPS_SHIPPING_MODE_DIR, $this->template_dir, "frontend", "shipping-mode", "element") ); |
|
14 | + foreach ($shipping_modes['modes'] as $shipping_mode_id => $shipping_mode) : |
|
15 | + require(wpshop_tools::get_template_part(WPS_SHIPPING_MODE_DIR, $this->template_dir, "frontend", "shipping-mode", "element")); |
|
16 | 16 | endforeach; |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | </ul> |
20 | 20 | <?php else : ?> |
21 | - <div class="wps-alert-info"><?php _e( 'No shipping mode available', 'wpshop' ); ?> </div> |
|
21 | + <div class="wps-alert-info"><?php _e('No shipping mode available', 'wpshop'); ?> </div> |
|
22 | 22 | <?php endif; ?> |
23 | 23 | <?php endif; ?> |
24 | 24 | </div> |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | do_action( 'wpshop_account_custom_hook'); ?> |
3 | 5 | <div class="wps-gridwrapper"> |
4 | 6 | <span class="wps-h3"><?php _e( 'Shipping method', 'wpshop'); ?></span> |
@@ -6,9 +8,12 @@ discard block |
||
6 | 8 | <div> |
7 | 9 | <?php if( $no_shipping_mode_for_area ) : ?> |
8 | 10 | <div class="wps-alert-error"><?php _e( 'Sorry ! You can\'t order on this shop, because we don\'t ship in your area', 'wpshop' ); ?> </div> |
9 | - <?php else : ?> |
|
11 | + <?php else { |
|
12 | + : ?> |
|
10 | 13 | <?php if( !empty($shipping_modes) && !empty($shipping_modes['modes']) ) : ?> |
11 | - <ul class="wps-itemList" id="wps-shipping-method-list-container" data-nonce="<?php echo wp_create_nonce( 'wps_load_shipping_methods' ); ?>"> |
|
14 | + <ul class="wps-itemList" id="wps-shipping-method-list-container" data-nonce="<?php echo wp_create_nonce( 'wps_load_shipping_methods' ); |
|
15 | +} |
|
16 | +?>"> |
|
12 | 17 | <?php |
13 | 18 | $i = 0; |
14 | 19 | foreach( $shipping_modes['modes'] as $shipping_mode_id => $shipping_mode ) : |
@@ -17,8 +22,11 @@ discard block |
||
17 | 22 | |
18 | 23 | ?> |
19 | 24 | </ul> |
20 | - <?php else : ?> |
|
21 | - <div class="wps-alert-info"><?php _e( 'No shipping mode available', 'wpshop' ); ?> </div> |
|
25 | + <?php else { |
|
26 | + : ?> |
|
27 | + <div class="wps-alert-info"><?php _e( 'No shipping mode available', 'wpshop' ); |
|
28 | +} |
|
29 | +?> </div> |
|
22 | 30 | <?php endif; ?> |
23 | 31 | <?php endif; ?> |
24 | 32 | </div> |