@@ -18,55 +18,55 @@ discard block |
||
18 | 18 | * @package wpshop |
19 | 19 | */ |
20 | 20 | |
21 | -ini_set( 'memory_limit', '512M' ); |
|
21 | +ini_set('memory_limit', '512M'); |
|
22 | 22 | |
23 | 23 | /** Check if file is include. No direct access possible with file url */ |
24 | -if ( ! defined( 'ABSPATH' ) ) { |
|
25 | - die( 'Access is not allowed by this way' ); |
|
24 | +if (!defined('ABSPATH')) { |
|
25 | + die('Access is not allowed by this way'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** Allows to refresh css and js file in final user browser */ |
29 | -DEFINE( 'WPSHOP_VERSION', '1.4.4.3' ); |
|
29 | +DEFINE('WPSHOP_VERSION', '1.4.4.3'); |
|
30 | 30 | |
31 | 31 | /** Allows to avoid problem with theme not supporting thumbnail for post */ |
32 | -add_theme_support( 'post-thumbnails' ); |
|
33 | -add_image_size( 'wpshop-product-galery', 270, 270, true ); |
|
34 | -add_image_size( 'wps-categorie-mini-display', 80, 80, true ); |
|
35 | -add_image_size( 'wps-categorie-display', 480, 340, true ); |
|
32 | +add_theme_support('post-thumbnails'); |
|
33 | +add_image_size('wpshop-product-galery', 270, 270, true); |
|
34 | +add_image_size('wps-categorie-mini-display', 80, 80, true); |
|
35 | +add_image_size('wps-categorie-display', 480, 340, true); |
|
36 | 36 | |
37 | 37 | /** First thing we define the main directory for our plugin in a super global var */ |
38 | -DEFINE( 'WPSHOP_PLUGIN_DIR', basename( dirname( __FILE__ ) ) ); |
|
39 | -DEFINE( 'WPSHOP_PLUGIN_NAME', plugin_basename( __FILE__ ) ); |
|
38 | +DEFINE('WPSHOP_PLUGIN_DIR', basename(dirname(__FILE__))); |
|
39 | +DEFINE('WPSHOP_PLUGIN_NAME', plugin_basename(__FILE__)); |
|
40 | 40 | |
41 | 41 | /** Get the current language to translate the different text in plugin */ |
42 | 42 | $locale = get_locale(); |
43 | 43 | global $wpdb; |
44 | -if ( defined( 'ICL_LANGUAGE_CODE' ) ) { |
|
45 | - $query = $wpdb->prepare( 'SELECT locale FROM ' . $wpdb->prefix . 'icl_locale_map WHERE code = %s', ICL_LANGUAGE_CODE ); |
|
46 | - $local = $wpdb->get_var( $query ); |
|
47 | - $locale = ! empty( $local ) ? $local : $locale; |
|
44 | +if (defined('ICL_LANGUAGE_CODE')) { |
|
45 | + $query = $wpdb->prepare('SELECT locale FROM ' . $wpdb->prefix . 'icl_locale_map WHERE code = %s', ICL_LANGUAGE_CODE); |
|
46 | + $local = $wpdb->get_var($query); |
|
47 | + $locale = !empty($local) ? $local : $locale; |
|
48 | 48 | } |
49 | -DEFINE( 'WPSHOP_CURRENT_LOCALE', $locale ); |
|
49 | +DEFINE('WPSHOP_CURRENT_LOCALE', $locale); |
|
50 | 50 | /** Load plugin translation */ |
51 | -load_plugin_textdomain( 'wpshop', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
|
51 | +load_plugin_textdomain('wpshop', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
|
52 | 52 | |
53 | 53 | /** Include the config file */ |
54 | 54 | require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/config.php'; |
55 | 55 | |
56 | 56 | /** Allow to get errors back when debug mode is set to true */ |
57 | -if ( WPSHOP_DEBUG_MODE && (in_array( long2ip( ip2long( $_SERVER['REMOTE_ADDR'] ) ), unserialize( WPSHOP_DEBUG_MODE_ALLOWED_IP ) )) ) { |
|
58 | - ini_set( 'display_errors', true ); |
|
59 | - error_reporting( E_ALL ); |
|
57 | +if (WPSHOP_DEBUG_MODE && (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP)))) { |
|
58 | + ini_set('display_errors', true); |
|
59 | + error_reporting(E_ALL); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | include_once WPSHOP_LIBRAIRIES_DIR . 'init.class.php'; |
63 | -$current_installation_step = get_option( 'wps-installation-current-step', 1 ); |
|
63 | +$current_installation_step = get_option('wps-installation-current-step', 1); |
|
64 | 64 | |
65 | 65 | /** Get current plugin version */ |
66 | -$current_db_version = get_option( 'wpshop_db_options', 0 ); |
|
66 | +$current_db_version = get_option('wpshop_db_options', 0); |
|
67 | 67 | |
68 | 68 | /** Call main initialisation function */ |
69 | -add_action( 'init', array( 'wpshop_init', 'load' ) ); |
|
69 | +add_action('init', array('wpshop_init', 'load')); |
|
70 | 70 | |
71 | 71 | /** Include the main including file */ |
72 | 72 | require WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/include.php'; |
@@ -78,35 +78,35 @@ discard block |
||
78 | 78 | |
79 | 79 | /** Call function to create the main left menu */ |
80 | 80 | // if ( ( WPSINSTALLER_STEPS_COUNT <= $current_installation_step ) || ( !empty( $current_db_version ) && !empty( $current_db_version[ 'db_version' ] ) && ( 51 < $current_db_version[ 'db_version' ] ) ) || ( !empty( $_GET ) && !empty( $_GET[ 'installation_state' ] ) && ( "ignored" == $_GET[ 'installation_state' ] ) ) ) { |
81 | -add_action( 'admin_menu', array( 'wpshop_init', 'admin_menu' ) ); |
|
82 | -add_action( 'menu_order', array( 'wpshop_init', 'admin_menu_order' ) ); |
|
83 | -add_action( 'custom_menu_order', array( 'wpshop_init', 'admin_custom_menu_order' ) ); |
|
81 | +add_action('admin_menu', array('wpshop_init', 'admin_menu')); |
|
82 | +add_action('menu_order', array('wpshop_init', 'admin_menu_order')); |
|
83 | +add_action('custom_menu_order', array('wpshop_init', 'admin_custom_menu_order')); |
|
84 | 84 | |
85 | 85 | /* Call function for new WordPress element creating [term (product_category) / post (product)] */ |
86 | -add_action( 'init', array( 'wpshop_init', 'add_new_wp_type' ) ); |
|
86 | +add_action('init', array('wpshop_init', 'add_new_wp_type')); |
|
87 | 87 | |
88 | 88 | /* Call function allowing to change element front output */ |
89 | -add_action( 'the_content', array( 'wpshop_display', 'products_page' ), 1 ); |
|
89 | +add_action('the_content', array('wpshop_display', 'products_page'), 1); |
|
90 | 90 | // add_action('archive_template', array('wpshop_categories', 'category_template_switcher')); |
91 | 91 | // } |
92 | 92 | /** On plugin activation create the default parameters to use the ecommerce */ |
93 | -register_activation_hook( __FILE__, array( 'wpshop_install', 'install_on_activation' ) ); |
|
93 | +register_activation_hook(__FILE__, array('wpshop_install', 'install_on_activation')); |
|
94 | 94 | |
95 | 95 | /** On plugin deactivation call the function to clean the WordPress installation */ |
96 | -register_deactivation_hook( __FILE__, array( 'wpshop_install', 'uninstall_wpshop' ) ); |
|
96 | +register_deactivation_hook(__FILE__, array('wpshop_install', 'uninstall_wpshop')); |
|
97 | 97 | |
98 | 98 | /** Get current plugin version */ |
99 | -$current_db_version = get_option( 'wpshop_db_options', 0 ); |
|
99 | +$current_db_version = get_option('wpshop_db_options', 0); |
|
100 | 100 | |
101 | 101 | /** Add the database content */ |
102 | -add_action( 'admin_init', array( 'wpshop_install', 'update_wpshop' ) ); |
|
103 | -if ( (defined( 'WPSINSTALLER_STEPS_COUNT' ) && (WPSINSTALLER_STEPS_COUNT <= $current_installation_step)) || ( ! empty( $current_db_version ) && ! empty( $current_db_version['db_version'] ) && (51 < $current_db_version['db_version'])) || ( ! empty( $current_db_version ) && ! empty( $current_db_version['installation_state'] ) && ('ignore' == $current_db_version['installation_state'])) ) { |
|
104 | - if ( in_array( long2ip( ip2long( $_SERVER['REMOTE_ADDR'] ) ), unserialize( WPSHOP_DEBUG_MODE_ALLOWED_IP ) ) ) { |
|
105 | - add_action( 'admin_init', array( 'wpshop_install', 'update_wpshop_dev' ) ); |
|
102 | +add_action('admin_init', array('wpshop_install', 'update_wpshop')); |
|
103 | +if ((defined('WPSINSTALLER_STEPS_COUNT') && (WPSINSTALLER_STEPS_COUNT <= $current_installation_step)) || (!empty($current_db_version) && !empty($current_db_version['db_version']) && (51 < $current_db_version['db_version'])) || (!empty($current_db_version) && !empty($current_db_version['installation_state']) && ('ignore' == $current_db_version['installation_state']))) { |
|
104 | + if (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP))) { |
|
105 | + add_action('admin_init', array('wpshop_install', 'update_wpshop_dev')); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | // Start session |
109 | -if ( session_id() == '' ) { |
|
109 | +if (session_id() == '') { |
|
110 | 110 | session_start(); |
111 | 111 | } |
112 | 112 | |
@@ -116,52 +116,52 @@ discard block |
||
116 | 116 | $wpshop = new wpshop_form_management(); |
117 | 117 | $wpshop_payment = new wpshop_payment(); |
118 | 118 | } |
119 | -add_action( 'init', 'classes_init' ); |
|
119 | +add_action('init', 'classes_init'); |
|
120 | 120 | |
121 | 121 | /** Shortcode management */ |
122 | -add_shortcode( 'wpshop_att_val', array( 'wpshop_attributes', 'wpshop_att_val_func' ) ); // Attributes |
|
123 | -add_shortcode( 'wpshop_products', array( 'wpshop_products', 'wpshop_products_func' ) ); // Products list |
|
124 | -add_shortcode( 'wpshop_product', array( 'wpshop_products', 'wpshop_products_func' ) ); // Products list |
|
125 | -add_shortcode( 'wpshop_product_variation_summary', array( 'wpshop_products', 'wpshop_product_variations_summary' ) ); // Variation summary |
|
126 | -add_shortcode( 'wpshop_product_variation_value_detail', array( 'wpshop_products', 'wpshop_product_variation_value_detail' ) ); // Variation value detail |
|
127 | -add_shortcode( 'wpshop_related_products', array( 'wpshop_products', 'wpshop_related_products_func' ) ); // Products list |
|
128 | -add_shortcode( 'wpshop_category', array( 'wpshop_categories', 'wpshop_category_func' ) ); // Category |
|
129 | -add_shortcode( 'wpshop_att_group', array( 'wpshop_attributes_set', 'wpshop_att_group_func' ) ); // Attributes groups |
|
130 | -add_shortcode( 'wpshop_cart', 'wpshop_display_cart' ); // Cart |
|
122 | +add_shortcode('wpshop_att_val', array('wpshop_attributes', 'wpshop_att_val_func')); // Attributes |
|
123 | +add_shortcode('wpshop_products', array('wpshop_products', 'wpshop_products_func')); // Products list |
|
124 | +add_shortcode('wpshop_product', array('wpshop_products', 'wpshop_products_func')); // Products list |
|
125 | +add_shortcode('wpshop_product_variation_summary', array('wpshop_products', 'wpshop_product_variations_summary')); // Variation summary |
|
126 | +add_shortcode('wpshop_product_variation_value_detail', array('wpshop_products', 'wpshop_product_variation_value_detail')); // Variation value detail |
|
127 | +add_shortcode('wpshop_related_products', array('wpshop_products', 'wpshop_related_products_func')); // Products list |
|
128 | +add_shortcode('wpshop_category', array('wpshop_categories', 'wpshop_category_func')); // Category |
|
129 | +add_shortcode('wpshop_att_group', array('wpshop_attributes_set', 'wpshop_att_group_func')); // Attributes groups |
|
130 | +add_shortcode('wpshop_cart', 'wpshop_display_cart'); // Cart |
|
131 | 131 | // add_shortcode('wpshop_mini_cart', 'wpshop_display_mini_cart'); // Mini cart |
132 | 132 | // add_shortcode('wpshop_signup', 'wpshop_signup_init'); // Signup |
133 | 133 | // add_shortcode('wpshop_myaccount', 'wpshop_account_display_form' ); |
134 | -add_shortcode( 'wpshop_payment_result', array( 'wpshop_payment', 'wpshop_payment_result' ) ); // Payment result |
|
135 | -add_shortcode( 'wpshop_payment_result_unsuccessfull', array( 'wpshop_payment', 'wpshop_payment_result' ) ); // Payment result |
|
134 | +add_shortcode('wpshop_payment_result', array('wpshop_payment', 'wpshop_payment_result')); // Payment result |
|
135 | +add_shortcode('wpshop_payment_result_unsuccessfull', array('wpshop_payment', 'wpshop_payment_result')); // Payment result |
|
136 | 136 | |
137 | -add_shortcode( 'wpshop_variations', array( 'wpshop_products', 'wpshop_variation' ) ); |
|
138 | -add_shortcode( 'wpshop_entities', array( 'wpshop_entities', 'wpshop_entities_shortcode' ) ); |
|
139 | -add_shortcode( 'wpshop_attributes', array( 'wpshop_attributes', 'wpshop_attributes_shortcode' ) ); |
|
137 | +add_shortcode('wpshop_variations', array('wpshop_products', 'wpshop_variation')); |
|
138 | +add_shortcode('wpshop_entities', array('wpshop_entities', 'wpshop_entities_shortcode')); |
|
139 | +add_shortcode('wpshop_attributes', array('wpshop_attributes', 'wpshop_attributes_shortcode')); |
|
140 | 140 | |
141 | 141 | /** Add specific messages for wpshop elements management */ |
142 | 142 | // add_filter('post_updated_messages', array('wpshop_messages', 'update_wp_message_list')); |
143 | -$file = basename( __FILE__ ); |
|
144 | -$folder = basename( dirname( __FILE__ ) ); |
|
143 | +$file = basename(__FILE__); |
|
144 | +$folder = basename(dirname(__FILE__)); |
|
145 | 145 | $hook = "in_plugin_update_message-{$folder}/{$file}"; |
146 | -add_action( $hook, 'wps_update_message', 10, 2 ); // 10:priority, 2:arguments # |
|
147 | -function wps_update_message( $currentPluginMetadata, $newPluginMetadata ) { |
|
146 | +add_action($hook, 'wps_update_message', 10, 2); // 10:priority, 2:arguments # |
|
147 | +function wps_update_message($currentPluginMetadata, $newPluginMetadata) { |
|
148 | 148 | $message = ''; |
149 | 149 | |
150 | - if ( '1.4.1.6' == $currentPluginMetadata['Version'] ) { |
|
151 | - $message = sprintf( __( 'For security reason %1$splease read this post%2$s', 'wpshop' ), '<a href="" >', '</a>' ); |
|
150 | + if ('1.4.1.6' == $currentPluginMetadata['Version']) { |
|
151 | + $message = sprintf(__('For security reason %1$splease read this post%2$s', 'wpshop'), '<a href="" >', '</a>'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | // check "upgrade_notice" |
155 | - if ( isset( $newPluginMetadata->upgrade_notice ) && strlen( trim( $newPluginMetadata->upgrade_notice ) ) > 0 ) { |
|
156 | - $message = esc_html( $newPluginMetadata->upgrade_notice ); |
|
155 | + if (isset($newPluginMetadata->upgrade_notice) && strlen(trim($newPluginMetadata->upgrade_notice)) > 0) { |
|
156 | + $message = esc_html($newPluginMetadata->upgrade_notice); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( ! empty( $message ) ) { |
|
160 | - echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>' . __( 'Important upgrade notice', 'wpshop' ) . ': </strong>' . $message . '</p>'; |
|
159 | + if (!empty($message)) { |
|
160 | + echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>' . __('Important upgrade notice', 'wpshop') . ': </strong>' . $message . '</p>'; |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | require_once 'core/external/wpeo_util/singleton.util.php'; |
165 | 165 | require_once 'core/external/wpeo_util/init.util.php'; |
166 | 166 | require_once 'core/external/wpeo_log/class/log.class.php'; |
167 | -\eoxia\Init_util::g()->exec( realpath( plugin_dir_path( __FILE__ ) ) . '/', basename( __FILE__, '.php' ) ); |
|
167 | +\eoxia\Init_util::g()->exec(realpath(plugin_dir_path(__FILE__)) . '/', basename(__FILE__, '.php')); |