|
@@ -18,55 +18,55 @@ discard block |
|
|
block discarded – undo |
|
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.4' ); |
|
|
29
|
+DEFINE('WPSHOP_VERSION', '1.4.4.4'); |
|
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,32 +78,32 @@ discard block |
|
|
block discarded – undo |
|
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
|
/** Get current plugin version */ |
|
96
|
|
-$current_db_version = get_option( 'wpshop_db_options', 0 ); |
|
|
96
|
+$current_db_version = get_option('wpshop_db_options', 0); |
|
97
|
97
|
|
|
98
|
98
|
/** Add the database content */ |
|
99
|
|
-add_action( 'admin_init', array( 'wpshop_install', 'update_wpshop' ) ); |
|
100
|
|
-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'])) ) { |
|
101
|
|
- if ( in_array( long2ip( ip2long( $_SERVER['REMOTE_ADDR'] ) ), unserialize( WPSHOP_DEBUG_MODE_ALLOWED_IP ) ) ) { |
|
102
|
|
- add_action( 'admin_init', array( 'wpshop_install', 'update_wpshop_dev' ) ); |
|
|
99
|
+add_action('admin_init', array('wpshop_install', 'update_wpshop')); |
|
|
100
|
+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']))) { |
|
|
101
|
+ if (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP))) { |
|
|
102
|
+ add_action('admin_init', array('wpshop_install', 'update_wpshop_dev')); |
|
103
|
103
|
} |
|
104
|
104
|
} |
|
105
|
105
|
// Start session |
|
106
|
|
-if ( session_id() == '' ) { |
|
|
106
|
+if (session_id() == '') { |
|
107
|
107
|
session_start(); |
|
108
|
108
|
} |
|
109
|
109
|
|
|
@@ -113,29 +113,29 @@ discard block |
|
|
block discarded – undo |
|
113
|
113
|
$wpshop = new wpshop_form_management(); |
|
114
|
114
|
$wpshop_payment = new wpshop_payment(); |
|
115
|
115
|
} |
|
116
|
|
-add_action( 'init', 'classes_init' ); |
|
|
116
|
+add_action('init', 'classes_init'); |
|
117
|
117
|
|
|
118
|
118
|
/** Shortcode management */ |
|
119
|
|
-add_shortcode( 'wpshop_att_val', array( 'wpshop_attributes', 'wpshop_att_val_func' ) ); // Attributes |
|
120
|
|
-add_shortcode( 'wpshop_products', array( 'wpshop_products', 'wpshop_products_func' ) ); // Products list |
|
121
|
|
-add_shortcode( 'wpshop_product', array( 'wpshop_products', 'wpshop_products_func' ) ); // Products list |
|
122
|
|
-add_shortcode( 'wpshop_product_variation_summary', array( 'wpshop_products', 'wpshop_product_variations_summary' ) ); // Variation summary |
|
123
|
|
-add_shortcode( 'wpshop_product_variation_value_detail', array( 'wpshop_products', 'wpshop_product_variation_value_detail' ) ); // Variation value detail |
|
124
|
|
-add_shortcode( 'wpshop_related_products', array( 'wpshop_products', 'wpshop_related_products_func' ) ); // Products list |
|
125
|
|
-add_shortcode( 'wpshop_category', array( 'wpshop_categories', 'wpshop_category_func' ) ); // Category |
|
126
|
|
-add_shortcode( 'wpshop_att_group', array( 'wpshop_attributes_set', 'wpshop_att_group_func' ) ); // Attributes groups |
|
127
|
|
-add_shortcode( 'wpshop_cart', 'wpshop_display_cart' ); // Cart |
|
|
119
|
+add_shortcode('wpshop_att_val', array('wpshop_attributes', 'wpshop_att_val_func')); // Attributes |
|
|
120
|
+add_shortcode('wpshop_products', array('wpshop_products', 'wpshop_products_func')); // Products list |
|
|
121
|
+add_shortcode('wpshop_product', array('wpshop_products', 'wpshop_products_func')); // Products list |
|
|
122
|
+add_shortcode('wpshop_product_variation_summary', array('wpshop_products', 'wpshop_product_variations_summary')); // Variation summary |
|
|
123
|
+add_shortcode('wpshop_product_variation_value_detail', array('wpshop_products', 'wpshop_product_variation_value_detail')); // Variation value detail |
|
|
124
|
+add_shortcode('wpshop_related_products', array('wpshop_products', 'wpshop_related_products_func')); // Products list |
|
|
125
|
+add_shortcode('wpshop_category', array('wpshop_categories', 'wpshop_category_func')); // Category |
|
|
126
|
+add_shortcode('wpshop_att_group', array('wpshop_attributes_set', 'wpshop_att_group_func')); // Attributes groups |
|
|
127
|
+add_shortcode('wpshop_cart', 'wpshop_display_cart'); // Cart |
|
128
|
128
|
// add_shortcode('wpshop_mini_cart', 'wpshop_display_mini_cart'); // Mini cart |
|
129
|
129
|
// add_shortcode('wpshop_signup', 'wpshop_signup_init'); // Signup |
|
130
|
130
|
// add_shortcode('wpshop_myaccount', 'wpshop_account_display_form' ); |
|
131
|
|
-add_shortcode( 'wpshop_payment_result', array( 'wpshop_payment', 'wpshop_payment_result' ) ); // Payment result |
|
132
|
|
-add_shortcode( 'wpshop_payment_result_unsuccessfull', array( 'wpshop_payment', 'wpshop_payment_result' ) ); // Payment result |
|
|
131
|
+add_shortcode('wpshop_payment_result', array('wpshop_payment', 'wpshop_payment_result')); // Payment result |
|
|
132
|
+add_shortcode('wpshop_payment_result_unsuccessfull', array('wpshop_payment', 'wpshop_payment_result')); // Payment result |
|
133
|
133
|
|
|
134
|
|
-add_shortcode( 'wpshop_variations', array( 'wpshop_products', 'wpshop_variation' ) ); |
|
135
|
|
-add_shortcode( 'wpshop_entities', array( 'wpshop_entities', 'wpshop_entities_shortcode' ) ); |
|
136
|
|
-add_shortcode( 'wpshop_attributes', array( 'wpshop_attributes', 'wpshop_attributes_shortcode' ) ); |
|
|
134
|
+add_shortcode('wpshop_variations', array('wpshop_products', 'wpshop_variation')); |
|
|
135
|
+add_shortcode('wpshop_entities', array('wpshop_entities', 'wpshop_entities_shortcode')); |
|
|
136
|
+add_shortcode('wpshop_attributes', array('wpshop_attributes', 'wpshop_attributes_shortcode')); |
|
137
|
137
|
|
|
138
|
138
|
require_once 'core/external/wpeo_util/singleton.util.php'; |
|
139
|
139
|
require_once 'core/external/wpeo_util/init.util.php'; |
|
140
|
140
|
require_once 'core/external/wpeo_log/class/log.class.php'; |
|
141
|
|
-\eoxia\Init_util::g()->exec( realpath( plugin_dir_path( __FILE__ ) ) . '/', basename( __FILE__, '.php' ) ); |
|
|
141
|
+\eoxia\Init_util::g()->exec(realpath(plugin_dir_path(__FILE__)) . '/', basename(__FILE__, '.php')); |