@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | /** Generate the billing reference regarding the order $order_id |
245 | 245 | * @return void |
246 | - */ |
|
246 | + */ |
|
247 | 247 | function order_generate_billing_number($order_id, $force_invoicing = false){ |
248 | 248 | global $wpdb, $wpshop_modules_billing; |
249 | 249 | |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | |
265 | 265 | |
266 | 266 | /** Renvoi une nouvelle r�f�rence unique pour une commande |
267 | - * @return int |
|
268 | - */ |
|
267 | + * @return int |
|
268 | + */ |
|
269 | 269 | public static function get_new_order_reference(){ |
270 | 270 | $number_figures = get_option('wpshop_order_number_figures', false); |
271 | 271 | /* If the number doesn't exist, we create a default one */ |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | /** Renvoi une nouvelle r�f�rence unique pour un devis |
288 | - * @return int |
|
289 | - */ |
|
288 | + * @return int |
|
289 | + */ |
|
290 | 290 | public static function get_new_pre_order_reference($save = true){ |
291 | 291 | $number_figures = get_option('wpshop_order_number_figures', false); |
292 | 292 | /* If the number doesn't exist, we create a default one */ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | |
349 | 349 | /** Set the custom colums |
350 | 350 | * @return array |
351 | - */ |
|
351 | + */ |
|
352 | 352 | static function orders_edit_columns($columns){ |
353 | 353 | $columns = array( |
354 | 354 | 'cb' => '<input type="checkbox" />', |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | |
368 | 368 | /** Give the content by column |
369 | 369 | * @return array |
370 | - */ |
|
370 | + */ |
|
371 | 371 | public static function orders_custom_columns($column, $post_id) { |
372 | 372 | if ( get_post_type( $post_id ) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) { |
373 | 373 | global $civility, $order_status; |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | |
262 | 262 | |
263 | 263 | /** Renvoi une nouvelle r�f�rence unique pour une commande |
264 | - * @return int |
|
264 | + * @return string |
|
265 | 265 | */ |
266 | 266 | public static function get_new_order_reference(){ |
267 | 267 | $number_figures = get_option('wpshop_order_number_figures', false); |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | /** Renvoi une nouvelle r�f�rence unique pour un devis |
285 | - * @return int |
|
285 | + * @return string |
|
286 | 286 | */ |
287 | 287 | public static function get_new_pre_order_reference($save = true){ |
288 | 288 | $number_figures = get_option('wpshop_order_number_figures', false); |
@@ -662,6 +662,10 @@ discard block |
||
662 | 662 | |
663 | 663 | return $output; |
664 | 664 | } |
665 | + |
|
666 | + /** |
|
667 | + * @param boolean $state |
|
668 | + */ |
|
665 | 669 | static function display_customer_pay_quotation( $state, $oid ) { |
666 | 670 | $label = ( ( $state ) ? __('Invalid quotation', 'wpshop') : __('Valid quotation', 'wpshop') ); |
667 | 671 | $btn = '<p><a role="button" data-nonce="' . wp_create_nonce( 'wps_quotation_is_payable_by_customer' ) . '" class="wps-bton-' . ( ( $state ) ? 'third' : 'second' ) . '-mini-rounded quotation_is_payable_by_customer" href="#" >'.$label.'</a></p>'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Products management method file |
4 | 4 | * |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | /* Check if file is include. No direct access possible with file url */ |
13 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
14 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
13 | +if (!defined('WPSHOP_VERSION')) { |
|
14 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | /** Add action button */ |
71 | 71 | add_meta_box( |
72 | 72 | 'wpshop_order_actions', |
73 | - '<span class="dashicons dashicons-info"></span> '.__('Actions on order', 'wpshop'), |
|
73 | + '<span class="dashicons dashicons-info"></span> ' . __('Actions on order', 'wpshop'), |
|
74 | 74 | array('wpshop_orders', 'order_actions'), |
75 | 75 | WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'high' |
76 | 76 | ); |
77 | 77 | |
78 | - if ( !in_array( $post->post_status, array( 'auto-draft' ) ) ) { |
|
78 | + if (!in_array($post->post_status, array('auto-draft'))) { |
|
79 | 79 | add_meta_box('wpshop_credit_actions', __('Credit on order', 'wpshop'), array('wps_credit', 'wps_credit_meta_box'), WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'side', 'low'); |
80 | 80 | } |
81 | 81 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param object $order The current order being edited |
102 | 102 | */ |
103 | - public static function order_actions( $order ) { |
|
103 | + public static function order_actions($order) { |
|
104 | 104 | $output = ''; |
105 | 105 | |
106 | 106 | $order_status = unserialize(WPSHOP_ORDER_STATUS); |
@@ -108,34 +108,34 @@ discard block |
||
108 | 108 | |
109 | 109 | $tpl_component = array(); |
110 | 110 | |
111 | - $delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url( get_delete_post_link($order->ID) ) , 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') : __('Move to Trash', 'wpshop'))), array(), 'admin'); |
|
112 | - $tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can( "delete_post", $order->ID ) ? $delete_button : ''; |
|
111 | + $delete_button = wpshop_display::display_template_element('wpshop_admin_order_action_del_button', array('ADMIN_ORDER_DELETE_LINK' => esc_url(get_delete_post_link($order->ID)), 'ADMIN_ORDER_DELETE_TEXT' => (!EMPTY_TRASH_DAYS ? __('Delete Permanently', 'wpshop') : __('Move to Trash', 'wpshop'))), array(), 'admin'); |
|
112 | + $tpl_component['ADMIN_ORDER_DELETE_ORDER'] = current_user_can("delete_post", $order->ID) ? $delete_button : ''; |
|
113 | 113 | |
114 | 114 | /** Add an action list */ |
115 | 115 | $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = ''; |
116 | 116 | |
117 | 117 | /** Display main information about the order */ |
118 | 118 | $order_main_info = ''; |
119 | - if(!empty($order_postmeta['order_date'])){ |
|
120 | - $order_main_info .= '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>'.__('Order date','wpshop').' : </strong><br/>'.mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true).'</div>'; |
|
119 | + if (!empty($order_postmeta['order_date'])) { |
|
120 | + $order_main_info .= '<div class="wps-product-section"><span class="dashicons dashicons-calendar-alt"></span> <strong>' . __('Order date', 'wpshop') . ' : </strong><br/>' . mysql2date('d F Y H:i:s', $order_postmeta['order_date'], true) . '</div>'; |
|
121 | 121 | } |
122 | 122 | $order_main_info .= '<div class="wps-product-section">'; |
123 | - if(empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))){ |
|
124 | - $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Temporary quotation reference','wpshop').': </strong>'.self::get_new_pre_order_reference(false).'<br/>'; |
|
123 | + if (empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))) { |
|
124 | + $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Temporary quotation reference', 'wpshop') . ': </strong>' . self::get_new_pre_order_reference(false) . '<br/>'; |
|
125 | 125 | } |
126 | - else{ |
|
127 | - if(!empty($order_postmeta['order_key'])){ |
|
128 | - $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Order reference','wpshop').' : </strong>'.$order_postmeta['order_key'].'<br/>'; |
|
126 | + else { |
|
127 | + if (!empty($order_postmeta['order_key'])) { |
|
128 | + $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Order reference', 'wpshop') . ' : </strong>' . $order_postmeta['order_key'] . '<br/>'; |
|
129 | 129 | } |
130 | - if(!empty($order_postmeta['order_temporary_key'])){ |
|
131 | - $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Pre-order reference','wpshop').': </strong>'.$order_postmeta['order_temporary_key'].'<br/>'; |
|
132 | - $post_ID = !empty( $_GET['post'] ) ? (int) $_GET['post'] : 0; |
|
133 | - $order_main_info .= '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf' ) . '">' .__('Download the quotation', 'wpshop'). '</a><br />'; |
|
130 | + if (!empty($order_postmeta['order_temporary_key'])) { |
|
131 | + $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Pre-order reference', 'wpshop') . ': </strong>' . $order_postmeta['order_temporary_key'] . '<br/>'; |
|
132 | + $post_ID = !empty($_GET['post']) ? (int)$_GET['post'] : 0; |
|
133 | + $order_main_info .= '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $post_ID . '&mode=pdf') . '">' . __('Download the quotation', 'wpshop') . '</a><br />'; |
|
134 | 134 | } |
135 | - if(!empty($order_postmeta['order_invoice_ref'])){ |
|
135 | + if (!empty($order_postmeta['order_invoice_ref'])) { |
|
136 | 136 | $sub_tpl_component = array(); |
137 | - $order_invoice_download = '<a href="' . admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf' ) . '">' . __('Download invoice', 'wpshop') . '</a><br />'; |
|
138 | - $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'. __('Invoice number','wpshop').': </strong>'.$order_postmeta['order_invoice_ref'].'<br/>' . $order_invoice_download . ''; |
|
137 | + $order_invoice_download = '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf') . '">' . __('Download invoice', 'wpshop') . '</a><br />'; |
|
138 | + $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>' . __('Invoice number', 'wpshop') . ': </strong>' . $order_postmeta['order_invoice_ref'] . '<br/>' . $order_invoice_download . ''; |
|
139 | 139 | } |
140 | 140 | else { |
141 | 141 | $order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin'); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | |
147 | 147 | /*Add the current order status in display**/ |
148 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= ( !empty($order_postmeta['order_status']) ) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) ) : ''; |
|
148 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= (!empty($order_postmeta['order_status'])) ? (sprintf('<span class="order_status_' . $order->ID . ' wpshop_order_status_container wpshop_order_status_%1$s ">%2$s</span>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop'))) : ''; |
|
149 | 149 | |
150 | 150 | $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= $order_main_info; |
151 | 151 | |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | </div>'; |
164 | 164 | }*/ |
165 | 165 | |
166 | - if( ( ( !empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation' ) || !empty( $order_postmeta['order_temporary_key'] ) ) && in_array( $order_postmeta['order_status'], array( 'awaiting_payment', 'partially_paid' ) ) && (float) $order_postmeta['order_amount_to_pay_now'] != (float) 0 ) { |
|
167 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation( isset( $order_postmeta['pay_quotation'] ), $order->ID ) . '</div>'; |
|
166 | + if (((!empty($order_postmeta['cart_type']) && $order_postmeta['cart_type'] == 'quotation') || !empty($order_postmeta['order_temporary_key'])) && in_array($order_postmeta['order_status'], array('awaiting_payment', 'partially_paid')) && (float)$order_postmeta['order_amount_to_pay_now'] != (float)0) { |
|
167 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section">' . self::display_customer_pay_quotation(isset($order_postmeta['pay_quotation']), $order->ID) . '</div>'; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -175,30 +175,30 @@ discard block |
||
175 | 175 | }*/ |
176 | 176 | |
177 | 177 | /*Add the button regarding the order status**/ |
178 | - if ( !empty($order_postmeta['order_status']) ) { |
|
179 | - if( $order_postmeta['order_status'] == 'awaiting_payment' ) { |
|
180 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_'.$order->ID.'" >'.__('Cancel this order', 'wpshop').'</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>'; |
|
178 | + if (!empty($order_postmeta['order_status'])) { |
|
179 | + if ($order_postmeta['order_status'] == 'awaiting_payment') { |
|
180 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section"><button class="wps-bton-second-mini-rounded markAsCanceled order_' . $order->ID . '" >' . __('Cancel this order', 'wpshop') . '</button><input type="hidden" id="markascanceled_order_hidden_indicator" name="markascanceled_order_hidden_indicator" /></div>'; |
|
181 | 181 | } |
182 | - $credit_meta = get_post_meta( $order->ID, '_wps_order_credit', true ); |
|
182 | + $credit_meta = get_post_meta($order->ID, '_wps_order_credit', true); |
|
183 | 183 | |
184 | - $total_received = (float) 0; |
|
185 | - if ( ! empty( $order_postmeta['order_payment'] ) && ! empty( $order_postmeta['order_payment']['received'] ) ) { |
|
186 | - foreach( $order_postmeta['order_payment']['received'] as $received ) { |
|
187 | - $total_received += (float) isset( $received['received_amount'] ) ? $received['received_amount'] : 0; |
|
184 | + $total_received = (float)0; |
|
185 | + if (!empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['received'])) { |
|
186 | + foreach ($order_postmeta['order_payment']['received'] as $received) { |
|
187 | + $total_received += (float)isset($received['received_amount']) ? $received['received_amount'] : 0; |
|
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - if ( empty($credit_meta) && (float) 0 !== $total_received ) { |
|
192 | - if( $order_postmeta['order_status'] == 'refunded') { |
|
193 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' .__('Credit Slip number', 'wpshop'). ' : <strong>'. ( (!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref']) ) ? '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' .$order->ID. '&invoice_ref=' .$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'&credit_slip=ok' ). '" target="_blank">'.$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'</a>' : '') .'</strong></div>'; |
|
191 | + if (empty($credit_meta) && (float)0 !== $total_received) { |
|
192 | + if ($order_postmeta['order_status'] == 'refunded') { |
|
193 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' . __('Credit Slip number', 'wpshop') . ' : <strong>' . ((!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref'])) ? '<a href="' . admin_url('admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '&credit_slip=ok') . '" target="_blank">' . $order_postmeta['order_payment']['refunded_action']['credit_slip_ref'] . '</a>' : '') . '</strong></div>'; |
|
194 | 194 | } |
195 | 195 | else { |
196 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' .$order->ID. '">' .__('Refund this order', 'wpshop'). '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>'; |
|
196 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' . $order->ID . '">' . __('Refund this order', 'wpshop') . '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>'; |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
200 | - $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev( preg_replace( strrev( '/wps-product-section/' ), '', strrev( $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] ), 1 ) ); |
|
201 | - echo wpshop_display::display_template_element( 'wpshop_admin_order_action_box', $tpl_component, array( 'type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID ), 'admin' ); |
|
200 | + $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] = strrev(preg_replace(strrev('/wps-product-section/'), '', strrev($tpl_component['ADMIN_ORDER_ACTIONS_LIST']), 1)); |
|
201 | + echo wpshop_display::display_template_element('wpshop_admin_order_action_box', $tpl_component, array('type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, 'id' => $order->ID), 'admin'); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | function order_container_in_admin() { |
207 | 207 | global $post; |
208 | 208 | $output = '<div id="wps_order_content_container">'; |
209 | - $output .= self::order_content( $post ); |
|
209 | + $output .= self::order_content($post); |
|
210 | 210 | $output .= '</div>'; |
211 | 211 | echo $output; |
212 | 212 | } |
@@ -217,13 +217,13 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param order $post The complete order content |
219 | 219 | */ |
220 | - function order_content( $post ) { |
|
220 | + function order_content($post) { |
|
221 | 221 | $order_content = ''; |
222 | 222 | |
223 | 223 | $order = get_post_meta($post->ID, '_order_postmeta', true); |
224 | 224 | |
225 | 225 | $order_content .= '<div id="order_product_container" class="order_product_container wpshop_cls" >'; |
226 | - if($order){/* Read the order content if the order has product */ |
|
226 | + if ($order) {/* Read the order content if the order has product */ |
|
227 | 227 | $order_content .= '<input type="hidden" value="" name="order_products_to_delete" id="order_products_to_delete" />' . wpshop_cart::display_cart(true, $order, 'admin'); |
228 | 228 | if (empty($order['order_invoice_ref'])) { |
229 | 229 | $order_content .= '<div id="order_refresh_button_container" class="wpshop_clear_block" ><input type="button" class="button-primary alignright wpshopHide" id="wpshop_admin_order_recalculate" value="' . __('Refresh order informations', 'wpshop') . '" /></div>'; |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | /** Generate the billing reference regarding the order $order_id |
242 | 242 | * @return void |
243 | 243 | */ |
244 | - function order_generate_billing_number($order_id, $force_invoicing = false){ |
|
244 | + function order_generate_billing_number($order_id, $force_invoicing = false) { |
|
245 | 245 | global $wpdb, $wpshop_modules_billing; |
246 | 246 | |
247 | 247 | // Get the order from the db |
248 | 248 | $order = get_post_meta($order_id, '_order_postmeta', true); |
249 | 249 | |
250 | 250 | // If the payment is completed |
251 | - if(($order['order_status']=='completed') || $force_invoicing) { |
|
251 | + if (($order['order_status'] == 'completed') || $force_invoicing) { |
|
252 | 252 | |
253 | 253 | // If the reference hasn't been generated yet |
254 | - if(empty($order['order_invoice_ref'])) { |
|
255 | - $order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number( $order_id ); |
|
254 | + if (empty($order['order_invoice_ref'])) { |
|
255 | + $order['order_invoice_ref'] = $wpshop_modules_billing->generate_invoice_number($order_id); |
|
256 | 256 | |
257 | 257 | update_post_meta($order_id, '_order_postmeta', $order); |
258 | 258 | } |
@@ -263,45 +263,45 @@ discard block |
||
263 | 263 | /** Renvoi une nouvelle r�f�rence unique pour une commande |
264 | 264 | * @return int |
265 | 265 | */ |
266 | - public static function get_new_order_reference(){ |
|
266 | + public static function get_new_order_reference() { |
|
267 | 267 | $number_figures = get_option('wpshop_order_number_figures', false); |
268 | 268 | /* If the number doesn't exist, we create a default one */ |
269 | - if(!$number_figures){ |
|
269 | + if (!$number_figures) { |
|
270 | 270 | $number_figures = 5; |
271 | 271 | update_option('wpshop_order_number_figures', $number_figures); |
272 | 272 | } |
273 | 273 | |
274 | 274 | $order_current_number = get_option('wpshop_order_current_number', false); |
275 | 275 | /* If the counter doesn't exist, we initiate it */ |
276 | - if(!$order_current_number) { $order_current_number = 1; } |
|
276 | + if (!$order_current_number) { $order_current_number = 1; } |
|
277 | 277 | else { $order_current_number++; } |
278 | 278 | update_option('wpshop_order_current_number', $order_current_number); |
279 | 279 | |
280 | - $order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number); |
|
281 | - return WPSHOP_ORDER_REFERENCE_PREFIX.$order_ref; |
|
280 | + $order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number); |
|
281 | + return WPSHOP_ORDER_REFERENCE_PREFIX . $order_ref; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** Renvoi une nouvelle r�f�rence unique pour un devis |
285 | 285 | * @return int |
286 | 286 | */ |
287 | - public static function get_new_pre_order_reference($save = true){ |
|
287 | + public static function get_new_pre_order_reference($save = true) { |
|
288 | 288 | $number_figures = get_option('wpshop_order_number_figures', false); |
289 | 289 | /* If the number doesn't exist, we create a default one */ |
290 | - if(!$number_figures){ |
|
290 | + if (!$number_figures) { |
|
291 | 291 | $number_figures = 5; |
292 | 292 | update_option('wpshop_order_number_figures', $number_figures); |
293 | 293 | } |
294 | 294 | |
295 | 295 | $order_current_number = get_option('wpshop_preorder_current_number', false); |
296 | 296 | /* If the counter doesn't exist, we initiate it */ |
297 | - if(!$order_current_number) { $order_current_number = 1; } |
|
297 | + if (!$order_current_number) { $order_current_number = 1; } |
|
298 | 298 | else { $order_current_number++; } |
299 | - if($save){ |
|
299 | + if ($save) { |
|
300 | 300 | update_option('wpshop_preorder_current_number', $order_current_number); |
301 | 301 | } |
302 | 302 | |
303 | - $order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number); |
|
304 | - return WPSHOP_PREORDER_REFERENCE_PREFIX.$order_ref; |
|
303 | + $order_ref = (string)sprintf('%0' . $number_figures . 'd', $order_current_number); |
|
304 | + return WPSHOP_PREORDER_REFERENCE_PREFIX . $order_ref; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -316,24 +316,24 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @return void |
318 | 318 | */ |
319 | - public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id='', $billing_address_id=''){ |
|
319 | + public static function set_order_customer_addresses($user_id, $order_id, $shipping_address_id = '', $billing_address_id = '') { |
|
320 | 320 | /** Get order informations */ |
321 | 321 | $billing_info['id'] = get_post_meta($billing_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true); |
322 | - $billing_info['address'] = get_post_meta($billing_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true); |
|
323 | - $billing_info['address_id'] = ( !empty($_SESSION['billing_address']) ) ? intval( $_SESSION['billing_address'] ) : ''; |
|
324 | - if ( !empty($_SESSION['shipping_partner_id']) ) { |
|
325 | - $partner_address_id = get_post_meta( $_SESSION['shipping_partner_id'], '_wpshop_attached_address', true); |
|
322 | + $billing_info['address'] = get_post_meta($billing_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true); |
|
323 | + $billing_info['address_id'] = (!empty($_SESSION['billing_address'])) ? intval($_SESSION['billing_address']) : ''; |
|
324 | + if (!empty($_SESSION['shipping_partner_id'])) { |
|
325 | + $partner_address_id = get_post_meta($_SESSION['shipping_partner_id'], '_wpshop_attached_address', true); |
|
326 | 326 | if (!empty($partner_address_id)) { |
327 | - foreach( $partner_address_id as $address_id ) { |
|
327 | + foreach ($partner_address_id as $address_id) { |
|
328 | 328 | $shipping_info['id'] = get_post_meta($address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true); |
329 | - $shipping_info['address'] = get_post_meta( $address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true); |
|
329 | + $shipping_info['address'] = get_post_meta($address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true); |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | } |
333 | 333 | else { |
334 | 334 | $shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true); |
335 | - $shipping_info['address'] = get_post_meta($shipping_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true); |
|
336 | - $shipping_info['address_id'] = ( !empty($_SESSION['shipping_address']) ) ? intval( $_SESSION['shipping_address'] ) : ''; |
|
335 | + $shipping_info['address'] = get_post_meta($shipping_address_id, '_' . WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS . '_metadata', true); |
|
336 | + $shipping_info['address_id'] = (!empty($_SESSION['shipping_address'])) ? intval($_SESSION['shipping_address']) : ''; |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | $order_info = array('billing' => $billing_info, 'shipping' => $shipping_info); |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | /** Set the custom colums |
347 | 347 | * @return array |
348 | 348 | */ |
349 | - static function orders_edit_columns($columns){ |
|
349 | + static function orders_edit_columns($columns) { |
|
350 | 350 | $columns = array( |
351 | 351 | 'cb' => '<input type="checkbox" />', |
352 | 352 | 'order_identifier' => __('Identifiers', 'wpshop'), |
@@ -366,40 +366,40 @@ discard block |
||
366 | 366 | * @return array |
367 | 367 | */ |
368 | 368 | public static function orders_custom_columns($column, $post_id) { |
369 | - if ( get_post_type( $post_id ) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) { |
|
369 | + if (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) { |
|
370 | 370 | global $civility, $order_status; |
371 | 371 | |
372 | 372 | $metadata = get_post_custom(); |
373 | 373 | |
374 | - $order_postmeta = isset($metadata['_order_postmeta'][0])?unserialize($metadata['_order_postmeta'][0]):''; |
|
375 | - $addresses = get_post_meta($post_id,'_order_info', true); |
|
374 | + $order_postmeta = isset($metadata['_order_postmeta'][0]) ? unserialize($metadata['_order_postmeta'][0]) : ''; |
|
375 | + $addresses = get_post_meta($post_id, '_order_info', true); |
|
376 | 376 | |
377 | - switch($column){ |
|
377 | + switch ($column) { |
|
378 | 378 | case "order_identifier": |
379 | - if( !empty( $order_postmeta['order_key'] ) ) { |
|
379 | + if (!empty($order_postmeta['order_key'])) { |
|
380 | 380 | echo '<b>' . $order_postmeta['order_key'] . '</b><br>'; |
381 | 381 | } |
382 | - if( !empty( $order_postmeta['order_invoice_ref'] ) ) { |
|
382 | + if (!empty($order_postmeta['order_invoice_ref'])) { |
|
383 | 383 | echo '<i>' . $order_postmeta['order_invoice_ref'] . '</i>'; |
384 | - } elseif( !empty($order_postmeta['order_temporary_key'] ) ) { |
|
384 | + } elseif (!empty($order_postmeta['order_temporary_key'])) { |
|
385 | 385 | echo '<b>' . $order_postmeta['order_temporary_key'] . '</b>'; |
386 | 386 | } |
387 | 387 | break; |
388 | 388 | |
389 | 389 | case "order_status": |
390 | - echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_'.$post_id.'">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop'); |
|
390 | + echo !empty($order_postmeta['order_status']) ? sprintf('<mark class="%s" id="order_status_' . $post_id . '">%s</mark>', sanitize_title(strtolower($order_postmeta['order_status'])), __($order_status[strtolower($order_postmeta['order_status'])], 'wpshop')) : __('Unknown Status', 'wpshop'); |
|
391 | 391 | break; |
392 | 392 | |
393 | 393 | case "order_billing": |
394 | - if ( !empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address']) ) { |
|
394 | + if (!empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address'])) { |
|
395 | 395 | $billing = $addresses['billing']['address']; |
396 | 396 | } |
397 | - else if ( !empty($addresses['billing']) ) { |
|
397 | + else if (!empty($addresses['billing'])) { |
|
398 | 398 | $billing = $addresses['billing']; |
399 | 399 | } |
400 | - if ( !empty($billing) ) { |
|
401 | - echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null).' <strong>'.(!empty($billing['address_first_name']) ? $billing['address_first_name'] : null).' '.(!empty($billing['address_last_name']) ? $billing['address_last_name'] : null).'</strong>'; |
|
402 | - echo empty($billing['company']) ?'<br />' : ', <i>'.$billing['company'].'</i><br />'; |
|
400 | + if (!empty($billing)) { |
|
401 | + echo (!empty($billing['civility']) ? __(wpshop_attributes::get_attribute_type_select_option_info($billing['civility'], 'label', 'custom'), 'wpshop') : null) . ' <strong>' . (!empty($billing['address_first_name']) ? $billing['address_first_name'] : null) . ' ' . (!empty($billing['address_last_name']) ? $billing['address_last_name'] : null) . '</strong>'; |
|
402 | + echo empty($billing['company']) ? '<br />' : ', <i>' . $billing['company'] . '</i><br />'; |
|
403 | 403 | echo !empty($billing['address']) ? $billing['address'] : null; |
404 | 404 | echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null; |
405 | 405 | echo !empty($billing['city']) ? $billing['city'] . ', ' : null; |
@@ -412,35 +412,35 @@ discard block |
||
412 | 412 | break; |
413 | 413 | |
414 | 414 | case "order_shipping": |
415 | - if ( !empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address']) ) { |
|
415 | + if (!empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address'])) { |
|
416 | 416 | $shipping = $addresses['shipping']['address']; |
417 | 417 | } |
418 | - else if ( !empty($addresses['shipping']) ) { |
|
418 | + else if (!empty($addresses['shipping'])) { |
|
419 | 419 | $shipping = $addresses['shipping']; |
420 | 420 | } |
421 | - if ( !empty($shipping) ) { |
|
422 | - echo '<strong>'.(!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null).' '.(!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null).'</strong>'; |
|
423 | - echo empty($shipping['company'])?'<br />':', <i>'.$shipping['company'].'</i><br />'; |
|
421 | + if (!empty($shipping)) { |
|
422 | + echo '<strong>' . (!empty($shipping['address_first_name']) ? $shipping['address_first_name'] : null) . ' ' . (!empty($shipping['address_last_name']) ? $shipping['address_last_name'] : null) . '</strong>'; |
|
423 | + echo empty($shipping['company']) ? '<br />' : ', <i>' . $shipping['company'] . '</i><br />'; |
|
424 | 424 | echo (!empty($shipping['address']) ? $shipping['address'] : null); |
425 | 425 | echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null; |
426 | 426 | echo !empty($billing['city']) ? $billing['city'] . ', ' : null; |
427 | 427 | echo !empty($billing['country']) ? $billing['country'] : null; |
428 | 428 | } |
429 | - else{ |
|
429 | + else { |
|
430 | 430 | echo __('No information available for user shipping', 'wpshop'); |
431 | 431 | } |
432 | 432 | break; |
433 | 433 | |
434 | 434 | case "order_type": |
435 | - echo '<a href="'.admin_url('post.php?post='.$post_id.'&action=edit').'">'.(!empty($order_postmeta['order_temporary_key']) ? __('Quotation','wpshop') : __('Basic order','wpshop')).'</a>'; |
|
435 | + echo '<a href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . (!empty($order_postmeta['order_temporary_key']) ? __('Quotation', 'wpshop') : __('Basic order', 'wpshop')) . '</a>'; |
|
436 | 436 | $buttons = '<p class="row-actions">'; |
437 | 437 | // Voir la commande |
438 | - $buttons .= '<a class="button button-small" href="'.admin_url('post.php?post='.$post_id.'&action=edit').'">'.__('View', 'wpshop').'</a>'; |
|
438 | + $buttons .= '<a class="button button-small" href="' . admin_url('post.php?post=' . $post_id . '&action=edit') . '">' . __('View', 'wpshop') . '</a>'; |
|
439 | 439 | // Marquer comme envoy� |
440 | 440 | if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) { |
441 | - $buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_'.$post_id.' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">'.__('Mark as shipped', 'wpshop').'</a> '; |
|
441 | + $buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_' . $post_id . ' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">' . __('Mark as shipped', 'wpshop') . '</a> '; |
|
442 | 442 | } |
443 | - else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) { |
|
443 | + else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment')) { |
|
444 | 444 | // $buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' '; |
445 | 445 | } |
446 | 446 | $buttons .= '</p>'; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | |
454 | 454 | case "order_total": |
455 | 455 | $currency = !empty($order_postmeta['order_currency']) ? $order_postmeta['order_currency'] : get_option('wpshop_shop_default_currency'); |
456 | - echo isset( $order_postmeta['order_grand_total'] ) ? number_format( $order_postmeta['order_grand_total'], 2, '.', '' ).' '. wpshop_tools::wpshop_get_sigle($currency) : 'NaN'; |
|
456 | + echo isset($order_postmeta['order_grand_total']) ? number_format($order_postmeta['order_grand_total'], 2, '.', '') . ' ' . wpshop_tools::wpshop_get_sigle($currency) : 'NaN'; |
|
457 | 457 | break; |
458 | 458 | |
459 | 459 | /*case "order_actions": |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | } |
482 | 482 | |
483 | 483 | public static function list_table_filters() { |
484 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
485 | - $entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : ''; |
|
486 | - $entity_filter_btpf = !empty( $_GET['entity_filter_btpf'] ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : ''; |
|
487 | - $entity_filter_btps = !empty( $_GET['entity_filter_btps'] ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : ''; |
|
484 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
485 | + $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''; |
|
486 | + $entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : ''; |
|
487 | + $entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : ''; |
|
488 | 488 | |
489 | 489 | if (isset($post_type)) { |
490 | 490 | if (post_type_exists($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) { |
@@ -496,23 +496,23 @@ discard block |
||
496 | 496 | echo wpshop_form::form_input_select('entity_filter', 'entity_filter', $filter_possibilities, $entity_filter, '', 'index'); |
497 | 497 | $min = $entity_filter_btpf; |
498 | 498 | $max = $entity_filter_btps; |
499 | - echo ' <label for="entity_filter_btpf">'.__('Between two prices', 'wpshop').'</label> '; |
|
500 | - echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="'.__('Minimum price', 'wpshop').'"', null); |
|
501 | - echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="'.__('Maximum price', 'wpshop').'"', null); |
|
499 | + echo ' <label for="entity_filter_btpf">' . __('Between two prices', 'wpshop') . '</label> '; |
|
500 | + echo wpshop_form::form_input('entity_filter_btpf', 'entity_filter_btpf', $min, 'text', 'placeholder="' . __('Minimum price', 'wpshop') . '"', null); |
|
501 | + echo wpshop_form::form_input('entity_filter_btps', 'entity_filter_btps', $max, 'text', 'placeholder="' . __('Maximum price', 'wpshop') . '"', null); |
|
502 | 502 | } |
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
506 | 506 | public static function list_table_filter_parse_query($query) { |
507 | 507 | global $pagenow, $wpdb; |
508 | - $post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : ''; |
|
509 | - $entity_filter = !empty( $_GET['entity_filter'] ) ? sanitize_text_field( $_GET['entity_filter'] ) : ''; |
|
510 | - $entity_filter_btpf = !empty( $_GET['entity_filter_btpf'] ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : ''; |
|
511 | - $entity_filter_btps = !empty( $_GET['entity_filter_btps'] ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : ''; |
|
508 | + $post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : ''; |
|
509 | + $entity_filter = !empty($_GET['entity_filter']) ? sanitize_text_field($_GET['entity_filter']) : ''; |
|
510 | + $entity_filter_btpf = !empty($_GET['entity_filter_btpf']) ? sanitize_text_field($_GET['entity_filter_btpf']) : ''; |
|
511 | + $entity_filter_btps = !empty($_GET['entity_filter_btps']) ? sanitize_text_field($_GET['entity_filter_btps']) : ''; |
|
512 | 512 | |
513 | - if ( is_admin() && ($pagenow == 'edit.php') && !empty( $post_type ) && ( $post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) && !empty( $entity_filter ) ) { |
|
513 | + if (is_admin() && ($pagenow == 'edit.php') && !empty($post_type) && ($post_type == WPSHOP_NEWTYPE_IDENTIFIER_ORDER) && !empty($entity_filter)) { |
|
514 | 514 | $check = null; |
515 | - switch ( $entity_filter ) { |
|
515 | + switch ($entity_filter) { |
|
516 | 516 | case 'all': |
517 | 517 | $sql_query = $wpdb->prepare( |
518 | 518 | "SELECT ID |
@@ -576,27 +576,27 @@ discard block |
||
576 | 576 | break; |
577 | 577 | } |
578 | 578 | |
579 | - if ( !empty( $check ) ) { |
|
580 | - if( !empty($no_btp) && $no_btp == 'yes' ) { |
|
579 | + if (!empty($check)) { |
|
580 | + if (!empty($no_btp) && $no_btp == 'yes') { |
|
581 | 581 | $min = 'minimum'; |
582 | 582 | $max = 'maximum'; |
583 | 583 | } else { |
584 | - $min = ( !empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf']) ) ? sanitize_text_field( $_GET['entity_filter_btpf'] ) : 'minimum'; |
|
585 | - $max = ( !empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps']) ) ? sanitize_text_field( $_GET['entity_filter_btps'] ) : 'maximum'; |
|
584 | + $min = (!empty($_GET['entity_filter_btpf']) && is_numeric($_GET['entity_filter_btpf'])) ? sanitize_text_field($_GET['entity_filter_btpf']) : 'minimum'; |
|
585 | + $max = (!empty($_GET['entity_filter_btps']) && is_numeric($_GET['entity_filter_btps'])) ? sanitize_text_field($_GET['entity_filter_btps']) : 'maximum'; |
|
586 | 586 | } |
587 | 587 | $results = $wpdb->get_results($sql_query); |
588 | 588 | $post_id_list = array(); |
589 | 589 | $i = 0; |
590 | - foreach($results as $item){ |
|
590 | + foreach ($results as $item) { |
|
591 | 591 | $meta_value = get_post_meta($item->ID, '_order_postmeta'); |
592 | - $price = ( !empty( $meta_value[0]['order_grand_total'] ) ) ? $meta_value[0]['order_grand_total'] : ''; |
|
593 | - if( $price >= $min || $min == 'minimum' ) { |
|
594 | - if( $price <= $max || $max == 'maximum' ) { |
|
592 | + $price = (!empty($meta_value[0]['order_grand_total'])) ? $meta_value[0]['order_grand_total'] : ''; |
|
593 | + if ($price >= $min || $min == 'minimum') { |
|
594 | + if ($price <= $max || $max == 'maximum') { |
|
595 | 595 | $post_id_list[] = $item->ID; |
596 | 596 | } |
597 | 597 | } |
598 | 598 | } |
599 | - if( empty($post_id_list) ) { |
|
599 | + if (empty($post_id_list)) { |
|
600 | 600 | $post_id_list[] = 'no_result'; |
601 | 601 | } |
602 | 602 | $query->query_vars[$check] = $post_id_list; |
@@ -607,67 +607,67 @@ discard block |
||
607 | 607 | |
608 | 608 | |
609 | 609 | |
610 | - function latest_products_ordered ( $orders ) { |
|
610 | + function latest_products_ordered($orders) { |
|
611 | 611 | global $wpdb; |
612 | 612 | $product_id = $output = ''; |
613 | 613 | $products = array(); |
614 | 614 | $display_option = get_option('wpshop_display_option'); |
615 | - if ( !empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered']) ) { |
|
616 | - foreach( $orders as $order ) { |
|
617 | - $order_content = get_post_meta( $order->ID, '_order_postmeta', true ); |
|
618 | - if ( !empty($order_content) && !empty( $order_content['order_items']) ) { |
|
615 | + if (!empty($orders) && !empty($display_option) && !empty($display_option['latest_products_ordered'])) { |
|
616 | + foreach ($orders as $order) { |
|
617 | + $order_content = get_post_meta($order->ID, '_order_postmeta', true); |
|
618 | + if (!empty($order_content) && !empty($order_content['order_items'])) { |
|
619 | 619 | |
620 | - foreach( $order_content['order_items'] as $item ) { |
|
621 | - if ( count( $products) >= $display_option['latest_products_ordered'] ) { |
|
620 | + foreach ($order_content['order_items'] as $item) { |
|
621 | + if (count($products) >= $display_option['latest_products_ordered']) { |
|
622 | 622 | continue; |
623 | 623 | } |
624 | 624 | $product_id = $item['item_id']; |
625 | - if ( !empty( $item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition']) ) { |
|
626 | - $parent_def = wpshop_products::get_parent_variation( $item['item_id'] ); |
|
627 | - if ( !empty( $parent_def ) ) { |
|
625 | + if (!empty($item) && !empty($item['item_meta']) && !empty($item['item_meta']['variation_definition'])) { |
|
626 | + $parent_def = wpshop_products::get_parent_variation($item['item_id']); |
|
627 | + if (!empty($parent_def)) { |
|
628 | 628 | $parent_post = $parent_def['parent_post']; |
629 | 629 | $product_id = $parent_post->ID; |
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
633 | - if ( !in_array($product_id, $products) ) { |
|
633 | + if (!in_array($product_id, $products)) { |
|
634 | 634 | $products[] = $product_id; |
635 | 635 | } |
636 | 636 | } |
637 | 637 | } |
638 | 638 | } |
639 | - if ( !empty($products) ) { |
|
639 | + if (!empty($products)) { |
|
640 | 640 | $products_id = implode(",", $products); |
641 | - $output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' .$products_id. '"]')) ); |
|
641 | + $output = wpshop_display::display_template_element('latest_products_ordered', array('LATEST_PRODUCTS_ORDERED' => do_shortcode('[wpshop_products pid="' . $products_id . '"]'))); |
|
642 | 642 | } |
643 | 643 | } |
644 | 644 | return $output; |
645 | 645 | } |
646 | 646 | |
647 | - function get_order_list_for_customer( $customer_id ) { |
|
647 | + function get_order_list_for_customer($customer_id) { |
|
648 | 648 | global $wpdb; |
649 | 649 | $output = ''; |
650 | 650 | |
651 | - if( !empty($customer_id) ) { |
|
652 | - $query = $wpdb->prepare( 'SELECT * |
|
653 | - FROM ' .$wpdb->posts. ' |
|
651 | + if (!empty($customer_id)) { |
|
652 | + $query = $wpdb->prepare('SELECT * |
|
653 | + FROM ' .$wpdb->posts . ' |
|
654 | 654 | WHERE post_author = %d |
655 | - AND post_type = %s', $customer_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ); |
|
656 | - $orders = $wpdb->get_results( $query ); |
|
655 | + AND post_type = %s', $customer_id, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS); |
|
656 | + $orders = $wpdb->get_results($query); |
|
657 | 657 | |
658 | - foreach( $orders as $order ) { |
|
658 | + foreach ($orders as $order) { |
|
659 | 659 | |
660 | 660 | } |
661 | 661 | } |
662 | 662 | |
663 | 663 | return $output; |
664 | 664 | } |
665 | - static function display_customer_pay_quotation( $state, $oid ) { |
|
666 | - $label = ( ( $state ) ? __('Invalid quotation', 'wpshop') : __('Valid quotation', 'wpshop') ); |
|
667 | - $btn = '<p><a role="button" data-nonce="' . wp_create_nonce( 'wps_quotation_is_payable_by_customer' ) . '" class="wps-bton-' . ( ( $state ) ? 'third' : 'second' ) . '-mini-rounded quotation_is_payable_by_customer" href="#" >'.$label.'</a></p>'; |
|
668 | - if( $state ) { |
|
665 | + static function display_customer_pay_quotation($state, $oid) { |
|
666 | + $label = (($state) ? __('Invalid quotation', 'wpshop') : __('Valid quotation', 'wpshop')); |
|
667 | + $btn = '<p><a role="button" data-nonce="' . wp_create_nonce('wps_quotation_is_payable_by_customer') . '" class="wps-bton-' . (($state) ? 'third' : 'second') . '-mini-rounded quotation_is_payable_by_customer" href="#" >' . $label . '</a></p>'; |
|
668 | + if ($state) { |
|
669 | 669 | //$btn .= '<a target="_blank" href="' . admin_url( 'admin-ajax.php?action=wps_checkout_quotation&order_id=' . $oid . '&is_link=link' ) . '">' . __( 'Pay link', 'wpshop' ) . '</a>'; |
670 | - $btn .= '<span><input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url( $oid ) . '"/><a class="button" data-copy-target="#wps_direct_link_url" title="' . __( 'Copy', 'wpshop' ) . '"><span class="dashicons dashicons-clipboard"></span></a><a data-nonce="' . wp_create_nonce( 'wps_send_direct_payment_link' ) . '" role="button" class="button" href="#" title="' . __( 'Send by mail', 'wpshop' ) . '"><span class="dashicons dashicons-email"></span></a></span><span>' . sprintf( __( 'Link is valid until %s', 'wpshop' ), mysql2date( get_option( 'date_format' ), date_format( date_create( date('Y-m') . ' + 2month - 1day' ), 'Y-m-d H:i:s' ), true ) ) . '</span>'; |
|
670 | + $btn .= '<span><input id="wps_direct_link_url" type="text" value="' . wpshop_checkout::wps_direct_payment_link_url($oid) . '"/><a class="button" data-copy-target="#wps_direct_link_url" title="' . __('Copy', 'wpshop') . '"><span class="dashicons dashicons-clipboard"></span></a><a data-nonce="' . wp_create_nonce('wps_send_direct_payment_link') . '" role="button" class="button" href="#" title="' . __('Send by mail', 'wpshop') . '"><span class="dashicons dashicons-email"></span></a></span><span>' . sprintf(__('Link is valid until %s', 'wpshop'), mysql2date(get_option('date_format'), date_format(date_create(date('Y-m') . ' + 2month - 1day'), 'Y-m-d H:i:s'), true)) . '</span>'; |
|
671 | 671 | } |
672 | 672 | return $btn; |
673 | 673 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Products management method file |
4 | 6 | * |
@@ -122,8 +124,7 @@ discard block |
||
122 | 124 | $order_main_info .= '<div class="wps-product-section">'; |
123 | 125 | if(empty($order_postmeta['order_date']) || (empty($order_postmeta['order_key']) && empty($order_postmeta['order_temporary_key']) && empty($order_postmeta['order_invoice_ref']))){ |
124 | 126 | $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Temporary quotation reference','wpshop').': </strong>'.self::get_new_pre_order_reference(false).'<br/>'; |
125 | - } |
|
126 | - else{ |
|
127 | + } else{ |
|
127 | 128 | if(!empty($order_postmeta['order_key'])){ |
128 | 129 | $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'.__('Order reference','wpshop').' : </strong>'.$order_postmeta['order_key'].'<br/>'; |
129 | 130 | } |
@@ -136,8 +137,7 @@ discard block |
||
136 | 137 | $sub_tpl_component = array(); |
137 | 138 | $order_invoice_download = '<a href="' . admin_url( 'admin-post.php?action=wps_invoice&order_id=' . $order->ID . '&invoice_ref=' . $order_postmeta['order_invoice_ref'] . '&mode=pdf' ) . '">' . __('Download invoice', 'wpshop') . '</a><br />'; |
138 | 139 | $order_main_info .= '<span class="dashicons dashicons-arrow-right"></span> <strong>'. __('Invoice number','wpshop').': </strong>'.$order_postmeta['order_invoice_ref'].'<br/>' . $order_invoice_download . ''; |
139 | - } |
|
140 | - else { |
|
140 | + } else { |
|
141 | 141 | $order_main_info .= wpshop_display::display_template_element('wpshop_admin_order_generate_invoice_button', array(), array(), 'admin'); |
142 | 142 | } |
143 | 143 | } |
@@ -191,8 +191,7 @@ discard block |
||
191 | 191 | if ( empty($credit_meta) && (float) 0 !== $total_received ) { |
192 | 192 | if( $order_postmeta['order_status'] == 'refunded') { |
193 | 193 | $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container">' .__('Credit Slip number', 'wpshop'). ' : <strong>'. ( (!empty($order_postmeta) && !empty($order_postmeta['order_payment']) && !empty($order_postmeta['order_payment']['refunded_action']) && !empty($order_postmeta['order_payment']['refunded_action']['credit_slip_ref']) ) ? '<a href="' .admin_url( 'admin-post.php?action=wps_invoice&order_id=' .$order->ID. '&invoice_ref=' .$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'&credit_slip=ok' ). '" target="_blank">'.$order_postmeta['order_payment']['refunded_action']['credit_slip_ref'].'</a>' : '') .'</strong></div>'; |
194 | - } |
|
195 | - else { |
|
194 | + } else { |
|
196 | 195 | $tpl_component['ADMIN_ORDER_ACTIONS_LIST'] .= '<div class="wps-product-section wps_markAsRefunded_container" ><button class="wps-bton-second-mini-rounded markAsRefunded order_' .$order->ID. '">' .__('Refund this order', 'wpshop'). '</button><input type="hidden" id="markasrefunded_order_hidden_indicator" name="markasrefunded_order_hidden_indicator" /></div>'; |
197 | 196 | } |
198 | 197 | } |
@@ -273,8 +272,7 @@ discard block |
||
273 | 272 | |
274 | 273 | $order_current_number = get_option('wpshop_order_current_number', false); |
275 | 274 | /* If the counter doesn't exist, we initiate it */ |
276 | - if(!$order_current_number) { $order_current_number = 1; } |
|
277 | - else { $order_current_number++; } |
|
275 | + if(!$order_current_number) { $order_current_number = 1; } else { $order_current_number++; } |
|
278 | 276 | update_option('wpshop_order_current_number', $order_current_number); |
279 | 277 | |
280 | 278 | $order_ref = (string)sprintf('%0'.$number_figures.'d', $order_current_number); |
@@ -294,8 +292,7 @@ discard block |
||
294 | 292 | |
295 | 293 | $order_current_number = get_option('wpshop_preorder_current_number', false); |
296 | 294 | /* If the counter doesn't exist, we initiate it */ |
297 | - if(!$order_current_number) { $order_current_number = 1; } |
|
298 | - else { $order_current_number++; } |
|
295 | + if(!$order_current_number) { $order_current_number = 1; } else { $order_current_number++; } |
|
299 | 296 | if($save){ |
300 | 297 | update_option('wpshop_preorder_current_number', $order_current_number); |
301 | 298 | } |
@@ -329,8 +326,7 @@ discard block |
||
329 | 326 | $shipping_info['address'] = get_post_meta( $address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true); |
330 | 327 | } |
331 | 328 | } |
332 | - } |
|
333 | - else { |
|
329 | + } else { |
|
334 | 330 | $shipping_info['id'] = get_post_meta($shipping_address_id, WPSHOP_ADDRESS_ATTRIBUTE_SET_ID_META_KEY, true); |
335 | 331 | $shipping_info['address'] = get_post_meta($shipping_address_id, '_'.WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS.'_metadata', true); |
336 | 332 | $shipping_info['address_id'] = ( !empty($_SESSION['shipping_address']) ) ? intval( $_SESSION['shipping_address'] ) : ''; |
@@ -393,8 +389,7 @@ discard block |
||
393 | 389 | case "order_billing": |
394 | 390 | if ( !empty($addresses['billing']) && !empty($addresses['billing']['address']) && is_array($addresses['billing']['address']) ) { |
395 | 391 | $billing = $addresses['billing']['address']; |
396 | - } |
|
397 | - else if ( !empty($addresses['billing']) ) { |
|
392 | + } else if ( !empty($addresses['billing']) ) { |
|
398 | 393 | $billing = $addresses['billing']; |
399 | 394 | } |
400 | 395 | if ( !empty($billing) ) { |
@@ -405,8 +400,7 @@ discard block |
||
405 | 400 | echo !empty($billing['city']) ? $billing['city'] . ', ' : null; |
406 | 401 | echo !empty($billing['country']) ? $billing['country'] : null; |
407 | 402 | echo (!empty($billing['phone']) ? '<br /><b>' . $billing['phone'] . '</b>' : ''); |
408 | - } |
|
409 | - else { |
|
403 | + } else { |
|
410 | 404 | echo __('No information available for user billing', 'wpshop'); |
411 | 405 | } |
412 | 406 | break; |
@@ -414,8 +408,7 @@ discard block |
||
414 | 408 | case "order_shipping": |
415 | 409 | if ( !empty($addresses['shipping']) && !empty($addresses['shipping']['address']) && is_array($addresses['shipping']['address']) ) { |
416 | 410 | $shipping = $addresses['shipping']['address']; |
417 | - } |
|
418 | - else if ( !empty($addresses['shipping']) ) { |
|
411 | + } else if ( !empty($addresses['shipping']) ) { |
|
419 | 412 | $shipping = $addresses['shipping']; |
420 | 413 | } |
421 | 414 | if ( !empty($shipping) ) { |
@@ -425,8 +418,7 @@ discard block |
||
425 | 418 | echo !empty($billing['postcode']) ? '<br />' . $billing['postcode'] . ' ' : null; |
426 | 419 | echo !empty($billing['city']) ? $billing['city'] . ', ' : null; |
427 | 420 | echo !empty($billing['country']) ? $billing['country'] : null; |
428 | - } |
|
429 | - else{ |
|
421 | + } else{ |
|
430 | 422 | echo __('No information available for user shipping', 'wpshop'); |
431 | 423 | } |
432 | 424 | break; |
@@ -439,8 +431,7 @@ discard block |
||
439 | 431 | // Marquer comme envoy� |
440 | 432 | if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'completed')) { |
441 | 433 | $buttons .= '<a data-id="' . $post_id . '" class="wps-bton-second-mini-rounded markAsShipped order_'.$post_id.' wps-bton-loader" data-nonce="' . wp_create_nonce("wpshop_dialog_inform_shipping_number") . '">'.__('Mark as shipped', 'wpshop').'</a> '; |
442 | - } |
|
443 | - else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) { |
|
434 | + } else if (!empty($order_postmeta['order_status']) && ($order_postmeta['order_status'] == 'awaiting_payment' )) { |
|
444 | 435 | // $buttons .= '<a class="button markAsCompleted order_'.$post_id.' alignleft" >'.__('Payment received', 'wpshop').'</a>' . wpshop_payment::display_payment_receiver_interface($post_id) . ' '; |
445 | 436 | } |
446 | 437 | $buttons .= '</p>'; |
@@ -23,8 +23,8 @@ |
||
23 | 23 | var $creating_account = true; |
24 | 24 | |
25 | 25 | /** Constructor of the class |
26 | - * @return void |
|
27 | - */ |
|
26 | + * @return void |
|
27 | + */ |
|
28 | 28 | function __construct () { |
29 | 29 | } |
30 | 30 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -58,12 +60,13 @@ discard block |
||
58 | 60 | // On enregistre la commande |
59 | 61 | update_post_meta($order_id, '_order_postmeta', $order); |
60 | 62 | update_post_meta($order_id, '_wpshop_order_customer_id', $user_id); |
63 | + } else { |
|
64 | + $wpshop->add_error(__('You don\'t own the order', 'wpshop')); |
|
61 | 65 | } |
62 | - else $wpshop->add_error(__('You don\'t own the order', 'wpshop')); |
|
66 | + } else { |
|
67 | + $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop')); |
|
63 | 68 | } |
64 | - else $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop')); |
|
65 | - } |
|
66 | - else{ |
|
69 | + } else{ |
|
67 | 70 | $order_data = array( |
68 | 71 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
69 | 72 | 'post_title' => sprintf(__('Order - %s','wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)), |
@@ -118,7 +121,9 @@ discard block |
||
118 | 121 | } |
119 | 122 | } |
120 | 123 | } |
121 | - if(!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes); |
|
124 | + if(!empty($download_codes)) { |
|
125 | + update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes); |
|
126 | + } |
|
122 | 127 | |
123 | 128 | // Informations de commande � stocker |
124 | 129 | $currency = wpshop_tools::wpshop_get_currency(true); |
@@ -140,8 +145,7 @@ discard block |
||
140 | 145 | // Si c'est un devis |
141 | 146 | if ( $paymentMethod == 'quotation' ) { |
142 | 147 | $order['order_temporary_key'] = wpshop_orders::get_new_pre_order_reference(); |
143 | - } |
|
144 | - else { |
|
148 | + } else { |
|
145 | 149 | $order['order_key'] = wpshop_orders::get_new_order_reference(); |
146 | 150 | } |
147 | 151 | |
@@ -202,8 +206,7 @@ discard block |
||
202 | 206 | |
203 | 207 | if ( !empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key']) ) { |
204 | 208 | $wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '') ); |
205 | - } |
|
206 | - else { |
|
209 | + } else { |
|
207 | 210 | $email_option = get_option( 'wpshop_emails' ); |
208 | 211 | if ( empty($email_option['send_confirmation_order_message']) ) { |
209 | 212 | $payment_method_option = get_option( 'wps_payment_mode' ); |
@@ -257,8 +260,7 @@ discard block |
||
257 | 260 | |
258 | 261 | if( !empty( $order_infos ) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key']) ){ |
259 | 262 | $message_type = 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE'; |
260 | - } |
|
261 | - else { |
|
263 | + } else { |
|
262 | 264 | $message_type = 'WPSHOP_NEW_QUOTATION_ADMIN_MESSAGE'; |
263 | 265 | $order_tmp_key = $order_infos['order_temporary_key']; |
264 | 266 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | |
3 | 3 | /* Check if file is include. No direct access possible with file url */ |
4 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
5 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
4 | +if (!defined('WPSHOP_VERSION')) { |
|
5 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | /** Constructor of the class |
26 | 26 | * @return void |
27 | 27 | */ |
28 | - function __construct () { |
|
28 | + function __construct() { |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | |
32 | - public static function process_checkout($paymentMethod='paypal', $order_id = 0, $customer_id = 0, $customer_billing_address_id = 0, $customer_shipping_address_id = 0) { |
|
32 | + public static function process_checkout($paymentMethod = 'paypal', $order_id = 0, $customer_id = 0, $customer_billing_address_id = 0, $customer_shipping_address_id = 0) { |
|
33 | 33 | |
34 | 34 | global $wpdb, $wpshop, $wpshop_cart; |
35 | 35 | $wps_message = new wps_message_ctr(); |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | if (is_user_logged_in()) : |
39 | 39 | $user_id = get_current_user_id(); |
40 | 40 | |
41 | - if ( $customer_id != 0 ) { |
|
41 | + if ($customer_id != 0) { |
|
42 | 42 | $user_id = $customer_id; |
43 | 43 | } |
44 | 44 | |
45 | 45 | // If the order is already created in the db |
46 | - if(!empty($order_id) && is_numeric($order_id)) { |
|
46 | + if (!empty($order_id) && is_numeric($order_id)) { |
|
47 | 47 | $order = get_post_meta($order_id, '_order_postmeta', true); |
48 | 48 | |
49 | - if(!empty($order)) { |
|
50 | - if($order['customer_id'] == $user_id) { |
|
49 | + if (!empty($order)) { |
|
50 | + if ($order['customer_id'] == $user_id) { |
|
51 | 51 | $order['payment_method'] = $paymentMethod; |
52 | - $_SESSION['order_id'] = (int) $order_id; |
|
52 | + $_SESSION['order_id'] = (int)$order_id; |
|
53 | 53 | // Store cart in session |
54 | 54 | //wpshop_cart::store_cart_in_session($order); |
55 | 55 | // Add a payment |
56 | - $order['order_payment']['received'][] = array( 'method' => $paymentMethod, 'waited_amount' => $order['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => get_current_user_id() ); |
|
56 | + $order['order_payment']['received'][] = array('method' => $paymentMethod, 'waited_amount' => $order['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => get_current_user_id()); |
|
57 | 57 | |
58 | 58 | // On enregistre la commande |
59 | 59 | update_post_meta($order_id, '_order_postmeta', $order); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | } |
64 | 64 | else $wpshop->add_error(__('The order doesn\'t exist.', 'wpshop')); |
65 | 65 | } |
66 | - else{ |
|
66 | + else { |
|
67 | 67 | $order_data = array( |
68 | 68 | 'post_type' => WPSHOP_NEWTYPE_IDENTIFIER_ORDER, |
69 | - 'post_title' => sprintf(__('Order - %s','wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)), |
|
69 | + 'post_title' => sprintf(__('Order - %s', 'wpshop'), mysql2date('d M Y\, H:i:s', current_time('mysql', 0), true)), |
|
70 | 70 | 'post_status' => 'publish', |
71 | - 'post_excerpt' => !empty($_POST['wps-customer-comment']) ? sanitize_text_field( $_POST['wps-customer-comment'] ) : '', |
|
71 | + 'post_excerpt' => !empty($_POST['wps-customer-comment']) ? sanitize_text_field($_POST['wps-customer-comment']) : '', |
|
72 | 72 | 'post_author' => $user_id, |
73 | 73 | 'comment_status' => 'closed' |
74 | 74 | ); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $order_tva = array(); |
79 | 79 | |
80 | 80 | //$cart = (array)$wpshop_cart->cart; |
81 | - if ( !empty($_SESSION['cart']) && !empty( $_SESSION['cart']['shipping_method']) ) { |
|
81 | + if (!empty($_SESSION['cart']) && !empty($_SESSION['cart']['shipping_method'])) { |
|
82 | 82 | $_SESSION['cart']['shipping_method'] = __('Standard shipping method', 'wpshop'); |
83 | 83 | } |
84 | 84 | $cart = (array)$_SESSION['cart']; |
@@ -90,35 +90,35 @@ discard block |
||
90 | 90 | $_SESSION['order_id'] = $order_id; |
91 | 91 | |
92 | 92 | // Cr�ation des codes de t�l�chargement si il y a des produits t�l�chargeable dans le panier |
93 | - if ( !empty( $cart['order_items'] ) ) { |
|
94 | - foreach($cart['order_items'] as $c) { |
|
93 | + if (!empty($cart['order_items'])) { |
|
94 | + foreach ($cart['order_items'] as $c) { |
|
95 | 95 | $product_id = $c['item_id']; |
96 | 96 | $product = null; |
97 | - if( isset( $c['item_meta']['variations'] ) ) { |
|
98 | - foreach ( $c['item_meta']['variations'] as $variation_id => $variation ) { |
|
99 | - if( isset( $variation['item_meta']['is_downloadable_'] ) ) { |
|
97 | + if (isset($c['item_meta']['variations'])) { |
|
98 | + foreach ($c['item_meta']['variations'] as $variation_id => $variation) { |
|
99 | + if (isset($variation['item_meta']['is_downloadable_'])) { |
|
100 | 100 | $product_id = $c['item_id'] . '__' . $variation_id; |
101 | - $product = wpshop_products::get_product_data( $product_id ); |
|
101 | + $product = wpshop_products::get_product_data($product_id); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
105 | - if( !isset( $product ) ) { |
|
106 | - $product = wpshop_products::get_product_data( $c['item_id'] ); |
|
105 | + if (!isset($product)) { |
|
106 | + $product = wpshop_products::get_product_data($c['item_id']); |
|
107 | 107 | $product_id = $c['item_id']; |
108 | 108 | /** Check if it's a variation and check the parent product **/ |
109 | - if ( get_post_type( $c['item_id'] ) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION ) { |
|
110 | - $parent_def = wpshop_products::get_parent_variation( $c['item_id'] ); |
|
111 | - if ( !empty($parent_def) && !empty($parent_def['parent_post_meta']) && !empty($parent_def['parent_post_meta']['is_downloadable_']) ) { |
|
109 | + if (get_post_type($c['item_id']) == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION) { |
|
110 | + $parent_def = wpshop_products::get_parent_variation($c['item_id']); |
|
111 | + if (!empty($parent_def) && !empty($parent_def['parent_post_meta']) && !empty($parent_def['parent_post_meta']['is_downloadable_'])) { |
|
112 | 112 | $product['is_downloadable_'] = $parent_def['parent_post_meta']['is_downloadable_']; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | - if(!empty($product['is_downloadable_'])) { |
|
116 | + if (!empty($product['is_downloadable_'])) { |
|
117 | 117 | $download_codes[$product_id] = array('item_id' => $product_id, 'download_code' => uniqid('', true)); |
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
121 | - if(!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_'.$order_id, $download_codes); |
|
121 | + if (!empty($download_codes)) update_user_meta($user_id, '_order_download_codes_' . $order_id, $download_codes); |
|
122 | 122 | |
123 | 123 | // Informations de commande � stocker |
124 | 124 | $currency = wpshop_tools::wpshop_get_currency(true); |
@@ -133,12 +133,12 @@ discard block |
||
133 | 133 | 'order_payment' => array( |
134 | 134 | 'customer_choice' => array('method' => $paymentMethod), |
135 | 135 | 'received' => array('0' => array('method' => $paymentMethod, 'waited_amount' => $cart['order_amount_to_pay_now'], 'status' => 'waiting_payment', 'author' => $user_id)), |
136 | - 'shipping_method' => ( ( !empty( $_SESSION['shipping_method']) ) ? wpshop_tools::varSanitizer( $_SESSION['shipping_method']) : __('Standard shipping method', 'wpshop') ) |
|
136 | + 'shipping_method' => ((!empty($_SESSION['shipping_method'])) ? wpshop_tools::varSanitizer($_SESSION['shipping_method']) : __('Standard shipping method', 'wpshop')) |
|
137 | 137 | ), |
138 | 138 | ), $cart); |
139 | 139 | |
140 | 140 | // Si c'est un devis |
141 | - if ( $paymentMethod == 'quotation' ) { |
|
141 | + if ($paymentMethod == 'quotation') { |
|
142 | 142 | $order['order_temporary_key'] = wpshop_orders::get_new_pre_order_reference(); |
143 | 143 | } |
144 | 144 | else { |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | } |
147 | 147 | |
148 | 148 | //Round final amount |
149 | - $order['order_grand_total'] = number_format( round($order['order_grand_total'], 2), 2, '.', ''); |
|
150 | - $order['order_total_ttc'] = number_format( round($order['order_total_ttc'], 2), 2, '.', ''); |
|
151 | - $order['order_amount_to_pay_now'] = number_format( round($order['order_amount_to_pay_now'], 2), 2, '.', ''); |
|
149 | + $order['order_grand_total'] = number_format(round($order['order_grand_total'], 2), 2, '.', ''); |
|
150 | + $order['order_total_ttc'] = number_format(round($order['order_total_ttc'], 2), 2, '.', ''); |
|
151 | + $order['order_amount_to_pay_now'] = number_format(round($order['order_amount_to_pay_now'], 2), 2, '.', ''); |
|
152 | 152 | |
153 | 153 | /** On enregistre la commande */ |
154 | 154 | update_post_meta($order_id, '_order_postmeta', $order); |
@@ -157,75 +157,75 @@ discard block |
||
157 | 157 | update_post_meta($order_id, '_wpshop_order_status', $order['order_status']); |
158 | 158 | |
159 | 159 | |
160 | - do_action( 'wps_order_extra_save', $order_id ); |
|
160 | + do_action('wps_order_extra_save', $order_id); |
|
161 | 161 | |
162 | 162 | //Add an action to extra actions on order save |
163 | 163 | // @TODO : REQUEST |
164 | - $args = array( 'order_id' => $order_id, 'posted_data' => $_REQUEST ); |
|
165 | - wpshop_tools::create_custom_hook( 'wps_order_extra_save_action', $args ); |
|
164 | + $args = array('order_id' => $order_id, 'posted_data' => $_REQUEST); |
|
165 | + wpshop_tools::create_custom_hook('wps_order_extra_save_action', $args); |
|
166 | 166 | |
167 | 167 | /** Set custmer information for the order */ |
168 | - $shipping_address = ( !empty($shipping_address_option) && !empty($shipping_address_option['activate']) ) ? ( ( !empty($_SESSION['shipping_address']) ) ? wpshop_tools::varSanitizer($_SESSION['shipping_address']) : $customer_shipping_address_id ) : ''; |
|
169 | - $billing_address = ( !empty($_SESSION['billing_address']) ) ? wpshop_tools::varSanitizer($_SESSION['billing_address']) : $customer_billing_address_id; |
|
168 | + $shipping_address = (!empty($shipping_address_option) && !empty($shipping_address_option['activate'])) ? ((!empty($_SESSION['shipping_address'])) ? wpshop_tools::varSanitizer($_SESSION['shipping_address']) : $customer_shipping_address_id) : ''; |
|
169 | + $billing_address = (!empty($_SESSION['billing_address'])) ? wpshop_tools::varSanitizer($_SESSION['billing_address']) : $customer_billing_address_id; |
|
170 | 170 | |
171 | 171 | |
172 | - if ( !empty( $billing_address) ) { |
|
172 | + if (!empty($billing_address)) { |
|
173 | 173 | wpshop_orders::set_order_customer_addresses($user_id, $order_id, $shipping_address, $billing_address); |
174 | 174 | } |
175 | 175 | |
176 | - if ( !empty($_SESSION['shipping_address_to_save']) ) { |
|
176 | + if (!empty($_SESSION['shipping_address_to_save'])) { |
|
177 | 177 | $order_infos_postmeta = get_post_meta($order_id, '_order_info', true); |
178 | 178 | $order_infos_postmeta['shipping']['address'] = $_SESSION['shipping_address_to_save']; |
179 | 179 | $order_infos_postmeta['shipping']['address_id'] = ''; |
180 | 180 | update_post_meta($order_id, '_order_info', $order_infos_postmeta); |
181 | - unset( $_SESSION['shipping_address_to_save'] ); |
|
181 | + unset($_SESSION['shipping_address_to_save']); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | 185 | /** Save Coupon use **/ |
186 | - if ( !empty($_SESSION['cart']['coupon_id']) ) { |
|
186 | + if (!empty($_SESSION['cart']['coupon_id'])) { |
|
187 | 187 | $wps_coupon_mdl = new wps_coupon_model(); |
188 | - $wps_coupon_mdl->save_coupon_use( $_SESSION['cart']['coupon_id'] ); |
|
188 | + $wps_coupon_mdl->save_coupon_use($_SESSION['cart']['coupon_id']); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** Notify the customer as the case */ |
192 | 192 | $user_info = get_userdata($user_id); |
193 | 193 | $email = $user_info->user_email; |
194 | - $first_name = $user_info->user_firstname ; |
|
194 | + $first_name = $user_info->user_firstname; |
|
195 | 195 | $last_name = $user_info->user_lastname; |
196 | 196 | |
197 | 197 | // Envoie du message de confirmation de commande au client |
198 | - $order_meta = get_post_meta( $order_id, '_order_postmeta', true); |
|
198 | + $order_meta = get_post_meta($order_id, '_order_postmeta', true); |
|
199 | 199 | |
200 | - $shipping_mode_option = get_option( 'wps_shipping_mode' ); |
|
201 | - $shipping_method = ( !empty($order_meta['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_meta['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_meta['order_payment']['shipping_method']]['name'] : ( (!empty($order_meta['order_payment']['shipping_method']) ) ? $order_meta['order_payment']['shipping_method'] : '' ); |
|
200 | + $shipping_mode_option = get_option('wps_shipping_mode'); |
|
201 | + $shipping_method = (!empty($order_meta['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_meta['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_meta['order_payment']['shipping_method']]['name'] : ((!empty($order_meta['order_payment']['shipping_method'])) ? $order_meta['order_payment']['shipping_method'] : ''); |
|
202 | 202 | |
203 | - if ( !empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key']) ) { |
|
204 | - $wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '') ); |
|
203 | + if (!empty($order_meta) && !empty($order_meta['cart_type']) && $order_meta['cart_type'] == 'quotation' && empty($order_meta['order_key'])) { |
|
204 | + $wps_message->wpshop_prepared_email($email, 'WPSHOP_QUOTATION_CONFIRMATION_MESSAGE', array('order_id' => $order_id, 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_date' => current_time('mysql', 0), 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '')); |
|
205 | 205 | } |
206 | 206 | else { |
207 | - $email_option = get_option( 'wpshop_emails' ); |
|
208 | - if ( empty($email_option['send_confirmation_order_message']) ) { |
|
209 | - $payment_method_option = get_option( 'wps_payment_mode' ); |
|
210 | - $order_payment_method = ( !empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_meta['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']]) ) ? $payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']]['name'] : $order_meta['order_payment']['customer_choice']['method']; |
|
207 | + $email_option = get_option('wpshop_emails'); |
|
208 | + if (empty($email_option['send_confirmation_order_message'])) { |
|
209 | + $payment_method_option = get_option('wps_payment_mode'); |
|
210 | + $order_payment_method = (!empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_meta['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']])) ? $payment_method_option['mode'][$order_meta['order_payment']['customer_choice']['method']]['name'] : $order_meta['order_payment']['customer_choice']['method']; |
|
211 | 211 | |
212 | - $wps_message->wpshop_prepared_email($email, 'WPSHOP_ORDER_CONFIRMATION_MESSAGE', array('order_id' => $order_id,'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_key' => ( ( !empty($order_meta['order_key']) ) ? $order_meta['order_key'] : ''),'order_date' => current_time('mysql', 0), 'order_payment_method' => $order_payment_method, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '' ) ); |
|
212 | + $wps_message->wpshop_prepared_email($email, 'WPSHOP_ORDER_CONFIRMATION_MESSAGE', array('order_id' => $order_id, 'customer_first_name' => $first_name, 'customer_last_name' => $last_name, 'customer_email' => $email, 'order_key' => ((!empty($order_meta['order_key'])) ? $order_meta['order_key'] : ''), 'order_date' => current_time('mysql', 0), 'order_payment_method' => $order_payment_method, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => '')); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
216 | - if ( empty($_SESSION['wps-pos-addon']) ) { |
|
216 | + if (empty($_SESSION['wps-pos-addon'])) { |
|
217 | 217 | $email_option = get_option('wpshop_emails'); |
218 | - if( empty($email_option) || ( !empty($email_option) && empty($email_option['send_confirmation_order_message']) ) ){ |
|
219 | - self::send_order_email_to_administrator( $order_id, $user_info ); |
|
218 | + if (empty($email_option) || (!empty($email_option) && empty($email_option['send_confirmation_order_message']))) { |
|
219 | + self::send_order_email_to_administrator($order_id, $user_info); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | |
223 | 223 | |
224 | 224 | /** IF Order amount is 0, Finish the Order **/ |
225 | - if ( $cart['order_amount_to_pay_now'] == 0 ) { |
|
225 | + if ($cart['order_amount_to_pay_now'] == 0) { |
|
226 | 226 | $order_meta = get_post_meta($order_id, '_order_postmeta', true); |
227 | 227 | $payment_status = 'completed'; |
228 | - $params_array = array ( |
|
228 | + $params_array = array( |
|
229 | 229 | 'method' =>'free', |
230 | 230 | 'waited_amount' => $order_meta['order_amount_to_pay_now'], |
231 | 231 | 'status' => 'payment_received', |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | ); |
237 | 237 | wpshop_payment::check_order_payment_total_amount($order_id, $params_array, $payment_status); |
238 | 238 | } |
239 | - apply_filters( 'wpshop_finish_order_extra_actions', $order_id); |
|
239 | + apply_filters('wpshop_finish_order_extra_actions', $order_id); |
|
240 | 240 | } |
241 | 241 | endif; |
242 | 242 | return $order_id; |
243 | 243 | } |
244 | 244 | |
245 | - public static function send_order_email_to_administrator ( $order_id, $customer_infos = '' ) { |
|
246 | - if ( !empty($order_id) ) { |
|
245 | + public static function send_order_email_to_administrator($order_id, $customer_infos = '') { |
|
246 | + if (!empty($order_id)) { |
|
247 | 247 | $wps_message = new wps_message_ctr(); |
248 | 248 | $order_infos = get_post_meta($order_id, '_order_postmeta', true); |
249 | 249 | //Send email to administrator(s) |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | $shop_admin_email = $shop_admin_email_option['contact_email']; |
252 | 252 | $order_tmp_key = ''; |
253 | 253 | |
254 | - $shipping_mode_option = get_option( 'wps_shipping_mode' ); |
|
255 | - $shipping_method = ( !empty($order_infos['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_infos['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_infos['order_payment']['shipping_method']]['name'] : ( (!empty($order_infos['order_payment']['shipping_method']) ) ? $order_infos['order_payment']['shipping_method'] : '' ); |
|
254 | + $shipping_mode_option = get_option('wps_shipping_mode'); |
|
255 | + $shipping_method = (!empty($order_infos['order_payment']['shipping_method']) && !empty($shipping_mode_option) && !empty($shipping_mode_option['modes']) && is_array($shipping_mode_option['modes']) && array_key_exists($order_infos['order_payment']['shipping_method'], $shipping_mode_option['modes'])) ? $shipping_mode_option['modes'][$order_infos['order_payment']['shipping_method']]['name'] : ((!empty($order_infos['order_payment']['shipping_method'])) ? $order_infos['order_payment']['shipping_method'] : ''); |
|
256 | 256 | |
257 | 257 | |
258 | - if( !empty( $order_infos ) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key']) ){ |
|
258 | + if (!empty($order_infos) && !empty($order_infos['cart_type']) && $order_infos['cart_type'] == 'normal' && !empty($order_infos['order_key'])) { |
|
259 | 259 | $message_type = 'WPSHOP_NEW_ORDER_ADMIN_MESSAGE'; |
260 | 260 | } |
261 | 261 | else { |
@@ -263,12 +263,12 @@ discard block |
||
263 | 263 | $order_tmp_key = $order_infos['order_temporary_key']; |
264 | 264 | } |
265 | 265 | |
266 | - $payment_method_option = get_option( 'wps_payment_mode' ); |
|
267 | - $order_payment_method = ( !empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_infos['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']]) ) ? $payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']]['name'] : $order_infos['order_payment']['customer_choice']['method']; |
|
266 | + $payment_method_option = get_option('wps_payment_mode'); |
|
267 | + $order_payment_method = (!empty($payment_method_option) && !empty($payment_method_option['mode']) && !empty($order_infos['order_payment']['customer_choice']['method']) && !empty($payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']])) ? $payment_method_option['mode'][$order_infos['order_payment']['customer_choice']['method']]['name'] : $order_infos['order_payment']['customer_choice']['method']; |
|
268 | 268 | |
269 | - $data_to_send = array('order_id' => $order_id, 'order_key' => $order_infos['order_key'], 'customer_email' => ( !empty($customer_infos) && !empty($customer_infos->user_email) ) ? $customer_infos->user_email : '' , 'customer_last_name' => ( !empty($customer_infos) && !empty($customer_infos->user_lastname) ) ? $customer_infos->user_lastname : '', 'customer_first_name' => ( !empty($customer_infos) && !empty($customer_infos->user_firstname) ) ? $customer_infos->user_firstname : '', 'order_date' => $order_infos['order_date'], 'order_payment_method' => $order_payment_method, 'order_temporary_key' => $order_tmp_key, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '','order_shipping_method' => $shipping_method, 'order_personnal_informations' => '' ); |
|
269 | + $data_to_send = array('order_id' => $order_id, 'order_key' => $order_infos['order_key'], 'customer_email' => (!empty($customer_infos) && !empty($customer_infos->user_email)) ? $customer_infos->user_email : '', 'customer_last_name' => (!empty($customer_infos) && !empty($customer_infos->user_lastname)) ? $customer_infos->user_lastname : '', 'customer_first_name' => (!empty($customer_infos) && !empty($customer_infos->user_firstname)) ? $customer_infos->user_firstname : '', 'order_date' => $order_infos['order_date'], 'order_payment_method' => $order_payment_method, 'order_temporary_key' => $order_tmp_key, 'order_content' => '', 'order_addresses' => '', 'order_customer_comments' => '', 'order_billing_address' => '', 'order_shipping_address' => '', 'order_shipping_method' => $shipping_method, 'order_personnal_informations' => ''); |
|
270 | 270 | |
271 | - $wps_message->wpshop_prepared_email( $shop_admin_email, $message_type, $data_to_send, array('object_type' => 'order', 'object_id' => $order_id)); |
|
271 | + $wps_message->wpshop_prepared_email($shop_admin_email, $message_type, $data_to_send, array('object_type' => 'order', 'object_id' => $order_id)); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | * @param mixed $data Array or false. |
280 | 280 | * @return void |
281 | 281 | */ |
282 | - public static function wps_direct_payment_link( $data = false ) { |
|
283 | - $data = empty( $data ) ? self::wps_direct_payment_link_verify_token() : $data; |
|
284 | - if ( (bool) $data ) { |
|
285 | - wps_orders_ctr::pay_quotation( $data['oid'] ); |
|
286 | - wpshop_tools::wpshop_safe_redirect( get_permalink( wpshop_tools::get_page_id( get_option( 'wpshop_checkout_page_id' ) ) ) . '?order_step=5' ); |
|
282 | + public static function wps_direct_payment_link($data = false) { |
|
283 | + $data = empty($data) ? self::wps_direct_payment_link_verify_token() : $data; |
|
284 | + if ((bool)$data) { |
|
285 | + wps_orders_ctr::pay_quotation($data['oid']); |
|
286 | + wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_checkout_page_id'))) . '?order_step=5'); |
|
287 | 287 | } else { |
288 | - wpshop_tools::wpshop_safe_redirect( get_permalink( wpshop_tools::get_page_id( get_option( 'wpshop_myaccount_page_id' ) ) ) ); |
|
288 | + wpshop_tools::wpshop_safe_redirect(get_permalink(wpshop_tools::get_page_id(get_option('wpshop_myaccount_page_id')))); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | /** |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | * @param mixed $data Array or false. |
296 | 296 | * @return void |
297 | 297 | */ |
298 | - public static function wps_direct_payment_link_nopriv( $data = false ) { |
|
299 | - $data = empty( $data ) ? self::wps_direct_payment_link_verify_token() : $data; |
|
300 | - if ( (bool) $data ) { |
|
301 | - wp_set_auth_cookie( $data['cid'], true, is_ssl() ); |
|
298 | + public static function wps_direct_payment_link_nopriv($data = false) { |
|
299 | + $data = empty($data) ? self::wps_direct_payment_link_verify_token() : $data; |
|
300 | + if ((bool)$data) { |
|
301 | + wp_set_auth_cookie($data['cid'], true, is_ssl()); |
|
302 | 302 | } |
303 | - self::wps_direct_payment_link( $data ); |
|
303 | + self::wps_direct_payment_link($data); |
|
304 | 304 | } |
305 | 305 | /** |
306 | 306 | * Verify token in request. |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | * @return mixed Customer id or false. |
310 | 310 | */ |
311 | 311 | public static function wps_direct_payment_link_verify_token() { |
312 | - $token = ! empty( $_GET['token'] ) ? sanitize_text_field( $_GET['token'] ) : ''; |
|
313 | - $order_id = ! empty( $_GET['order_id'] ) ? (int) $_GET['order_id'] : ''; |
|
314 | - $order_metadata = get_post_meta( $order_id, '_order_postmeta', true ); |
|
315 | - $customer_id = ! empty( $order_metadata['customer_id'] ) ? (int) $order_metadata['customer_id'] : false; |
|
316 | - return ( (bool) $customer_id && wps_orders_ctr::wps_verify_token_order( $token, (int) $order_id ) ) ? array( 'oid' => $order_id, 'cid' => $customer_id ) : false; |
|
312 | + $token = !empty($_GET['token']) ? sanitize_text_field($_GET['token']) : ''; |
|
313 | + $order_id = !empty($_GET['order_id']) ? (int)$_GET['order_id'] : ''; |
|
314 | + $order_metadata = get_post_meta($order_id, '_order_postmeta', true); |
|
315 | + $customer_id = !empty($order_metadata['customer_id']) ? (int)$order_metadata['customer_id'] : false; |
|
316 | + return ((bool)$customer_id && wps_orders_ctr::wps_verify_token_order($token, (int)$order_id)) ? array('oid' => $order_id, 'cid' => $customer_id) : false; |
|
317 | 317 | } |
318 | 318 | /** |
319 | 319 | * Get URL for wps_direct_link. |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @param int $order_id OrderID. |
323 | 323 | * @return string Url or empty string. |
324 | 324 | */ |
325 | - public static function wps_direct_payment_link_url( $order_id ) { |
|
326 | - return ( (bool) ( $token = wps_orders_ctr::wps_token_order_customer( (int) $order_id ) ) ) ? admin_url( 'admin-post.php?action=wps_direct_payment_link&token=' . $token . '&order_id=' . (int) $order_id ) : ''; |
|
325 | + public static function wps_direct_payment_link_url($order_id) { |
|
326 | + return ((bool)($token = wps_orders_ctr::wps_token_order_customer((int)$order_id))) ? admin_url('admin-post.php?action=wps_direct_payment_link&token=' . $token . '&order_id=' . (int)$order_id) : ''; |
|
327 | 327 | } |
328 | 328 | } |
@@ -1,4 +1,4 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | $wpshop_tab_countries = array( |
3 | 3 | 'AF' => __('Afghanistan', 'wpshop'), |
4 | 4 | 'AX' => __('Åland Islands', 'wpshop'), |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $wpshop_tab_countries = array( |
3 | 5 | 'AF' => __('Afghanistan', 'wpshop'), |
4 | 6 | 'AX' => __('Åland Islands', 'wpshop'), |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helveticaBI']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
6 | - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
8 | - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
14 | - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helveticaBI'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>333, '"'=>474, '#'=>556, '$'=>556, '%'=>889, '&'=>722, '\''=>238, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>333, ';'=>333, '<'=>584, '='=>584, '>'=>584, '?'=>611, '@'=>975, 'A'=>722, |
|
6 | + 'B'=>722, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>556, 'K'=>722, 'L'=>611, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>584, '_'=>556, '`'=>333, 'a'=>556, 'b'=>611, 'c'=>556, 'd'=>611, 'e'=>556, 'f'=>333, 'g'=>611, 'h'=>611, 'i'=>278, 'j'=>278, 'k'=>556, 'l'=>278, 'm'=>889, |
|
8 | + 'n'=>611, 'o'=>611, 'p'=>611, 'q'=>611, 'r'=>389, 's'=>556, 't'=>333, 'u'=>611, 'v'=>556, 'w'=>778, 'x'=>556, 'y'=>556, 'z'=>500, '{'=>389, '|'=>280, '}'=>389, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>278, chr(131)=>556, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>278, chr(146)=>278, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>556, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>280, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>611, chr(182)=>556, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>556, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>611, chr(241)=>611, |
|
14 | + chr(242)=>611, chr(243)=>611, chr(244)=>611, chr(245)=>611, chr(246)=>611, chr(247)=>584, chr(248)=>611, chr(249)=>611, chr(250)=>611, chr(251)=>611, chr(252)=>611, chr(253)=>556, chr(254)=>611, chr(255)=>556); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['helveticaBI']=array( |
3 | 5 | chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
4 | 6 | chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['times']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
6 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['times'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>408, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>180, '('=>333, ')'=>333, '*'=>500, '+'=>564, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>564, '='=>564, '>'=>564, '?'=>444, '@'=>921, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>556, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>389, 'K'=>722, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>556, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>722, 'W'=>944, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>469, '_'=>500, '`'=>333, 'a'=>444, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>333, 's'=>389, 't'=>278, 'u'=>500, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>480, '|'=>200, '}'=>480, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>444, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>889, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>444, chr(148)=>444, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>200, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>564, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>564, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>453, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>444, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>564, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>556, chr(223)=>500, chr(224)=>444, chr(225)=>444, chr(226)=>444, chr(227)=>444, chr(228)=>444, chr(229)=>444, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>564, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>500, chr(254)=>500, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['times']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesB']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
8 | - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesB'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>555, '#'=>500, '$'=>500, '%'=>1000, '&'=>833, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>930, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>778, 'L'=>667, 'M'=>944, 'N'=>722, 'O'=>778, 'P'=>611, 'Q'=>778, 'R'=>722, 'S'=>556, 'T'=>667, 'U'=>722, 'V'=>722, 'W'=>1000, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>667, '['=>333, '\\'=>278, ']'=>333, '^'=>581, '_'=>500, '`'=>333, 'a'=>500, 'b'=>556, 'c'=>444, 'd'=>556, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>333, 'k'=>556, 'l'=>278, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>500, 'p'=>556, 'q'=>556, 'r'=>444, 's'=>389, 't'=>333, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>394, '|'=>220, '}'=>394, '~'=>520, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>667, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>300, chr(171)=>500, chr(172)=>570, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>556, chr(182)=>540, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>330, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>570, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>611, chr(223)=>556, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['timesB']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helvetica']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
8 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, |
|
9 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
14 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helvetica'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556, |
|
9 | + chr(132)=>333, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>500, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>260, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>556, chr(182)=>537, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>500, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>556, chr(241)=>556, |
|
14 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['helvetica']=array( |
3 | 5 | chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
4 | 6 | chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesI']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, |
|
6 | - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, |
|
7 | - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesI'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>420, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>214, '('=>333, ')'=>333, '*'=>500, '+'=>675, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>675, '='=>675, '>'=>675, '?'=>500, '@'=>920, 'A'=>611, |
|
6 | + 'B'=>611, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>611, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>444, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>667, 'O'=>722, 'P'=>611, 'Q'=>722, 'R'=>611, 'S'=>500, 'T'=>556, 'U'=>722, 'V'=>611, 'W'=>833, |
|
7 | + 'X'=>611, 'Y'=>556, 'Z'=>556, '['=>389, '\\'=>278, ']'=>389, '^'=>422, '_'=>500, '`'=>333, 'a'=>500, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>278, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>444, 'l'=>278, 'm'=>722, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>389, 's'=>389, 't'=>278, 'u'=>500, 'v'=>444, 'w'=>667, 'x'=>444, 'y'=>444, 'z'=>389, '{'=>400, '|'=>275, '}'=>400, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>556, chr(133)=>889, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>500, chr(139)=>333, chr(140)=>944, chr(141)=>350, chr(142)=>556, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>556, chr(148)=>556, chr(149)=>350, chr(150)=>500, chr(151)=>889, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>667, chr(157)=>350, chr(158)=>389, chr(159)=>556, chr(160)=>250, chr(161)=>389, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>275, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>675, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>675, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>523, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>611, chr(193)=>611, chr(194)=>611, chr(195)=>611, chr(196)=>611, chr(197)=>611, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>667, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>675, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>556, chr(222)=>611, chr(223)=>500, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>675, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>444, chr(254)=>500, chr(255)=>444); |
|
15 | 15 | ?> |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | $fpdf_charwidths['timesI']=array( |
3 | 5 | chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
4 | 6 | chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, |
@@ -1,7 +1,7 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
3 | - $fpdf_charwidths['courier'][chr($i)]=600; |
|
4 | -$fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
|
5 | -$fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
|
6 | -$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +for ($i = 0; $i <= 255; $i++) |
|
3 | + $fpdf_charwidths['courier'][chr($i)] = 600; |
|
4 | +$fpdf_charwidths['courierB'] = $fpdf_charwidths['courier']; |
|
5 | +$fpdf_charwidths['courierI'] = $fpdf_charwidths['courier']; |
|
6 | +$fpdf_charwidths['courierBI'] = $fpdf_charwidths['courier']; |
|
7 | 7 | ?> |
@@ -1,6 +1,9 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -for($i=0;$i<=255;$i++) |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
4 | +for($i=0;$i<=255;$i++) { |
|
3 | 5 | $fpdf_charwidths['courier'][chr($i)]=600; |
6 | +} |
|
4 | 7 | $fpdf_charwidths['courierB']=$fpdf_charwidths['courier']; |
5 | 8 | $fpdf_charwidths['courierI']=$fpdf_charwidths['courier']; |
6 | 9 | $fpdf_charwidths['courierBI']=$fpdf_charwidths['courier']; |