@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin database options |
4 | 4 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin database options |
4 | 4 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin database options |
4 | 4 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -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 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,20 +1,20 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-gridwrapper2-padded"> |
4 | 4 | <div> |
5 | 5 | <div class="wps-form-group"> |
6 | - <label><?php _e( 'Write your notification and send it to your customer', 'wpshop'); ?> :</label> |
|
6 | + <label><?php _e('Write your notification and send it to your customer', 'wpshop'); ?> :</label> |
|
7 | 7 | <div class="wps-form"><textarea name="order_private_comment"></textarea></div> |
8 | 8 | </div> |
9 | - <div class="wps-form-group"><input type="checkbox" name="send_email" id="wps_send_email" /> <label for="wps_send_email"><?php _e('Send an email to customer','wpshop'); ?></label><br/> |
|
10 | - <input type="checkbox" name="copy_to_administrator" id="copy_to_administrator" /> <label for="copy_to_administrator"><?php _e('Send a copy to administrator','wpshop'); ?></label></div> |
|
11 | - <div class="wps-form-group"><a data-nonce="<?php echo wp_create_nonce( 'wpshop_add_private_comment_to_order' ); ?>" href="#" class="wps-bton-first-mini-rounded addPrivateComment order_<?php echo $post->ID; ?>"><?php _e('Add the comment','wpshop'); ?></a></div> |
|
9 | + <div class="wps-form-group"><input type="checkbox" name="send_email" id="wps_send_email" /> <label for="wps_send_email"><?php _e('Send an email to customer', 'wpshop'); ?></label><br/> |
|
10 | + <input type="checkbox" name="copy_to_administrator" id="copy_to_administrator" /> <label for="copy_to_administrator"><?php _e('Send a copy to administrator', 'wpshop'); ?></label></div> |
|
11 | + <div class="wps-form-group"><a data-nonce="<?php echo wp_create_nonce('wpshop_add_private_comment_to_order'); ?>" href="#" class="wps-bton-first-mini-rounded addPrivateComment order_<?php echo $post->ID; ?>"><?php _e('Add the comment', 'wpshop'); ?></a></div> |
|
12 | 12 | </div> |
13 | 13 | |
14 | 14 | <div id="wps_private_messages_container"> |
15 | - <?php if( !empty($post) && !empty($post->ID) ) : |
|
15 | + <?php if (!empty($post) && !empty($post->ID)) : |
|
16 | 16 | $oid = $post->ID; |
17 | - require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_sended_private_comments") ); |
|
17 | + require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "order-private-comments/wps_orders_sended_private_comments")); |
|
18 | 18 | endif; ?> |
19 | 19 | </div> |
20 | 20 | </div> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,12 +1,12 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-boxed"> |
4 | -<span class="wps-h5"><span class="dashicons dashicons-search"></span> <?php _e( 'Search products by letter', 'wpshop' ); ?></span> |
|
5 | -<?php foreach( $letters as $letter ) : ?> |
|
6 | -<a href="#" data-nonce="<?php echo wp_create_nonce( 'refresh_product_list' ); ?>" class="wps-bton-second-mini-rounded <?php echo ( strtoupper( $current_letter ) == strtoupper( $letter ) ) ? 'third' : ''; ?> search_product_by_letter" id="<?php echo $letter; ?>"><?php echo ( $letter != 'ALL' ) ? $letter : __('ALL', 'wpshop' ); ?></a> |
|
7 | -<?php endforeach; echo apply_filters( 'wps-filter-free-product-bton-tpl', $post->ID ); ?> |
|
4 | +<span class="wps-h5"><span class="dashicons dashicons-search"></span> <?php _e('Search products by letter', 'wpshop'); ?></span> |
|
5 | +<?php foreach ($letters as $letter) : ?> |
|
6 | +<a href="#" data-nonce="<?php echo wp_create_nonce('refresh_product_list'); ?>" class="wps-bton-second-mini-rounded <?php echo (strtoupper($current_letter) == strtoupper($letter)) ? 'third' : ''; ?> search_product_by_letter" id="<?php echo $letter; ?>"><?php echo ($letter != 'ALL') ? $letter : __('ALL', 'wpshop'); ?></a> |
|
7 | +<?php endforeach; echo apply_filters('wps-filter-free-product-bton-tpl', $post->ID); ?> |
|
8 | 8 | </div> |
9 | 9 | |
10 | 10 | <div id="wps_orders_product_listing_table"> |
11 | -<?php require( wpshop_tools::get_template_part( WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing_table") ); ?> |
|
11 | +<?php require(wpshop_tools::get_template_part(WPS_ORDERS_DIR, $this->template_dir, "backend", "product-listing/wps_orders_product_listing_table")); ?> |
|
12 | 12 | </div> |
@@ -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 de gestion du modèle des taxinomies / File for term model management |
4 | 6 | * |
@@ -113,8 +115,7 @@ discard block |
||
113 | 115 | } |
114 | 116 | |
115 | 117 | return $object; |
116 | - } |
|
117 | - else { |
|
118 | + } else { |
|
118 | 119 | /** |
119 | 120 | * @todo return error when creation does not work |
120 | 121 | */ |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wps_export_ctr { |
3 | 3 | |
4 | 4 | /** Define the main directory containing the template for the current plugin |
@@ -13,30 +13,30 @@ discard block |
||
13 | 13 | |
14 | 14 | function __construct() { |
15 | 15 | $this->template_dir = WPS_EXPORT_PATH . WPS_EXPORT_DIR . "/templates/"; |
16 | - add_action( 'admin_init', array( $this, 'wps_export_admin_int_actions' ) ); |
|
17 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts' ) ); |
|
16 | + add_action('admin_init', array($this, 'wps_export_admin_int_actions')); |
|
17 | + add_action('admin_enqueue_scripts', array($this, 'add_scripts')); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | function wps_export_admin_int_actions() { |
21 | 21 | $current_user_def = wp_get_current_user(); |
22 | - $download_users = !empty( $_GET['download_users'] ) ? sanitize_text_field( $_GET['download_users'] ) : ''; |
|
23 | - $download_orders = !empty( $_GET['download_orders'] ) ? sanitize_text_field( $_GET['download_orders'] ) : ''; |
|
24 | - if( !empty($current_user_def) && $current_user_def->ID != 0 && array_key_exists('administrator', $current_user_def->caps) && is_admin() ) { |
|
25 | - if ( !empty( $download_users) ) { |
|
26 | - $this->list_customers( $download_users ); |
|
27 | - } elseif ( !empty( $download_orders ) ) { |
|
28 | - $this->list_orders( sanitize_text_field( $download_orders ) ); |
|
22 | + $download_users = !empty($_GET['download_users']) ? sanitize_text_field($_GET['download_users']) : ''; |
|
23 | + $download_orders = !empty($_GET['download_orders']) ? sanitize_text_field($_GET['download_orders']) : ''; |
|
24 | + if (!empty($current_user_def) && $current_user_def->ID != 0 && array_key_exists('administrator', $current_user_def->caps) && is_admin()) { |
|
25 | + if (!empty($download_users)) { |
|
26 | + $this->list_customers($download_users); |
|
27 | + } elseif (!empty($download_orders)) { |
|
28 | + $this->list_orders(sanitize_text_field($download_orders)); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | function add_scripts() { |
34 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
35 | - wp_enqueue_script( 'wps_export_script', WPS_EXPORT_URL . WPS_EXPORT_DIR . "/assets/backend/js/wps_export.js"); |
|
34 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
35 | + wp_enqueue_script('wps_export_script', WPS_EXPORT_URL . WPS_EXPORT_DIR . "/assets/backend/js/wps_export.js"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function wps_export_tpl() { |
39 | - require( wpshop_tools::get_template_part( WPS_EXPORT_DIR, $this->template_dir, "backend", "wps_export_tpl") ); |
|
39 | + require(wpshop_tools::get_template_part(WPS_EXPORT_DIR, $this->template_dir, "backend", "wps_export_tpl")); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | function list_customers($option) { |
47 | 47 | $wps_export_mdl = new wps_export_mdl(); |
48 | - if( !empty($option) ) { |
|
48 | + if (!empty($option)) { |
|
49 | 49 | switch ($option) { |
50 | 50 | case 'users_all': |
51 | 51 | $filetitle = "users_all"; |
@@ -64,21 +64,21 @@ discard block |
||
64 | 64 | $array = $wps_export_mdl->get_customers($option); |
65 | 65 | break; |
66 | 66 | case 'date': |
67 | - $bdte = !empty( $_GET['bdte'] ) ? sanitize_text_field( $_GET['bdte'] ) : ''; |
|
68 | - $edte = !empty( $_GET['edte'] ) ? sanitize_text_field( $_GET['edte'] ) : ''; |
|
69 | - if( !empty($bdte) && !empty($edte) ) { |
|
67 | + $bdte = !empty($_GET['bdte']) ? sanitize_text_field($_GET['bdte']) : ''; |
|
68 | + $edte = !empty($_GET['edte']) ? sanitize_text_field($_GET['edte']) : ''; |
|
69 | + if (!empty($bdte) && !empty($edte)) { |
|
70 | 70 | $filetitle = "users_registered_" . $bdte . "_to_" . $edte; |
71 | 71 | $array = $wps_export_mdl->get_customers($option, $bdte, $edte); |
72 | 72 | } |
73 | 73 | break; |
74 | 74 | case 'orders': |
75 | - $free_order = !empty( $_GET['free_order'] ) ? sanitize_text_field( $_GET['free_order'] ) : ''; |
|
76 | - if( !empty( $free_order ) && $free_order == 'yes' ) { |
|
75 | + $free_order = !empty($_GET['free_order']) ? sanitize_text_field($_GET['free_order']) : ''; |
|
76 | + if (!empty($free_order) && $free_order == 'yes') { |
|
77 | 77 | $filetitle = "users_order_with_free_orders"; |
78 | 78 | $array = $wps_export_mdl->get_customers($option, true, true); |
79 | 79 | } |
80 | - $minp = !empty( $_GET['minp'] ) ? sanitize_text_field( $_GET['minp'] ) : ''; |
|
81 | - if( !empty( $minp ) ) { |
|
80 | + $minp = !empty($_GET['minp']) ? sanitize_text_field($_GET['minp']) : ''; |
|
81 | + if (!empty($minp)) { |
|
82 | 82 | $filetitle = "users_order_higher_than_" . $minp; |
83 | 83 | $array = $wps_export_mdl->get_customers($option, $minp); |
84 | 84 | } |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | - if( empty($array) || !is_array($array) ) { |
|
89 | + if (empty($array) || !is_array($array)) { |
|
90 | 90 | $array = ''; |
91 | 91 | } |
92 | 92 | |
93 | - $this->download_csv( $filetitle, $array ); |
|
93 | + $this->download_csv($filetitle, $array); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | $wps_export_mdl = new wps_export_mdl(); |
102 | 102 | switch ($option) { |
103 | 103 | case 'date': |
104 | - $bdte = !empty( $_GET['bdte'] ) ? sanitize_text_field( $_GET['bdte'] ) : ''; |
|
105 | - $edte = !empty( $_GET['edte'] ) ? sanitize_text_field( $_GET['edte'] ) : ''; |
|
106 | - if( !empty($bdte) && !empty($edte) ) { |
|
104 | + $bdte = !empty($_GET['bdte']) ? sanitize_text_field($_GET['bdte']) : ''; |
|
105 | + $edte = !empty($_GET['edte']) ? sanitize_text_field($_GET['edte']) : ''; |
|
106 | + if (!empty($bdte) && !empty($edte)) { |
|
107 | 107 | $filetitle = "commands_registered_" . $bdte . "_to_" . $edte; |
108 | 108 | $array = $wps_export_mdl->get_orders($option, $bdte, $edte); |
109 | 109 | } |
110 | 110 | break; |
111 | 111 | } |
112 | 112 | |
113 | - if( empty($array) || !is_array($array) ) { |
|
113 | + if (empty($array) || !is_array($array)) { |
|
114 | 114 | $array = ''; |
115 | 115 | } |
116 | 116 | |
117 | - $this->download_csv( $filetitle, $array ); |
|
117 | + $this->download_csv($filetitle, $array); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -122,25 +122,25 @@ discard block |
||
122 | 122 | * @param string $filetitle |
123 | 123 | * @param array $array |
124 | 124 | */ |
125 | - function download_csv( $filetitle, $array ) { |
|
125 | + function download_csv($filetitle, $array) { |
|
126 | 126 | $filename = $filetitle . '.csv'; |
127 | - $fp = fopen( $filename, 'w' ); |
|
127 | + $fp = fopen($filename, 'w'); |
|
128 | 128 | |
129 | - if ( !empty( $array ) ) { |
|
129 | + if (!empty($array)) { |
|
130 | 130 | foreach ($array as $fields) { |
131 | 131 | fputcsv($fp, $fields); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | else { |
135 | - fputcsv($fp, array( __( 'No data selected', 'wpshop' ), )); |
|
135 | + fputcsv($fp, array(__('No data selected', 'wpshop'),)); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | fclose($fp); |
139 | 139 | header("Content-type: application/force-download"); |
140 | - header("Content-Disposition: attachment; filename=".$filename); |
|
140 | + header("Content-Disposition: attachment; filename=" . $filename); |
|
141 | 141 | readfile($filename); |
142 | 142 | |
143 | - unlink( $filename ); |
|
143 | + unlink($filename); |
|
144 | 144 | exit; |
145 | 145 | } |
146 | 146 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin database options |
4 | 4 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Plugin database options |
4 | 4 | * |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Fichier de définition du modèle des taxinomies / File for term model definition |
4 | 6 | * |