|
@@ -20,18 +20,18 @@ discard block |
|
|
block discarded – undo |
|
20
|
20
|
ini_set('memory_limit', '512M'); |
|
21
|
21
|
|
|
22
|
22
|
/** Check if file is include. No direct access possible with file url */ |
|
23
|
|
-if ( !defined( 'ABSPATH' ) ) { |
|
24
|
|
- die( 'Access is not allowed by this way' ); |
|
|
23
|
+if (!defined('ABSPATH')) { |
|
|
24
|
+ die('Access is not allowed by this way'); |
|
25
|
25
|
} |
|
26
|
26
|
|
|
27
|
27
|
/** Allows to refresh css and js file in final user browser */ |
|
28
|
28
|
DEFINE('WPSHOP_VERSION', '1.4.3.2'); |
|
29
|
29
|
|
|
30
|
30
|
/** Allows to avoid problem with theme not supporting thumbnail for post */ |
|
31
|
|
-add_theme_support( 'post-thumbnails' ); |
|
32
|
|
-add_image_size( 'wpshop-product-galery', 270, 270, true ); |
|
33
|
|
-add_image_size( 'wps-categorie-mini-display', 80, 80, true ); |
|
34
|
|
-add_image_size( 'wps-categorie-display', 480, 340, true ); |
|
|
31
|
+add_theme_support('post-thumbnails'); |
|
|
32
|
+add_image_size('wpshop-product-galery', 270, 270, true); |
|
|
33
|
+add_image_size('wps-categorie-mini-display', 80, 80, true); |
|
|
34
|
+add_image_size('wps-categorie-display', 480, 340, true); |
|
35
|
35
|
|
|
36
|
36
|
/** First thing we define the main directory for our plugin in a super global var */ |
|
37
|
37
|
DEFINE('WPSHOP_PLUGIN_DIR', basename(dirname(__FILE__))); |
|
@@ -39,26 +39,26 @@ discard block |
|
|
block discarded – undo |
|
39
|
39
|
/** Get the current language to translate the different text in plugin */ |
|
40
|
40
|
$locale = get_locale(); |
|
41
|
41
|
global $wpdb; |
|
42
|
|
-if ( defined("ICL_LANGUAGE_CODE") ) { |
|
|
42
|
+if (defined("ICL_LANGUAGE_CODE")) { |
|
43
|
43
|
$query = $wpdb->prepare("SELECT locale FROM " . $wpdb->prefix . "icl_locale_map WHERE code = %s", ICL_LANGUAGE_CODE); |
|
44
|
44
|
$local = $wpdb->get_var($query); |
|
45
|
45
|
$locale = !empty($local) ? $local : $locale; |
|
46
|
46
|
} |
|
47
|
47
|
DEFINE('WPSHOP_CURRENT_LOCALE', $locale); |
|
48
|
48
|
/** Load plugin translation */ |
|
49
|
|
-load_plugin_textdomain( 'wpshop', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/'); |
|
|
49
|
+load_plugin_textdomain('wpshop', false, dirname(plugin_basename(__FILE__)) . '/languages/'); |
|
50
|
50
|
|
|
51
|
51
|
/** Include the config file */ |
|
52
|
52
|
require(WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/includes/config.php'); |
|
53
|
53
|
|
|
54
|
54
|
/** Allow to get errors back when debug mode is set to true */ |
|
55
|
|
-if ( WPSHOP_DEBUG_MODE && (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP)) ) ) { |
|
|
55
|
+if (WPSHOP_DEBUG_MODE && (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP)))) { |
|
56
|
56
|
ini_set('display_errors', true); |
|
57
|
57
|
error_reporting(E_ALL); |
|
58
|
58
|
} |
|
59
|
59
|
|
|
60
|
60
|
include_once(WPSHOP_LIBRAIRIES_DIR . 'init.class.php'); |
|
61
|
|
-$current_installation_step = get_option( 'wps-installation-current-step', 1 ); |
|
|
61
|
+$current_installation_step = get_option('wps-installation-current-step', 1); |
|
62
|
62
|
|
|
63
|
63
|
/** Get current plugin version */ |
|
64
|
64
|
$current_db_version = get_option('wpshop_db_options', 0); |
|
@@ -76,32 +76,32 @@ discard block |
|
|
block discarded – undo |
|
76
|
76
|
|
|
77
|
77
|
/** Call function to create the main left menu */ |
|
78
|
78
|
//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' ] ) ) ) { |
|
79
|
|
- add_action('admin_menu', array( 'wpshop_init', 'admin_menu' ) ); |
|
80
|
|
- add_action( 'menu_order', array( 'wpshop_init', 'admin_menu_order' ) ); |
|
81
|
|
- add_action( 'custom_menu_order', array( 'wpshop_init', 'admin_custom_menu_order' ) ); |
|
|
79
|
+ add_action('admin_menu', array('wpshop_init', 'admin_menu')); |
|
|
80
|
+ add_action('menu_order', array('wpshop_init', 'admin_menu_order')); |
|
|
81
|
+ add_action('custom_menu_order', array('wpshop_init', 'admin_custom_menu_order')); |
|
82
|
82
|
|
|
83
|
83
|
/* Call function for new wordpress element creating [term (product_category) / post (product)] */ |
|
84
|
|
- add_action( 'init', array( 'wpshop_init', 'add_new_wp_type' ) ); |
|
|
84
|
+ add_action('init', array('wpshop_init', 'add_new_wp_type')); |
|
85
|
85
|
|
|
86
|
86
|
/* Call function allowing to change element front output */ |
|
87
|
|
- add_action( 'the_content', array( 'wpshop_display', 'products_page' ), 1 ); |
|
|
87
|
+ add_action('the_content', array('wpshop_display', 'products_page'), 1); |
|
88
|
88
|
// add_action('archive_template', array('wpshop_categories', 'category_template_switcher')); |
|
89
|
89
|
//} |
|
90
|
90
|
|
|
91
|
91
|
/** On plugin activation create the default parameters to use the ecommerce */ |
|
92
|
|
-register_activation_hook( __FILE__ , array('wpshop_install', 'install_on_activation') ); |
|
|
92
|
+register_activation_hook(__FILE__, array('wpshop_install', 'install_on_activation')); |
|
93
|
93
|
|
|
94
|
94
|
/** On plugin deactivation call the function to clean the wordpress installation */ |
|
95
|
|
-register_deactivation_hook( __FILE__ , array('wpshop_install', 'uninstall_wpshop') ); |
|
|
95
|
+register_deactivation_hook(__FILE__, array('wpshop_install', 'uninstall_wpshop')); |
|
96
|
96
|
|
|
97
|
97
|
/** Get current plugin version */ |
|
98
|
98
|
$current_db_version = get_option('wpshop_db_options', 0); |
|
99
|
99
|
|
|
100
|
100
|
/** Add the database content */ |
|
101
|
101
|
add_action('admin_init', array('wpshop_install', 'update_wpshop')); |
|
102
|
|
-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' ] ) ) ) { |
|
103
|
|
- if ( in_array( long2ip( ip2long($_SERVER['REMOTE_ADDR'] ) ), unserialize( WPSHOP_DEBUG_MODE_ALLOWED_IP ) ) ) { |
|
104
|
|
- add_action( 'admin_init', array( 'wpshop_install', 'update_wpshop_dev' ) ); |
|
|
102
|
+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']))) { |
|
|
103
|
+ if (in_array(long2ip(ip2long($_SERVER['REMOTE_ADDR'])), unserialize(WPSHOP_DEBUG_MODE_ALLOWED_IP))) { |
|
|
104
|
+ add_action('admin_init', array('wpshop_install', 'update_wpshop_dev')); |
|
105
|
105
|
} |
|
106
|
106
|
} |
|
107
|
107
|
// Start session |
|
@@ -138,24 +138,24 @@ discard block |
|
|
block discarded – undo |
|
138
|
138
|
/** Add specific messages for wpshop elements management */ |
|
139
|
139
|
// add_filter('post_updated_messages', array('wpshop_messages', 'update_wp_message_list')); |
|
140
|
140
|
|
|
141
|
|
-$file = basename( __FILE__ ); |
|
142
|
|
-$folder = basename( dirname( __FILE__ ) ); |
|
|
141
|
+$file = basename(__FILE__); |
|
|
142
|
+$folder = basename(dirname(__FILE__)); |
|
143
|
143
|
$hook = "in_plugin_update_message-{$folder}/{$file}"; |
|
144
|
|
-add_action( $hook, 'wps_update_message', 10, 2 ); // 10:priority, 2:arguments # |
|
145
|
|
-function wps_update_message( $currentPluginMetadata, $newPluginMetadata){ |
|
|
144
|
+add_action($hook, 'wps_update_message', 10, 2); // 10:priority, 2:arguments # |
|
|
145
|
+function wps_update_message($currentPluginMetadata, $newPluginMetadata) { |
|
146
|
146
|
$message = ''; |
|
147
|
147
|
|
|
148
|
|
- if ( '1.4.1.6' == $currentPluginMetadata[ 'Version' ] ) { |
|
149
|
|
- $message = sprintf( __( 'For security reason %splease read this post%s', 'wpshop' ), '<a href="" >', '</a>'); |
|
|
148
|
+ if ('1.4.1.6' == $currentPluginMetadata['Version']) { |
|
|
149
|
+ $message = sprintf(__('For security reason %splease read this post%s', 'wpshop'), '<a href="" >', '</a>'); |
|
150
|
150
|
} |
|
151
|
151
|
|
|
152
|
152
|
// check "upgrade_notice" |
|
153
|
|
- if (isset( $newPluginMetadata->upgrade_notice) && strlen(trim($newPluginMetadata->upgrade_notice)) > 0 ) { |
|
154
|
|
- $message = esc_html( $newPluginMetadata->upgrade_notice ); |
|
|
153
|
+ if (isset($newPluginMetadata->upgrade_notice) && strlen(trim($newPluginMetadata->upgrade_notice)) > 0) { |
|
|
154
|
+ $message = esc_html($newPluginMetadata->upgrade_notice); |
|
155
|
155
|
} |
|
156
|
156
|
|
|
157
|
|
- if ( !empty( $message ) ) { |
|
158
|
|
- echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>' . __( 'Important upgrade notice', 'wpshop' ) . ': </strong>' . $message . '</p>'; |
|
|
157
|
+ if (!empty($message)) { |
|
|
158
|
+ echo '<p style="background-color: #d54e21; padding: 10px; color: #f9f9f9; margin-top: 10px"><strong>' . __('Important upgrade notice', 'wpshop') . ': </strong>' . $message . '</p>'; |
|
159
|
159
|
} |
|
160
|
160
|
} |
|
161
|
161
|
|