@@ -14,22 +14,22 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | -<tr class="row <?php echo empty( $contact->data['id'] ) ? 'new' : 'edit'; ?>" style="<?php echo empty( $contact->data['id'] ) ? 'display: none;' : ''; ?>"> |
|
19 | +<tr class="row <?php echo empty($contact->data['id']) ? 'new' : 'edit'; ?>" style="<?php echo empty($contact->data['id']) ? 'display: none;' : ''; ?>"> |
|
20 | 20 | <td></td> |
21 | - <td><input type="text" name="contact[lastname]" value="<?php echo esc_attr( $contact->data['lastname'] ); ?>" /></td> |
|
22 | - <td><input type="text" name="contact[firstname]" value="<?php echo esc_attr( $contact->data['firstname'] ); ?>" /></td> |
|
23 | - <td><input type="text" name="contact[email]" value="<?php echo esc_attr( $contact->data['email'] ); ?>" /></td> |
|
24 | - <td><input type="text" name="contact[phone]" value="<?php echo esc_attr( $contact->data['phone'] ); ?>" /></td> |
|
21 | + <td><input type="text" name="contact[lastname]" value="<?php echo esc_attr($contact->data['lastname']); ?>" /></td> |
|
22 | + <td><input type="text" name="contact[firstname]" value="<?php echo esc_attr($contact->data['firstname']); ?>" /></td> |
|
23 | + <td><input type="text" name="contact[email]" value="<?php echo esc_attr($contact->data['email']); ?>" /></td> |
|
24 | + <td><input type="text" name="contact[phone]" value="<?php echo esc_attr($contact->data['phone']); ?>" /></td> |
|
25 | 25 | <td> |
26 | - <input type="hidden" name="contact[id]" value="<?php echo esc_attr( $contact->data['id'] ); ?>" /> |
|
26 | + <input type="hidden" name="contact[id]" value="<?php echo esc_attr($contact->data['id']); ?>" /> |
|
27 | 27 | <div data-parent="row" |
28 | - data-parent-id="<?php echo esc_attr( $third_party_id ); ?>" |
|
28 | + data-parent-id="<?php echo esc_attr($third_party_id); ?>" |
|
29 | 29 | data-action="third_party_save_contact" |
30 | - data-nonce="<?php echo esc_attr( wp_create_nonce( 'save_and_associate_contact' ) ); ?>" |
|
30 | + data-nonce="<?php echo esc_attr(wp_create_nonce('save_and_associate_contact')); ?>" |
|
31 | 31 | class="action-input wpeo-button button-square-30"> |
32 | - <i class="button-icon fas <?php echo ! empty( $contact->data['id'] ) ? 'fa-save' : 'fa-plus'; ?>"></i> |
|
32 | + <i class="button-icon fas <?php echo !empty($contact->data['id']) ? 'fa-save' : 'fa-plus'; ?>"></i> |
|
33 | 33 | </div> |
34 | 34 | </td> |
35 | 35 | </tr> |
@@ -14,19 +14,19 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | -<form class="wpeo-form" method="post" action="<?php echo ( 0 === $third_party->data['id'] ) ? admin_url( 'admin-post.php' ) : admin_url( 'admin-ajax.php' ); ?>"> |
|
19 | +<form class="wpeo-form" method="post" action="<?php echo (0 === $third_party->data['id']) ? admin_url('admin-post.php') : admin_url('admin-ajax.php'); ?>"> |
|
20 | 20 | <input type="hidden" name="action" value="third_party_save_title" /> |
21 | 21 | <input type="hidden" name="post_id" value="<?php echo $third_party->data['id']; ?>" /> |
22 | - <?php wp_nonce_field( 'save_third' ); ?> |
|
22 | + <?php wp_nonce_field('save_third'); ?> |
|
23 | 23 | |
24 | 24 | <div class="form-element"> |
25 | 25 | <label class="form-field-container"> |
26 | - <input type="text" class="form-field" name="title" placeholder="<?php esc_attr_e( 'New third party', 'wpshop' ); ?>" value="<?php echo $third_party->data['title']; ?>" /> |
|
26 | + <input type="text" class="form-field" name="title" placeholder="<?php esc_attr_e('New third party', 'wpshop'); ?>" value="<?php echo $third_party->data['title']; ?>" /> |
|
27 | 27 | <span class="form-field-label-next"> |
28 | 28 | <?php |
29 | - if ( 0 === $third_party->data['id'] ) : |
|
29 | + if (0 === $third_party->data['id']) : |
|
30 | 30 | ?> |
31 | 31 | <input type="submit" class="wpeo-button button-square-30" value='Save' /> |
32 | 32 | <?php |
@@ -14,33 +14,33 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | <div class="wrap"> |
20 | 20 | <h2> |
21 | 21 | <?php |
22 | - if ( 0 == $third_party->data['id'] ) : |
|
23 | - \eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title-edit', array( |
|
22 | + if (0 == $third_party->data['id']) : |
|
23 | + \eoxia\View_Util::exec('wpshop', 'third-parties', 'single-title-edit', array( |
|
24 | 24 | 'third_party' => $third_party, |
25 | - ) ); |
|
25 | + )); |
|
26 | 26 | else : |
27 | - \eoxia\View_Util::exec( 'wpshop', 'third-parties', 'single-title', array( |
|
27 | + \eoxia\View_Util::exec('wpshop', 'third-parties', 'single-title', array( |
|
28 | 28 | 'third_party' => $third_party, |
29 | - ) ); |
|
29 | + )); |
|
30 | 30 | endif; |
31 | 31 | ?> |
32 | 32 | </h2> |
33 | 33 | |
34 | 34 | <p> |
35 | - <span class="wpeo-button button-main <?php echo ! empty( $third_party->data['external_id'] ) ? 'action-attribute' : 'wpeo-modal-event'; ?>" |
|
35 | + <span class="wpeo-button button-main <?php echo !empty($third_party->data['external_id']) ? 'action-attribute' : 'wpeo-modal-event'; ?>" |
|
36 | 36 | data-title="Choix du tier à associer" |
37 | 37 | data-class="synchro-single" |
38 | - data-id="<?php echo esc_attr( $third_party->data['id'] ); ?>" |
|
38 | + data-id="<?php echo esc_attr($third_party->data['id']); ?>" |
|
39 | 39 | data-action="load_synchro_modal_single" |
40 | - data-nonce="<?php echo esc_attr( wp_create_nonce( 'load_modal_synchro_single' ) ); ?>"> |
|
40 | + data-nonce="<?php echo esc_attr(wp_create_nonce('load_modal_synchro_single')); ?>"> |
|
41 | 41 | <span> |
42 | 42 | <?php |
43 | - if ( ! empty( $third_party->data['external_id'] ) ) : |
|
43 | + if (!empty($third_party->data['external_id'])) : |
|
44 | 44 | ?> |
45 | 45 | Dernière synchronisation le <?php echo $third_party->data['last_sync']['rendered']['date_human_readable']; ?>. Resynchroniser. |
46 | 46 | <?php |
@@ -54,5 +54,5 @@ discard block |
||
54 | 54 | </span> |
55 | 55 | </p> |
56 | 56 | |
57 | - <?php do_meta_boxes( 'wps-third-party', 'normal', '' ); ?> |
|
57 | + <?php do_meta_boxes('wps-third-party', 'normal', ''); ?> |
|
58 | 58 | </div> |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | namespace wpshop; |
18 | 18 | |
19 | -defined( 'ABSPATH' ) || exit; |
|
19 | +defined('ABSPATH') || exit; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Product Action Class. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @since 2.0.0 |
30 | 30 | */ |
31 | 31 | public function __construct() { |
32 | - add_action( 'admin_menu', array( $this, 'callback_admin_menu' ) ); |
|
32 | + add_action('admin_menu', array($this, 'callback_admin_menu')); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @since 2.0.0 |
39 | 39 | */ |
40 | 40 | public function callback_admin_menu() { |
41 | - add_submenu_page( 'wps-order', __( 'Products', 'wpshop' ), __( 'Products', 'wpshop' ), 'manage_options', 'wps-product', array( $this, 'callback_add_menu_page' ) ); |
|
42 | - add_submenu_page( 'wps-order', __( 'Products Category', 'wpshop' ), __( 'Products Category', 'wpshop' ), 'manage_options', 'edit-tags.php?taxonomy=wps-product-cat' ); |
|
41 | + add_submenu_page('wps-order', __('Products', 'wpshop'), __('Products', 'wpshop'), 'manage_options', 'wps-product', array($this, 'callback_add_menu_page')); |
|
42 | + add_submenu_page('wps-order', __('Products Category', 'wpshop'), __('Products Category', 'wpshop'), 'manage_options', 'edit-tags.php?taxonomy=wps-product-cat'); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | 'posts_per_page' => -1, |
54 | 54 | ); |
55 | 55 | |
56 | - $count = count( get_posts( $args ) ); |
|
56 | + $count = count(get_posts($args)); |
|
57 | 57 | |
58 | - \eoxia\View_Util::exec( 'wpshop', 'products', 'main', array( |
|
58 | + \eoxia\View_Util::exec('wpshop', 'products', 'main', array( |
|
59 | 59 | 'count' => $count, |
60 | - ) ); |
|
60 | + )); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 |
@@ -14,25 +14,25 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | <div class="wps-list-product wpeo-table table-flex table-7"> |
20 | 20 | <div class="table-row table-header"> |
21 | 21 | <div class="table-cell table-25"><input type="checkbox" class="check-all"/></div> |
22 | - <div class="table-cell table-150"><?php esc_html_e( 'Thumbnail', 'wpshop' ); ?></div> |
|
23 | - <div class="table-cell table-full"><?php esc_html_e( 'Title', 'wpshop' ); ?></div> |
|
24 | - <div class="table-cell table-100"><?php esc_html_e( 'Price HT(€)', 'wpshop' ); ?></div> |
|
25 | - <div class="table-cell table-100"><?php esc_html_e( 'Tax Rate', 'wpshop' ); ?>%</div> |
|
26 | - <div class="table-cell table-100"><?php esc_html_e( 'Price TTC(€)', 'wpshop' ); ?></div> |
|
27 | - <div class="table-cell table-100"><?php esc_html_e( 'Synchro', 'wpshop' ); ?></div> |
|
22 | + <div class="table-cell table-150"><?php esc_html_e('Thumbnail', 'wpshop'); ?></div> |
|
23 | + <div class="table-cell table-full"><?php esc_html_e('Title', 'wpshop'); ?></div> |
|
24 | + <div class="table-cell table-100"><?php esc_html_e('Price HT(€)', 'wpshop'); ?></div> |
|
25 | + <div class="table-cell table-100"><?php esc_html_e('Tax Rate', 'wpshop'); ?>%</div> |
|
26 | + <div class="table-cell table-100"><?php esc_html_e('Price TTC(€)', 'wpshop'); ?></div> |
|
27 | + <div class="table-cell table-100"><?php esc_html_e('Synchro', 'wpshop'); ?></div> |
|
28 | 28 | </div> |
29 | 29 | |
30 | 30 | <?php |
31 | - if ( ! empty( $products ) ) : |
|
32 | - foreach ( $products as $product ) : |
|
33 | - \eoxia\View_Util::exec( 'wpshop', 'products', 'item', array( |
|
31 | + if (!empty($products)) : |
|
32 | + foreach ($products as $product) : |
|
33 | + \eoxia\View_Util::exec('wpshop', 'products', 'item', array( |
|
34 | 34 | 'product' => $product, |
35 | - ) ); |
|
35 | + )); |
|
36 | 36 | endforeach; |
37 | 37 | endif; |
38 | 38 | ?> |
@@ -14,27 +14,27 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | <div class="wrap"> |
20 | - <h2><?php esc_html_e( 'Products', 'wpshop' ); ?></h2> |
|
20 | + <h2><?php esc_html_e('Products', 'wpshop'); ?></h2> |
|
21 | 21 | |
22 | - <!--<a href="<?php echo esc_attr( admin_url( 'post-new.php?post_type=wps-product' ) ); ?>" class="wpeo-button button-main"><?php esc_html_e( 'Add', 'wpshop' ); ?></a>--> |
|
22 | + <!--<a href="<?php echo esc_attr(admin_url('post-new.php?post_type=wps-product')); ?>" class="wpeo-button button-main"><?php esc_html_e('Add', 'wpshop'); ?></a>--> |
|
23 | 23 | |
24 | 24 | <div class="wps-filter-bar wpeo-form form-light"> |
25 | 25 | <div class="form-element"> |
26 | 26 | <label class="form-field-container"> |
27 | 27 | <span class="form-field-icon-prev"><i class="fas fa-filter"></i></span> |
28 | 28 | <select id="monselect" class="form-field"> |
29 | - <option value="valeur1" selected><?php esc_html_e( 'Date', 'wpshop' ); ?></option> |
|
30 | - <option value="valeur2"><?php esc_html_e( 'Title', 'wpshop' ); ?></option> |
|
31 | - <option value="valeur3"><?php esc_html_e( 'Price HT(€)', 'wpshop' ); ?></option> |
|
32 | - <option value="valeur4"><?php esc_html_e( 'Desynchronized products', 'wpshop' ); ?></option> |
|
29 | + <option value="valeur1" selected><?php esc_html_e('Date', 'wpshop'); ?></option> |
|
30 | + <option value="valeur2"><?php esc_html_e('Title', 'wpshop'); ?></option> |
|
31 | + <option value="valeur3"><?php esc_html_e('Price HT(€)', 'wpshop'); ?></option> |
|
32 | + <option value="valeur4"><?php esc_html_e('Desynchronized products', 'wpshop'); ?></option> |
|
33 | 33 | </select> |
34 | 34 | </label> |
35 | 35 | </div> |
36 | 36 | |
37 | - <a href="#" class="wpeo-button button-filter"><?php esc_html_e( 'Filter', 'wpshop' ); ?></a> |
|
37 | + <a href="#" class="wpeo-button button-filter"><?php esc_html_e('Filter', 'wpshop'); ?></a> |
|
38 | 38 | |
39 | 39 | <div class="form-element"> |
40 | 40 | <label class="form-field-container"> |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | </label> |
44 | 44 | </div> |
45 | 45 | |
46 | - <a href="#" class="wpeo-button button-filter"><?php esc_html_e( 'Search', 'wpshop' ); ?></a> |
|
46 | + <a href="#" class="wpeo-button button-filter"><?php esc_html_e('Search', 'wpshop'); ?></a> |
|
47 | 47 | |
48 | 48 | <div></div> |
49 | 49 | <div></div> |
@@ -14,34 +14,34 @@ |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | 19 | <div class="table-row"> |
20 | 20 | <div class="table-cell table-25"><input type="checkbox" class="check"/></div> |
21 | - <div class="table-cell table-100 table-padding-0"><?php echo get_the_post_thumbnail( $product->data['id'], array( 80, 80 ) ); ?></div> |
|
21 | + <div class="table-cell table-100 table-padding-0"><?php echo get_the_post_thumbnail($product->data['id'], array(80, 80)); ?></div> |
|
22 | 22 | <div class="table-cell table-full"> |
23 | 23 | <ul class="reference-id"> |
24 | - <li><i class="fas fa-hashtag"></i>WP : <?php echo esc_html( $product->data['id'] ); ?></li> |
|
25 | - <?php if ( ! empty( $product->data['external_id'] ) ) : ?> |
|
26 | - <li><i class="fas fa-hashtag"></i>Doli : <?php echo esc_html( $product->data['external_id'] ); ?></li> |
|
24 | + <li><i class="fas fa-hashtag"></i>WP : <?php echo esc_html($product->data['id']); ?></li> |
|
25 | + <?php if (!empty($product->data['external_id'])) : ?> |
|
26 | + <li><i class="fas fa-hashtag"></i>Doli : <?php echo esc_html($product->data['external_id']); ?></li> |
|
27 | 27 | <?php endif; ?> |
28 | 28 | </ul> |
29 | 29 | <div class="reference-title"> |
30 | - <a href="<?php echo esc_attr( admin_url( 'post.php?post=' . $product->data['id'] . '&action=edit' ) ); ?>"><?php echo esc_html( $product->data['title'] ); ?></a> |
|
30 | + <a href="<?php echo esc_attr(admin_url('post.php?post=' . $product->data['id'] . '&action=edit')); ?>"><?php echo esc_html($product->data['title']); ?></a> |
|
31 | 31 | </div> |
32 | 32 | <ul class="reference-actions"> |
33 | - <li><a href="<?php echo esc_attr( admin_url( 'post.php?post=' . $product->data['id'] . '&action=edit' ) ); ?>"><?php esc_html_e( 'Edit', 'wpshop' ); ?></a></li> |
|
34 | - <!-- <li><a href="#"><?php esc_html_e( 'Quick edit', 'wpshop' ); ?></a></li> --> |
|
35 | - <?php if ( ! empty( $product->data['external_id'] ) ) : ?> |
|
36 | - <li><a href="<?php echo esc_attr( $doli_url ); ?>product/card.php?id=<?php echo $product->data['external_id']; ?>" target="_blank"><?php esc_html_e( 'Edit in Dolibarr', 'wpshop' ); ?></a></li> |
|
33 | + <li><a href="<?php echo esc_attr(admin_url('post.php?post=' . $product->data['id'] . '&action=edit')); ?>"><?php esc_html_e('Edit', 'wpshop'); ?></a></li> |
|
34 | + <!-- <li><a href="#"><?php esc_html_e('Quick edit', 'wpshop'); ?></a></li> --> |
|
35 | + <?php if (!empty($product->data['external_id'])) : ?> |
|
36 | + <li><a href="<?php echo esc_attr($doli_url); ?>product/card.php?id=<?php echo $product->data['external_id']; ?>" target="_blank"><?php esc_html_e('Edit in Dolibarr', 'wpshop'); ?></a></li> |
|
37 | 37 | <?php endif; ?> |
38 | - <!-- <li class="delete"><a href="#"><?php esc_html_e( 'Delete', 'wpshop' ); ?></a></li> --> |
|
39 | - <li><a href="<?php echo esc_attr( get_post_permalink( $product->data['id'] ) ); ?>"><?php esc_html_e( 'Preview', 'wpshop' ); ?></a></li> |
|
38 | + <!-- <li class="delete"><a href="#"><?php esc_html_e('Delete', 'wpshop'); ?></a></li> --> |
|
39 | + <li><a href="<?php echo esc_attr(get_post_permalink($product->data['id'])); ?>"><?php esc_html_e('Preview', 'wpshop'); ?></a></li> |
|
40 | 40 | </ul> |
41 | 41 | </div> |
42 | - <div class="table-cell table-100"><?php echo esc_html( number_format( $product->data['price'], 2, ',', '' ) ); ?>€</div> |
|
43 | - <div class="table-cell table-100"><?php echo esc_html( number_format( $product->data['tva_tx'], 2, ',', '' ) ); ?>%</div> |
|
44 | - <div class="table-cell table-100"><strong><?php echo esc_html( number_format( $product->data['price_ttc'], 2, ',', '' ) ); ?>€</strong></div> |
|
42 | + <div class="table-cell table-100"><?php echo esc_html(number_format($product->data['price'], 2, ',', '')); ?>€</div> |
|
43 | + <div class="table-cell table-100"><?php echo esc_html(number_format($product->data['tva_tx'], 2, ',', '')); ?>%</div> |
|
44 | + <div class="table-cell table-100"><strong><?php echo esc_html(number_format($product->data['price_ttc'], 2, ',', '')); ?>€</strong></div> |
|
45 | 45 | <div class="table-cell table-100"> |
46 | 46 | <!-- <div class="button-synchro"><i class="fas fa-sync"></i></div> |
47 | 47 | <div class="statut statut-green wpeo-tooltip-event" data-direction="left" aria-label="Date de la derniere synchro"></div> --> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; |
|
17 | +defined('ABSPATH') || exit; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Settings Action Class. |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | * @since 2.0.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'admin_menu', array( $this, 'callback_admin_menu' ) ); |
|
31 | - add_action( 'admin_post_wps_load_settings_tab', array( $this, 'callback_load_tab' ) ); |
|
30 | + add_action('admin_menu', array($this, 'callback_admin_menu')); |
|
31 | + add_action('admin_post_wps_load_settings_tab', array($this, 'callback_load_tab')); |
|
32 | 32 | |
33 | - add_action( 'admin_post_wps_update_general_settings', array( $this, 'callback_update_general_settings' ) ); |
|
34 | - add_action( 'admin_post_wps_update_pages_settings', array( $this, 'callback_update_pages_settings' ) ); |
|
35 | - add_action( 'admin_post_wps_update_email', array( $this, 'callback_update_email' ) ); |
|
36 | - add_action( 'admin_post_wps_update_shipping_cost', array( $this, 'callback_update_shipping_cost' ) ); |
|
33 | + add_action('admin_post_wps_update_general_settings', array($this, 'callback_update_general_settings')); |
|
34 | + add_action('admin_post_wps_update_pages_settings', array($this, 'callback_update_pages_settings')); |
|
35 | + add_action('admin_post_wps_update_email', array($this, 'callback_update_email')); |
|
36 | + add_action('admin_post_wps_update_shipping_cost', array($this, 'callback_update_shipping_cost')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @since 2.0.0 |
43 | 43 | */ |
44 | 44 | public function callback_admin_menu() { |
45 | - add_submenu_page( 'wps-order', __( 'Settings', 'wpshop' ), __( 'Settings', 'wpshop' ), 'manage_options', 'wps-settings', array( $this, 'callback_add_menu_page' ) ); |
|
45 | + add_submenu_page('wps-order', __('Settings', 'wpshop'), __('Settings', 'wpshop'), 'manage_options', 'wps-settings', array($this, 'callback_add_menu_page')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -51,17 +51,17 @@ discard block |
||
51 | 51 | * @since 2.0.0 |
52 | 52 | */ |
53 | 53 | public function callback_add_menu_page() { |
54 | - $tab = ! empty( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'general'; |
|
55 | - $section = ! empty( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : ''; |
|
54 | + $tab = !empty($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'general'; |
|
55 | + $section = !empty($_GET['section']) ? sanitize_text_field($_GET['section']) : ''; |
|
56 | 56 | |
57 | - $transient = get_transient( 'updated_wpshop_option_' . get_current_user_id() ); |
|
58 | - delete_transient( 'updated_wpshop_option_' . get_current_user_id() ); |
|
57 | + $transient = get_transient('updated_wpshop_option_' . get_current_user_id()); |
|
58 | + delete_transient('updated_wpshop_option_' . get_current_user_id()); |
|
59 | 59 | |
60 | - \eoxia\View_Util::exec( 'wpshop', 'settings', 'main', array( |
|
60 | + \eoxia\View_Util::exec('wpshop', 'settings', 'main', array( |
|
61 | 61 | 'tab' => $tab, |
62 | 62 | 'section' => $section, |
63 | 63 | 'transient' => $transient, |
64 | - ) ); |
|
64 | + )); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | * @since 2.0.0 |
71 | 71 | */ |
72 | 72 | public function callback_load_tab() { |
73 | - check_admin_referer( 'callback_load_tab' ); |
|
73 | + check_admin_referer('callback_load_tab'); |
|
74 | 74 | |
75 | - $tab = ! empty( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'general'; |
|
76 | - $section = ! empty( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : ''; |
|
75 | + $tab = !empty($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'general'; |
|
76 | + $section = !empty($_GET['section']) ? sanitize_text_field($_GET['section']) : ''; |
|
77 | 77 | |
78 | 78 | $url = 'admin.php?page=wps-settings&tab= ' . $tab; |
79 | 79 | |
80 | - if ( ! empty( $section ) ) { |
|
80 | + if (!empty($section)) { |
|
81 | 81 | $url .= '§ion=' . $section; |
82 | 82 | } |
83 | 83 | |
84 | - wp_redirect( admin_url( $url ) ); |
|
84 | + wp_redirect(admin_url($url)); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -90,28 +90,28 @@ discard block |
||
90 | 90 | * @since 2.0.0 |
91 | 91 | */ |
92 | 92 | public function callback_update_general_settings() { |
93 | - check_admin_referer( 'callback_update_general_settings' ); |
|
93 | + check_admin_referer('callback_update_general_settings'); |
|
94 | 94 | |
95 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
95 | + if (!current_user_can('manage_options')) { |
|
96 | 96 | wp_die(); |
97 | 97 | } |
98 | 98 | |
99 | - $tab = ! empty( $_POST['tab'] ) ? sanitize_text_field( $_POST['tab'] ) : 'general'; |
|
100 | - $dolibarr_url = ! empty( $_POST['dolibarr_url'] ) ? sanitize_text_field( $_POST['dolibarr_url'] ) : ''; |
|
101 | - $dolibarr_secret = ! empty( $_POST['dolibarr_secret'] ) ? sanitize_text_field( $_POST['dolibarr_secret'] ) : ''; |
|
102 | - $shop_email = ! empty( $_POST['shop_email'] ) ? sanitize_text_field( $_POST['shop_email'] ) : ''; |
|
99 | + $tab = !empty($_POST['tab']) ? sanitize_text_field($_POST['tab']) : 'general'; |
|
100 | + $dolibarr_url = !empty($_POST['dolibarr_url']) ? sanitize_text_field($_POST['dolibarr_url']) : ''; |
|
101 | + $dolibarr_secret = !empty($_POST['dolibarr_secret']) ? sanitize_text_field($_POST['dolibarr_secret']) : ''; |
|
102 | + $shop_email = !empty($_POST['shop_email']) ? sanitize_text_field($_POST['shop_email']) : ''; |
|
103 | 103 | |
104 | - $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); |
|
104 | + $dolibarr_option = get_option('wps_dolibarr', Settings::g()->default_settings); |
|
105 | 105 | |
106 | 106 | $dolibarr_option['dolibarr_url'] = $dolibarr_url; |
107 | 107 | $dolibarr_option['dolibarr_secret'] = $dolibarr_secret; |
108 | 108 | $dolibarr_option['shop_email'] = $shop_email; |
109 | 109 | |
110 | - update_option( 'wps_dolibarr', $dolibarr_option ); |
|
110 | + update_option('wps_dolibarr', $dolibarr_option); |
|
111 | 111 | |
112 | - set_transient( 'updated_wpshop_option_' . get_current_user_id(), __( 'Your settings have been saved.', 'wpshop' ), 30 ); |
|
112 | + set_transient('updated_wpshop_option_' . get_current_user_id(), __('Your settings have been saved.', 'wpshop'), 30); |
|
113 | 113 | |
114 | - wp_redirect( admin_url( 'admin.php?page=wps-settings&tab= ' . $tab ) ); |
|
114 | + wp_redirect(admin_url('admin.php?page=wps-settings&tab= ' . $tab)); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,21 +120,21 @@ discard block |
||
120 | 120 | * @since 2.0.0 |
121 | 121 | */ |
122 | 122 | public function callback_update_pages_settings() { |
123 | - check_admin_referer( 'callback_update_pages_settings' ); |
|
123 | + check_admin_referer('callback_update_pages_settings'); |
|
124 | 124 | |
125 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
125 | + if (!current_user_can('manage_options')) { |
|
126 | 126 | wp_die(); |
127 | 127 | } |
128 | 128 | |
129 | - $tab = ! empty( $_POST['tab'] ) ? sanitize_text_field( $_POST['tab'] ) : 'general'; |
|
130 | - $wps_page_shop_id = ! empty( $_POST['wps_page_shop_id'] ) ? (int) $_POST['wps_page_shop_id'] : 0; |
|
131 | - $wps_page_cart_id = ! empty( $_POST['wps_page_cart_id'] ) ? (int) $_POST['wps_page_cart_id'] : 0; |
|
132 | - $wps_page_checkout_id = ! empty( $_POST['wps_page_checkout_id'] ) ? (int) $_POST['wps_page_checkout_id'] : 0; |
|
133 | - $wps_page_my_account_id = ! empty( $_POST['wps_page_my_account_id'] ) ? (int) $_POST['wps_page_my_account_id'] : 0; |
|
134 | - $wps_page_valid_checkout_id = ! empty( $_POST['wps_page_valid_checkout_id'] ) ? (int) $_POST['wps_page_valid_checkout_id'] : 0; |
|
135 | - $wps_page_valid_proposal_id = ! empty( $_POST['wps_page_valid_proposal_id'] ) ? (int) $_POST['wps_page_valid_proposal_id'] : 0; |
|
129 | + $tab = !empty($_POST['tab']) ? sanitize_text_field($_POST['tab']) : 'general'; |
|
130 | + $wps_page_shop_id = !empty($_POST['wps_page_shop_id']) ? (int)$_POST['wps_page_shop_id'] : 0; |
|
131 | + $wps_page_cart_id = !empty($_POST['wps_page_cart_id']) ? (int)$_POST['wps_page_cart_id'] : 0; |
|
132 | + $wps_page_checkout_id = !empty($_POST['wps_page_checkout_id']) ? (int)$_POST['wps_page_checkout_id'] : 0; |
|
133 | + $wps_page_my_account_id = !empty($_POST['wps_page_my_account_id']) ? (int)$_POST['wps_page_my_account_id'] : 0; |
|
134 | + $wps_page_valid_checkout_id = !empty($_POST['wps_page_valid_checkout_id']) ? (int)$_POST['wps_page_valid_checkout_id'] : 0; |
|
135 | + $wps_page_valid_proposal_id = !empty($_POST['wps_page_valid_proposal_id']) ? (int)$_POST['wps_page_valid_proposal_id'] : 0; |
|
136 | 136 | |
137 | - $page_ids_options = get_option( 'wps_page_ids', Pages::g()->default_options ); |
|
137 | + $page_ids_options = get_option('wps_page_ids', Pages::g()->default_options); |
|
138 | 138 | |
139 | 139 | $page_ids_options['shop_id'] = $wps_page_shop_id; |
140 | 140 | $page_ids_options['cart_id'] = $wps_page_cart_id; |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | $page_ids_options['valid_checkout_id'] = $wps_page_valid_checkout_id; |
144 | 144 | $page_ids_options['valid_proposal_id'] = $wps_page_valid_proposal_id; |
145 | 145 | |
146 | - update_option( 'wps_page_ids', $page_ids_options ); |
|
146 | + update_option('wps_page_ids', $page_ids_options); |
|
147 | 147 | |
148 | - set_transient( 'updated_wpshop_option_' . get_current_user_id(), __( 'Your settings have been saved.', 'wpshop' ), 30 ); |
|
148 | + set_transient('updated_wpshop_option_' . get_current_user_id(), __('Your settings have been saved.', 'wpshop'), 30); |
|
149 | 149 | |
150 | - wp_redirect( admin_url( 'admin.php?page=wps-settings&tab= ' . $tab ) ); |
|
150 | + wp_redirect(admin_url('admin.php?page=wps-settings&tab= ' . $tab)); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -156,26 +156,26 @@ discard block |
||
156 | 156 | * @since 2.0.0 |
157 | 157 | */ |
158 | 158 | public function callback_update_shipping_cost() { |
159 | - check_admin_referer( 'callback_update_shipping_cost' ); |
|
159 | + check_admin_referer('callback_update_shipping_cost'); |
|
160 | 160 | |
161 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
161 | + if (!current_user_can('manage_options')) { |
|
162 | 162 | wp_die(); |
163 | 163 | } |
164 | 164 | |
165 | - $tab = ! empty( $_POST['tab'] ) ? sanitize_text_field( $_POST['tab'] ) : 'general'; |
|
166 | - $from_price_ht = ! empty( $_POST['from_price_ht'] ) ? sanitize_text_field( $_POST['from_price_ht'] ) : ''; |
|
167 | - $shipping_product_id = ! empty( $_POST['shipping_product_id'] ) ? (int) $_POST['shipping_product_id'] : 0; |
|
165 | + $tab = !empty($_POST['tab']) ? sanitize_text_field($_POST['tab']) : 'general'; |
|
166 | + $from_price_ht = !empty($_POST['from_price_ht']) ? sanitize_text_field($_POST['from_price_ht']) : ''; |
|
167 | + $shipping_product_id = !empty($_POST['shipping_product_id']) ? (int)$_POST['shipping_product_id'] : 0; |
|
168 | 168 | |
169 | - $shipping_cost_option = get_option( 'wps_shipping_cost', Settings::g()->shipping_cost_default_settings ); |
|
169 | + $shipping_cost_option = get_option('wps_shipping_cost', Settings::g()->shipping_cost_default_settings); |
|
170 | 170 | |
171 | - $shipping_cost_option['from_price_ht'] = str_replace( ',', '.', $from_price_ht ); |
|
171 | + $shipping_cost_option['from_price_ht'] = str_replace(',', '.', $from_price_ht); |
|
172 | 172 | $shipping_cost_option['shipping_product_id'] = $shipping_product_id; |
173 | 173 | |
174 | - update_option( 'wps_shipping_cost', $shipping_cost_option ); |
|
174 | + update_option('wps_shipping_cost', $shipping_cost_option); |
|
175 | 175 | |
176 | - set_transient( 'updated_wpshop_option_' . get_current_user_id(), __( 'Your settings have been saved.', 'wpshop' ), 30 ); |
|
176 | + set_transient('updated_wpshop_option_' . get_current_user_id(), __('Your settings have been saved.', 'wpshop'), 30); |
|
177 | 177 | |
178 | - wp_redirect( admin_url( 'admin.php?page=wps-settings&tab= ' . $tab ) ); |
|
178 | + wp_redirect(admin_url('admin.php?page=wps-settings&tab= ' . $tab)); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 |
@@ -14,27 +14,27 @@ discard block |
||
14 | 14 | |
15 | 15 | namespace wpshop; |
16 | 16 | |
17 | -defined( 'ABSPATH' ) || exit; ?> |
|
17 | +defined('ABSPATH') || exit; ?> |
|
18 | 18 | |
19 | -<form class="wpeo-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST"> |
|
20 | - <input type="hidden" name="action" value="<?php echo esc_attr( 'wps_update_pages_settings' ); ?>" /> |
|
19 | +<form class="wpeo-form" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="POST"> |
|
20 | + <input type="hidden" name="action" value="<?php echo esc_attr('wps_update_pages_settings'); ?>" /> |
|
21 | 21 | <input type="hidden" name="tab" value="pages" /> |
22 | - <?php wp_nonce_field( 'callback_update_pages_settings' ); ?> |
|
22 | + <?php wp_nonce_field('callback_update_pages_settings'); ?> |
|
23 | 23 | |
24 | 24 | <div class="form-element"> |
25 | 25 | <span class="form-label">Page boutique</span> |
26 | 26 | <label class="form-field-container"> |
27 | 27 | <select id="" class="form-field" name="wps_page_shop_id"> |
28 | 28 | <?php |
29 | - if ( ! empty( $pages ) ) : |
|
30 | - foreach ( $pages as $page ) : |
|
29 | + if (!empty($pages)) : |
|
30 | + foreach ($pages as $page) : |
|
31 | 31 | $selected = ''; |
32 | 32 | |
33 | - if ( $page->ID == $page_ids_options['shop_id'] ) : |
|
33 | + if ($page->ID == $page_ids_options['shop_id']) : |
|
34 | 34 | $selected = 'selected="selected"'; |
35 | 35 | endif; |
36 | 36 | ?> |
37 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
37 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
38 | 38 | <?php |
39 | 39 | endforeach; |
40 | 40 | endif; |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | <label class="form-field-container"> |
49 | 49 | <select id="" class="form-field" name="wps_page_cart_id"> |
50 | 50 | <?php |
51 | - if ( ! empty( $pages ) ) : |
|
52 | - foreach ( $pages as $page ) : |
|
51 | + if (!empty($pages)) : |
|
52 | + foreach ($pages as $page) : |
|
53 | 53 | $selected = ''; |
54 | 54 | |
55 | - if ( $page->ID == $page_ids_options['cart_id'] ) : |
|
55 | + if ($page->ID == $page_ids_options['cart_id']) : |
|
56 | 56 | $selected = 'selected="selected"'; |
57 | 57 | endif; |
58 | 58 | ?> |
59 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
59 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
60 | 60 | <?php |
61 | 61 | endforeach; |
62 | 62 | endif; |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | <label class="form-field-container"> |
71 | 71 | <select id="" class="form-field" name="wps_page_checkout_id"> |
72 | 72 | <?php |
73 | - if ( ! empty( $pages ) ) : |
|
74 | - foreach ( $pages as $page ) : |
|
73 | + if (!empty($pages)) : |
|
74 | + foreach ($pages as $page) : |
|
75 | 75 | $selected = ''; |
76 | 76 | |
77 | - if ( $page->ID == $page_ids_options['checkout_id'] ) : |
|
77 | + if ($page->ID == $page_ids_options['checkout_id']) : |
|
78 | 78 | $selected = 'selected="selected"'; |
79 | 79 | endif; |
80 | 80 | ?> |
81 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
81 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
82 | 82 | <?php |
83 | 83 | endforeach; |
84 | 84 | endif; |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | <label class="form-field-container"> |
93 | 93 | <select id="" class="form-field" name="wps_page_my_account_id"> |
94 | 94 | <?php |
95 | - if ( ! empty( $pages ) ) : |
|
96 | - foreach ( $pages as $page ) : |
|
95 | + if (!empty($pages)) : |
|
96 | + foreach ($pages as $page) : |
|
97 | 97 | $selected = ''; |
98 | 98 | |
99 | - if ( $page->ID == $page_ids_options['my_account_id'] ) : |
|
99 | + if ($page->ID == $page_ids_options['my_account_id']) : |
|
100 | 100 | $selected = 'selected="selected"'; |
101 | 101 | endif; |
102 | 102 | ?> |
103 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
103 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
104 | 104 | <?php |
105 | 105 | endforeach; |
106 | 106 | endif; |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | <label class="form-field-container"> |
115 | 115 | <select id="" class="form-field" name="wps_page_valid_checkout_id"> |
116 | 116 | <?php |
117 | - if ( ! empty( $pages ) ) : |
|
118 | - foreach ( $pages as $page ) : |
|
117 | + if (!empty($pages)) : |
|
118 | + foreach ($pages as $page) : |
|
119 | 119 | $selected = ''; |
120 | 120 | |
121 | - if ( $page->ID == $page_ids_options['valid_checkout_id'] ) : |
|
121 | + if ($page->ID == $page_ids_options['valid_checkout_id']) : |
|
122 | 122 | $selected = 'selected="selected"'; |
123 | 123 | endif; |
124 | 124 | ?> |
125 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
125 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
126 | 126 | <?php |
127 | 127 | endforeach; |
128 | 128 | endif; |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | <label class="form-field-container"> |
137 | 137 | <select id="" class="form-field" name="wps_page_valid_proposal_id"> |
138 | 138 | <?php |
139 | - if ( ! empty( $pages ) ) : |
|
140 | - foreach ( $pages as $page ) : |
|
139 | + if (!empty($pages)) : |
|
140 | + foreach ($pages as $page) : |
|
141 | 141 | $selected = ''; |
142 | 142 | |
143 | - if ( $page->ID == $page_ids_options['valid_proposal_id'] ) : |
|
143 | + if ($page->ID == $page_ids_options['valid_proposal_id']) : |
|
144 | 144 | $selected = 'selected="selected"'; |
145 | 145 | endif; |
146 | 146 | ?> |
147 | - <option <?php echo $selected; ?> value="<?php echo esc_attr( $page->ID ); ?>"><?php echo esc_html( $page->post_title ); ?></option> |
|
147 | + <option <?php echo $selected; ?> value="<?php echo esc_attr($page->ID); ?>"><?php echo esc_html($page->post_title); ?></option> |
|
148 | 148 | <?php |
149 | 149 | endforeach; |
150 | 150 | endif; |