Completed
Pull Request — master (#2)
by Jimmy
1216:52 queued 1185:43
created
includes/modules/wps_address/templates/backend/address-metabox.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?>
3
-<div class="wps-address-list-container" data-nonce="<?php echo wp_create_nonce( 'display_addresses_list' ); ?>" >
4
-	<?php require( wpshop_tools::get_template_part( WPS_ADDRESS_DIR, WPS_LOCALISATION_TEMPLATES_MAIN_DIR, "backend", "addresses" ) ); ?>
3
+<div class="wps-address-list-container" data-nonce="<?php echo wp_create_nonce('display_addresses_list'); ?>" >
4
+	<?php require(wpshop_tools::get_template_part(WPS_ADDRESS_DIR, WPS_LOCALISATION_TEMPLATES_MAIN_DIR, "backend", "addresses")); ?>
5 5
 </div>
6
-<a href="#" data-nonce="<?php echo wp_create_nonce( 'display_address_adding_form' ); ?>" class="alignright wps-address-icon-black wps-address-icon-add" id="wps-address-add-for-<?php echo $post->ID; ?>" ></a>
6
+<a href="#" data-nonce="<?php echo wp_create_nonce('display_address_adding_form'); ?>" class="alignright wps-address-icon-black wps-address-icon-add" id="wps-address-add-for-<?php echo $post->ID; ?>" ></a>
7 7
 <div class="clear" ></div>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
includes/modules/wps_credit/wps_credit.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@
 block discarded – undo
35 35
 		}
36 36
 
37 37
 		/** Load module/addon automatically to existing template list
38
-		*
39
-		* @param array $templates The current template definition
40
-		*
41
-		* @return array The template with new elements
42
-		*/
38
+		 *
39
+		 * @param array $templates The current template definition
40
+		 *
41
+		 * @return array The template with new elements
42
+		 */
43 43
 		function custom_template_load( $templates ) {
44 44
 			include('templates/backend/main_elements.tpl.php');
45 45
 			$wpshop_display = new wpshop_display();
Please login to merge, or discard this patch.
Spacing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 /**
3 3
  * WP Shop Credit bootstrap file
4 4
  * @author Jérôme ALLEGRE - Eoxia dev team <[email protected]>
@@ -8,22 +8,22 @@  discard block
 block discarded – undo
8 8
  *
9 9
  */
10 10
 
11
-if ( !class_exists('wps_credit') ) {
11
+if (!class_exists('wps_credit')) {
12 12
 	class wps_credit {
13 13
 		function __construct() {
14 14
 			/** Template Load **/
15
-			add_filter( 'wpshop_custom_template', array( &$this, 'custom_template_load' ) );
15
+			add_filter('wpshop_custom_template', array(&$this, 'custom_template_load'));
16 16
 
17 17
 			/**	Include the different javascript	*/
18
-			add_action( 'admin_init', array(&$this, 'admin_js') );
18
+			add_action('admin_init', array(&$this, 'admin_js'));
19 19
 
20 20
 			/** Ajax actions **/
21
-			add_action( 'wp_ajax_wps_credit_make_credit', array( &$this, 'wps_credit_make_credit_interface'));
22
-			add_action( 'wp_ajax_wps_make_credit_action', array( &$this, 'wps_make_credit_action') );
23
-			add_action( 'wp_ajax_wps_credit_change_status', array( &$this, 'wps_credit_change_status') );
21
+			add_action('wp_ajax_wps_credit_make_credit', array(&$this, 'wps_credit_make_credit_interface'));
22
+			add_action('wp_ajax_wps_make_credit_action', array(&$this, 'wps_make_credit_action'));
23
+			add_action('wp_ajax_wps_credit_change_status', array(&$this, 'wps_credit_change_status'));
24 24
 
25 25
 			// Filter
26
-			add_filter( 'wps_order_saving_admin_extra_action', array( $this, 'wps_credit_actions_on_order_save'), 10, 2 );
26
+			add_filter('wps_order_saving_admin_extra_action', array($this, 'wps_credit_actions_on_order_save'), 10, 2);
27 27
 		}
28 28
 
29 29
 		/**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		 */
32 32
 		function admin_js() {
33 33
 			add_thickbox();
34
-			wp_enqueue_script( 'wps_credit', plugins_url('templates/backend/js/wps_credit.js', __FILE__), array( "jquery" ) );
34
+			wp_enqueue_script('wps_credit', plugins_url('templates/backend/js/wps_credit.js', __FILE__), array("jquery"));
35 35
 		}
36 36
 
37 37
 		/** Load module/addon automatically to existing template list
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 		*
41 41
 		* @return array The template with new elements
42 42
 		*/
43
-		function custom_template_load( $templates ) {
43
+		function custom_template_load($templates) {
44 44
 			include('templates/backend/main_elements.tpl.php');
45 45
 			$wpshop_display = new wpshop_display();
46
-			$templates = $wpshop_display->add_modules_template_to_internal( $tpl_element, $templates );
46
+			$templates = $wpshop_display->add_modules_template_to_internal($tpl_element, $templates);
47 47
 			unset($tpl_element);
48 48
 
49 49
 			return $templates;
@@ -53,126 +53,126 @@  discard block
 block discarded – undo
53 53
 		public static function wps_credit_meta_box() {
54 54
 			global $post;
55 55
 			$output = '';
56
-			if ( !empty($post) && !empty($post->ID) ) {
57
-				$order_meta = get_post_meta( $post->ID, '_order_postmeta', true );
58
-				if( !empty($order_meta) && !empty($order_meta['order_status']) && $order_meta['order_status'] != 'awaiting_payment' ) {
56
+			if (!empty($post) && !empty($post->ID)) {
57
+				$order_meta = get_post_meta($post->ID, '_order_postmeta', true);
58
+				if (!empty($order_meta) && !empty($order_meta['order_status']) && $order_meta['order_status'] != 'awaiting_payment') {
59 59
 					$output .= '<div id="wps_credit_list_container">';
60 60
 					$output .= self::display_credit_list($post->ID);
61 61
 					$output .= '</div>';
62 62
 				}
63
-				$url = wp_nonce_url( admin_url( 'admin-ajax.php?action=wps_credit_make_credit&oid='.$post->ID ), 'wps_credit_make_credit_interface', '_wpnonce' );
63
+				$url = wp_nonce_url(admin_url('admin-ajax.php?action=wps_credit_make_credit&oid=' . $post->ID), 'wps_credit_make_credit_interface', '_wpnonce');
64 64
 				$output .= '<a href="' . $url . '" id="make_credit_button" class="thickbox button">' . __('Make a credit', 'wpshop') . '</a>';
65
-				$output .= '<img src="' .WPSHOP_LOADING_ICON. '" alt="' .__('Loading', 'wpshop'). '" class="wpshopHide" id="change_credit_status_loader" />';
65
+				$output .= '<img src="' . WPSHOP_LOADING_ICON . '" alt="' . __('Loading', 'wpshop') . '" class="wpshopHide" id="change_credit_status_loader" />';
66 66
 			}
67 67
 			echo $output;
68 68
 		}
69 69
 
70 70
 		/** Create a credit **/
71
-		function create_an_credit( $order_id, $product_list = array(), $credit_statut = 'not_paid', $credit_customer_account = '', $products_list_to_restock = array() ) {
71
+		function create_an_credit($order_id, $product_list = array(), $credit_statut = 'not_paid', $credit_customer_account = '', $products_list_to_restock = array()) {
72 72
 			$status = false;
73
-			if ( !empty($order_id) ) {
74
-				$price_piloting_option = get_option( 'wpshop_shop_price_piloting' );
75
-				$order_credits = get_post_meta( $order_id, '_wps_order_credit', true );
76
-				$order_meta = get_post_meta( $order_id, '_order_postmeta', true );
73
+			if (!empty($order_id)) {
74
+				$price_piloting_option = get_option('wpshop_shop_price_piloting');
75
+				$order_credits = get_post_meta($order_id, '_wps_order_credit', true);
76
+				$order_meta = get_post_meta($order_id, '_order_postmeta', true);
77 77
 
78
-				if ( empty($product_list) ) {
79
-					if ( !empty($order_meta) && !empty($order_meta['order_items']) ) {
78
+				if (empty($product_list)) {
79
+					if (!empty($order_meta) && !empty($order_meta['order_items'])) {
80 80
 						$credit_def = array();
81
-						$credit_def['ref'] = self::generate_credit_slip_number( $order_id );
81
+						$credit_def['ref'] = self::generate_credit_slip_number($order_id);
82 82
 						$credit_def['credit_status'] = 'not_paid';
83 83
 						$credit_def['items'] = array();
84 84
 						$credit_total_amount = 0;
85
-						foreach( $order_meta['order_items'] as $item_id => $item ) {
86
-							if ( !empty($item_id) && !empty($item) ) {
87
-								$credit_def['items'][ $item_id ] = $item;
88
-								$credit_total_amount += $credit_def['items'][ $item_id ]['item_total_ttc'];
85
+						foreach ($order_meta['order_items'] as $item_id => $item) {
86
+							if (!empty($item_id) && !empty($item)) {
87
+								$credit_def['items'][$item_id] = $item;
88
+								$credit_total_amount += $credit_def['items'][$item_id]['item_total_ttc'];
89 89
 							}
90 90
 						}
91
-						if ( !empty($order_meta['order_shipping_cost']) ) {
92
-							$credit_def['items'][ 'shipping_cost' ][ 'item_qty' ] = 1;
93
-							$credit_def['items'][ 'shipping_cost' ][ 'item_total_ht' ] = $credit_def['items'][ 'shipping_cost' ]['item_pu_ht'] = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $order_meta['order_shipping_cost'] : $order_meta['order_shipping_cost'] / ( 1 + ( WPSHOP_VAT_ON_SHIPPING_COST / 100 ) );
94
-							$credit_def['items'][ 'shipping_cost' ][ 'item_total_ttc' ] = $credit_def['items'][ 'shipping_cost' ]['item_pu_ttc'] = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $order_meta['order_shipping_cost'] * ( 1 + ( WPSHOP_VAT_ON_SHIPPING_COST / 100 ) ) : $order_meta['order_shipping_cost'];
95
-							$credit_def['items'][ 'shipping_cost' ][ 'item_tva_amount' ] = $credit_def['items'][ 'shipping_cost' ]['item_tva_total_amount'] = $credit_def['items'][ 'shipping_cost' ]['item_pu_ttc'] - $credit_def['items'][ 'shipping_cost' ]['item_pu_ht'];
96
-							$credit_def['items'][ 'shipping_cost' ][ 'item_name' ] = __('Shipping cost', 'wpshop');
97
-							$credit_def['items'][ 'shipping_cost' ][ 'item_tva_rate' ] = WPSHOP_VAT_ON_SHIPPING_COST;
91
+						if (!empty($order_meta['order_shipping_cost'])) {
92
+							$credit_def['items']['shipping_cost']['item_qty'] = 1;
93
+							$credit_def['items']['shipping_cost']['item_total_ht'] = $credit_def['items']['shipping_cost']['item_pu_ht'] = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $order_meta['order_shipping_cost'] : $order_meta['order_shipping_cost'] / (1 + (WPSHOP_VAT_ON_SHIPPING_COST / 100));
94
+							$credit_def['items']['shipping_cost']['item_total_ttc'] = $credit_def['items']['shipping_cost']['item_pu_ttc'] = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $order_meta['order_shipping_cost'] * (1 + (WPSHOP_VAT_ON_SHIPPING_COST / 100)) : $order_meta['order_shipping_cost'];
95
+							$credit_def['items']['shipping_cost']['item_tva_amount'] = $credit_def['items']['shipping_cost']['item_tva_total_amount'] = $credit_def['items']['shipping_cost']['item_pu_ttc'] - $credit_def['items']['shipping_cost']['item_pu_ht'];
96
+							$credit_def['items']['shipping_cost']['item_name'] = __('Shipping cost', 'wpshop');
97
+							$credit_def['items']['shipping_cost']['item_tva_rate'] = WPSHOP_VAT_ON_SHIPPING_COST;
98 98
 						}
99 99
 					}
100 100
 					$d = array();
101 101
 					$d[] = $credit_def;
102
-					update_post_meta( $order_id, '_wps_order_credit', $d );
102
+					update_post_meta($order_id, '_wps_order_credit', $d);
103 103
 				}
104 104
 				else {
105
-					if ( empty($order_credits) ) {
105
+					if (empty($order_credits)) {
106 106
 						$order_credits = array();
107 107
 					}
108 108
 					$credit_def = array();
109 109
 					$credit_def['credit_date'] = current_time('mysql', 0);
110
-					$credit_def['ref'] = self::generate_credit_slip_number( $order_id );
110
+					$credit_def['ref'] = self::generate_credit_slip_number($order_id);
111 111
 					$credit_def['credit_status'] = $credit_statut;
112 112
 					$credit_def['items'] = array();
113 113
 					$credit_total_amount = 0;
114
-					foreach( $product_list as $product_id => $product ) {
115
-						if ( !empty($order_meta) && !empty($order_meta['order_items']) && !empty($order_meta['order_items'][ $product_id ]) ) {
116
-							$credit_def['items'][ $product_id ] = $order_meta['order_items'][ $product_id ];
114
+					foreach ($product_list as $product_id => $product) {
115
+						if (!empty($order_meta) && !empty($order_meta['order_items']) && !empty($order_meta['order_items'][$product_id])) {
116
+							$credit_def['items'][$product_id] = $order_meta['order_items'][$product_id];
117 117
 							/** Check Price & Quantity **/
118
-							if ( !empty($product['qty']) && ($product['qty'] != $credit_def['items'][ $product_id ]['item_qty']) ) {
119
-								$credit_def['items'][ $product_id ]['item_qty'] =  $product['qty'];
120
-								$credit_def['items'][ $product_id ]['item_total_ht'] = $credit_def['items'][ $product_id ]['item_pu_ht'] * $credit_def['items'][ $product_id ]['item_qty'];
121
-								$credit_def['items'][ $product_id ]['item_total_ttc'] = ( $credit_def['items'][ $product_id ]['item_pu_ht'] * ( 1 + ($credit_def['items'][ $product_id ]['item_tva_rate'] / 100) ) ) * $credit_def['items'][ $product_id ]['item_qty'];
122
-								$credit_def['items'][ $product_id ]['item_tva_total_amount'] = ( $credit_def['items'][ $product_id ]['item_pu_ht'] * ( $credit_def['items'][ $product_id ]['item_tva_rate'] / 100) ) * $credit_def['items'][ $product_id ]['item_qty'];
118
+							if (!empty($product['qty']) && ($product['qty'] != $credit_def['items'][$product_id]['item_qty'])) {
119
+								$credit_def['items'][$product_id]['item_qty'] = $product['qty'];
120
+								$credit_def['items'][$product_id]['item_total_ht'] = $credit_def['items'][$product_id]['item_pu_ht'] * $credit_def['items'][$product_id]['item_qty'];
121
+								$credit_def['items'][$product_id]['item_total_ttc'] = ($credit_def['items'][$product_id]['item_pu_ht'] * (1 + ($credit_def['items'][$product_id]['item_tva_rate'] / 100))) * $credit_def['items'][$product_id]['item_qty'];
122
+								$credit_def['items'][$product_id]['item_tva_total_amount'] = ($credit_def['items'][$product_id]['item_pu_ht'] * ($credit_def['items'][$product_id]['item_tva_rate'] / 100)) * $credit_def['items'][$product_id]['item_qty'];
123 123
 							}
124
-							if ( !empty($product['price']) && ($product['price'] != ( ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $credit_def['items'][ $product_id ]['item_pu_ht'] : $credit_def['items'][ $product_id ]['item_qty'] ) ) ) {
125
-								$credit_def['items'][ $product_id ]['item_pu_ht'] = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? (  $product['price'] / ( 1 + ($credit_def['items'][ $product_id ]['item_tva_rate'] / 100) ) ) : $product['price'];
126
-								$credit_def['items'][ $product_id ]['item_pu_ttc'] = $credit_def['items'][ $product_id ]['item_pu_ht'] * ( 1 + ($credit_def['items'][ $product_id ]['item_tva_rate'] / 100) );
127
-								$credit_def['items'][ $product_id ]['item_tva_amount'] = $credit_def['items'][ $product_id ]['item_pu_ht'] * ( 1 + ($credit_def['items'][ $product_id ]['item_tva_rate'] / 100) );
124
+							if (!empty($product['price']) && ($product['price'] != ((!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $credit_def['items'][$product_id]['item_pu_ht'] : $credit_def['items'][$product_id]['item_qty']))) {
125
+								$credit_def['items'][$product_id]['item_pu_ht'] = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? ($product['price'] / (1 + ($credit_def['items'][$product_id]['item_tva_rate'] / 100))) : $product['price'];
126
+								$credit_def['items'][$product_id]['item_pu_ttc'] = $credit_def['items'][$product_id]['item_pu_ht'] * (1 + ($credit_def['items'][$product_id]['item_tva_rate'] / 100));
127
+								$credit_def['items'][$product_id]['item_tva_amount'] = $credit_def['items'][$product_id]['item_pu_ht'] * (1 + ($credit_def['items'][$product_id]['item_tva_rate'] / 100));
128 128
 
129 129
 								/** Total **/
130
-								$credit_def['items'][ $product_id ]['item_total_ht'] = $credit_def['items'][ $product_id ]['item_pu_ht'] * $credit_def['items'][ $product_id ]['item_qty'];
131
-								$credit_def['items'][ $product_id ]['item_total_ttc'] = ( $credit_def['items'][ $product_id ]['item_pu_ht'] * ( 1 + ($credit_def['items'][ $product_id ]['item_tva_rate'] / 100) ) ) * $credit_def['items'][ $product_id ]['item_qty'];
132
-								$credit_def['items'][ $product_id ]['item_tva_total_amount'] = ( $credit_def['items'][ $product_id ]['item_pu_ht'] * ( $credit_def['items'][ $product_id ]['item_tva_rate'] / 100) ) * $credit_def['items'][ $product_id ]['item_qty'];
130
+								$credit_def['items'][$product_id]['item_total_ht'] = $credit_def['items'][$product_id]['item_pu_ht'] * $credit_def['items'][$product_id]['item_qty'];
131
+								$credit_def['items'][$product_id]['item_total_ttc'] = ($credit_def['items'][$product_id]['item_pu_ht'] * (1 + ($credit_def['items'][$product_id]['item_tva_rate'] / 100))) * $credit_def['items'][$product_id]['item_qty'];
132
+								$credit_def['items'][$product_id]['item_tva_total_amount'] = ($credit_def['items'][$product_id]['item_pu_ht'] * ($credit_def['items'][$product_id]['item_tva_rate'] / 100)) * $credit_def['items'][$product_id]['item_qty'];
133 133
 							}
134 134
 						}
135 135
 
136 136
 						/** Shipping Cost Include **/
137
-						if ( $product_id == 'shipping_cost') {
138
-							$credit_def['items'][ $product_id ][ 'item_qty' ] = 1;
139
-							$credit_def['items'][ $product_id ][ 'item_total_ht' ] = $credit_def['items'][ $product_id ]['item_pu_ht'] = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $product['price'] : $product['price'] / ( 1 + ( WPSHOP_VAT_ON_SHIPPING_COST / 100 ) );
140
-							$credit_def['items'][ $product_id ][ 'item_total_ttc' ] = $credit_def['items'][ $product_id ]['item_pu_ttc'] = ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $product['price'] * ( 1 + ( WPSHOP_VAT_ON_SHIPPING_COST / 100 ) ) : $product['price'];
141
-							$credit_def['items'][ $product_id ][ 'item_tva_amount' ] = $credit_def['items'][ $product_id ]['item_tva_total_amount'] = $credit_def['items'][ $product_id ]['item_pu_ttc'] - $credit_def['items'][ $product_id ]['item_pu_ht'];
142
-							$credit_def['items'][ $product_id ][ 'item_name' ] = __('Shipping cost', 'wpshop');
143
-							$credit_def['items'][ $product_id ][ 'item_tva_rate' ] = WPSHOP_VAT_ON_SHIPPING_COST;
137
+						if ($product_id == 'shipping_cost') {
138
+							$credit_def['items'][$product_id]['item_qty'] = 1;
139
+							$credit_def['items'][$product_id]['item_total_ht'] = $credit_def['items'][$product_id]['item_pu_ht'] = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $product['price'] : $product['price'] / (1 + (WPSHOP_VAT_ON_SHIPPING_COST / 100));
140
+							$credit_def['items'][$product_id]['item_total_ttc'] = $credit_def['items'][$product_id]['item_pu_ttc'] = (!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $product['price'] * (1 + (WPSHOP_VAT_ON_SHIPPING_COST / 100)) : $product['price'];
141
+							$credit_def['items'][$product_id]['item_tva_amount'] = $credit_def['items'][$product_id]['item_tva_total_amount'] = $credit_def['items'][$product_id]['item_pu_ttc'] - $credit_def['items'][$product_id]['item_pu_ht'];
142
+							$credit_def['items'][$product_id]['item_name'] = __('Shipping cost', 'wpshop');
143
+							$credit_def['items'][$product_id]['item_tva_rate'] = WPSHOP_VAT_ON_SHIPPING_COST;
144 144
 						}
145 145
 
146
-						$credit_total_amount += $credit_def['items'][ $product_id ]['item_total_ttc'];
146
+						$credit_total_amount += $credit_def['items'][$product_id]['item_total_ttc'];
147 147
 
148
-						if ( !empty($products_list_to_restock) ) {
149
-							if ( array_key_exists( $product_id, $products_list_to_restock) ) {
148
+						if (!empty($products_list_to_restock)) {
149
+							if (array_key_exists($product_id, $products_list_to_restock)) {
150 150
 								/** Check Post type to know if product is a variation **/
151
-								$product_quantity = $credit_def['items'][ $product_id ][ 'item_qty' ];
152
-								$item_post_type = get_post_type( $product_id );
153
-								if ( $item_post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ){
154
-									$parent_product_def = wpshop_products::get_parent_variation( $product_id );
151
+								$product_quantity = $credit_def['items'][$product_id]['item_qty'];
152
+								$item_post_type = get_post_type($product_id);
153
+								if ($item_post_type == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) {
154
+									$parent_product_def = wpshop_products::get_parent_variation($product_id);
155 155
 									$parent_post = $parent_product_def['parent_post'];
156
-									if ( !empty($parent_post) ) {
156
+									if (!empty($parent_post)) {
157 157
 										$product_id = $parent_post->ID;
158 158
 									}
159 159
 								}
160
-								self::restock_product_after_credit( $product_id, $product_quantity );
160
+								self::restock_product_after_credit($product_id, $product_quantity);
161 161
 							}
162 162
 						}
163 163
 
164 164
 					}
165 165
 					$credit_def['total_credit'] = $credit_total_amount;
166 166
 					$order_credits[] = $credit_def;
167
-					update_post_meta( $order_id, '_wps_order_credit', $order_credits );
167
+					update_post_meta($order_id, '_wps_order_credit', $order_credits);
168 168
 
169
-					if ( !empty($credit_customer_account) ) {
170
-						$user_metadata = get_user_meta( $order_meta['customer_id'], '_wps_credit_amount', true);
171
-						if ( empty($user_metadata) ) {
169
+					if (!empty($credit_customer_account)) {
170
+						$user_metadata = get_user_meta($order_meta['customer_id'], '_wps_credit_amount', true);
171
+						if (empty($user_metadata)) {
172 172
 							$user_metadata = 0;
173 173
 						}
174 174
 						$user_metadata += $credit_def['total_credit'];
175
-						update_user_meta( $order_meta['customer_id'], '_wps_credit_amount', $user_metadata );
175
+						update_user_meta($order_meta['customer_id'], '_wps_credit_amount', $user_metadata);
176 176
 					}
177 177
 				}
178 178
 
@@ -186,12 +186,12 @@  discard block
 block discarded – undo
186 186
 		 * @param int $order_id
187 187
 		 * @return string
188 188
 		 */
189
-		function generate_credit_slip_number( $order_id ) {
189
+		function generate_credit_slip_number($order_id) {
190 190
 			/**	Get configuration about the number of figure dor invoice number	*/
191 191
 			$number_figures = get_option('wpshop_credit_slip_number_figures', false);
192 192
 
193 193
 			/** If the number doesn't exist, we create a default one */
194
-			if(!$number_figures) {
194
+			if (!$number_figures) {
195 195
 				update_option('wpshop_credit_slip_number_figures', 5);
196 196
 				$number_figures = 5;
197 197
 			}
@@ -208,29 +208,29 @@  discard block
 block discarded – undo
208 208
 			}
209 209
 			update_option('wpshop_credit_slip_current_number', $credit_slip_number);
210 210
 			/**	Create the new invoice number with all parameters viewed above	*/
211
-			$invoice_ref = WPSHOP_CREDIT_SLIP_REFERENCE_PREFIX. ((string)sprintf('%0'.$number_figures.'d', $credit_slip_number));
211
+			$invoice_ref = WPSHOP_CREDIT_SLIP_REFERENCE_PREFIX . ((string)sprintf('%0' . $number_figures . 'd', $credit_slip_number));
212 212
 			return $invoice_ref;
213 213
 		}
214 214
 
215 215
 		/** Display Credit List **/
216
-		public static function display_credit_list( $order_id ) {
217
-			if ( !empty($order_id) ) {
218
-				$credit_meta = get_post_meta($order_id, '_wps_order_credit', true );
216
+		public static function display_credit_list($order_id) {
217
+			if (!empty($order_id)) {
218
+				$credit_meta = get_post_meta($order_id, '_wps_order_credit', true);
219 219
 				$credit_list = '';
220
-				if ( !empty($credit_meta) ) {
221
-					foreach( $credit_meta as $credit ) {
220
+				if (!empty($credit_meta)) {
221
+					foreach ($credit_meta as $credit) {
222 222
 						$tpl_component = array();
223
-						$tpl_component['CREDIT_DATE'] = ( !empty($credit['credit_date']) ) ? $credit['credit_date'] : '';
223
+						$tpl_component['CREDIT_DATE'] = (!empty($credit['credit_date'])) ? $credit['credit_date'] : '';
224 224
 						$tpl_component['CREDIT_REF'] = $credit['ref'];
225
-						$tpl_component['CREDIT_STATUS_ELEMENTS'] = '<option value="not_paid" ' .( ( !empty($credit['credit_status']) && $credit['credit_status'] == 'not_paid') ? 'selected="selected"' : ''). '>' .__('Not paid', 'wpshop'). '</option>';
226
-						$tpl_component['CREDIT_STATUS_ELEMENTS'] .= '<option value="paid" ' .( ( !empty($credit['credit_status']) && $credit['credit_status'] == 'paid') ? 'selected="selected"' : ''). '>' .__('Paid', 'wpshop'). '</option>';
227
-						$tpl_component['CREDIT_STATUS'] = ( !empty($credit['credit_status']) ) ? $credit['credit_status'] : '';
228
-						$tpl_component['CREDIT_STATUS_ICON'] = ( !empty($credit['credit_status']) && $credit['credit_status'] == 'paid' ) ? 'wpshop_order_payment_received_icon' : 'wpshop_order_incorrect_amount_icon';
229
-						$tpl_component['CREDIT_PDF_LINK'] = '<a href="' .WPSHOP_TEMPLATES_URL. 'credit_slip.php?order_id=' .$order_id. '&credit_ref=' .$credit['ref']. '" target="_blank">' .$credit['ref']. '</a>';
230
-						$tpl_component['CREDIT_PDF_LINK'] .= ' | <a href="' .WPSHOP_TEMPLATES_URL. 'credit_slip.php?order_id=' .$order_id. '&credit_ref=' .$credit['ref']. '&mode=pdf" target="_blank">PDF</a>';
231
-						$credit_list .=  wpshop_display::display_template_element('wps_credit_list_element', $tpl_component, array(), 'admin');
225
+						$tpl_component['CREDIT_STATUS_ELEMENTS'] = '<option value="not_paid" ' . ((!empty($credit['credit_status']) && $credit['credit_status'] == 'not_paid') ? 'selected="selected"' : '') . '>' . __('Not paid', 'wpshop') . '</option>';
226
+						$tpl_component['CREDIT_STATUS_ELEMENTS'] .= '<option value="paid" ' . ((!empty($credit['credit_status']) && $credit['credit_status'] == 'paid') ? 'selected="selected"' : '') . '>' . __('Paid', 'wpshop') . '</option>';
227
+						$tpl_component['CREDIT_STATUS'] = (!empty($credit['credit_status'])) ? $credit['credit_status'] : '';
228
+						$tpl_component['CREDIT_STATUS_ICON'] = (!empty($credit['credit_status']) && $credit['credit_status'] == 'paid') ? 'wpshop_order_payment_received_icon' : 'wpshop_order_incorrect_amount_icon';
229
+						$tpl_component['CREDIT_PDF_LINK'] = '<a href="' . WPSHOP_TEMPLATES_URL . 'credit_slip.php?order_id=' . $order_id . '&credit_ref=' . $credit['ref'] . '" target="_blank">' . $credit['ref'] . '</a>';
230
+						$tpl_component['CREDIT_PDF_LINK'] .= ' | <a href="' . WPSHOP_TEMPLATES_URL . 'credit_slip.php?order_id=' . $order_id . '&credit_ref=' . $credit['ref'] . '&mode=pdf" target="_blank">PDF</a>';
231
+						$credit_list .= wpshop_display::display_template_element('wps_credit_list_element', $tpl_component, array(), 'admin');
232 232
 					}
233
-					$output = wpshop_display::display_template_element('wps_credit_list', array( 'WPS_CREDIT_LIST_ELEMENTS' => $credit_list ), array(), 'admin');
233
+					$output = wpshop_display::display_template_element('wps_credit_list', array('WPS_CREDIT_LIST_ELEMENTS' => $credit_list), array(), 'admin');
234 234
 				}
235 235
 				else {
236 236
 					$output = __('No credit is associated to this order', 'wpshop');
@@ -241,28 +241,28 @@  discard block
 block discarded – undo
241 241
 
242 242
 		/** Display Configuration interface to make credit **/
243 243
 		function wps_credit_make_credit_interface() {
244
-			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
244
+			$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
245 245
 
246
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_make_credit_interface' ) )
246
+			if (!wp_verify_nonce($_wpnonce, 'wps_credit_make_credit_interface'))
247 247
 				wp_die();
248 248
 
249
-			$order_id = ( !empty($_REQUEST['oid']) ) ? wpshop_tools::varSanitizer($_REQUEST['oid']) : null;
249
+			$order_id = (!empty($_REQUEST['oid'])) ? wpshop_tools::varSanitizer($_REQUEST['oid']) : null;
250 250
 			$tab_lines = '';
251
-			$price_piloting_option = get_option( 'wpshop_shop_price_piloting' );
252
-			if ( !empty($order_id) ) {
253
-				$order_meta = get_post_meta( $order_id, '_order_postmeta', true );
254
-				$credit_meta = get_post_meta( $order_id, '_wps_order_credit', true );
255
-				if ( !empty($order_meta) && !empty($order_meta['order_items']) ) {
256
-
257
-					$items = self::check_existing_credits( $order_id, $order_meta['order_items'] );
258
-					if ( !empty($items) ) {
259
-						foreach( $items as $item_id => $item  ) {
251
+			$price_piloting_option = get_option('wpshop_shop_price_piloting');
252
+			if (!empty($order_id)) {
253
+				$order_meta = get_post_meta($order_id, '_order_postmeta', true);
254
+				$credit_meta = get_post_meta($order_id, '_wps_order_credit', true);
255
+				if (!empty($order_meta) && !empty($order_meta['order_items'])) {
256
+
257
+					$items = self::check_existing_credits($order_id, $order_meta['order_items']);
258
+					if (!empty($items)) {
259
+						foreach ($items as $item_id => $item) {
260 260
 							$tpl_component['ITEM_ID'] = $item['item_id'];
261 261
 							$tpl_component['ITEM_NAME'] = $item['item_name'];
262 262
 							$tpl_component['ITEM_QTY'] = $item['item_qty'];
263
-							$tpl_component['ITEM_PRICE'] = number_format( (( !empty($price_piloting_option) && $price_piloting_option == 'HT') ? $item['item_pu_ht'] : $item['item_pu_ttc']), 2, '.', '' );
263
+							$tpl_component['ITEM_PRICE'] = number_format(((!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $item['item_pu_ht'] : $item['item_pu_ttc']), 2, '.', '');
264 264
 							$tab_lines .= wpshop_display::display_template_element('wps_credit_items_table_line', $tpl_component, array(), 'admin');
265
-							unset( $tpl_component );
265
+							unset($tpl_component);
266 266
 
267 267
 						}
268 268
 						$tpl_component['TABLE_LINES'] = $tab_lines;
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 						$tpl_component['LOADING_ICON'] = WPSHOP_LOADING_ICON;
271 271
 						$output = wpshop_display::display_template_element('wps_credit_items_table', $tpl_component, array(), 'admin');
272 272
 
273
-						unset( $tpl_component );
273
+						unset($tpl_component);
274 274
 					}
275 275
 					else {
276
-						$output .= __('All products of this order has been credited', 'wpshop' );
276
+						$output .= __('All products of this order has been credited', 'wpshop');
277 277
 					}
278 278
 				}
279 279
 				else {
@@ -289,61 +289,61 @@  discard block
 block discarded – undo
289 289
 
290 290
 		/** Make a credit action Ajax Form **/
291 291
 		function wps_make_credit_action() {
292
-			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
292
+			$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
293 293
 
294
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_make_credit_action' ) )
294
+			if (!wp_verify_nonce($_wpnonce, 'wps_make_credit_action'))
295 295
 				wp_die();
296 296
 
297 297
 			$status = false; $result = '';
298
-			$price_piloting_option = get_option( 'wpshop_shop_price_piloting' );
298
+			$price_piloting_option = get_option('wpshop_shop_price_piloting');
299 299
 			$product_list_to_return = array();
300
-			$order_id = ( !empty($_POST['order_id']) ) ? wpshop_tools::varSanitizer( $_POST['order_id'] ) : null;
301
-			$wps_credit_return = !empty( $_POST['wps_credit_return'] ) ? (array) $_POST['wps_credit_return'] : array();
302
-			$wps_credit_item_quantity = !empty( $_POST['wps_credit_item_quantity'] ) ? (array) $_POST['wps_credit_item_quantity'] : array();
303
-			$wps_credit_item_price = !empty( $_POST['wps_credit_item_price'] ) ? (array) $_POST['wps_credit_item_price'] : array();
304
-			if ( !empty($order_id) ) {
305
-				if( !empty($wps_credit_return) ) {
306
-					$order_postmeta = get_post_meta( $order_id, '_order_postmeta', true );
307
-					if ( !empty($order_postmeta) && $order_postmeta['order_items'] ) {
308
-						if ( !empty( $wps_credit_return ) && is_array($wps_credit_return) ) {
309
-							foreach( $wps_credit_return as $item_key => $returned_item ) {
310
-	 							if ( !empty( $wps_credit_item_quantity[$item_key] ) && $wps_credit_item_quantity[$item_key] <= $order_postmeta['order_items'][$item_key]['item_qty'] ) {
311
-	 								if ( !empty( $wps_credit_item_price[$item_key] ) && $wps_credit_item_price[$item_key] <= ( ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $order_postmeta['order_items'][$item_key]['item_pu_ht'] : $order_postmeta['order_items'][$item_key]['item_pu_ttc'] ) ){
312
-	 									$product_list_to_return[ $item_key ]['qty'] = sanitize_key( $wps_credit_item_quantity[$item_key] );
313
-	 									$product_list_to_return[ $item_key ]['price'] = sanitize_key( $wps_credit_item_price[$item_key] );
300
+			$order_id = (!empty($_POST['order_id'])) ? wpshop_tools::varSanitizer($_POST['order_id']) : null;
301
+			$wps_credit_return = !empty($_POST['wps_credit_return']) ? (array)$_POST['wps_credit_return'] : array();
302
+			$wps_credit_item_quantity = !empty($_POST['wps_credit_item_quantity']) ? (array)$_POST['wps_credit_item_quantity'] : array();
303
+			$wps_credit_item_price = !empty($_POST['wps_credit_item_price']) ? (array)$_POST['wps_credit_item_price'] : array();
304
+			if (!empty($order_id)) {
305
+				if (!empty($wps_credit_return)) {
306
+					$order_postmeta = get_post_meta($order_id, '_order_postmeta', true);
307
+					if (!empty($order_postmeta) && $order_postmeta['order_items']) {
308
+						if (!empty($wps_credit_return) && is_array($wps_credit_return)) {
309
+							foreach ($wps_credit_return as $item_key => $returned_item) {
310
+	 							if (!empty($wps_credit_item_quantity[$item_key]) && $wps_credit_item_quantity[$item_key] <= $order_postmeta['order_items'][$item_key]['item_qty']) {
311
+	 								if (!empty($wps_credit_item_price[$item_key]) && $wps_credit_item_price[$item_key] <= ((!empty($price_piloting_option) && $price_piloting_option == 'HT') ? $order_postmeta['order_items'][$item_key]['item_pu_ht'] : $order_postmeta['order_items'][$item_key]['item_pu_ttc'])) {
312
+	 									$product_list_to_return[$item_key]['qty'] = sanitize_key($wps_credit_item_quantity[$item_key]);
313
+	 									$product_list_to_return[$item_key]['price'] = sanitize_key($wps_credit_item_price[$item_key]);
314 314
 	 								}
315 315
 	 								else {
316
-	 									$result = __( 'You try to return a product more expensive than what was purchased', 'wpshop' );
316
+	 									$result = __('You try to return a product more expensive than what was purchased', 'wpshop');
317 317
 	 								}
318 318
 	 							}
319 319
 	 							else {
320
-	 								$result = __( 'You try to return more quantity than what was purchased', 'wpshop' );
320
+	 								$result = __('You try to return more quantity than what was purchased', 'wpshop');
321 321
 	 							}
322 322
 							}
323 323
 
324
-							$wps_credit_shipping_cost = !empty( $_POST['wps_credit_shipping_cost'] ) ? sanitize_text_field( $_POST['wps_credit_shipping_cost'] ) : '';
325
-							if( !empty( $wps_credit_shipping_cost ) ) {
324
+							$wps_credit_shipping_cost = !empty($_POST['wps_credit_shipping_cost']) ? sanitize_text_field($_POST['wps_credit_shipping_cost']) : '';
325
+							if (!empty($wps_credit_shipping_cost)) {
326 326
 								$product_list_to_return['shipping_cost']['price'] = $order_postmeta['order_shipping_cost'];
327 327
 							}
328 328
 
329 329
 							/** Check if Returned product is already in a credit **/
330
-							if ( !empty($product_list_to_return) ) {
330
+							if (!empty($product_list_to_return)) {
331 331
 								/** Check restock Item **/
332 332
 								$products_list_to_restock = array();
333
-								$wps_credit_restock = !empty( $_POST['wps_credit_restock'] ) ? sanitize_text_field( $_POST['wps_credit_restock'] ) : '';
334
-								if ( !empty($wps_credit_restock) ) {
333
+								$wps_credit_restock = !empty($_POST['wps_credit_restock']) ? sanitize_text_field($_POST['wps_credit_restock']) : '';
334
+								if (!empty($wps_credit_restock)) {
335 335
 									$products_list_to_restock = $wps_credit_restock;
336 336
 								}
337
-								$wps_credit_status = !empty( $_POST['wps_credit_status'] ) ? sanitize_text_field( $_POST['wps_credit_status'] ) : '';
338
-								$wps_add_credit_value = !empty( $_POST['wps_add_credit_value'] ) ? sanitize_text_field( $_POST['wps_add_credit_value'] ) : '';
337
+								$wps_credit_status = !empty($_POST['wps_credit_status']) ? sanitize_text_field($_POST['wps_credit_status']) : '';
338
+								$wps_add_credit_value = !empty($_POST['wps_add_credit_value']) ? sanitize_text_field($_POST['wps_add_credit_value']) : '';
339 339
 								$credit_status = $wps_credit_status;
340 340
 								$add_credit_value = $wps_add_credit_value;
341
-								$status = self::create_an_credit( $order_id, $product_list_to_return, $credit_status, $add_credit_value, $products_list_to_restock );
341
+								$status = self::create_an_credit($order_id, $product_list_to_return, $credit_status, $add_credit_value, $products_list_to_restock);
342 342
 							}
343 343
 
344 344
 
345
-							if ( $status ) {
346
-								$result = self::display_credit_list( $order_id );
345
+							if ($status) {
346
+								$result = self::display_credit_list($order_id);
347 347
 							}
348 348
 						}
349 349
 					}
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 					$result = __('No product has been selected for credit', 'wpshop');
353 353
 				}
354 354
 			}
355
-			$response = array( $status, $result );
356
-			echo json_encode( $response );
355
+			$response = array($status, $result);
356
+			echo json_encode($response);
357 357
 			die();
358 358
 		}
359 359
 
@@ -362,35 +362,35 @@  discard block
 block discarded – undo
362 362
 		 * @param int $product_id
363 363
 		 * @param int $product_qty
364 364
 		 */
365
-		function restock_product_after_credit( $product_id, $product_qty ) {
365
+		function restock_product_after_credit($product_id, $product_qty) {
366 366
 			global $wpdb;
367 367
 			$stock_attribute_def = wpshop_attributes::getElement('product_stock', '"valid"', 'code');
368
-			$product_type_entity_id = wpshop_entities::get_entity_identifier_from_code( WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT);
369
-			if ( !empty($product_id) && !empty($product_qty) ) {
370
-				$product_postmeta = get_post_meta( $product_id, '_wpshop_product_metadata', true);
371
-				$product_postmeta['product_stock'] = str_replace(',','.', $product_postmeta['product_stock']) + $product_qty;
372
-				update_post_meta( $product_id, '_wpshop_product_metadata', $product_postmeta);
373
-				$wpdb->update( WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL, array('value' => $product_postmeta['product_stock']), array('entity_type_id' => $product_type_entity_id, 'attribute_id' => $stock_attribute_def->id, 'entity_id' => $product_id) );
368
+			$product_type_entity_id = wpshop_entities::get_entity_identifier_from_code(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT);
369
+			if (!empty($product_id) && !empty($product_qty)) {
370
+				$product_postmeta = get_post_meta($product_id, '_wpshop_product_metadata', true);
371
+				$product_postmeta['product_stock'] = str_replace(',', '.', $product_postmeta['product_stock']) + $product_qty;
372
+				update_post_meta($product_id, '_wpshop_product_metadata', $product_postmeta);
373
+				$wpdb->update(WPSHOP_DBT_ATTRIBUTE_VALUES_DECIMAL, array('value' => $product_postmeta['product_stock']), array('entity_type_id' => $product_type_entity_id, 'attribute_id' => $stock_attribute_def->id, 'entity_id' => $product_id));
374 374
 			}
375 375
 		}
376 376
 
377 377
 
378 378
 		/** Check all returned products **/
379
-		function check_existing_credits( $order_id, $items ) {
380
-			$credit_meta = get_post_meta( $order_id, '_wps_order_credit', true);
381
-			if ( !empty($credit_meta) ) {
379
+		function check_existing_credits($order_id, $items) {
380
+			$credit_meta = get_post_meta($order_id, '_wps_order_credit', true);
381
+			if (!empty($credit_meta)) {
382 382
 				$count = 0;
383
-				foreach( $items as $item_id => $item ) {
384
-					foreach( $credit_meta as $credit ) {
385
-						if ( !empty($credit['items']) ) {
386
-							if ( array_key_exists( $item_id, $credit['items'] ) ) {
387
-								$count += $credit['items'][ $item_id ]['item_qty'];
383
+				foreach ($items as $item_id => $item) {
384
+					foreach ($credit_meta as $credit) {
385
+						if (!empty($credit['items'])) {
386
+							if (array_key_exists($item_id, $credit['items'])) {
387
+								$count += $credit['items'][$item_id]['item_qty'];
388 388
 							}
389 389
 						}
390 390
 					}
391
-					if ( $count > 0 ) {
392
-						if( $count >= $item['item_qty'] ) {
393
-							unset( $items[$item_id] );
391
+					if ($count > 0) {
392
+						if ($count >= $item['item_qty']) {
393
+							unset($items[$item_id]);
394 394
 						}
395 395
 						else {
396 396
 							$items[$item_id]['item_qty'] -= $count;
@@ -402,37 +402,37 @@  discard block
 block discarded – undo
402 402
 		}
403 403
 
404 404
 		/** Credit Slip Generation **/
405
-		static function generate_credit_slip( $order_id, $credit_ref ) {
406
-			$order_meta = get_post_meta( $order_id, '_order_postmeta', true);
407
-			$credit_meta = get_post_meta( $order_id, '_wps_order_credit', true );
408
-
409
-			if ( !empty($credit_meta) ) {
410
-				foreach( $credit_meta as $id => $credit_def ) {
411
-					if ( $credit_def['ref'] == $credit_ref ) {
412
-						$credit = $credit_meta[ $id ];
405
+		static function generate_credit_slip($order_id, $credit_ref) {
406
+			$order_meta = get_post_meta($order_id, '_order_postmeta', true);
407
+			$credit_meta = get_post_meta($order_id, '_wps_order_credit', true);
408
+
409
+			if (!empty($credit_meta)) {
410
+				foreach ($credit_meta as $id => $credit_def) {
411
+					if ($credit_def['ref'] == $credit_ref) {
412
+						$credit = $credit_meta[$id];
413 413
 					}
414 414
 				}
415 415
 			}
416 416
 
417 417
 
418
-			$credit_date = ( !empty($credit) && !empty($credit['credit_date']) ) ? $credit['credit_date'] : '';
418
+			$credit_date = (!empty($credit) && !empty($credit['credit_date'])) ? $credit['credit_date'] : '';
419 419
 			$logo_options = get_option('wpshop_logo');
420 420
 			$tpl_component['INVOICE_SUMMARY_MORE'] = '';
421
-			$tpl_component['INVOICE_LOGO'] = ( !empty($logo_options) ) ? '<img src="' .$logo_options .'" alt="" />' : '';
422
-			$tpl_component['INVOICE_ORDER_KEY_INDICATION'] = sprintf( __('Correction on order n. %s', 'wpshop'), $order_meta['order_key'] );
423
-			$tpl_component['INVOICE_ORDER_DATE_INDICATION'] = sprintf( __('Credit slip date %s', 'wpshop'), $credit_date ) ;
421
+			$tpl_component['INVOICE_LOGO'] = (!empty($logo_options)) ? '<img src="' . $logo_options . '" alt="" />' : '';
422
+			$tpl_component['INVOICE_ORDER_KEY_INDICATION'] = sprintf(__('Correction on order n. %s', 'wpshop'), $order_meta['order_key']);
423
+			$tpl_component['INVOICE_ORDER_DATE_INDICATION'] = sprintf(__('Credit slip date %s', 'wpshop'), $credit_date);
424 424
 			$tpl_component['INVOICE_VALIDATE_TIME'] = '';
425 425
 			$tpl_component['IBAN_INFOS'] = '';
426 426
 
427 427
 
428
-			$tpl_component['AMOUNT_INFORMATION'] = sprintf( __('Amount are shown in %s', 'wpshop'), wpshop_tools::wpshop_get_currency( true ) );
428
+			$tpl_component['AMOUNT_INFORMATION'] = sprintf(__('Amount are shown in %s', 'wpshop'), wpshop_tools::wpshop_get_currency(true));
429 429
 
430 430
 			/** Header **/
431
-			$tpl_component['INVOICE_TITLE'] = __('Credit slip', 'wpshop' );
431
+			$tpl_component['INVOICE_TITLE'] = __('Credit slip', 'wpshop');
432 432
 			$tpl_component['INVOICE_ORDER_INVOICE_REF'] = $credit_ref;
433 433
 
434 434
 			$tpl_component['INVOICE_SENDER'] = wpshop_modules_billing::generate_invoice_sender_part();
435
-			$tpl_component['INVOICE_RECEIVER'] = wpshop_modules_billing::generate_receiver_part( $order_id );
435
+			$tpl_component['INVOICE_RECEIVER'] = wpshop_modules_billing::generate_receiver_part($order_id);
436 436
 
437 437
 			/** Tab **/
438 438
 			$tpl_component['INVOICE_HEADER'] = wpshop_display::display_template_element('credit_slip_row_header', array(), array(), 'common');
@@ -440,18 +440,18 @@  discard block
 block discarded – undo
440 440
 			/** Rows **/
441 441
 			$tpl_component['INVOICE_ROWS'] = '';
442 442
 			$total_HT = $total_TTC = 0; $credit_TVA = array();
443
-			if ( !empty($credit['items']) ) {
444
-				foreach( $credit['items'] as $item ) {
443
+			if (!empty($credit['items'])) {
444
+				foreach ($credit['items'] as $item) {
445 445
 					$sub_tpl_component = array();
446 446
 					$sub_tpl_component['INVOICE_ROW_ITEM_NAME'] = $item['item_name'];
447
-					$sub_tpl_component['INVOICE_ROW_ITEM_TOTAL_HT'] = '-'.number_format( $item['item_total_ht'], 2, '.', '' );
448
-					$sub_tpl_component['INVOICE_ROW_ITEM_TVA_TOTAL_AMOUNT'] = '-'.number_format( $item['item_tva_total_amount'], 2, '.', '' ).' ('.$item['item_tva_rate'].'%)';
449
-					$sub_tpl_component['INVOICE_ROW_ITEM_TOTAL_TTC'] = '-'.number_format( $item['item_total_ttc'], 2, '.', '' );
447
+					$sub_tpl_component['INVOICE_ROW_ITEM_TOTAL_HT'] = '-' . number_format($item['item_total_ht'], 2, '.', '');
448
+					$sub_tpl_component['INVOICE_ROW_ITEM_TVA_TOTAL_AMOUNT'] = '-' . number_format($item['item_tva_total_amount'], 2, '.', '') . ' (' . $item['item_tva_rate'] . '%)';
449
+					$sub_tpl_component['INVOICE_ROW_ITEM_TOTAL_TTC'] = '-' . number_format($item['item_total_ttc'], 2, '.', '');
450 450
 
451 451
 					$total_HT += $item['item_total_ht'];
452 452
 					$total_TTC += $item['item_total_ttc'];
453 453
 
454
-					if ( empty($credit_TVA[(string)$item['item_tva_rate']]) ) {
454
+					if (empty($credit_TVA[(string)$item['item_tva_rate']])) {
455 455
 						$credit_TVA[$item['item_tva_rate']] = $item['item_tva_total_amount'];
456 456
 					}
457 457
 					else {
@@ -460,25 +460,25 @@  discard block
 block discarded – undo
460 460
 
461 461
 
462 462
 					$tpl_component['INVOICE_ROWS'] .= wpshop_display::display_template_element('credit_slip_row', $sub_tpl_component, array(), 'common');
463
-					unset( $sub_tpl_component );
463
+					unset($sub_tpl_component);
464 464
 				}
465 465
 
466 466
 			}
467 467
 
468 468
 			$d = '';
469
-			foreach( $credit_TVA as $tx => $value ) {
470
-				$tva_tpl_component['SUMMARY_ROW_TITLE'] = sprintf( __('Tax amount (%s %s)', 'wpshop'), $tx, '%' );
471
-				$tva_tpl_component['SUMMARY_ROW_VALUE'] = '-'.number_format($value, '2', '.', '').' '.wpshop_tools::wpshop_get_currency( false );
469
+			foreach ($credit_TVA as $tx => $value) {
470
+				$tva_tpl_component['SUMMARY_ROW_TITLE'] = sprintf(__('Tax amount (%s %s)', 'wpshop'), $tx, '%');
471
+				$tva_tpl_component['SUMMARY_ROW_VALUE'] = '-' . number_format($value, '2', '.', '') . ' ' . wpshop_tools::wpshop_get_currency(false);
472 472
 				$d .= wpshop_display::display_template_element('invoice_summary_row', $tva_tpl_component, array(), 'common');
473
-				unset( $tva_tpl_component );
473
+				unset($tva_tpl_component);
474 474
 			}
475 475
 			$sub_tpl_component['CREDIT_SLIP_SUMMARY_TVA'] = $d;
476 476
 
477 477
 
478 478
 			$sub_tpl_component['INVOICE_SUMMARY_MORE'] = '';
479 479
 
480
-			$sub_tpl_component['CREDIT_SLIP_TOTAL_HT'] = '-'.number_format( $total_HT, '2', '.', '');
481
-			$sub_tpl_component['CREDIT_SLIP_ORDER_GRAND_TOTAL'] = '-'.number_format($total_TTC, '2', '.', '');
480
+			$sub_tpl_component['CREDIT_SLIP_TOTAL_HT'] = '-' . number_format($total_HT, '2', '.', '');
481
+			$sub_tpl_component['CREDIT_SLIP_ORDER_GRAND_TOTAL'] = '-' . number_format($total_TTC, '2', '.', '');
482 482
 
483 483
 
484 484
 			$tpl_component['INVOICE_SUMMARY_PART'] = wpshop_display::display_template_element('credit_slip_summary_part', $sub_tpl_component, array(), 'common');
@@ -490,39 +490,39 @@  discard block
 block discarded – undo
490 490
 
491 491
 
492 492
 			$output = wpshop_display::display_template_element('invoice_page_content', $tpl_component, array(), 'common');
493
-			unset( $tpl_component );
493
+			unset($tpl_component);
494 494
 			return $output;
495 495
 		}
496 496
 
497 497
 		function wps_credit_change_status() {
498
-			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
498
+			$_wpnonce = !empty($_POST['_wpnonce']) ? sanitize_text_field($_POST['_wpnonce']) : '';
499 499
 
500
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_change_status' ) )
500
+			if (!wp_verify_nonce($_wpnonce, 'wps_credit_change_status'))
501 501
 				wp_die();
502 502
 
503 503
 			$status = false; $result = '';
504
-			$order_id = ( !empty($_POST['order_id']) ) ? wpshop_tools::varSanitizer( $_POST['order_id'] ): null;
505
-			$credit_ref = ( !empty($_POST['credit_ref']) ) ? wpshop_tools::varSanitizer( $_POST['credit_ref'] ): null;
506
-			$selected_status = ( !empty($_POST['selected_status']) ) ? wpshop_tools::varSanitizer( $_POST['selected_status'] ): null;
504
+			$order_id = (!empty($_POST['order_id'])) ? wpshop_tools::varSanitizer($_POST['order_id']) : null;
505
+			$credit_ref = (!empty($_POST['credit_ref'])) ? wpshop_tools::varSanitizer($_POST['credit_ref']) : null;
506
+			$selected_status = (!empty($_POST['selected_status'])) ? wpshop_tools::varSanitizer($_POST['selected_status']) : null;
507 507
 
508
-			if ( !empty( $order_id) && !empty($credit_ref) ) {
509
-				$credit_meta = get_post_meta( $order_id, '_wps_order_credit', true );
508
+			if (!empty($order_id) && !empty($credit_ref)) {
509
+				$credit_meta = get_post_meta($order_id, '_wps_order_credit', true);
510 510
 				$id = 0;
511
-				if ( !empty($credit_meta) ) {
512
-					foreach( $credit_meta as $credit_id => $credit_def ) {
513
-						if ( $credit_def['ref'] == $credit_ref ) {
511
+				if (!empty($credit_meta)) {
512
+					foreach ($credit_meta as $credit_id => $credit_def) {
513
+						if ($credit_def['ref'] == $credit_ref) {
514 514
 							$id = $credit_id;
515 515
 						}
516 516
 					}
517 517
 					$credit_meta[$id]['credit_status'] = $selected_status;
518
-					update_post_meta( $order_id, '_wps_order_credit', $credit_meta );
518
+					update_post_meta($order_id, '_wps_order_credit', $credit_meta);
519 519
 					$status = true;
520
-					$result = self::display_credit_list( $order_id );
520
+					$result = self::display_credit_list($order_id);
521 521
 				}
522 522
 			}
523 523
 
524
-			$response = array( 'status' => $status, 'response' => $result);
525
-			echo json_encode( $response );
524
+			$response = array('status' => $status, 'response' => $result);
525
+			echo json_encode($response);
526 526
 			die();
527 527
 		}
528 528
 
@@ -531,32 +531,32 @@  discard block
 block discarded – undo
531 531
 		 * @param array $order_metadata
532 532
 		 * @param array $posted_datas
533 533
 		 */
534
-		function wps_credit_actions_on_order_save( $order_metadata, $posted_datas ) {
535
-			if ( ( !empty($posted_datas['markascanceled_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['markascanceled_order_hidden_indicator']) == 'canceled' ) || ( !empty($posted_datas['markasrefunded_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['markasrefunded_order_hidden_indicator']) == 'refunded' ) || ( !empty($posted_datas['resendordertocustomer_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['resendordertocustomer_order_hidden_indicator']) == 'resended' ) ) {
536
-				if( empty($posted_datas['resendordertocustomer_order_hidden_indicator'] )) {
534
+		function wps_credit_actions_on_order_save($order_metadata, $posted_datas) {
535
+			if ((!empty($posted_datas['markascanceled_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['markascanceled_order_hidden_indicator']) == 'canceled') || (!empty($posted_datas['markasrefunded_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['markasrefunded_order_hidden_indicator']) == 'refunded') || (!empty($posted_datas['resendordertocustomer_order_hidden_indicator']) && wpshop_tools::varSanitizer($posted_datas['resendordertocustomer_order_hidden_indicator']) == 'resended')) {
536
+				if (empty($posted_datas['resendordertocustomer_order_hidden_indicator'])) {
537 537
 					// Make a credit
538
-					$this->create_an_credit( $posted_datas['post_ID'] );
539
-					if( !empty($posted_datas['markascanceled_order_hidden_indicator']) ) {
538
+					$this->create_an_credit($posted_datas['post_ID']);
539
+					if (!empty($posted_datas['markascanceled_order_hidden_indicator'])) {
540 540
 						$order_metadata['order_status'] = wpshop_tools::varSanitizer($posted_datas['markascanceled_order_hidden_indicator']);
541
-					} elseif( !empty($posted_datas['markasrefunded_order_hidden_indicator']) ) {
541
+					} elseif (!empty($posted_datas['markasrefunded_order_hidden_indicator'])) {
542 542
 						$order_metadata['order_status'] = wpshop_tools::varSanitizer($posted_datas['markasrefunded_order_hidden_indicator']);
543 543
 					}
544
-					$order_metadata['order_payment']['refunded_action']['refunded_date'] = current_time('mysql', 0 );
544
+					$order_metadata['order_payment']['refunded_action']['refunded_date'] = current_time('mysql', 0);
545 545
 					$order_metadata['order_payment']['refunded_action']['author'] = get_current_user_id();
546
-				} elseif(wpshop_tools::varSanitizer($posted_datas['resendordertocustomer_order_hidden_indicator']) == 'resended' ) {
546
+				} elseif (wpshop_tools::varSanitizer($posted_datas['resendordertocustomer_order_hidden_indicator']) == 'resended') {
547 547
 					$order_id = $posted_datas['post_ID'];
548 548
 					$order_info = get_post_meta($order_id, '_order_info', true);
549
-					$user_data = get_userdata( $order_metadata['customer_id'] );
550
-					$shipping_mode_option = get_option( 'wps_shipping_mode' );
551
-					$shipping_method = ( !empty($order_metadata['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_metadata['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_metadata['order_payment']['shipping_method']]['name'] : ( (!empty($order_metadata['order_payment']['shipping_method']) ) ? $order_metadata['order_payment']['shipping_method'] : '' );
552
-					$email = ( !empty($user_data) && !empty($user_data->user_email) ) ? $user_data->user_email : '';
549
+					$user_data = get_userdata($order_metadata['customer_id']);
550
+					$shipping_mode_option = get_option('wps_shipping_mode');
551
+					$shipping_method = (!empty($order_metadata['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_metadata['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_metadata['order_payment']['shipping_method']]['name'] : ((!empty($order_metadata['order_payment']['shipping_method'])) ? $order_metadata['order_payment']['shipping_method'] : '');
552
+					$email = (!empty($user_data) && !empty($user_data->user_email)) ? $user_data->user_email : '';
553 553
 					//echo '<pre>'; print_r($email); echo '</pre>'; exit();
554
-					$first_name = (!empty($order_info) && !empty($order_info['billing']) &&  !empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '' );
555
-					$last_name = ( !empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '' );
556
-					$allow_send_invoice = get_option( 'wpshop_send_invoice' );
554
+					$first_name = (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_first_name']) ? $order_info['billing']['address']['address_first_name'] : '');
555
+					$last_name = (!empty($order_info) && !empty($order_info['billing']) && !empty($order_info['billing']['address']['address_last_name']) ? $order_info['billing']['address']['address_last_name'] : '');
556
+					$allow_send_invoice = get_option('wpshop_send_invoice');
557 557
 					$payment_methods = new wpshop_payment();
558 558
 					$key = count($order_metadata['order_payment']['received']) - 1;
559
-					$invoice_attachment_file = ( !empty($allow_send_invoice) ) ? wpshop_modules_billing::generate_invoice_for_email( $order_id, $order_metadata['order_payment']['received'][$key]['invoice_ref'] ) : '';
559
+					$invoice_attachment_file = (!empty($allow_send_invoice)) ? wpshop_modules_billing::generate_invoice_for_email($order_id, $order_metadata['order_payment']['received'][$key]['invoice_ref']) : '';
560 560
 					$wps_message = new wps_message_ctr();
561 561
 					$wps_message->wpshop_prepared_email($email, 'WPSHOP_OTHERS_PAYMENT_CONFIRMATION_MESSAGE', array('order_key' => $order_metadata['order_key'], 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'order_date' => $order_metadata['order_date'], 'order_shipping_method' => $shipping_method), array(), $invoice_attachment_file);
562 562
 				}
@@ -566,6 +566,6 @@  discard block
 block discarded – undo
566 566
 
567 567
 	}
568 568
 }
569
-if ( class_exists('wps_credit') ) {
569
+if (class_exists('wps_credit')) {
570 570
 	$wps_classic_checkout = new wps_credit();
571 571
 }
Please login to merge, or discard this patch.
Braces   +23 added lines, -29 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
2 4
 /**
3 5
  * WP Shop Credit bootstrap file
4 6
  * @author Jérôme ALLEGRE - Eoxia dev team <[email protected]>
@@ -100,8 +102,7 @@  discard block
 block discarded – undo
100 102
 					$d = array();
101 103
 					$d[] = $credit_def;
102 104
 					update_post_meta( $order_id, '_wps_order_credit', $d );
103
-				}
104
-				else {
105
+				} else {
105 106
 					if ( empty($order_credits) ) {
106 107
 						$order_credits = array();
107 108
 					}
@@ -202,8 +203,7 @@  discard block
 block discarded – undo
202 203
 			/** If the counter doesn't exist, we initiate it */
203 204
 			if (!$credit_slip_number) {
204 205
 				$credit_slip_number = 1;
205
-			}
206
-			else {
206
+			} else {
207 207
 				$credit_slip_number++;
208 208
 			}
209 209
 			update_option('wpshop_credit_slip_current_number', $credit_slip_number);
@@ -231,8 +231,7 @@  discard block
 block discarded – undo
231 231
 						$credit_list .=  wpshop_display::display_template_element('wps_credit_list_element', $tpl_component, array(), 'admin');
232 232
 					}
233 233
 					$output = wpshop_display::display_template_element('wps_credit_list', array( 'WPS_CREDIT_LIST_ELEMENTS' => $credit_list ), array(), 'admin');
234
-				}
235
-				else {
234
+				} else {
236 235
 					$output = __('No credit is associated to this order', 'wpshop');
237 236
 				}
238 237
 			}
@@ -243,8 +242,9 @@  discard block
 block discarded – undo
243 242
 		function wps_credit_make_credit_interface() {
244 243
 			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
245 244
 
246
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_make_credit_interface' ) )
247
-				wp_die();
245
+			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_make_credit_interface' ) ) {
246
+							wp_die();
247
+			}
248 248
 
249 249
 			$order_id = ( !empty($_REQUEST['oid']) ) ? wpshop_tools::varSanitizer($_REQUEST['oid']) : null;
250 250
 			$tab_lines = '';
@@ -271,16 +271,13 @@  discard block
 block discarded – undo
271 271
 						$output = wpshop_display::display_template_element('wps_credit_items_table', $tpl_component, array(), 'admin');
272 272
 
273 273
 						unset( $tpl_component );
274
-					}
275
-					else {
274
+					} else {
276 275
 						$output .= __('All products of this order has been credited', 'wpshop' );
277 276
 					}
278
-				}
279
-				else {
277
+				} else {
280 278
 					$output = __('order informations are not available. You can\'t make a credit.', 'wpshop');
281 279
 				}
282
-			}
283
-			else {
280
+			} else {
284 281
 				$output = __('order ID is not defined. You can\t make a credit.', 'wpshop');
285 282
 			}
286 283
 			echo $output;
@@ -291,8 +288,9 @@  discard block
 block discarded – undo
291 288
 		function wps_make_credit_action() {
292 289
 			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
293 290
 
294
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_make_credit_action' ) )
295
-				wp_die();
291
+			if ( !wp_verify_nonce( $_wpnonce, 'wps_make_credit_action' ) ) {
292
+							wp_die();
293
+			}
296 294
 
297 295
 			$status = false; $result = '';
298 296
 			$price_piloting_option = get_option( 'wpshop_shop_price_piloting' );
@@ -311,12 +309,10 @@  discard block
 block discarded – undo
311 309
 	 								if ( !empty( $wps_credit_item_price[$item_key] ) && $wps_credit_item_price[$item_key] <= ( ( !empty($price_piloting_option) && $price_piloting_option == 'HT' ) ? $order_postmeta['order_items'][$item_key]['item_pu_ht'] : $order_postmeta['order_items'][$item_key]['item_pu_ttc'] ) ){
312 310
 	 									$product_list_to_return[ $item_key ]['qty'] = sanitize_key( $wps_credit_item_quantity[$item_key] );
313 311
 	 									$product_list_to_return[ $item_key ]['price'] = sanitize_key( $wps_credit_item_price[$item_key] );
314
-	 								}
315
-	 								else {
312
+	 								} else {
316 313
 	 									$result = __( 'You try to return a product more expensive than what was purchased', 'wpshop' );
317 314
 	 								}
318
-	 							}
319
-	 							else {
315
+	 							} else {
320 316
 	 								$result = __( 'You try to return more quantity than what was purchased', 'wpshop' );
321 317
 	 							}
322 318
 							}
@@ -347,8 +343,7 @@  discard block
 block discarded – undo
347 343
 							}
348 344
 						}
349 345
 					}
350
-				}
351
-				else {
346
+				} else {
352 347
 					$result = __('No product has been selected for credit', 'wpshop');
353 348
 				}
354 349
 			}
@@ -391,8 +386,7 @@  discard block
 block discarded – undo
391 386
 					if ( $count > 0 ) {
392 387
 						if( $count >= $item['item_qty'] ) {
393 388
 							unset( $items[$item_id] );
394
-						}
395
-						else {
389
+						} else {
396 390
 							$items[$item_id]['item_qty'] -= $count;
397 391
 						}
398 392
 					}
@@ -453,8 +447,7 @@  discard block
 block discarded – undo
453 447
 
454 448
 					if ( empty($credit_TVA[(string)$item['item_tva_rate']]) ) {
455 449
 						$credit_TVA[$item['item_tva_rate']] = $item['item_tva_total_amount'];
456
-					}
457
-					else {
450
+					} else {
458 451
 						$credit_TVA[(string)$item['item_tva_rate']] += $item['item_tva_total_amount'];
459 452
 					}
460 453
 
@@ -497,8 +490,9 @@  discard block
 block discarded – undo
497 490
 		function wps_credit_change_status() {
498 491
 			$_wpnonce = !empty( $_POST['_wpnonce'] ) ? sanitize_text_field( $_POST['_wpnonce'] ) : '';
499 492
 
500
-			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_change_status' ) )
501
-				wp_die();
493
+			if ( !wp_verify_nonce( $_wpnonce, 'wps_credit_change_status' ) ) {
494
+							wp_die();
495
+			}
502 496
 
503 497
 			$status = false; $result = '';
504 498
 			$order_id = ( !empty($_POST['order_id']) ) ? wpshop_tools::varSanitizer( $_POST['order_id'] ): null;
Please login to merge, or discard this patch.
includes/modules/wps_shortcodes/templates/backend/shortcode_help_tab.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 ?> 
3 3
 $shortcode = ( empty($shortcode) ) ? array() : $shortcode;
4 4
 foreach( $shortcodes as $categorie => $cat_content ) {
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
 			
20 20
 			echo __($id_shortcode);
21 21
 			
22
-			$shortcode['args'] = ( empty($shortcode['args']) ) ? array() : $shortcode['args'];
23
-			foreach( $shortcode['args'] as $argument => $parameter ) {
22
+			$shortcode['args'] = (empty($shortcode['args'])) ? array() : $shortcode['args'];
23
+			foreach ($shortcode['args'] as $argument => $parameter) {
24 24
 				echo ' ' . $argument . '="' . $parameter . '"';
25 25
 			}
26 26
 			
27 27
 			?>]</code> <?php
28 28
 
29
-			echo !empty($shortcode['description']) ?  __($shortcode['description']) . ' ' : '';
29
+			echo !empty($shortcode['description']) ? __($shortcode['description']) . ' ' : '';
30 30
 			
31 31
 			echo '<i style="color:';
32
-			if( $shortcode['active'] == 'true' ) {
32
+			if ($shortcode['active'] == 'true') {
33 33
 				echo 'green">' . __('Active', 'wpshop');
34 34
 			} else {
35 35
 				echo 'red">' . __('Inactive', 'wpshop');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
includes/modules/wps_shortcodes/templates/backend/list-shortcode.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if (!defined('ABSPATH')) exit; ?>
2 2
 
3 3
 <div id="shortcode-tabs" class="wpshop_tabs wpshop_full_page_tabs wpshop_shortcode_tabs" >
4 4
 	<ul>
@@ -11,78 +11,78 @@  discard block
 block discarded – undo
11 11
 
12 12
 	<div id="products">
13 13
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_product" >
14
-			<h3><?php _e('Simple product','wpshop'); ?></h3>
14
+			<h3><?php _e('Simple product', 'wpshop'); ?></h3>
15 15
 			<?php self::output_shortcode('simple_product'); ?>
16
-			<h3><?php _e( 'Product title', 'wpshop' ); ?></h3>
17
-			<?php self::output_shortcode( 'wpshop_product_title' ); ?>
18
-			<h3><?php _e( 'Product content', 'wpshop' ); ?></h3>
19
-			<?php self::output_shortcode( 'wpshop_product_content' ); ?>
20
-			<h3><?php _e( 'Product thumbnail', 'wpshop' ); ?></h3>
21
-			<?php self::output_shortcode( 'wpshop_product_thumbnail' ); ?>
22
-			<h3><?php _e('Products listing','wpshop'); ?></h3>
16
+			<h3><?php _e('Product title', 'wpshop'); ?></h3>
17
+			<?php self::output_shortcode('wpshop_product_title'); ?>
18
+			<h3><?php _e('Product content', 'wpshop'); ?></h3>
19
+			<?php self::output_shortcode('wpshop_product_content'); ?>
20
+			<h3><?php _e('Product thumbnail', 'wpshop'); ?></h3>
21
+			<?php self::output_shortcode('wpshop_product_thumbnail'); ?>
22
+			<h3><?php _e('Products listing', 'wpshop'); ?></h3>
23 23
 			<?php self::output_shortcode('product_listing'); ?>
24
-			<h3><?php _e('Products listing specific','wpshop'); ?></h3>
24
+			<h3><?php _e('Products listing specific', 'wpshop'); ?></h3>
25 25
 			<?php self::output_shortcode('product_listing_specific'); ?>
26
-			<h3><?php _e('Products listing by attributes','wpshop'); ?></h3>
26
+			<h3><?php _e('Products listing by attributes', 'wpshop'); ?></h3>
27 27
 			<?php self::output_shortcode('product_by_attribute'); ?>
28
-			<h3><?php _e( 'Related products', 'wpshop'); ?></h3>
28
+			<h3><?php _e('Related products', 'wpshop'); ?></h3>
29 29
 			<?php self::output_shortcode('related_products'); ?>
30 30
 		</div>
31 31
 	</div>
32 32
 
33 33
 	<div id="category">
34 34
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_category" >
35
-			<h3><?php _e('Simple category','wpshop'); ?></h3>
35
+			<h3><?php _e('Simple category', 'wpshop'); ?></h3>
36 36
 			<?php self::output_shortcode('simple_category'); ?>
37 37
 		</div>
38 38
 	</div>
39 39
 
40 40
 	<div id="attributs">
41 41
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_attributes" >
42
-			<h3><?php _e('Simple attribute','wpshop'); ?></h3>
42
+			<h3><?php _e('Simple attribute', 'wpshop'); ?></h3>
43 43
 			<?php self::output_shortcode('simple_attribute'); ?>
44
-			<h3><?php _e('Attributes set','wpshop'); ?></h3>
44
+			<h3><?php _e('Attributes set', 'wpshop'); ?></h3>
45 45
 			<?php self::output_shortcode('attributes_set'); ?>
46 46
 		</div>
47 47
 	</div>
48 48
 
49 49
 	<div id="widgets">
50 50
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_widget_cart" >
51
-			<h3><?php _e('Cart','wpshop'); ?></h3>
51
+			<h3><?php _e('Cart', 'wpshop'); ?></h3>
52 52
 			<?php self::output_shortcode('widget_cart_full'); ?>
53 53
 			<?php self::output_shortcode('widget_cart_mini'); ?>
54 54
 			<?php self::output_shortcode('wpshop_button_add_to_cart'); ?>
55 55
 		</div>
56 56
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_widget_checkout" >
57
-			<h3><?php _e('Checkout','wpshop'); ?></h3>
57
+			<h3><?php _e('Checkout', 'wpshop'); ?></h3>
58 58
 			<?php self::output_shortcode('widget_checkout'); ?>
59 59
 		</div>
60 60
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_widget_customer_account" >
61
-			<h3><?php _e('Account','wpshop'); ?></h3>
61
+			<h3><?php _e('Account', 'wpshop'); ?></h3>
62 62
 			<?php self::output_shortcode('widget_account'); ?>
63 63
 		</div>
64 64
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_widget_shop" >
65
-			<h3><?php _e('Shop','wpshop'); ?></h3>
65
+			<h3><?php _e('Shop', 'wpshop'); ?></h3>
66 66
 			<?php self::output_shortcode('widget_shop'); ?>
67 67
 		</div>
68 68
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_custom_search" >
69
-			<h3><?php _e('Custom search','wpshop'); ?></h3>
69
+			<h3><?php _e('Custom search', 'wpshop'); ?></h3>
70 70
 			<?php self::output_shortcode('widget_custom_search'); ?>
71 71
 		</div>
72 72
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_custom_search" >
73
-			<h3><?php _e('Filter Search','wpshop'); ?></h3>
73
+			<h3><?php _e('Filter Search', 'wpshop'); ?></h3>
74 74
 			<?php self::output_shortcode('widget_filter_search'); ?>
75
-			<a href="http://www.wpshop.fr/documentations/la-recherche-par-filtre/" target="_blank"><?php _e( 'Read the filter search tutorial', 'wpshop'); ?></a>
75
+			<a href="http://www.wpshop.fr/documentations/la-recherche-par-filtre/" target="_blank"><?php _e('Read the filter search tutorial', 'wpshop'); ?></a>
76 76
 		</div>
77 77
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_widget wpshop_admin_box_shortcode_custom_search" >
78
-			<h3><?php _e('Breadcrumb WPShop','wpshop'); ?></h3>
78
+			<h3><?php _e('Breadcrumb WPShop', 'wpshop'); ?></h3>
79 79
 			<?php self::output_shortcode('widget_wps_breadcrumb'); ?>
80 80
 		</div>
81 81
 	</div>
82 82
 
83 83
 	<div id="customs_emails">
84 84
 		<div class="wpshop_admin_box wpshop_admin_box_shortcode wpshop_admin_box_shortcode_emails" >
85
-			<h3><?php _e('Available tags for emails cutomization','wpshop'); ?></h3>
85
+			<h3><?php _e('Available tags for emails cutomization', 'wpshop'); ?></h3>
86 86
 			<ul >
87 87
 				<li><span class="wpshop_customer_tag_name" ><?php _e('Customer first name', 'wpshop'); ?></span><code>[customer_first_name]</code><li>
88 88
 				<li><span class="wpshop_customer_tag_name" ><?php _e('Customer last name', 'wpshop'); ?></span><code>[customer_last_name]</code><li>
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <form id="wps_create_free_product" method="post" action="<?php echo admin_url('admin-ajax.php'); ?>">
3 6
 
4 7
 	<input type="hidden" name="action" value="wps_create_new_free_product">
Please login to merge, or discard this patch.
includes/modules/wps_shortcodes/wps_shortcodes.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3
-DEFINE( 'WPS_SHORTCODES_VERSION', '1.0.1' );
4
-DEFINE( 'WPS_SHORTCODES_DIR', basename(dirname(__FILE__)));
5
-DEFINE( 'WPS_SHORTCODES_PATH', dirname( __FILE__ ) );
6
-DEFINE( 'WPS_SHORTCODES_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', str_replace( "\\", "/", WPS_SHORTCODES_PATH ) ) );
3
+DEFINE('WPS_SHORTCODES_VERSION', '1.0.1');
4
+DEFINE('WPS_SHORTCODES_DIR', basename(dirname(__FILE__)));
5
+DEFINE('WPS_SHORTCODES_PATH', dirname(__FILE__));
6
+DEFINE('WPS_SHORTCODES_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', str_replace("\\", "/", WPS_SHORTCODES_PATH)));
7 7
 
8 8
 /**	Define the templates directories	*/
9
-DEFINE( 'WPS_SHORTCODES_TEMPLATES_MAIN_DIR', WPS_SHORTCODES_PATH . '/templates/');
9
+DEFINE('WPS_SHORTCODES_TEMPLATES_MAIN_DIR', WPS_SHORTCODES_PATH . '/templates/');
10 10
 
11
-require_once( WPS_SHORTCODES_PATH . '/controller/wps_shortcodes_ctr.php' );
11
+require_once(WPS_SHORTCODES_PATH . '/controller/wps_shortcodes_ctr.php');
12 12
 
13 13
 new wps_shortcodes_ctr();
14 14
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
includes/modules/wps_quotation/templates/backend/addon-activated.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;?>
1
+<?php if (!defined('ABSPATH')) exit; ?>
2 2
 <hr/>
3
-<span class="wps-alert-success" ><?php _e( 'Quotation addon is currently activated', 'wpshop' ); ?></span>
4 3
\ No newline at end of file
4
+<span class="wps-alert-success" ><?php _e('Quotation addon is currently activated', 'wpshop'); ?></span>
5 5
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,6 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <hr/>
3 6
 <span class="wps-alert-success" ><?php _e( 'Quotation addon is currently activated', 'wpshop' ); ?></span>
4 7
\ No newline at end of file
Please login to merge, or discard this patch.
modules/wps_quotation/templates/backend/add_free_product_form_page_tpl.php 2 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <form id="wps_create_free_product" method="post" action="<?php echo admin_url('admin-ajax.php'); ?>">
3 6
 
4 7
 	<input type="hidden" name="action" value="wps_create_new_free_product">
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit; ?>
2
-<form id="wps_create_free_product" data-nonce="<?php echo wp_create_nonce( 'wps_add_product_to_order_admin' ); ?> " method="post" action="<?php echo admin_url('admin-ajax.php'); ?>">
1
+<?php if (!defined('ABSPATH')) exit; ?>
2
+<form id="wps_create_free_product" data-nonce="<?php echo wp_create_nonce('wps_add_product_to_order_admin'); ?> " method="post" action="<?php echo admin_url('admin-ajax.php'); ?>">
3 3
 
4 4
 	<input type="hidden" name="action" value="wps_create_new_free_product">
5
-	<?php wp_nonce_field( 'wps_create_new_free_product' ); ?>
5
+	<?php wp_nonce_field('wps_create_new_free_product'); ?>
6 6
 
7 7
 	<div class="wps-boxed" style="margin-top:10px;">
8
-		<span class="wps-h5"><?php _e( 'Product', 'wpshop'); ?></span>
8
+		<span class="wps-h5"><?php _e('Product', 'wpshop'); ?></span>
9 9
 
10 10
 		<div class="wpshop_cls" >
11 11
 			<div class="wpshop_form_label _product_title_label alignleft" >
12
-				<label for="attribute_product_title" ><?php _e( 'Product name', 'wpshop'); ?> <span class="wpshop_required" >*</span></label>
12
+				<label for="attribute_product_title" ><?php _e('Product name', 'wpshop'); ?> <span class="wpshop_required" >*</span></label>
13 13
 			</div>
14 14
 			<div class="wpshop_form_input_element _product_title_input alignleft" >
15 15
 				<input type="text" name="post_title" id="post_title" value="" class="wpshop_product_attribute_post_title wpshop_attributes_display">
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 		<div class="wpshop_cls" >
20 20
 			<div class="wpshop_form_label _description_label alignleft" >
21
-				<label for="attribute_description" ><?php _e( 'Description', 'wpshop'); ?></label>
21
+				<label for="attribute_description" ><?php _e('Description', 'wpshop'); ?></label>
22 22
 			</div>
23 23
 			<div class="wpshop_form_input_element _description_input alignleft" >
24 24
 				<textarea name="post_content" id="post_content" class="wpshop_product_post_content wpshop_attributes_display" rows="2"></textarea>
@@ -30,21 +30,21 @@  discard block
 block discarded – undo
30 30
 	<?php
31 31
 		$attribute_set_list = wpshop_attributes_set::get_attribute_set_list_for_entity(wpshop_entities::get_entity_identifier_from_code('wpshop_product'));
32 32
 		$id_attribute_set = null;
33
-		foreach( $attribute_set_list as $attribute_set ) {
34
-			if( $attribute_set->name == 'free_product' ) {
33
+		foreach ($attribute_set_list as $attribute_set) {
34
+			if ($attribute_set->name == 'free_product') {
35 35
 				$id_attribute_set = $attribute_set->id;
36 36
 				break;
37 37
 			}
38 38
 		}
39
-		$list = empty( $id_attribute_set ) ? array() : wpshop_attributes_set::getAttributeSetDetails($id_attribute_set);
40
-		foreach($list as $group) {
39
+		$list = empty($id_attribute_set) ? array() : wpshop_attributes_set::getAttributeSetDetails($id_attribute_set);
40
+		foreach ($list as $group) {
41 41
 	?>
42 42
 
43 43
 	<div class="wps-boxed">
44 44
 		<span class="wps-h5"><?php echo $group['name']; ?></span>
45 45
 		<?php
46
-			foreach($group['attribut'] as $attribute_key => $attribute) {
47
-				if( !empty($attribute_key) && $attribute->status == 'valid' ) {
46
+			foreach ($group['attribut'] as $attribute_key => $attribute) {
47
+				if (!empty($attribute_key) && $attribute->status == 'valid') {
48 48
 					$output = wpshop_attributes::display_attribute($attribute->code);
49 49
 					echo $output['field'];
50 50
 				}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		}
57 57
 	?>
58 58
 
59
-	<button class="wps-bton-first-mini-rounded alignRight" id="add_free_product_form_bton"><?php _e( 'Add product', 'wpshop'); ?></button>
59
+	<button class="wps-bton-first-mini-rounded alignRight" id="add_free_product_form_bton"><?php _e('Add product', 'wpshop'); ?></button>
60 60
 
61 61
 </form>
62 62
 
Please login to merge, or discard this patch.
includes/modules/wps_quotation/templates/backend/addon-activation.php 2 patches
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;?>
1
+<?php if ( !defined( 'ABSPATH' ) ) {
2
+	exit;
3
+}
4
+?>
2 5
 <hr/>
3 6
 <div class="wps-quotation-addon-state-message-container" ></div>
4 7
 <div class="wps-quotation-addon-state-container" >
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;?>
1
+<?php if (!defined('ABSPATH')) exit; ?>
2 2
 <hr/>
3 3
 <div class="wps-quotation-addon-state-message-container" ></div>
4 4
 <div class="wps-quotation-addon-state-container" >
5
-	<?php printf( __( 'Extend WPShop basic quotation functionnality with %1$sour quotation extra module%2$s', 'wpshop' ), '<a target="shop_eoxia_quotaion_addon" href="' . $quotation_module_def[ 'PluginURI' ] . '" >', '</a>' ); ?><br/>
6
-	<?php _e( 'Already have bought the module? Simply type your code below to activate module', 'wpshop' ); ?>
7
-	<input type="text" name="wps-quotation-check-code-value" id="wps-quotation-check-code-value" value="" placeholder="<?php _e( 'Type your code here', 'wpshop' ); ?>" /><button class="wps-bton-mini-third-rounded wps-bton-loading" data-nonce="<?php echo wp_create_nonce( 'check_code_for_activation' ); ?>" id="wps-quotation-check-code-button" ><?php _e( 'Check code', 'wpshop' ); ?></button>
5
+	<?php printf(__('Extend WPShop basic quotation functionnality with %1$sour quotation extra module%2$s', 'wpshop'), '<a target="shop_eoxia_quotaion_addon" href="' . $quotation_module_def['PluginURI'] . '" >', '</a>'); ?><br/>
6
+	<?php _e('Already have bought the module? Simply type your code below to activate module', 'wpshop'); ?>
7
+	<input type="text" name="wps-quotation-check-code-value" id="wps-quotation-check-code-value" value="" placeholder="<?php _e('Type your code here', 'wpshop'); ?>" /><button class="wps-bton-mini-third-rounded wps-bton-loading" data-nonce="<?php echo wp_create_nonce('check_code_for_activation'); ?>" id="wps-quotation-check-code-button" ><?php _e('Check code', 'wpshop'); ?></button>
8 8
 </div>
Please login to merge, or discard this patch.
includes/modules/wps_quotation/wps_quotation.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1
-<?php if ( !defined( 'ABSPATH' ) ) exit;
1
+<?php if (!defined('ABSPATH')) exit;
2 2
 
3 3
 /**
4 4
  * Define the current version for the plugin. Interresting for clear cache for plugin style and script
5 5
  * @var string Plugin current version number
6 6
  */
7
-DEFINE( 'WPS_QUOTATION_VERSION', '1.0');
7
+DEFINE('WPS_QUOTATION_VERSION', '1.0');
8 8
 
9 9
 /**	Définition des constantes pour le module / Define constant for module	*/
10
-DEFINE( 'WPS_QUOTATION_DIR', basename(dirname(__FILE__)));
11
-DEFINE( 'WPS_QUOTATION_PATH_TO_MODULE', str_replace( str_replace( "\\", "/", WP_PLUGIN_DIR ), "", str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) ) );
12
-DEFINE( 'WPS_QUOTATION_PATH', str_replace( "\\", "/", plugin_dir_path( __FILE__ ) ) );
13
-DEFINE( 'WPS_QUOTATION_URL', str_replace( str_replace( "\\", "/", ABSPATH), site_url() . '/', WPS_QUOTATION_PATH ) );
10
+DEFINE('WPS_QUOTATION_DIR', basename(dirname(__FILE__)));
11
+DEFINE('WPS_QUOTATION_PATH_TO_MODULE', str_replace(str_replace("\\", "/", WP_PLUGIN_DIR), "", str_replace("\\", "/", plugin_dir_path(__FILE__))));
12
+DEFINE('WPS_QUOTATION_PATH', str_replace("\\", "/", plugin_dir_path(__FILE__)));
13
+DEFINE('WPS_QUOTATION_URL', str_replace(str_replace("\\", "/", ABSPATH), site_url() . '/', WPS_QUOTATION_PATH));
14 14
 
15 15
 /**	Définition du chemin absolu vers les templates / Define the templates absolute directories	*/
16
-DEFINE( 'WPS_QUOTATION_TEMPLATES_MAIN_DIR', WPS_QUOTATION_PATH . '/templates/');
16
+DEFINE('WPS_QUOTATION_TEMPLATES_MAIN_DIR', WPS_QUOTATION_PATH . '/templates/');
17 17
 
18
-load_plugin_textdomain( 'wps_quotation', false, basename(dirname(__FILE__)).'/languages/');
18
+load_plugin_textdomain('wps_quotation', false, basename(dirname(__FILE__)) . '/languages/');
19 19
 
20
-include( plugin_dir_path( __FILE__ ).'/controller/wps_quotation_backend_ctr.php' );
20
+include(plugin_dir_path(__FILE__) . '/controller/wps_quotation_backend_ctr.php');
21 21
 
22 22
 new wps_quotation_backend_ctr();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.