@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
| 2 | + exit; |
|
| 3 | +} |
|
| 2 | 4 | class wps_product_ctr { |
| 3 | 5 | |
| 4 | 6 | /** |
@@ -47,8 +49,9 @@ discard block |
||
| 47 | 49 | |
| 48 | 50 | public function callback_admin_enqueue_scripts( $hook ) { |
| 49 | 51 | wp_enqueue_script( 'wps_backend_product_js', WPS_PRODUCT_URL . '/asset/js/backend-product.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
| 50 | - if( $hook != 'tools_page_wpshop_tools' ) |
|
| 51 | - return; |
|
| 52 | + if( $hook != 'tools_page_wpshop_tools' ) { |
|
| 53 | + return; |
|
| 54 | + } |
|
| 52 | 55 | |
| 53 | 56 | wp_enqueue_script( 'wps_product_js', WPS_PRODUCT_URL . '/asset/js/backend.js', array( "jquery", "jquery-form" ), WPS_PRODUCT_VERSION ); |
| 54 | 57 | } |
@@ -139,8 +142,7 @@ discard block |
||
| 139 | 142 | |
| 140 | 143 | if (($manage_stock_is_activated && $the_qty_is_in_stock) OR !$manage_stock_is_activated) { |
| 141 | 144 | return true; |
| 142 | - } |
|
| 143 | - else { |
|
| 145 | + } else { |
|
| 144 | 146 | return __('You cannot add that amount to the cart since there is not enough stock.', 'wpshop'); |
| 145 | 147 | } |
| 146 | 148 | } |
@@ -180,8 +182,9 @@ discard block |
||
| 180 | 182 | if(!empty($product->price) && is_array($product->price)) { |
| 181 | 183 | $array_price = array(); |
| 182 | 184 | foreach($product->price as &$price) { |
| 183 | - if(strpos( $price, '&&' )) |
|
| 184 | - $price = substr($price, 0, -2); |
|
| 185 | + if(strpos( $price, '&&' )) { |
|
| 186 | + $price = substr($price, 0, -2); |
|
| 187 | + } |
|
| 185 | 188 | |
| 186 | 189 | $tmp_price = explode('&sep&', $price); |
| 187 | 190 | $key = $tmp_price[0]; |
@@ -235,13 +238,15 @@ discard block |
||
| 235 | 238 | * @return WP_Post |
| 236 | 239 | */ |
| 237 | 240 | public function get_thumbnail ( $pid ) { |
| 238 | - if( empty( $pid ) ) |
|
| 239 | - return null; |
|
| 241 | + if( empty( $pid ) ) { |
|
| 242 | + return null; |
|
| 243 | + } |
|
| 240 | 244 | |
| 241 | 245 | $thumbnail_id = get_post_meta( $pid, '_thumbnail_id', true ); |
| 242 | 246 | |
| 243 | - if( empty( $thumbnail_id ) ) |
|
| 244 | - return null; |
|
| 247 | + if( empty( $thumbnail_id ) ) { |
|
| 248 | + return null; |
|
| 249 | + } |
|
| 245 | 250 | |
| 246 | 251 | return $thumbnail_id; |
| 247 | 252 | } |
@@ -285,8 +290,7 @@ discard block |
||
| 285 | 290 | array($value_attribute, $product_id, $attribute_id) |
| 286 | 291 | ) |
| 287 | 292 | ); |
| 288 | - } |
|
| 289 | - else { |
|
| 293 | + } else { |
|
| 290 | 294 | /** Insert avec toutes les informations requise */ |
| 291 | 295 | $wpdb->insert(WPSHOP_DBT_ATTRIBUTE . '_value_' . $type, array( |
| 292 | 296 | 'attribute_id' => $attribute_id, |
@@ -397,8 +401,7 @@ discard block |
||
| 397 | 401 | $html2pdf->setDefaultFont('Arial'); |
| 398 | 402 | $html2pdf->writeHTML($html_content); |
| 399 | 403 | $html2pdf->Output('product-' .$product_id.'-'.$product_post->post_name.'.pdf', 'D'); |
| 400 | - } |
|
| 401 | - catch (HTML2PDF_exception $e) { |
|
| 404 | + } catch (HTML2PDF_exception $e) { |
|
| 402 | 405 | echo $e; |
| 403 | 406 | } |
| 404 | 407 | } |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
| 1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
| 2 | + exit; |
|
| 3 | +} |
|
| 2 | 4 | if( !empty($messages_histo) && is_array($messages_histo) ) :?> |
| 3 | 5 | <div class="wps-table wps-my-message"> |
| 4 | 6 | <div class="wps-table-header wps-table-row"> |
@@ -62,8 +64,11 @@ discard block |
||
| 62 | 64 | ); |
| 63 | 65 | ?> |
| 64 | 66 | </div> |
| 65 | -<?php else: ?> |
|
| 67 | +<?php else { |
|
| 68 | + : ?> |
|
| 66 | 69 | <div class="wps-alert-info"> |
| 67 | - <?php _e( 'No email was sent.', 'wpshop' ); ?> |
|
| 70 | + <?php _e( 'No email was sent.', 'wpshop' ); |
|
| 71 | +} |
|
| 72 | +?> |
|
| 68 | 73 | </div> |
| 69 | 74 | <?php endif; ?> |