@@ -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 | * Pages Filter Class. |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | protected function construct() { |
| 30 | 30 | |
| 31 | - add_action( 'template_redirect', array( $this, 'check_checkout_page' ) ); |
|
| 32 | - add_filter( 'display_post_states', array( $this, 'add_states_post' ), 10, 2 ); |
|
| 33 | - add_filter( 'the_content', array( $this, 'do_shortcode_page' ), 99, 1 ); |
|
| 31 | + add_action('template_redirect', array($this, 'check_checkout_page')); |
|
| 32 | + add_filter('display_post_states', array($this, 'add_states_post'), 10, 2); |
|
| 33 | + add_filter('the_content', array($this, 'do_shortcode_page'), 99, 1); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function check_checkout_page() { |
| 44 | 44 | |
| 45 | - $page_ids_options = get_option( 'wps_page_ids', Pages::g()->default_options ); |
|
| 45 | + $page_ids_options = get_option('wps_page_ids', Pages::g()->default_options); |
|
| 46 | 46 | |
| 47 | - if ( $page_ids_options['checkout_id'] && is_page( $page_ids_options['checkout_id'] ) ) { |
|
| 47 | + if ($page_ids_options['checkout_id'] && is_page($page_ids_options['checkout_id'])) { |
|
| 48 | 48 | $cart_contents = Cart_Session::g()->cart_contents; |
| 49 | 49 | |
| 50 | - if ( empty( $cart_contents ) ) { |
|
| 51 | - wp_redirect( Pages::g()->get_cart_link() ); |
|
| 50 | + if (empty($cart_contents)) { |
|
| 51 | + wp_redirect(Pages::g()->get_cart_link()); |
|
| 52 | 52 | exit; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return array Les status avec celui de WPShop en plus. |
| 68 | 68 | */ |
| 69 | - public function add_states_post( $post_states, $post ) { |
|
| 69 | + public function add_states_post($post_states, $post) { |
|
| 70 | 70 | |
| 71 | - $page_ids_options = get_option( 'wps_page_ids', Pages::g()->default_options ); |
|
| 71 | + $page_ids_options = get_option('wps_page_ids', Pages::g()->default_options); |
|
| 72 | 72 | |
| 73 | - $key = array_search( $post->ID, $page_ids_options ); |
|
| 73 | + $key = array_search($post->ID, $page_ids_options); |
|
| 74 | 74 | |
| 75 | - if ( false !== $key ) { |
|
| 75 | + if (false !== $key) { |
|
| 76 | 76 | $post_states[] = $key; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -88,29 +88,29 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @return string $content Le contenu de la page + le contenu du shortcode. |
| 90 | 90 | */ |
| 91 | - public function do_shortcode_page( $content ) { |
|
| 91 | + public function do_shortcode_page($content) { |
|
| 92 | 92 | |
| 93 | - if ( ! is_admin() ) { |
|
| 94 | - $page_ids_options = get_option( 'wps_page_ids', Pages::g()->default_options ); |
|
| 93 | + if (!is_admin()) { |
|
| 94 | + $page_ids_options = get_option('wps_page_ids', Pages::g()->default_options); |
|
| 95 | 95 | |
| 96 | - $key = array_search( $GLOBALS['post']->ID, $page_ids_options ); |
|
| 96 | + $key = array_search($GLOBALS['post']->ID, $page_ids_options); |
|
| 97 | 97 | |
| 98 | 98 | $shortcode = ''; |
| 99 | 99 | $params = array(); |
| 100 | 100 | |
| 101 | - if ( false !== $key ) { |
|
| 102 | - switch ( $key ) { |
|
| 101 | + if (false !== $key) { |
|
| 102 | + switch ($key) { |
|
| 103 | 103 | case 'checkout_id': |
| 104 | - $params['step'] = isset( $_GET['step'] ) ? $_GET['step'] : 1; |
|
| 104 | + $params['step'] = isset($_GET['step']) ? $_GET['step'] : 1; |
|
| 105 | 105 | $shortcode = 'checkout'; |
| 106 | 106 | break; |
| 107 | 107 | case 'valid_checkout_id': |
| 108 | 108 | $shortcode = 'valid_checkout'; |
| 109 | - $params['order_id'] = isset( $_GET['order_id'] ) ? $_GET['order_id'] : 0; |
|
| 109 | + $params['order_id'] = isset($_GET['order_id']) ? $_GET['order_id'] : 0; |
|
| 110 | 110 | break; |
| 111 | 111 | case 'valid_proposal_id': |
| 112 | 112 | $shortcode = 'valid_proposal'; |
| 113 | - $params['proposal_id'] = isset( $_GET['proposal_id'] ) ? $_GET['proposal_id'] : 0; |
|
| 113 | + $params['proposal_id'] = isset($_GET['proposal_id']) ? $_GET['proposal_id'] : 0; |
|
| 114 | 114 | break; |
| 115 | 115 | case 'cart_id': |
| 116 | 116 | $shortcode = 'cart'; |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | $tmp_content = $content; |
| 127 | 127 | |
| 128 | - if ( ! empty( $shortcode ) ) { |
|
| 128 | + if (!empty($shortcode)) { |
|
| 129 | 129 | $shortcode_attr = ''; |
| 130 | - if ( ! empty( $params ) ) { |
|
| 131 | - foreach ( $params as $key => $value ) { |
|
| 130 | + if (!empty($params)) { |
|
| 131 | + foreach ($params as $key => $value) { |
|
| 132 | 132 | $shortcode_attr = $key . '=' . $value . ' '; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | - $content = do_shortcode( '[wps_' . $shortcode . ' ' . $shortcode_attr . ']' ); |
|
| 135 | + $content = do_shortcode('[wps_' . $shortcode . ' ' . $shortcode_attr . ']'); |
|
| 136 | 136 | $content .= $tmp_content; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -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 | * Doli Invoice Class. |
@@ -89,17 +89,17 @@ discard block |
||
| 89 | 89 | * @return Invoice_Model Les données de la facture WP avec les |
| 90 | 90 | * données de Dolibarr. |
| 91 | 91 | */ |
| 92 | - public function doli_to_wp( $doli_invoice, $wp_invoice ) { |
|
| 92 | + public function doli_to_wp($doli_invoice, $wp_invoice) { |
|
| 93 | 93 | $order = null; |
| 94 | 94 | |
| 95 | - $doli_invoice = Request_Util::get( 'invoices/' . $doli_invoice->id ); // Charges par la route single des factures pour avoir accès à linkedObjectsIds->commande. |
|
| 96 | - $wp_invoice->data['external_id'] = (int) $doli_invoice->id; |
|
| 95 | + $doli_invoice = Request_Util::get('invoices/' . $doli_invoice->id); // Charges par la route single des factures pour avoir accès à linkedObjectsIds->commande. |
|
| 96 | + $wp_invoice->data['external_id'] = (int)$doli_invoice->id; |
|
| 97 | 97 | |
| 98 | - if ( ! empty( $doli_invoice->linkedObjectsIds->commande ) ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName. |
|
| 99 | - $order_id = Doli_Order::g()->get_wp_id_by_doli_id( end( $doli_invoice->linkedObjectsIds->commande ) ); |
|
| 98 | + if (!empty($doli_invoice->linkedObjectsIds->commande)) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName. |
|
| 99 | + $order_id = Doli_Order::g()->get_wp_id_by_doli_id(end($doli_invoice->linkedObjectsIds->commande)); |
|
| 100 | 100 | $wp_invoice->data['post_parent'] = $order_id; |
| 101 | 101 | |
| 102 | - $order = Doli_Order::g()->get( array( 'id' => $order_id ), true ); |
|
| 102 | + $order = Doli_Order::g()->get(array('id' => $order_id), true); |
|
| 103 | 103 | $wp_invoice->data['author_id'] = $order->data['author_id']; |
| 104 | 104 | } |
| 105 | 105 | $wp_invoice->data['title'] = $doli_invoice->ref; |
@@ -107,12 +107,12 @@ discard block |
||
| 107 | 107 | $wp_invoice->data['total_ttc'] = $doli_invoice->total_ttc; |
| 108 | 108 | $wp_invoice->data['total_ht'] = $doli_invoice->total_ht; |
| 109 | 109 | $wp_invoice->data['total_ht'] = $doli_invoice->total_ht; |
| 110 | - $wp_invoice->data['payment_method'] = Doli_Payment::g()->convert_to_wp( $doli_invoice->mode_reglement_code ); |
|
| 111 | - $wp_invoice->data['paye'] = (int) $doli_invoice->paye; |
|
| 110 | + $wp_invoice->data['payment_method'] = Doli_Payment::g()->convert_to_wp($doli_invoice->mode_reglement_code); |
|
| 111 | + $wp_invoice->data['paye'] = (int)$doli_invoice->paye; |
|
| 112 | 112 | |
| 113 | 113 | $status = ''; |
| 114 | 114 | |
| 115 | - switch ( $doli_invoice->statut ) { |
|
| 115 | + switch ($doli_invoice->statut) { |
|
| 116 | 116 | case 1: |
| 117 | 117 | $status = 'wps-canceled'; |
| 118 | 118 | break; |
@@ -129,33 +129,33 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $wp_invoice->data['status'] = $status; |
| 131 | 131 | |
| 132 | - $wp_invoice = Doli_Invoice::g()->update( $wp_invoice->data ); |
|
| 132 | + $wp_invoice = Doli_Invoice::g()->update($wp_invoice->data); |
|
| 133 | 133 | |
| 134 | 134 | // Récupères les paiements attachés à cette facture. |
| 135 | - $doli_payments = Request_Util::get( 'invoices/' . $doli_invoice->id . '/payments' ); |
|
| 135 | + $doli_payments = Request_Util::get('invoices/' . $doli_invoice->id . '/payments'); |
|
| 136 | 136 | |
| 137 | - if ( ! empty( $doli_payments ) ) { |
|
| 138 | - foreach ( $doli_payments as $doli_payment ) { |
|
| 139 | - $payment = Doli_Payment::g()->get( array( |
|
| 137 | + if (!empty($doli_payments)) { |
|
| 138 | + foreach ($doli_payments as $doli_payment) { |
|
| 139 | + $payment = Doli_Payment::g()->get(array( |
|
| 140 | 140 | 'post_title' => $doli_payment->ref, |
| 141 | - ), true ); |
|
| 141 | + ), true); |
|
| 142 | 142 | |
| 143 | - if ( empty( $payment ) ) { |
|
| 144 | - $payment = Doli_Payment::g()->get( array( 'schema' => true ), true ); |
|
| 143 | + if (empty($payment)) { |
|
| 144 | + $payment = Doli_Payment::g()->get(array('schema' => true), true); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - $payment->data['post_parent'] = (int) $wp_invoice->data['id']; |
|
| 147 | + $payment->data['post_parent'] = (int)$wp_invoice->data['id']; |
|
| 148 | 148 | $payment->data['title'] = $doli_payment->ref; |
| 149 | 149 | $payment->data['status'] = 'publish'; |
| 150 | 150 | $payment->data['payment_type'] = $doli_payment->type; |
| 151 | 151 | $payment->data['amount'] = $doli_payment->amount; |
| 152 | 152 | $payment->data['date'] = $doli_payment->date; |
| 153 | 153 | |
| 154 | - Doli_Payment::g()->update( $payment->data ); |
|
| 154 | + Doli_Payment::g()->update($payment->data); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - do_action( 'wps_synchro_invoice', $wp_invoice->data, $doli_invoice ); |
|
| 158 | + do_action('wps_synchro_invoice', $wp_invoice->data, $doli_invoice); |
|
| 159 | 159 | |
| 160 | 160 | return $wp_invoice; |
| 161 | 161 | } |
@@ -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 | * Class product model. |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param Doli_Invoice $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', |
@@ -76,6 +76,6 @@ discard block |
||
| 76 | 76 | 'default' => '', |
| 77 | 77 | ); |
| 78 | 78 | |
| 79 | - parent::__construct( $object, $req_method ); |
|
| 79 | + parent::__construct($object, $req_method); |
|
| 80 | 80 | } |
| 81 | 81 | } |
@@ -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 | * PayPal Filter Class |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @since 2.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | - add_filter( 'wps_payment_method_paypal_description', array( $this, 'more_paypal_description' ) ); |
|
| 30 | + add_filter('wps_payment_method_paypal_description', array($this, 'more_paypal_description')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | * |
| 40 | 40 | * @return string Description modifiée. |
| 41 | 41 | */ |
| 42 | - public function more_paypal_description( $description ) { |
|
| 43 | - $paypal_options = Payment::g()->get_payment_option( 'paypal' ); |
|
| 42 | + public function more_paypal_description($description) { |
|
| 43 | + $paypal_options = Payment::g()->get_payment_option('paypal'); |
|
| 44 | 44 | |
| 45 | - if ( $paypal_options['use_paypal_sandbox'] ) { |
|
| 46 | - $description .= __( ' SANDBOX ENABLED. You can use sandbox testing accounts only. See the <a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">PayPal Sandbox Testing Guide</a> for more details.', 'wpshop' ); |
|
| 45 | + if ($paypal_options['use_paypal_sandbox']) { |
|
| 46 | + $description .= __(' SANDBOX ENABLED. You can use sandbox testing accounts only. See the <a href="https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/">PayPal Sandbox Testing Guide</a> for more details.', 'wpshop'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | return $description; |
@@ -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 Class. |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | * @since 2.0.0 |
| 82 | 82 | */ |
| 83 | 83 | public function display() { |
| 84 | - $products = $this->get( array( |
|
| 84 | + $products = $this->get(array( |
|
| 85 | 85 | 'orderby' => 'title', |
| 86 | 86 | 'order' => 'ASC', |
| 87 | 87 | 'posts_per_page' => -1, |
| 88 | - ) ); |
|
| 88 | + )); |
|
| 89 | 89 | |
| 90 | - \eoxia\View_Util::exec( 'wpshop', 'products', 'list', array( |
|
| 90 | + \eoxia\View_Util::exec('wpshop', 'products', 'list', array( |
|
| 91 | 91 | 'products' => $products, |
| 92 | - ) ); |
|
| 92 | + )); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | add_meta_box( |
| 102 | 102 | 'wps_product_configuration', |
| 103 | 103 | 'Product configuration', |
| 104 | - array( $this, 'callback_add_meta_box' ), |
|
| 104 | + array($this, 'callback_add_meta_box'), |
|
| 105 | 105 | 'wps-product' |
| 106 | 106 | ); |
| 107 | 107 | } |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @since 2.0.0 |
| 115 | 115 | */ |
| 116 | - public function callback_add_meta_box( $post ) { |
|
| 117 | - $product = $this->get( array( 'id' => $post->ID ), true ); |
|
| 116 | + public function callback_add_meta_box($post) { |
|
| 117 | + $product = $this->get(array('id' => $post->ID), true); |
|
| 118 | 118 | |
| 119 | - if ( empty( $product ) ) { |
|
| 120 | - $product = $this->get( array( 'schema' => true ), true ); |
|
| 119 | + if (empty($product)) { |
|
| 120 | + $product = $this->get(array('schema' => true), true); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $dolibarr_option = get_option( 'wps_dolibarr', Settings::g()->default_settings ); |
|
| 124 | - \eoxia\View_Util::exec( 'wpshop', 'products', 'metabox/main', array( |
|
| 123 | + $dolibarr_option = get_option('wps_dolibarr', Settings::g()->default_settings); |
|
| 124 | + \eoxia\View_Util::exec('wpshop', 'products', 'metabox/main', array( |
|
| 125 | 125 | 'product' => $product, |
| 126 | 126 | 'doli_url' => $dolibarr_option['dolibarr_url'], |
| 127 | - ) ); |
|
| 127 | + )); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -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 Filter Class. |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | * @since 2.0.0 |
| 28 | 28 | */ |
| 29 | 29 | public function __construct() { |
| 30 | - add_filter( 'eo_model_wps-product_register_post_type_args', array( $this, 'callback_register_post_type_args' ) ); |
|
| 31 | - add_filter( 'eo_model_wps-product_wps-product-cat', array( $this, 'callback_taxonomy' ) ); |
|
| 32 | - add_filter( 'single_template', array( $this, 'get_custom_post_type_template' ), 11 ); |
|
| 30 | + add_filter('eo_model_wps-product_register_post_type_args', array($this, 'callback_register_post_type_args')); |
|
| 31 | + add_filter('eo_model_wps-product_wps-product-cat', array($this, 'callback_taxonomy')); |
|
| 32 | + add_filter('single_template', array($this, 'get_custom_post_type_template'), 11); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -40,26 +40,26 @@ discard block |
||
| 40 | 40 | * @param array $args Les arguments pour le register_post_type. |
| 41 | 41 | * @return array Les arguments pour le register_post_type avec public à true. |
| 42 | 42 | */ |
| 43 | - public function callback_register_post_type_args( $args ) { |
|
| 43 | + public function callback_register_post_type_args($args) { |
|
| 44 | 44 | $labels = array( |
| 45 | - 'name' => _x( 'Products', 'post type general name', 'wpshop' ), |
|
| 46 | - 'singular_name' => _x( 'Product', 'post type singular name', 'wpshop' ), |
|
| 47 | - 'menu_name' => _x( 'Products', 'admin menu', 'wpshop' ), |
|
| 48 | - 'name_admin_bar' => _x( 'Product', 'add new on admin bar', 'wpshop' ), |
|
| 49 | - 'add_new' => _x( 'Add New', 'product', 'wpshop' ), |
|
| 50 | - 'add_new_item' => __( 'Add New Product', 'wpshop' ), |
|
| 51 | - 'new_item' => __( 'New Product', 'wpshop' ), |
|
| 52 | - 'edit_item' => __( 'Edit Product', 'wpshop' ), |
|
| 53 | - 'view_item' => __( 'View Product', 'wpshop' ), |
|
| 54 | - 'all_items' => __( 'All Products', 'wpshop' ), |
|
| 55 | - 'search_items' => __( 'Search Products', 'wpshop' ), |
|
| 56 | - 'parent_item_colon' => __( 'Parent Products:', 'wpshop' ), |
|
| 57 | - 'not_found' => __( 'No products found.', 'wpshop' ), |
|
| 58 | - 'not_found_in_trash' => __( 'No products found in Trash.', 'wpshop' ), |
|
| 45 | + 'name' => _x('Products', 'post type general name', 'wpshop'), |
|
| 46 | + 'singular_name' => _x('Product', 'post type singular name', 'wpshop'), |
|
| 47 | + 'menu_name' => _x('Products', 'admin menu', 'wpshop'), |
|
| 48 | + 'name_admin_bar' => _x('Product', 'add new on admin bar', 'wpshop'), |
|
| 49 | + 'add_new' => _x('Add New', 'product', 'wpshop'), |
|
| 50 | + 'add_new_item' => __('Add New Product', 'wpshop'), |
|
| 51 | + 'new_item' => __('New Product', 'wpshop'), |
|
| 52 | + 'edit_item' => __('Edit Product', 'wpshop'), |
|
| 53 | + 'view_item' => __('View Product', 'wpshop'), |
|
| 54 | + 'all_items' => __('All Products', 'wpshop'), |
|
| 55 | + 'search_items' => __('Search Products', 'wpshop'), |
|
| 56 | + 'parent_item_colon' => __('Parent Products:', 'wpshop'), |
|
| 57 | + 'not_found' => __('No products found.', 'wpshop'), |
|
| 58 | + 'not_found_in_trash' => __('No products found in Trash.', 'wpshop'), |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | $args['labels'] = $labels; |
| 62 | - $args['supports'] = array( 'title', 'editor', 'thumbnail' ); |
|
| 62 | + $args['supports'] = array('title', 'editor', 'thumbnail'); |
|
| 63 | 63 | $args['public'] = true; |
| 64 | 64 | $args['has_archive'] = true; |
| 65 | 65 | $args['show_ui'] = true; |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $shop_page_slug = Pages::g()->get_slug_shop_page(); |
| 71 | 71 | |
| 72 | - if ( ! empty( $shop_page_slug ) ) { |
|
| 72 | + if (!empty($shop_page_slug)) { |
|
| 73 | 73 | $args['rewrite'] = array( |
| 74 | 74 | 'slug' => $shop_page_slug, |
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $args['register_meta_box_cb'] = array( Product::g(), 'callback_register_meta_box' ); |
|
| 78 | + $args['register_meta_box_cb'] = array(Product::g(), 'callback_register_meta_box'); |
|
| 79 | 79 | |
| 80 | 80 | flush_rewrite_rules(); |
| 81 | 81 | return $args; |
@@ -89,19 +89,19 @@ discard block |
||
| 89 | 89 | * @param array $args Les données à filtrer. |
| 90 | 90 | * @return array Les données filtrées. |
| 91 | 91 | */ |
| 92 | - public function callback_taxonomy( $args ) { |
|
| 92 | + public function callback_taxonomy($args) { |
|
| 93 | 93 | $labels = array( |
| 94 | - 'name' => _x( 'Products category', 'taxonomy general name', 'wpshop' ), |
|
| 95 | - 'singular_name' => _x( 'Product category', 'taxonomy singular name', 'wpshop' ), |
|
| 96 | - 'search_items' => __( 'Search Products category', 'wpshop' ), |
|
| 97 | - 'all_items' => __( 'All Products category', 'wpshop' ), |
|
| 98 | - 'parent_item' => __( 'Parent Product category', 'wpshop' ), |
|
| 99 | - 'parent_item_colon' => __( 'Parent Product: category', 'wpshop' ), |
|
| 100 | - 'edit_item' => __( 'Edit Product category', 'wpshop' ), |
|
| 101 | - 'update_item' => __( 'Update Product category', 'wpshop' ), |
|
| 102 | - 'add_new_item' => __( 'Add New Product category', 'wpshop' ), |
|
| 103 | - 'new_item_name' => __( 'New Product categoryName', 'wpshop' ), |
|
| 104 | - 'menu_name' => __( 'Product category', 'wpshop' ), |
|
| 94 | + 'name' => _x('Products category', 'taxonomy general name', 'wpshop'), |
|
| 95 | + 'singular_name' => _x('Product category', 'taxonomy singular name', 'wpshop'), |
|
| 96 | + 'search_items' => __('Search Products category', 'wpshop'), |
|
| 97 | + 'all_items' => __('All Products category', 'wpshop'), |
|
| 98 | + 'parent_item' => __('Parent Product category', 'wpshop'), |
|
| 99 | + 'parent_item_colon' => __('Parent Product: category', 'wpshop'), |
|
| 100 | + 'edit_item' => __('Edit Product category', 'wpshop'), |
|
| 101 | + 'update_item' => __('Update Product category', 'wpshop'), |
|
| 102 | + 'add_new_item' => __('Add New Product category', 'wpshop'), |
|
| 103 | + 'new_item_name' => __('New Product categoryName', 'wpshop'), |
|
| 104 | + 'menu_name' => __('Product category', 'wpshop'), |
|
| 105 | 105 | ); |
| 106 | 106 | |
| 107 | 107 | $args = array( |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | * @param string $single_template Template path. |
| 124 | 124 | * @return string $single_template Template path. |
| 125 | 125 | */ |
| 126 | - public function get_custom_post_type_template( $single_template ) { |
|
| 126 | + public function get_custom_post_type_template($single_template) { |
|
| 127 | 127 | global $post; |
| 128 | 128 | |
| 129 | - if ( Product::g()->get_type() === $post->post_type ) { |
|
| 130 | - $single_template = Template_Util::get_template_part( 'products', 'single-wps-product' ); |
|
| 129 | + if (Product::g()->get_type() === $post->post_type) { |
|
| 130 | + $single_template = Template_Util::get_template_part('products', 'single-wps-product'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | return $single_template; |
@@ -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' => 'string', |
| 35 | 35 | 'meta_type' => 'single', |
@@ -137,6 +137,6 @@ discard block |
||
| 137 | 137 | 'description' => 'Le poids en Kg (float). Peut être NULL. Valeur par défaut NULL.', |
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | - parent::__construct( $object, $req_method ); |
|
| 140 | + parent::__construct($object, $req_method); |
|
| 141 | 141 | } |
| 142 | 142 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | namespace wpshop; |
| 13 | 13 | |
| 14 | -defined( 'ABSPATH' ) || exit; ?> |
|
| 14 | +defined('ABSPATH') || exit; ?> |
|
| 15 | 15 | |
| 16 | 16 | <?php get_header(); ?> |
| 17 | 17 | |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | <main id="main" class="site-main" role="main"> |
| 20 | 20 | |
| 21 | 21 | <?php |
| 22 | - while ( have_posts() ) : |
|
| 22 | + while (have_posts()) : |
|
| 23 | 23 | the_post(); |
| 24 | 24 | the_title(); |
| 25 | 25 | ?> |
| 26 | 26 | <div class="wpeo-button action-attribute" |
| 27 | 27 | data-action="add_to_cart" |
| 28 | - data-nonce="<?php echo wp_create_nonce( 'add_to_cart' ); ?>" |
|
| 29 | - data-id="<?php echo esc_attr( the_ID() ); ?>"><?php esc_html_e( 'Add to cart', 'wpshop' ); ?></div> |
|
| 28 | + data-nonce="<?php echo wp_create_nonce('add_to_cart'); ?>" |
|
| 29 | + data-id="<?php echo esc_attr(the_ID()); ?>"><?php esc_html_e('Add to cart', 'wpshop'); ?></div> |
|
| 30 | 30 | <?php |
| 31 | 31 | endwhile; // End of the loop. |
| 32 | 32 | ?> |
@@ -14,39 +14,39 @@ |
||
| 14 | 14 | |
| 15 | 15 | namespace wpshop; |
| 16 | 16 | |
| 17 | -defined( 'ABSPATH' ) || exit; ?> |
|
| 17 | +defined('ABSPATH') || exit; ?> |
|
| 18 | 18 | |
| 19 | -<a href="<?php echo esc_attr( $doli_url ); ?>product/card.php?id=<?php echo $product->data['external_id']; ?>" target="_blank">Editer sur dolibarr</a> |
|
| 19 | +<a href="<?php echo esc_attr($doli_url); ?>product/card.php?id=<?php echo $product->data['external_id']; ?>" target="_blank">Editer sur dolibarr</a> |
|
| 20 | 20 | <div class="wpeo-button action-attribute" |
| 21 | 21 | data-action="associate_and_synchronize" |
| 22 | - data-entry-id="<?php echo esc_attr( $product->data['external_id'] ); ?>" |
|
| 23 | - data-wp-id="<?php echo esc_attr( $product->data['id'] ); ?>" |
|
| 22 | + data-entry-id="<?php echo esc_attr($product->data['external_id']); ?>" |
|
| 23 | + data-wp-id="<?php echo esc_attr($product->data['id']); ?>" |
|
| 24 | 24 | data-from="dolibarr">Synchroniser avec dolibarr</div> |
| 25 | 25 | |
| 26 | 26 | <div class="wpeo-form"> |
| 27 | - <?php wp_nonce_field( basename( __FILE__ ), 'wpshop_data_fields' ); ?> |
|
| 27 | + <?php wp_nonce_field(basename(__FILE__), 'wpshop_data_fields'); ?> |
|
| 28 | 28 | |
| 29 | 29 | <div> |
| 30 | - <h3><?php esc_html_e( 'Price', 'wpshop' ); ?></h3> |
|
| 30 | + <h3><?php esc_html_e('Price', 'wpshop'); ?></h3> |
|
| 31 | 31 | |
| 32 | 32 | <div class="form-element"> |
| 33 | 33 | <span class="form-label">Prix HT (€)</span> |
| 34 | 34 | <label class="form-field-container"> |
| 35 | - <span><?php echo esc_attr( $product->data['price'] ); ?></span> |
|
| 35 | + <span><?php echo esc_attr($product->data['price']); ?></span> |
|
| 36 | 36 | </label> |
| 37 | 37 | </div> |
| 38 | 38 | |
| 39 | 39 | <div class="form-element"> |
| 40 | 40 | <span class="form-label">Taux TVA</span> |
| 41 | 41 | <label class="form-field-container"> |
| 42 | - <span><?php echo esc_attr( $product->data['tva_tx'] ); ?></span> |
|
| 42 | + <span><?php echo esc_attr($product->data['tva_tx']); ?></span> |
|
| 43 | 43 | </label> |
| 44 | 44 | </div> |
| 45 | 45 | |
| 46 | 46 | <div class="form-element"> |
| 47 | 47 | <span class="form-label">Prix TTC (€)</span> |
| 48 | 48 | <label class="form-field-container"> |
| 49 | - <span><?php echo esc_attr( $product->data['price_ttc'] ); ?></span> |
|
| 49 | + <span><?php echo esc_attr($product->data['price_ttc']); ?></span> |
|
| 50 | 50 | </label> |
| 51 | 51 | </div> |
| 52 | 52 | |