@@ -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 | * Product Model Class. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param Product $object Les données de l'objet. |
| 30 | 30 | * @param string $req_method La méthode de la requête. |
| 31 | 31 | */ |
| 32 | - public function __construct( $object, $req_method = null ) { |
|
| 32 | + public function __construct($object, $req_method = null) { |
|
| 33 | 33 | $this->schema['external_id'] = array( |
| 34 | 34 | 'type' => 'integer', |
| 35 | 35 | 'meta_type' => 'single', |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | 'field' => '_date_last_synchro', |
| 53 | 53 | 'since' => '2.0.0', |
| 54 | 54 | 'description' => 'La date de la dernière synchronisation.', |
| 55 | - 'context' => array( 'GET' ), |
|
| 55 | + 'context' => array('GET'), |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | $this->schema['price'] = array( |
@@ -171,6 +171,6 @@ discard block |
||
| 171 | 171 | 'meta_type' => 'multiple', |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | - parent::__construct( $object, $req_method ); |
|
| 174 | + parent::__construct($object, $req_method); |
|
| 175 | 175 | } |
| 176 | 176 | } |
@@ -14,13 +14,13 @@ 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 wpeo-wrap"> |
| 20 | - <h2><?php esc_html_e( 'Settings', 'wpshop' ); ?></h2> |
|
| 20 | + <h2><?php esc_html_e('Settings', 'wpshop'); ?></h2> |
|
| 21 | 21 | |
| 22 | 22 | <?php |
| 23 | - if ( ! empty( $transient ) ) : |
|
| 23 | + if (!empty($transient)) : |
|
| 24 | 24 | ?> |
| 25 | 25 | <div class="notice notice-success is-dismissible"> |
| 26 | 26 | <p><?php echo $transient; ?></p> |
@@ -31,16 +31,16 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | <div class="wpeo-tab"> |
| 33 | 33 | <ul class="tab-list"> |
| 34 | - <a href="<?php echo esc_url( admin_url( 'admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce( 'callback_load_tab' ) . '&tab=general' ) ); ?>" class="tab-element <?php echo ( 'general' === $tab ) ? 'tab-active' : ''; ?>"><?php esc_html_e( 'General', 'wpshop' ); ?></a> |
|
| 35 | - <a href="<?php echo esc_url( admin_url( 'admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce( 'callback_load_tab' ) . '&tab=pages' ) ); ?>" class="tab-element <?php echo ( 'pages' === $tab ) ? 'tab-active' : ''; ?>"><?php esc_html_e( 'Pages', 'wpshop' ); ?></a> |
|
| 36 | - <a href="<?php echo esc_url( admin_url( 'admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce( 'callback_load_tab' ) . '&tab=emails' ) ); ?>" class="tab-element <?php echo ( 'emails' === $tab ) ? 'tab-active' : ''; ?>"><?php esc_html_e( 'Emails', 'wpshop' ); ?></a> |
|
| 37 | - <a href="<?php echo esc_url( admin_url( 'admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce( 'callback_load_tab' ) . '&tab=payment_method' ) ); ?>" class="tab-element <?php echo ( 'payment_method' === $tab ) ? 'tab-active' : ''; ?>"><?php esc_html_e( 'Payment method', 'wpshop' ); ?></a> |
|
| 38 | - <a href="<?php echo esc_url( admin_url( 'admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce( 'callback_load_tab' ) . '&tab=shipping_cost' ) ); ?>" class="tab-element <?php echo ( 'shipping_cost' === $tab ) ? 'tab-active' : ''; ?>"><?php esc_html_e( 'Shipping cost', 'wpshop' ); ?></a> |
|
| 34 | + <a href="<?php echo esc_url(admin_url('admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce('callback_load_tab') . '&tab=general')); ?>" class="tab-element <?php echo ('general' === $tab) ? 'tab-active' : ''; ?>"><?php esc_html_e('General', 'wpshop'); ?></a> |
|
| 35 | + <a href="<?php echo esc_url(admin_url('admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce('callback_load_tab') . '&tab=pages')); ?>" class="tab-element <?php echo ('pages' === $tab) ? 'tab-active' : ''; ?>"><?php esc_html_e('Pages', 'wpshop'); ?></a> |
|
| 36 | + <a href="<?php echo esc_url(admin_url('admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce('callback_load_tab') . '&tab=emails')); ?>" class="tab-element <?php echo ('emails' === $tab) ? 'tab-active' : ''; ?>"><?php esc_html_e('Emails', 'wpshop'); ?></a> |
|
| 37 | + <a href="<?php echo esc_url(admin_url('admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce('callback_load_tab') . '&tab=payment_method')); ?>" class="tab-element <?php echo ('payment_method' === $tab) ? 'tab-active' : ''; ?>"><?php esc_html_e('Payment method', 'wpshop'); ?></a> |
|
| 38 | + <a href="<?php echo esc_url(admin_url('admin-post.php?action=wps_load_settings_tab&_wpnonce=' . wp_create_nonce('callback_load_tab') . '&tab=shipping_cost')); ?>" class="tab-element <?php echo ('shipping_cost' === $tab) ? 'tab-active' : ''; ?>"><?php esc_html_e('Shipping cost', 'wpshop'); ?></a> |
|
| 39 | 39 | </ul> |
| 40 | 40 | |
| 41 | 41 | <div class="tab-container"> |
| 42 | 42 | <div class="tab-content tab-active"> |
| 43 | - <?php call_user_func( array( Settings::g(), 'display_' . $tab ), $section ); ?> |
|
| 43 | + <?php call_user_func(array(Settings::g(), 'display_' . $tab), $section); ?> |
|
| 44 | 44 | </div> |
| 45 | 45 | </div> |
| 46 | 46 | </div> |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | |
| 16 | 16 | namespace wpshop; |
| 17 | 17 | |
| 18 | -defined( 'ABSPATH' ) || exit; ?> |
|
| 18 | +defined('ABSPATH') || exit; ?> |
|
| 19 | 19 | |
| 20 | 20 | <div class="wrap wpeo-wrap transfert-data"> |
| 21 | 21 | <h1>Transfère des tiers de WPshop 1.x.x</h1> |
| 22 | - <?php wp_nonce_field( 'wps_transfert_data' ); ?> |
|
| 23 | - <input type="hidden" name="number_customers" value="<?php echo esc_attr( $number_customers ); ?>" /> |
|
| 22 | + <?php wp_nonce_field('wps_transfert_data'); ?> |
|
| 23 | + <input type="hidden" name="number_customers" value="<?php echo esc_attr($number_customers); ?>" /> |
|
| 24 | 24 | <input type="hidden" name="key_query" value="1" /> |
| 25 | 25 | <input type="hidden" name="index" value="0" /> |
| 26 | 26 | |
@@ -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 | * Doli Payement Model. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param Product $object Les données de l'objet. |
| 30 | 30 | * @param string $req_method La méthode de la requête. |
| 31 | 31 | */ |
| 32 | - public function __construct( $object, $req_method = null ) { |
|
| 32 | + public function __construct($object, $req_method = null) { |
|
| 33 | 33 | $this->schema['payment_type'] = array( |
| 34 | 34 | 'type' => 'string', |
| 35 | 35 | 'meta_type' => 'single', |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | 'type' => 'wpeo_date', |
| 51 | 51 | 'meta_type' => 'single', |
| 52 | 52 | 'field' => '_last_sync', |
| 53 | - 'context' => array( 'GET' ), |
|
| 53 | + 'context' => array('GET'), |
|
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - parent::__construct( $object, $req_method ); |
|
| 56 | + parent::__construct($object, $req_method); |
|
| 57 | 57 | } |
| 58 | 58 | } |
@@ -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 | * Dashboard Action Class. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 2.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | - add_action( 'load-toplevel_page_wps-third-party', array( $this, 'callback_load' ) ); |
|
| 30 | + add_action('load-toplevel_page_wps-third-party', array($this, 'callback_load')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -36,9 +36,9 @@ discard block |
||
| 36 | 36 | * @since 2.0.0 |
| 37 | 37 | */ |
| 38 | 38 | public function callback_load() { |
| 39 | - wp_enqueue_script( 'common' ); |
|
| 40 | - wp_enqueue_script( 'wp-lists' ); |
|
| 41 | - wp_enqueue_script( 'postbox' ); |
|
| 39 | + wp_enqueue_script('common'); |
|
| 40 | + wp_enqueue_script('wp-lists'); |
|
| 41 | + wp_enqueue_script('postbox'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | } |
@@ -14,30 +14,30 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | namespace wpshop; |
| 16 | 16 | |
| 17 | -defined( 'ABSPATH' ) || exit; ?> |
|
| 17 | +defined('ABSPATH') || exit; ?> |
|
| 18 | 18 | |
| 19 | -<table class="wpeo-table <?php echo apply_filters( 'wps_review_order_table_class', '', $object ); ?>"> |
|
| 19 | +<table class="wpeo-table <?php echo apply_filters('wps_review_order_table_class', '', $object); ?>"> |
|
| 20 | 20 | <thead> |
| 21 | 21 | <tr> |
| 22 | - <th><?php esc_html_e( 'Product name', 'wpshop' ); ?></th> |
|
| 23 | - <th><?php esc_html_e( 'VAT', 'wpshop' ); ?></th> |
|
| 24 | - <th><?php esc_html_e( 'P.U HT', 'wpshop' ); ?></th> |
|
| 25 | - <th><?php esc_html_e( 'Quantity', 'wpshop' ); ?></th> |
|
| 26 | - <th><?php esc_html_e( 'Total HT', 'wpshop' ); ?></th> |
|
| 22 | + <th><?php esc_html_e('Product name', 'wpshop'); ?></th> |
|
| 23 | + <th><?php esc_html_e('VAT', 'wpshop'); ?></th> |
|
| 24 | + <th><?php esc_html_e('P.U HT', 'wpshop'); ?></th> |
|
| 25 | + <th><?php esc_html_e('Quantity', 'wpshop'); ?></th> |
|
| 26 | + <th><?php esc_html_e('Total HT', 'wpshop'); ?></th> |
|
| 27 | 27 | </tr> |
| 28 | 28 | </thead> |
| 29 | 29 | |
| 30 | 30 | <tbody> |
| 31 | 31 | <?php |
| 32 | - if ( ! empty( $object->data['lines'] ) ) : |
|
| 33 | - foreach ( $object->data['lines'] as $line ) : |
|
| 32 | + if (!empty($object->data['lines'])) : |
|
| 33 | + foreach ($object->data['lines'] as $line) : |
|
| 34 | 34 | ?> |
| 35 | 35 | <tr> |
| 36 | 36 | <td><?php echo $line['libelle']; ?></td> |
| 37 | - <td><?php echo number_format( $line['tva_tx'], 2, ',', '' ); ?>%</td> |
|
| 38 | - <td><?php echo number_format( $line['subprice'], 2, ',', '' ); ?>€</td> |
|
| 37 | + <td><?php echo number_format($line['tva_tx'], 2, ',', ''); ?>%</td> |
|
| 38 | + <td><?php echo number_format($line['subprice'], 2, ',', ''); ?>€</td> |
|
| 39 | 39 | <td><?php echo $line['qty']; ?></td> |
| 40 | - <td><?php echo number_format( $line['total_ht'], 2, ',', '' ); ?>€</td> |
|
| 40 | + <td><?php echo number_format($line['total_ht'], 2, ',', ''); ?>€</td> |
|
| 41 | 41 | </tr> |
| 42 | 42 | <?php |
| 43 | 43 | endforeach; |
@@ -47,16 +47,16 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | <tfoot> |
| 49 | 49 | <tr> |
| 50 | - <td colspan="4"><strong><?php esc_html_e( 'Total HT', 'wpshop' ); ?></strong></td> |
|
| 51 | - <td><?php echo number_format( $object->data['total_ht'], 2, ',', '' ); ?>€</td> |
|
| 50 | + <td colspan="4"><strong><?php esc_html_e('Total HT', 'wpshop'); ?></strong></td> |
|
| 51 | + <td><?php echo number_format($object->data['total_ht'], 2, ',', ''); ?>€</td> |
|
| 52 | 52 | </tr> |
| 53 | 53 | <?php |
| 54 | - if ( ! empty( $tva_lines ) ) : |
|
| 55 | - foreach ( $tva_lines as $key => $tva_line ) : |
|
| 54 | + if (!empty($tva_lines)) : |
|
| 55 | + foreach ($tva_lines as $key => $tva_line) : |
|
| 56 | 56 | ?> |
| 57 | 57 | <tr> |
| 58 | - <td colspan="4"><strong><?php esc_html_e( 'Total VAT', 'wpshop' ); ?> <?php echo number_format( $key, 2, ',', '' ); ?>%</strong></td> |
|
| 59 | - <td><?php echo number_format( $tva_line, 2, ',', '' ); ?>€</td> |
|
| 58 | + <td colspan="4"><strong><?php esc_html_e('Total VAT', 'wpshop'); ?> <?php echo number_format($key, 2, ',', ''); ?>%</strong></td> |
|
| 59 | + <td><?php echo number_format($tva_line, 2, ',', ''); ?>€</td> |
|
| 60 | 60 | </tr> |
| 61 | 61 | <?php |
| 62 | 62 | endforeach; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | <tr> |
| 67 | 67 | <td colspan="4"><strong>Total TTC</strong></td> |
| 68 | - <td><strong><?php echo number_format( $object->data['total_ttc'], 2, ',', '' ); ?>€</strong></td> |
|
| 68 | + <td><strong><?php echo number_format($object->data['total_ttc'], 2, ',', ''); ?>€</strong></td> |
|
| 69 | 69 | </tr> |
| 70 | 70 | </tfoot> |
| 71 | 71 | </table> |
@@ -14,4 +14,4 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace wpshop; |
| 16 | 16 | |
| 17 | -defined( 'ABSPATH' ) || exit; |
|
| 17 | +defined('ABSPATH') || exit; |
|
@@ -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,8 +29,8 @@ discard block |
||
| 29 | 29 | * @since 2.0.0 |
| 30 | 30 | */ |
| 31 | 31 | public function __construct() { |
| 32 | - add_action( 'init', array( $this, 'create_wpshop_upload_dir' ) ); |
|
| 33 | - add_action( 'admin_post_wps_download_product', array( $this, 'download_product' ) ); |
|
| 32 | + add_action('init', array($this, 'create_wpshop_upload_dir')); |
|
| 33 | + add_action('admin_post_wps_download_product', array($this, 'download_product')); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -43,10 +43,10 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $path = $dir['basedir'] . '/wpshop_uploads'; |
| 45 | 45 | |
| 46 | - if ( wp_mkdir_p( $path ) && ! file_exists( $path . '/.htaccess' ) ) { |
|
| 47 | - $f = fopen( $path . '/.htaccess', 'a+' ); |
|
| 48 | - fwrite( $f, "Options -Indexes\r\ndeny from all" ); |
|
| 49 | - fclose( $f ); |
|
| 46 | + if (wp_mkdir_p($path) && !file_exists($path . '/.htaccess')) { |
|
| 47 | + $f = fopen($path . '/.htaccess', 'a+'); |
|
| 48 | + fwrite($f, "Options -Indexes\r\ndeny from all"); |
|
| 49 | + fclose($f); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
@@ -56,34 +56,34 @@ discard block |
||
| 56 | 56 | * @since 2.0.0 |
| 57 | 57 | */ |
| 58 | 58 | public function download_product() { |
| 59 | - check_admin_referer( 'download_product' ); |
|
| 59 | + check_admin_referer('download_product'); |
|
| 60 | 60 | |
| 61 | - $product_id = ! empty( $_GET['product_id'] ) ? (int) $_GET['product_id'] : 0; |
|
| 61 | + $product_id = !empty($_GET['product_id']) ? (int)$_GET['product_id'] : 0; |
|
| 62 | 62 | |
| 63 | - if ( ! $product_id ) { |
|
| 63 | + if (!$product_id) { |
|
| 64 | 64 | exit; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $contact = Contact::g()->get( array( 'id' => get_current_user_id() ), true ); |
|
| 68 | - $third_party = Third_Party::g()->get( array( 'id' => $contact->data['third_party_id'] ), true ); |
|
| 69 | - $product_downloadable = Product_Downloadable::g()->get( array( 'id' => $product_id ), true ); |
|
| 67 | + $contact = Contact::g()->get(array('id' => get_current_user_id()), true); |
|
| 68 | + $third_party = Third_Party::g()->get(array('id' => $contact->data['third_party_id']), true); |
|
| 69 | + $product_downloadable = Product_Downloadable::g()->get(array('id' => $product_id), true); |
|
| 70 | 70 | |
| 71 | - if ( ( $product_downloadable->data['author_id'] !== $contact->data['id'] ) && ! current_user_can( 'administrator' ) ) { |
|
| 71 | + if (($product_downloadable->data['author_id'] !== $contact->data['id']) && !current_user_can('administrator')) { |
|
| 72 | 72 | exit; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $wp_upload_dir = wp_upload_dir(); |
| 76 | - $path = str_replace( '\\', '/', $wp_upload_dir['path'] ); |
|
| 77 | - $basedir = str_replace( '\\', '/', $wp_upload_dir['basedir'] ); |
|
| 78 | - $baseurl = str_replace( '\\', '/', $wp_upload_dir['baseurl'] ); |
|
| 76 | + $path = str_replace('\\', '/', $wp_upload_dir['path']); |
|
| 77 | + $basedir = str_replace('\\', '/', $wp_upload_dir['basedir']); |
|
| 78 | + $baseurl = str_replace('\\', '/', $wp_upload_dir['baseurl']); |
|
| 79 | 79 | |
| 80 | - $guid = get_the_guid( $product_downloadable->data['product_id'] ); |
|
| 81 | - $file_path = str_replace( $baseurl, $basedir, $guid ); |
|
| 80 | + $guid = get_the_guid($product_downloadable->data['product_id']); |
|
| 81 | + $file_path = str_replace($baseurl, $basedir, $guid); |
|
| 82 | 82 | |
| 83 | - header( 'Content-Type: application/octect-stream' ); |
|
| 84 | - header( 'Content-Transfer-Encoding: Binary' ); |
|
| 85 | - header( 'Content-Disposition: attachment; filename="' . basename( $guid ) . '"' ); |
|
| 86 | - readfile( $file_path ); |
|
| 83 | + header('Content-Type: application/octect-stream'); |
|
| 84 | + header('Content-Transfer-Encoding: Binary'); |
|
| 85 | + header('Content-Disposition: attachment; filename="' . basename($guid) . '"'); |
|
| 86 | + readfile($file_path); |
|
| 87 | 87 | exit; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -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 | * Product Model Class. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param Product $object Les données de l'objet. |
| 30 | 30 | * @param string $req_method La méthode de la requête. |
| 31 | 31 | */ |
| 32 | - public function __construct( $object, $req_method = null ) { |
|
| 32 | + public function __construct($object, $req_method = null) { |
|
| 33 | 33 | $this->schema['download_count'] = array( |
| 34 | 34 | 'type' => 'integer', |
| 35 | 35 | 'meta_type' => 'single', |
@@ -47,6 +47,6 @@ discard block |
||
| 47 | 47 | 'description' => '', |
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | - parent::__construct( $object, $req_method ); |
|
| 50 | + parent::__construct($object, $req_method); |
|
| 51 | 51 | } |
| 52 | 52 | } |