@@ -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,14 +1,14 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | -<form id="wps_product_quick_add_form" method="post" action="<?php echo admin_url( 'admin-ajax.php' ); ?>" > |
|
3 | +<form id="wps_product_quick_add_form" method="post" action="<?php echo admin_url('admin-ajax.php'); ?>" > |
|
4 | 4 | <input type="hidden" name="action" value="wps-product-quick-add"> |
5 | - <?php wp_nonce_field( 'create_product' ); ?> |
|
5 | + <?php wp_nonce_field('create_product'); ?> |
|
6 | 6 | <div class="wps-boxed" style="margin-top:10px;" > |
7 | - <span class="wps-h5"><?php _e( 'Product', 'wpshop'); ?></span> |
|
7 | + <span class="wps-h5"><?php _e('Product', 'wpshop'); ?></span> |
|
8 | 8 | |
9 | 9 | <div class="wpshop_cls" > |
10 | 10 | <div class="wpshop_form_label _product_title_label alignleft" > |
11 | - <label for="attribute_product_title" ><?php _e( 'Product name', 'wpshop'); ?> <span class="wpshop_required" >*</span></label> |
|
11 | + <label for="attribute_product_title" ><?php _e('Product name', 'wpshop'); ?> <span class="wpshop_required" >*</span></label> |
|
12 | 12 | </div> |
13 | 13 | <div class="wpshop_form_input_element _product_title_input alignleft" > |
14 | 14 | <input type="text" name="post_title" id="post_title" value="" class="wpshop_product_attribute_post_title wpshop_attributes_display" required > |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | <div class="wpshop_cls" > |
19 | 19 | <div class="wpshop_form_label _description_label alignleft" > |
20 | - <label for="attribute_description" ><?php _e( 'Description', 'wpshop'); ?></label> |
|
20 | + <label for="attribute_description" ><?php _e('Description', 'wpshop'); ?></label> |
|
21 | 21 | </div> |
22 | 22 | <div class="wpshop_form_input_element _description_input alignleft" > |
23 | 23 | <textarea name="post_content" id="post_content" class="wpshop_product_post_content wpshop_attributes_display" rows="2"></textarea> |
@@ -27,35 +27,35 @@ discard block |
||
27 | 27 | |
28 | 28 | <?php |
29 | 29 | /** Get the attribute set list */ |
30 | - $attribute_set_list = wpshop_attributes_set::get_attribute_set_list_for_entity( wpshop_entities::get_entity_identifier_from_code( 'wpshop_product' ) ); |
|
30 | + $attribute_set_list = wpshop_attributes_set::get_attribute_set_list_for_entity(wpshop_entities::get_entity_identifier_from_code('wpshop_product')); |
|
31 | 31 | $default_set = 0; |
32 | - if ( 1 == count( $attribute_set_list ) ) { |
|
33 | - $default_set = $attribute_set_list[ 0 ]->id; |
|
32 | + if (1 == count($attribute_set_list)) { |
|
33 | + $default_set = $attribute_set_list[0]->id; |
|
34 | 34 | } |
35 | 35 | ?> |
36 | 36 | <?php /** Check if attribute set list is not empty in order to display a dropdown for sélection */ ?> |
37 | - <?php if ( !empty( $attribute_set_list ) && ( 1 < count( $attribute_set_list ) ) ) : ?> |
|
37 | + <?php if (!empty($attribute_set_list) && (1 < count($attribute_set_list))) : ?> |
|
38 | 38 | <div style=" width:80%; margin: 0 auto 10px auto; " > |
39 | - <?php _e( 'Product type to create', 'wpshop' ); ?> : |
|
40 | - <select name="wps-product-attribute-set" data-nonce="<?php echo wp_create_nonce( 'attribute_list_reload' ); ?>" > |
|
41 | - <?php foreach( $attribute_set_list as $attribute_set ) : ?> |
|
39 | + <?php _e('Product type to create', 'wpshop'); ?> : |
|
40 | + <select name="wps-product-attribute-set" data-nonce="<?php echo wp_create_nonce('attribute_list_reload'); ?>" > |
|
41 | + <?php foreach ($attribute_set_list as $attribute_set) : ?> |
|
42 | 42 | <?php $is_default_set = false; ?> |
43 | - <?php if ( !empty( $attribute_set->default_set ) && strtolower( __( 'Yes', 'wpshop' ) ) == strtolower( __( $attribute_set->default_set, 'wpshop' ) ) ) : ?> |
|
43 | + <?php if (!empty($attribute_set->default_set) && strtolower(__('Yes', 'wpshop')) == strtolower(__($attribute_set->default_set, 'wpshop'))) : ?> |
|
44 | 44 | <?php $is_default_set = true; ?> |
45 | 45 | <?php $default_set = $attribute_set->id; ?> |
46 | 46 | <?php endif; ?> |
47 | - <option value="<?php echo $attribute_set->id; ?>" <?php selected( ( !empty( $chosen_set ) ? true : $is_default_set ) , true, true ); ?> ><?php echo $attribute_set->name; ?></option> |
|
47 | + <option value="<?php echo $attribute_set->id; ?>" <?php selected((!empty($chosen_set) ? true : $is_default_set), true, true); ?> ><?php echo $attribute_set->name; ?></option> |
|
48 | 48 | <?php endforeach; ?> |
49 | 49 | </select> |
50 | 50 | </div> |
51 | 51 | <?php endif; ?> |
52 | 52 | |
53 | 53 | <?php /** If default set or if there is a selected set get existing attributes list for this set */ ?> |
54 | - <?php if ( !empty( $default_set ) || !empty( $chosen_set ) ) : ?> |
|
55 | - <?php $this->display_attribute( !empty( $chosen_set ) ? $chosen_set : ( !empty( $default_set ) ? $default_set : 0 ) ); ?> |
|
54 | + <?php if (!empty($default_set) || !empty($chosen_set)) : ?> |
|
55 | + <?php $this->display_attribute(!empty($chosen_set) ? $chosen_set : (!empty($default_set) ? $default_set : 0)); ?> |
|
56 | 56 | <?php endif; ?> |
57 | 57 | |
58 | - <button class="wps-bton-first-mini-rounded alignRight" ><?php _e( 'Add product', 'wpshop'); ?></button> |
|
58 | + <button class="wps-bton-first-mini-rounded alignRight" ><?php _e('Add product', 'wpshop'); ?></button> |
|
59 | 59 | </form> |
60 | 60 | <script type="text/javascript" > |
61 | 61 | jQuery( document ).ready( function() { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | if ( has_error ) { |
86 | - alert( wpshopConvertAccentTojs( "<?php _e( 'Please fill all fields mark as required', 'wpshop' ); ?>" ) ); |
|
86 | + alert( wpshopConvertAccentTojs( "<?php _e('Please fill all fields mark as required', 'wpshop'); ?>" ) ); |
|
87 | 87 | return false; |
88 | 88 | } |
89 | 89 | }, |
@@ -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,9 +1,9 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | - if( !empty($files) ) : ?> |
|
3 | -<u><strong><?php _e( 'Uploaded files', 'wpshop' ); ?> :</strong></u> |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | + if (!empty($files)) : ?> |
|
3 | +<u><strong><?php _e('Uploaded files', 'wpshop'); ?> :</strong></u> |
|
4 | 4 | <ul> |
5 | -<?php foreach( $files as $file ) : ?> |
|
6 | -<li><a href="<?php echo wp_get_attachment_url( $file->ID ); ?>" target="_blank"><?php echo $file->post_title; ?></a> <a href="#" data-nonce="<?php echo wp_create_nonce( 'wps_mass_delete_file' ); ?>" class="wps-mass-delete-file" id="wps-mass-delete-file-<?php echo $file->ID; ?>"><span class="wps-icon-trash"></span></a></li> |
|
5 | +<?php foreach ($files as $file) : ?> |
|
6 | +<li><a href="<?php echo wp_get_attachment_url($file->ID); ?>" target="_blank"><?php echo $file->post_title; ?></a> <a href="#" data-nonce="<?php echo wp_create_nonce('wps_mass_delete_file'); ?>" class="wps-mass-delete-file" id="wps-mass-delete-file-<?php echo $file->ID; ?>"><span class="wps-icon-trash"></span></a></li> |
|
7 | 7 | <?php endforeach; ?> |
8 | 8 | </ul> |
9 | 9 | <?php endif; ?> |
@@ -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,7 +1,7 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-table-content wps-table-row"> |
4 | - <div class="wps-table-cell wps-cart-item-img"><a href="<?php echo get_permalink($ordered_product); ?>"><?php echo get_the_post_thumbnail( $ordered_product, 'thumbnail', array( 'class' => 'wps-circlerounded') ); ?></a></div> |
|
5 | - <div class="wps-table-cell"><a href="<?php echo get_permalink($ordered_product); ?>" target="_blank"><?php echo get_the_title( $ordered_product ); ?></a></div> |
|
6 | - <div class="wps-table-cell"><button class="wps-bton-first-mini-rounded wps-add-opinion-opener" data-nonce="<?php echo wp_create_nonce( 'wps_fill_opinion_modal' ); ?>" id="wps-add-opinion-<?php echo $ordered_product; ?>"><?php _e( 'Add your opinion', 'wps_opinion'); ?></button></div> |
|
4 | + <div class="wps-table-cell wps-cart-item-img"><a href="<?php echo get_permalink($ordered_product); ?>"><?php echo get_the_post_thumbnail($ordered_product, 'thumbnail', array('class' => 'wps-circlerounded')); ?></a></div> |
|
5 | + <div class="wps-table-cell"><a href="<?php echo get_permalink($ordered_product); ?>" target="_blank"><?php echo get_the_title($ordered_product); ?></a></div> |
|
6 | + <div class="wps-table-cell"><button class="wps-bton-first-mini-rounded wps-add-opinion-opener" data-nonce="<?php echo wp_create_nonce('wps_fill_opinion_modal'); ?>" id="wps-add-opinion-<?php echo $ordered_product; ?>"><?php _e('Add your opinion', 'wps_opinion'); ?></button></div> |
|
7 | 7 | </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,35 +1,35 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | ?> |
3 | 3 | <div class="wps-opinion-error-container"></div> |
4 | -<form method="post" action="<?php echo admin_url( 'admin-ajax.php' ); ?>" id="wps-add-opinion-form"> |
|
4 | +<form method="post" action="<?php echo admin_url('admin-ajax.php'); ?>" id="wps-add-opinion-form"> |
|
5 | 5 | |
6 | 6 | <div class="wps-row wps-gridwrapper2-padded"> |
7 | 7 | |
8 | 8 | <div class="wps-form-group"> |
9 | 9 | <input type="hidden" name="action" value="wps-opinion-save-form"/> |
10 | - <?php wp_nonce_field( 'wps_opinion_save_form' ); ?> |
|
10 | + <?php wp_nonce_field('wps_opinion_save_form'); ?> |
|
11 | 11 | <input type="hidden" name="wps-opinion-product-id" value="<?php echo $pid; ?>"/> |
12 | - <label for="wps-opinion-comment"><?php _e( 'Your opinion', 'wps_opinion' ); ?></label> |
|
12 | + <label for="wps-opinion-comment"><?php _e('Your opinion', 'wps_opinion'); ?></label> |
|
13 | 13 | <div class="wps-form"><textarea id="wps-opinion-comment" name="wps-opinion-comment"></textarea></div> |
14 | 14 | </div> |
15 | 15 | <div class="wps-form-group"> |
16 | 16 | <div> |
17 | 17 | <input type="hidden" name="action" value="wps-opinion-save-form"/> |
18 | - <label for="wps-opinion-comment"><?php _e( 'Your rate', 'wps_opinion' ); ?></label> |
|
18 | + <label for="wps-opinion-comment"><?php _e('Your rate', 'wps_opinion'); ?></label> |
|
19 | 19 | <div class="wps-form"> |
20 | 20 | <select name="wps-opinion-rate" id="wps-opinion-rate" > |
21 | - <?php for( $i = 0; $i <= 5 ; $i++) { ?> |
|
21 | + <?php for ($i = 0; $i <= 5; $i++) { ?> |
|
22 | 22 | <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> |
23 | 23 | <?php } ?> |
24 | 24 | </select> |
25 | 25 | </div> |
26 | 26 | </div> |
27 | 27 | <div> |
28 | - <label for="wps-opinion-stars"><?php _e( 'Star rate', 'wps_opinion' ); ?></label> |
|
29 | - <div class="wps-form" id="wps-opinion-star-container" data-nonce="<?php echo wp_create_nonce( 'wps_update_opinion_star_rate' ); ?>"> |
|
28 | + <label for="wps-opinion-stars"><?php _e('Star rate', 'wps_opinion'); ?></label> |
|
29 | + <div class="wps-form" id="wps-opinion-star-container" data-nonce="<?php echo wp_create_nonce('wps_update_opinion_star_rate'); ?>"> |
|
30 | 30 | <?php |
31 | 31 | $wps_opinion_ctr = new wps_opinion_ctr(); |
32 | - echo $wps_opinion_ctr->display_stars( 0 ); |
|
32 | + echo $wps_opinion_ctr->display_stars(0); |
|
33 | 33 | ?> |
34 | 34 | </div> |
35 | 35 | </div> |
@@ -39,5 +39,5 @@ discard block |
||
39 | 39 | |
40 | 40 | </form> |
41 | 41 | <div class="wps-form-group"> |
42 | - <button class="wps-bton-first-rounded" id="wps-save-opinion"><?php _e( 'Save your opinion', 'wps_opinion' ); ?></button> |
|
42 | + <button class="wps-bton-first-rounded" id="wps-save-opinion"><?php _e('Save your opinion', 'wps_opinion'); ?></button> |
|
43 | 43 | </div> |
@@ -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,24 +1,24 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wpshop_customer_search { |
3 | 3 | |
4 | 4 | function __construct() { |
5 | - if ( is_admin() ) { |
|
6 | - add_filter( 'posts_where', array(&$this, 'wpshop_search_where_in_customer'), 10, 2 ); |
|
5 | + if (is_admin()) { |
|
6 | + add_filter('posts_where', array(&$this, 'wpshop_search_where_in_customer'), 10, 2); |
|
7 | 7 | } |
8 | 8 | } |
9 | 9 | |
10 | - public function wpshop_search_where_in_customer( $where ) { |
|
11 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
12 | - $s = !empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
13 | - $entity_filter = !empty( $_GET['filter'] ) ? sanitize_text_field( $_GET['filter'] ) : ''; |
|
10 | + public function wpshop_search_where_in_customer($where) { |
|
11 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
12 | + $s = !empty($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
13 | + $entity_filter = !empty($_GET['filter']) ? sanitize_text_field($_GET['filter']) : ''; |
|
14 | 14 | |
15 | - if( is_admin() && ( !empty($post_type) && ( $post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ) ) && ( !empty( $s ) || !empty( $entity_filter ) ) ) { |
|
15 | + if (is_admin() && (!empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS)) && (!empty($s) || !empty($entity_filter))) { |
|
16 | 16 | global $wpdb; |
17 | 17 | |
18 | 18 | $where = " AND {$wpdb->posts}.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS . "'"; |
19 | 19 | |
20 | - if( !empty( $entity_filter ) ) { |
|
21 | - switch ( $entity_filter ) { |
|
20 | + if (!empty($entity_filter)) { |
|
21 | + switch ($entity_filter) { |
|
22 | 22 | case 'orders': |
23 | 23 | $operator = 'IN'; |
24 | 24 | break; |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | )"; |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $s ) ) { |
|
39 | - $s_soundex = soundex( $s ); |
|
40 | - $s = strtoupper( $s ); |
|
38 | + if (!empty($s)) { |
|
39 | + $s_soundex = soundex($s); |
|
40 | + $s = strtoupper($s); |
|
41 | 41 | $where .= " AND ( {$wpdb->posts}.ID = '{$s}' |
42 | 42 | OR UPPER( {$wpdb->posts}.post_title ) LIKE '%{$s}%' |
43 | 43 | OR SOUNDEX( {$wpdb->posts}.post_title ) = '{$s_soundex}' |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | |
93 | 93 | } |
94 | 94 | |
95 | -if ( class_exists("wpshop_customer_search") ) { |
|
95 | +if (class_exists("wpshop_customer_search")) { |
|
96 | 96 | $wpshop_customer_search = new wpshop_customer_search(); |
97 | 97 | } |
@@ -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,11 +1,11 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /** Check if the plugin version is defined. If not defined script will be stopped here */ |
4 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
5 | - die( __("You are not allowed to use this service.", 'wpshop') ); |
|
4 | +if (!defined('WPSHOP_VERSION')) { |
|
5 | + die(__("You are not allowed to use this service.", 'wpshop')); |
|
6 | 6 | } |
7 | 7 | |
8 | -if ( !class_exists("wpshop_entity_filter") ) { |
|
8 | +if (!class_exists("wpshop_entity_filter")) { |
|
9 | 9 | class wpshop_entity_filter { |
10 | 10 | function __construct() { |
11 | 11 | add_action('restrict_manage_posts', array(&$this, 'wpshop_entity_filter')); |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | function wpshop_entity_filter() { |
16 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
17 | - $entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : ''; |
|
16 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
17 | + $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''; |
|
18 | 18 | |
19 | 19 | if (isset($post_type)) { |
20 | 20 | if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT)) { |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | function wpshop_entity_filter_parse_query($query) { |
34 | 34 | global $pagenow, $wpdb; |
35 | 35 | |
36 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
37 | - $entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : ''; |
|
36 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
37 | + $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''; |
|
38 | 38 | |
39 | - if ( is_admin() && ($pagenow == 'edit.php') && !empty( $post_type ) && ( $post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT ) && !empty( $entity_filter ) ) { |
|
39 | + if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) && !empty($entity_filter)) { |
|
40 | 40 | |
41 | 41 | $check = null; |
42 | - switch ( $entity_filter ) { |
|
42 | + switch ($entity_filter) { |
|
43 | 43 | case 'no_picture': |
44 | 44 | $sql_query = $wpdb->prepare("SELECT post_id FROM {$wpdb->postmeta} pm WHERE meta_key = %s ", '_thumbnail_id'); |
45 | 45 | $check = 'post__not_in'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | // $price_attribute = wpshop_attributes::getElement( WPSHOP_PRODUCT_PRICE_TTC, "'valid'", 'code'); |
50 | 50 | // $sql_query = $wpdb->prepare("SELECT DISTINCT ID as post_id FROM {$wpdb->posts} WHERE post_type = %s AND ID NOT IN (SELECT entity_id FROM {$table_attribute_decimal} WHERE value > 0 AND attribute_id = %d)", WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, $price_attribute->id); |
51 | 51 | // $check = 'post__in'; |
52 | - $query->set( 'meta_query' , array( |
|
52 | + $query->set('meta_query', array( |
|
53 | 53 | array( |
54 | 54 | 'key' => '_displayed_price', |
55 | 55 | 'value' => '', |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | WHERE meta_key = %s |
90 | 90 | ) AND post_type = %s" |
91 | 91 | , "_barcode", WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, "_barcode", WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, "_barcode", WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ); |
92 | - $options_product_without_barcode = $wpdb->get_results( $the_query ); |
|
93 | - if ( !empty( $options_product_without_barcode ) ) { |
|
94 | - foreach ( $options_product_without_barcode as $post ) { |
|
92 | + $options_product_without_barcode = $wpdb->get_results($the_query); |
|
93 | + if (!empty($options_product_without_barcode)) { |
|
94 | + foreach ($options_product_without_barcode as $post) { |
|
95 | 95 | $post_to_get[] = $post->post_parent; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | /** If there are post that have variations without barcode => add them to the post list to get */ |
99 | - if ( !empty( $post_to_get ) ) { |
|
100 | - $query->query_vars[ 'post__in' ] = $post_to_get; |
|
99 | + if (!empty($post_to_get)) { |
|
100 | + $query->query_vars['post__in'] = $post_to_get; |
|
101 | 101 | } |
102 | 102 | break; |
103 | 103 | case 'no_barcode_products': |
104 | 104 | /** Check all product that don't have a barcode or having a barcode containing PDCT */ |
105 | - $query->set( 'meta_query' , array( |
|
105 | + $query->set('meta_query', array( |
|
106 | 106 | 'relation' => 'OR', |
107 | 107 | array( |
108 | 108 | 'key' => '_barcode', |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | break; |
119 | 119 | } |
120 | 120 | |
121 | - if ( !empty( $check ) ) { |
|
121 | + if (!empty($check)) { |
|
122 | 122 | $results = $wpdb->get_results($sql_query); |
123 | 123 | $post_id_list = array(); |
124 | - foreach($results as $item){ |
|
124 | + foreach ($results as $item) { |
|
125 | 125 | $post_id_list[] = $item->post_id; |
126 | 126 | } |
127 | 127 | $query->query_vars[$check] = $post_id_list; |
@@ -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,10 +1,10 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | class wpshop_order_search { |
3 | 3 | |
4 | 4 | function __construct() { |
5 | - if ( is_admin() ) { |
|
5 | + if (is_admin()) { |
|
6 | 6 | //add_action('posts_where_request', array(&$this, 'wpshop_search_where_in_order')); |
7 | - add_filter( 'posts_where', array(&$this, 'wpshop_search_where_in_order'), 10, 2 ); |
|
7 | + add_filter('posts_where', array(&$this, 'wpshop_search_where_in_order'), 10, 2); |
|
8 | 8 | } |
9 | 9 | } |
10 | 10 | |
@@ -13,31 +13,31 @@ discard block |
||
13 | 13 | * @param string $join The current |
14 | 14 | * @return string The new search query table list |
15 | 15 | */ |
16 | - public function wpshop_search_join( $join ) { |
|
16 | + public function wpshop_search_join($join) { |
|
17 | 17 | global $wpdb; |
18 | 18 | |
19 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
19 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
20 | 20 | |
21 | - if( is_search() || (is_admin() && $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) ) { |
|
21 | + if (is_search() || (is_admin() && $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) { |
|
22 | 22 | $join .= " LEFT JOIN $wpdb->postmeta ON " . $wpdb->posts . ".ID = $wpdb->postmeta.post_id "; |
23 | 23 | } |
24 | 24 | |
25 | 25 | return $join; |
26 | 26 | } |
27 | 27 | |
28 | - public function wpshop_search_where_in_order( $where ) { |
|
28 | + public function wpshop_search_where_in_order($where) { |
|
29 | 29 | global $wpdb; |
30 | 30 | |
31 | - $s = !empty( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
32 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
31 | + $s = !empty($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
32 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
33 | 33 | |
34 | - if ( !empty( $s ) && !empty( $post_type ) && $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) { |
|
34 | + if (!empty($s) && !empty($post_type) && $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) { |
|
35 | 35 | |
36 | 36 | $where = " AND {$wpdb->posts}.post_type = '" . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . "'"; |
37 | 37 | |
38 | - if( !empty( $s ) ) { |
|
39 | - $s_soundex = soundex( sanitize_text_field( $_GET['s'] ) ); |
|
40 | - $s = strtoupper( sanitize_text_field( $_GET['s'] ) ); |
|
38 | + if (!empty($s)) { |
|
39 | + $s_soundex = soundex(sanitize_text_field($_GET['s'])); |
|
40 | + $s = strtoupper(sanitize_text_field($_GET['s'])); |
|
41 | 41 | $where .= "AND ( |
42 | 42 | ( |
43 | 43 | {$wpdb->posts}.ID IN ( |
@@ -95,6 +95,6 @@ discard block |
||
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | -if ( class_exists("wpshop_order_search") ) { |
|
98 | +if (class_exists("wpshop_order_search")) { |
|
99 | 99 | $wpshop_order_search = new wpshop_order_search(); |
100 | 100 | } |
@@ -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 | * |