Completed
Push — master ( 364439...f12726 )
by
unknown
19:51 queued 04:39
created
includes/librairies/init.class.php 1 patch
Spacing   +141 added lines, -141 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
 /**
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
  * @package wpshop
23 23
  * @subpackage librairies
24 24
  */
25
-class wpshop_init{
25
+class wpshop_init {
26 26
 
27 27
 	/**
28 28
 	 *	This is the function loaded when wordpress load the different plugin
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 		/*	Include head js	*/
41 41
 		add_action('admin_print_scripts', array('wpshop_init', 'admin_print_js'));
42 42
 
43
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
44
-		$post_type = !empty( $_GET['post_type'] ) ? sanitize_text_field( $_GET['post_type'] ) : '';
45
-		$action = !empty( $_GET['action'] ) ? sanitize_text_field( $_GET['action'] ) : '';
46
-		$post = !empty( $_GET['post'] ) ? (array) $_GET['post'] : '';
47
-		$taxonomy = !empty( $_GET['taxonomy'] ) ? sanitize_text_field( $_GET['taxonomy'] ) : '';
48
-		if((isset($page) && substr($page, 0, 7) == 'wpshop_') || (isset($page) && $page == 'wps-installer' ) || (isset($post_type) && substr($post_type, 0, 7) == 'wpshop_') || !empty($post) || (isset($page) && $page==WPSHOP_NEWTYPE_IDENTIFIER_GROUP) || (isset($taxonomy) && ($taxonomy == WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES))){
43
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
44
+		$post_type = !empty($_GET['post_type']) ? sanitize_text_field($_GET['post_type']) : '';
45
+		$action = !empty($_GET['action']) ? sanitize_text_field($_GET['action']) : '';
46
+		$post = !empty($_GET['post']) ? (array)$_GET['post'] : '';
47
+		$taxonomy = !empty($_GET['taxonomy']) ? sanitize_text_field($_GET['taxonomy']) : '';
48
+		if ((isset($page) && substr($page, 0, 7) == 'wpshop_') || (isset($page) && $page == 'wps-installer') || (isset($post_type) && substr($post_type, 0, 7) == 'wpshop_') || !empty($post) || (isset($page) && $page == WPSHOP_NEWTYPE_IDENTIFIER_GROUP) || (isset($taxonomy) && ($taxonomy == WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES))) {
49 49
 			/*	Include the different javascript	*/
50 50
 // 			add_action('admin_init', array('wpshop_init', 'admin_js'));
51
-			add_action( 'admin_enqueue_scripts', array('wpshop_init', 'admin_js') );
51
+			add_action('admin_enqueue_scripts', array('wpshop_init', 'admin_js'));
52 52
 			add_action('admin_footer', array('wpshop_init', 'admin_js_footer'));
53 53
 
54 54
 			/*	Include the different css	*/
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
 		add_action('admin_init', array('wpshop_init', 'admin_css'));
58 58
 
59 59
 		/*	Include the different css	*/
60
-		if ( !is_admin() ) {
60
+		if (!is_admin()) {
61 61
 			add_action('wp_print_styles', array('wpshop_init', 'frontend_css'));
62 62
 			add_action('wp_print_scripts', array('wpshop_init', 'frontend_js_instruction'));
63 63
 		}
64 64
 
65
-		if (isset($page,$action) && $page=='wpshop_doc' && $action=='edit') {
65
+		if (isset($page, $action) && $page == 'wpshop_doc' && $action == 'edit') {
66 66
 			add_action('admin_init', array('wpshop_doc', 'init_wysiwyg'));
67 67
 		}
68 68
 
69 69
 		// RICH TEXT EDIT INIT
70
-		add_action('init', array('wpshop_display','wpshop_rich_text_tags'), 9999);
71
-		add_action('init', array('wpshop_display','wps_hide_admin_bar_for_customers'), 9999 );
70
+		add_action('init', array('wpshop_display', 'wpshop_rich_text_tags'), 9999);
71
+		add_action('init', array('wpshop_display', 'wps_hide_admin_bar_for_customers'), 9999);
72 72
 
73 73
 		/**	Adda custom class to the admin body	*/
74
-		add_filter( 'admin_body_class', array( 'wpshop_init', 'admin_body_class' ) );
75
-		add_filter( 'site_transient_update_plugins', array( 'wpshop_init', 'site_transient_update_plugins' ) );
74
+		add_filter('admin_body_class', array('wpshop_init', 'admin_body_class'));
75
+		add_filter('site_transient_update_plugins', array('wpshop_init', 'site_transient_update_plugins'));
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 *	Admin menu creation
80 80
 	 */
81
-	public static function admin_menu(){
81
+	public static function admin_menu() {
82 82
 		global $menu;
83 83
 
84 84
 		/*	Get current plugin version	*/
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$wpshop_catalog_menu_order = 34;
88 88
 
89
-		$menu[ $wpshop_catalog_menu_order-1 ] = array( '', 'read', 'separator-wpshop_dashboard', '', 'wp-menu-separator wpshop_dashboard' );
89
+		$menu[$wpshop_catalog_menu_order - 1] = array('', 'read', 'separator-wpshop_dashboard', '', 'wp-menu-separator wpshop_dashboard');
90 90
 
91 91
 		/*	Main menu creation	*/
92 92
 		global $wps_dashboard_ctr;
93
-		add_menu_page(__( 'Dashboard', 'wpshop' ), __( 'Shop', 'wpshop' ), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array( $wps_dashboard_ctr, 'display_dashboard' ), 'dashicons-admin-home', $wpshop_catalog_menu_order);
94
-		add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __('Dashboard', 'wpshop' ), __('Dashboard', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array( $wps_dashboard_ctr, 'display_dashboard' ));
93
+		add_menu_page(__('Dashboard', 'wpshop'), __('Shop', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array($wps_dashboard_ctr, 'display_dashboard'), 'dashicons-admin-home', $wpshop_catalog_menu_order);
94
+		add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __('Dashboard', 'wpshop'), __('Dashboard', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_URL_SLUG_DASHBOARD, array($wps_dashboard_ctr, 'display_dashboard'));
95 95
 
96 96
 		/*	Add eav model menus	*/
97
-		add_menu_page(__( 'Entities', 'wpshop' ), __( 'Entities', 'wpshop' ), 'wpshop_view_dashboard', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, array('wpshop_display', 'display_page'), 'dashicons-universal-access-alt', $wpshop_catalog_menu_order + 1);
98
-		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __( 'Attributes', 'wpshop' ), __('Attributes', 'wpshop'), 'wpshop_view_attributes', WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, array('wpshop_display','display_page'));
99
-		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __( 'Attributes groups', 'wpshop' ), __('Attributes groups', 'wpshop'), 'wpshop_view_attribute_set', WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, array('wpshop_display','display_page'));
97
+		add_menu_page(__('Entities', 'wpshop'), __('Entities', 'wpshop'), 'wpshop_view_dashboard', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, array('wpshop_display', 'display_page'), 'dashicons-universal-access-alt', $wpshop_catalog_menu_order + 1);
98
+		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __('Attributes', 'wpshop'), __('Attributes', 'wpshop'), 'wpshop_view_attributes', WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, array('wpshop_display', 'display_page'));
99
+		add_submenu_page(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, __('Attributes groups', 'wpshop'), __('Attributes groups', 'wpshop'), 'wpshop_view_attribute_set', WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, array('wpshop_display', 'display_page'));
100 100
 
101 101
 		/*	Add messages menus	*/
102 102
 		//add_submenu_page(WPSHOP_URL_SLUG_DASHBOARD, __( 'Messages', 'wpshop' ), __( 'Messages', 'wpshop'), 'wpshop_view_messages', 'edit.php?post_type='.WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 		/*	Add a menu for plugin tools	*/
107 107
 // 		if (WPSHOP_DISPLAY_TOOLS_MENU) {
108
-			add_management_page( __('Wpshop - Tools', 'wpshop' ), __('Wpshop - Tools', 'wpshop' ), 'wpshop_view_tools_menu', WPSHOP_URL_SLUG_TOOLS , array('wpshop_tools', 'main_page'));
108
+			add_management_page(__('Wpshop - Tools', 'wpshop'), __('Wpshop - Tools', 'wpshop'), 'wpshop_view_tools_menu', WPSHOP_URL_SLUG_TOOLS, array('wpshop_tools', 'main_page'));
109 109
 // 		}
110 110
 
111 111
 		/*	Add the options menu	*/
@@ -119,29 +119,29 @@  discard block
 block discarded – undo
119 119
 		$wpshop_menu_order = array();
120 120
 
121 121
 		// Get the index of our custom separator
122
-		$separator = array_search( 'separator-wpshop_dashboard', $menu_order );
123
-		$product = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, $menu_order );
124
-		$order = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $menu_order );
125
-		$customers = array_search( 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $menu_order );
122
+		$separator = array_search('separator-wpshop_dashboard', $menu_order);
123
+		$product = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, $menu_order);
124
+		$order = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER, $menu_order);
125
+		$customers = array_search('edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, $menu_order);
126 126
 		//$entities = array_search( 'admin.php?page=' . WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order );
127
-		$entities = array_search( WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order );
127
+		$entities = array_search(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, $menu_order);
128 128
 
129
-		unset( $menu_order[$separator] );
130
-		unset( $menu_order[$product] );
131
-		unset( $menu_order[$order] );
132
-		unset( $menu_order[$customers] );
133
-		unset( $menu_order[$entities] );
129
+		unset($menu_order[$separator]);
130
+		unset($menu_order[$product]);
131
+		unset($menu_order[$order]);
132
+		unset($menu_order[$customers]);
133
+		unset($menu_order[$entities]);
134 134
 
135 135
 		// Loop through menu order and do some rearranging
136
-		foreach ( $menu_order as $index => $item ) :
137
-			if ( 'wpshop_dashboard' == $item ) :
136
+		foreach ($menu_order as $index => $item) :
137
+			if ('wpshop_dashboard' == $item) :
138 138
 				$wpshop_menu_order[] = 'separator-wpshop_dashboard';
139 139
 				$wpshop_menu_order[] = $item;
140 140
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT;
141 141
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER;
142 142
 				$wpshop_menu_order[] = 'edit.php?post_type=' . WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS;
143 143
 				$wpshop_menu_order[] = WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES;
144
-			elseif ( !in_array( $item, array( 'separator-wpshop_dashboard' ) ) ) :
144
+			elseif (!in_array($item, array('separator-wpshop_dashboard'))) :
145 145
 				$wpshop_menu_order[] = $item;
146 146
 			endif;
147 147
 		endforeach;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 
153 153
 	public static function admin_custom_menu_order() {
154
-		return current_user_can( 'manage_options' );
154
+		return current_user_can('manage_options');
155 155
 	}
156 156
 
157 157
 	/**
@@ -161,18 +161,18 @@  discard block
 block discarded – undo
161 161
 
162 162
 		/*	Désactivation de l'enregistrement automatique pour certains type de post	*/
163 163
 		global $post;
164
-		if ( $post && ( (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ORDER) ||  (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE)
165
-				|| (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_COUPON) ) ) {
164
+		if ($post && ((get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ORDER) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE)
165
+				|| (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) || (get_post_type($post->ID) === WPSHOP_NEWTYPE_IDENTIFIER_COUPON))) {
166 166
 			wp_dequeue_script('autosave');
167 167
 		}
168 168
 
169
-		$entity_to_search = !empty( $_GET['entity_to_search'] ) ? sanitize_text_field( $_GET['entity_to_search'] ) : '';
169
+		$entity_to_search = !empty($_GET['entity_to_search']) ? sanitize_text_field($_GET['entity_to_search']) : '';
170 170
 //	var WPSHOP_AJAX_FILE_URL = "'.WPSHOP_AJAX_FILE_URL.'";
171 171
 		echo '
172 172
 <script type="text/javascript">
173 173
 
174
-	var WPSHOP_MEDIAS_ICON_URL = "'.WPSHOP_MEDIAS_ICON_URL.'";
175
-	var WPSHOP_PRODUCT_PRICE_PILOT = "'.WPSHOP_PRODUCT_PRICE_PILOT.'";
174
+	var WPSHOP_MEDIAS_ICON_URL = "'.WPSHOP_MEDIAS_ICON_URL . '";
175
+	var WPSHOP_PRODUCT_PRICE_PILOT = "'.WPSHOP_PRODUCT_PRICE_PILOT . '";
176 176
 	var WPSHOP_PRODUCT_PRICE_HT = "' . WPSHOP_PRODUCT_PRICE_HT . '";
177 177
 	var WPSHOP_PRODUCT_PRICE_TAX = "' . WPSHOP_PRODUCT_PRICE_TAX . '";
178 178
 	var WPSHOP_PRODUCT_PRICE_TTC = "' . WPSHOP_PRODUCT_PRICE_TTC . '";
@@ -188,16 +188,16 @@  discard block
 block discarded – undo
188 188
 	var WPSHOP_JS_VAR_ADD_LOGO = "' . __('Upload your logo', 'wpshop') . '";
189 189
 	var WPSHOP_NEWOPTION_CREATION_NONCE = "' . wp_create_nonce("wpshop_new_option_for_attribute_creation") . '";
190 190
 
191
-	var WPSHOP_ADD_TEXT = "'.__('Add', 'wpshop').'";
192
-	var WPSHOP_CREATE_TEXT = "'.__('Create', 'wpshop').'";
193
-	var WPSHOP_SAVE_PRODUCT_OPTIONS_PARAMS = "'.__('Save parameters', 'wpshop').'";
191
+	var WPSHOP_ADD_TEXT = "'.__('Add', 'wpshop') . '";
192
+	var WPSHOP_CREATE_TEXT = "'.__('Create', 'wpshop') . '";
193
+	var WPSHOP_SAVE_PRODUCT_OPTIONS_PARAMS = "'.__('Save parameters', 'wpshop') . '";
194 194
 
195
-	var WPSHOP_NEW_OPTION_IN_LIST_EMPTY = "'.__('You don\'t specify all needed file', 'wpshop').'";
196
-	var WPSHOP_IS_NOT_ALLOWED_SHIPPING_COUNTRY = "'.__('Sorry ! You can\'t order on this shop, because we don\'t ship in your country.', 'wpshop').'";
197
-	var WPSHOP_CONFIRM_BEFORE_GENERATE_INVOICE = "'.__('If you generate the invoice, you will cannot modify this order later. Are you sure to do this action ?', 'wpshop').'";
198
-	var WPSHOP_NEW_OPTION_ALREADY_EXIST_IN_LIST = "'.__('The value you entered already exist in list', 'wpshop').'";
199
-	var WPSHOP_SURE_TO_DELETE_ATTR_OPTION_FROM_LIST = "'.__('Are you sure you want to delete this option from list?', 'wpshop').'";
200
-	var WPSHOP_DEFAULT_VALUE = "'.__('Set as default value', 'wpshop').'";
195
+	var WPSHOP_NEW_OPTION_IN_LIST_EMPTY = "'.__('You don\'t specify all needed file', 'wpshop') . '";
196
+	var WPSHOP_IS_NOT_ALLOWED_SHIPPING_COUNTRY = "'.__('Sorry ! You can\'t order on this shop, because we don\'t ship in your country.', 'wpshop') . '";
197
+	var WPSHOP_CONFIRM_BEFORE_GENERATE_INVOICE = "'.__('If you generate the invoice, you will cannot modify this order later. Are you sure to do this action ?', 'wpshop') . '";
198
+	var WPSHOP_NEW_OPTION_ALREADY_EXIST_IN_LIST = "'.__('The value you entered already exist in list', 'wpshop') . '";
199
+	var WPSHOP_SURE_TO_DELETE_ATTR_OPTION_FROM_LIST = "'.__('Are you sure you want to delete this option from list?', 'wpshop') . '";
200
+	var WPSHOP_DEFAULT_VALUE = "'.__('Set as default value', 'wpshop') . '";
201 201
 	var WPSHOP_MSG_INVOICE_QUOTATION = "' . __('Are you sure you want to charge this order? You\'ll be unable to modify the content after this operation', 'wpshop') . '";
202 202
 	var WPSHOP_MSG_IGNORE_CONFIGURATION = "' . __('If you continue without install the plugin. Your products won\'t be purchasable', 'wpshop') . '";
203 203
 	var WPSHOP_MSG_CONFIRM_THUMBNAIL_DELETION = "' . __('Are you sure you want to delete this thumbnail?', 'wpshop') . '";
@@ -206,55 +206,55 @@  discard block
 block discarded – undo
206 206
 	var WPSHOP_CHOSEN_SELECT_FROM_LIST = "' . __('Select an Option', 'wpshop') . '";
207 207
 	var WPSHOP_AJAX_CHOSEN_KEEP_TYPING = "' . __('Keep typing for search launching', 'wpshop') . '";
208 208
 	var WPSHOP_AJAX_CHOSEN_SEARCHING = "' . __('Searching in progress for', 'wpshop') . '";
209
-	var WPSHOP_MSG_CONFIRM_ADDON_DEACTIVATION = "'.__('Are you sure you want to deactivate this addon?', 'wpshop').'";
210
-	var WPS_DELETE_SHOP_LOGO_MSG = "'.__('Are you sure you want to delete this logo?', 'wpshop').'";
209
+	var WPSHOP_MSG_CONFIRM_ADDON_DEACTIVATION = "'.__('Are you sure you want to deactivate this addon?', 'wpshop') . '";
210
+	var WPS_DELETE_SHOP_LOGO_MSG = "'.__('Are you sure you want to delete this logo?', 'wpshop') . '";
211 211
 	var WPS_DEFAULT_LOGO = "'.WPSHOP_MEDIAS_IMAGES_URL . 'no_picture.png";
212 212
 
213
-	var WPSHOP_NO_ATTRIBUTES_SELECT_FOR_VARIATION = "'.__('You have to select at least one attribute for creating a new variation', 'wpshop').'";
213
+	var WPSHOP_NO_ATTRIBUTES_SELECT_FOR_VARIATION = "'.__('You have to select at least one attribute for creating a new variation', 'wpshop') . '";
214 214
 
215 215
 	var WPSHOP_CHOSEN_ATTRS = {disable_search_threshold: 5, no_results_text: WPSHOP_CHOSEN_NO_RESULT, placeholder_text_single : WPSHOP_CHOSEN_SELECT_FROM_LIST, placeholder_text_multiple : WPSHOP_CHOSEN_SELECT_FROM_MULTI_LIST};
216 216
 
217
-	var WPSHOP_TEMPLATES_URL = "'.WPSHOP_TEMPLATES_URL.'";
218
-	var WPSHOP_BUTTON_DESCRIPTION = "'.__('Insert shortcode into page content', 'wpshop').'";
219
-	var WPSHOP_WYSIWYG_MENU_TITLE_PRODUCT_LISTING = "'.__('Product listing', 'wpshop').'";
220
-	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_PID_TITLE = "'.__('By product ID', 'wpshop').'";
221
-	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_ATTRIBUTE_TITLE = "'.__('By attribute value', 'wpshop').'";
222
-	var WPSHOP_WYSIWYG_MENU_TITLE_CATEGORIES = "'.__('WPShop categories', 'wpshop').'";
223
-	var WPSHOP_WYSIWYG_MENU_TITLE_ATTRIBUTE_VALUE = "'.__('Attribute value', 'wpshop').'";
224
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_TITLE = "'.__('Custom message content', 'wpshop').'";
225
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_FIRST_NAME = "'.__('Customer first name', 'wpshop').'";
226
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_LAST_NAME = "'.__('Customer last name', 'wpshop').'";
227
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_EMAIL = "'.__('Customer email', 'wpshop').'";
228
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ID = "'.__('Order identifer', 'wpshop').'";
229
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_PAYPAL_TRANSACTION_ID = "'.__('Paypal transaction ID', 'wpshop').'";
230
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CONTENT = "'.__('Order content', 'wpshop').'";
231
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CUSTOMER_PERSONNAL_INFORMATIONS = "'.__('Customer personnal informations', 'wpshop').'";
232
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ADDRESSES = "'.__('Order addresses', 'wpshop').'";
233
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_BILLING_ORDER_ADDRESS = "'.__('Billing order address', 'wpshop').'";
234
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_ORDER_ADDRESS = "'.__('Shipping order address', 'wpshop').'";
235
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_METHOD = "'.__('Shipping method', 'wpshop').'";
236
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_PAYMENT_METHOD = "'.__('order payment_method', 'wpshop').'";
237
-	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_COMMENT = "'.__('Order customer comment', 'wpshop').'";
238
-	var WPSHOP_CUSTOM_TAGS_TITLE = "'.__('Wpshop custom tags', 'wpshop').'";
239
-	var WPSHOP_CUSTOM_TAGS_CART = "'.__('Cart', 'wpshop').'";
240
-	var WPSHOP_CUSTOM_TAGS_CART_MINI = "'.__('Cart widget', 'wpshop').'";
241
-	var WPSHOP_CUSTOM_TAGS_CHECKOUT = "'.__('Checkout', 'wpshop').'";
242
-	var WPSHOP_CUSTOM_TAGS_ACCOUNT = "'.__('Customer account', 'wpshop').'";
243
-	var WPSHOP_CUSTOM_TAGS_SHOP = "'.__('Shop', 'wpshop').'";
244
-	var WPSHOP_CUSTOM_TAGS_ADVANCED_SEARCH = "'.__('Advanced search', 'wpshop').'";
245
-	var WPSHOP_CANCEL_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to cancel this order ?', 'wpshop').'";
246
-	var WPSHOP_REFUND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to refund this order ?', 'wpshop').'";
247
-	var WPSHOP_RESEND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to resend this order to customer ?', 'wpshop').'";
248
-	var WPSHOP_SEARCH_IN_ORDER_EXPLAIN_MESSAGE = "'.__('You want to search in orders', 'wpshop').'";
249
-	var WPSHOP_SEARCH_IN_ORDER_CHOICE_CUSTOMER = "'.__('a customer', 'wpshop').'";
250
-	var WPSHOP_SEARCH_IN_ORDER_CHOICE_PRODUCT = "'.__('a product', 'wpshop').'";
251
-	var WPSHOP_SEARCH_IN_ORDER_USER_CHOICE = "'.( (!empty($entity_to_search) ) ? $entity_to_search : 'customer' ).'";
252
-	var WPSHOP_DELETE_ADDRESS_CONFIRMATION = "'.__( 'Do you really want to delete this address', 'wpshop' ).'";
253
-
254
-	var wps_options_shipping_weight_for_custom_fees = "'.__( 'You must enter a weight', 'wpshop' ).'";
255
-	var wps_options_country_choose_for_custom_fees = "'.__( 'You must a country for custom fees saving', 'wpshop' ).'";
256
-	var wps_options_country_postcode_choose_for_custom_fees = "'.__( 'You must choose a country or write a postcode.', 'wpshop' ).'";
257
-	var wps_an_error_occured = "'.__( 'An error occured', 'wpshop' ).'";
217
+	var WPSHOP_TEMPLATES_URL = "'.WPSHOP_TEMPLATES_URL . '";
218
+	var WPSHOP_BUTTON_DESCRIPTION = "'.__('Insert shortcode into page content', 'wpshop') . '";
219
+	var WPSHOP_WYSIWYG_MENU_TITLE_PRODUCT_LISTING = "'.__('Product listing', 'wpshop') . '";
220
+	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_PID_TITLE = "'.__('By product ID', 'wpshop') . '";
221
+	var WPSHOP_WYSIWYG_PRODUCT_LISTING_BY_ATTRIBUTE_TITLE = "'.__('By attribute value', 'wpshop') . '";
222
+	var WPSHOP_WYSIWYG_MENU_TITLE_CATEGORIES = "'.__('WPShop categories', 'wpshop') . '";
223
+	var WPSHOP_WYSIWYG_MENU_TITLE_ATTRIBUTE_VALUE = "'.__('Attribute value', 'wpshop') . '";
224
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_TITLE = "'.__('Custom message content', 'wpshop') . '";
225
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_FIRST_NAME = "'.__('Customer first name', 'wpshop') . '";
226
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_LAST_NAME = "'.__('Customer last name', 'wpshop') . '";
227
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_EMAIL = "'.__('Customer email', 'wpshop') . '";
228
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ID = "'.__('Order identifer', 'wpshop') . '";
229
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_PAYPAL_TRANSACTION_ID = "'.__('Paypal transaction ID', 'wpshop') . '";
230
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CONTENT = "'.__('Order content', 'wpshop') . '";
231
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_CUSTOMER_PERSONNAL_INFORMATIONS = "'.__('Customer personnal informations', 'wpshop') . '";
232
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_ADDRESSES = "'.__('Order addresses', 'wpshop') . '";
233
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_BILLING_ORDER_ADDRESS = "'.__('Billing order address', 'wpshop') . '";
234
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_ORDER_ADDRESS = "'.__('Shipping order address', 'wpshop') . '";
235
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_SHIPPING_METHOD = "'.__('Shipping method', 'wpshop') . '";
236
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_ORDER_PAYMENT_METHOD = "'.__('order payment_method', 'wpshop') . '";
237
+	var WPSHOP_CUSTOM_MESSAGE_CONTENT_CUSTOMER_COMMENT = "'.__('Order customer comment', 'wpshop') . '";
238
+	var WPSHOP_CUSTOM_TAGS_TITLE = "'.__('Wpshop custom tags', 'wpshop') . '";
239
+	var WPSHOP_CUSTOM_TAGS_CART = "'.__('Cart', 'wpshop') . '";
240
+	var WPSHOP_CUSTOM_TAGS_CART_MINI = "'.__('Cart widget', 'wpshop') . '";
241
+	var WPSHOP_CUSTOM_TAGS_CHECKOUT = "'.__('Checkout', 'wpshop') . '";
242
+	var WPSHOP_CUSTOM_TAGS_ACCOUNT = "'.__('Customer account', 'wpshop') . '";
243
+	var WPSHOP_CUSTOM_TAGS_SHOP = "'.__('Shop', 'wpshop') . '";
244
+	var WPSHOP_CUSTOM_TAGS_ADVANCED_SEARCH = "'.__('Advanced search', 'wpshop') . '";
245
+	var WPSHOP_CANCEL_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to cancel this order ?', 'wpshop') . '";
246
+	var WPSHOP_REFUND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to refund this order ?', 'wpshop') . '";
247
+	var WPSHOP_RESEND_ORDER_CONFIRM_MESSAGE = "'.__('Do you want to resend this order to customer ?', 'wpshop') . '";
248
+	var WPSHOP_SEARCH_IN_ORDER_EXPLAIN_MESSAGE = "'.__('You want to search in orders', 'wpshop') . '";
249
+	var WPSHOP_SEARCH_IN_ORDER_CHOICE_CUSTOMER = "'.__('a customer', 'wpshop') . '";
250
+	var WPSHOP_SEARCH_IN_ORDER_CHOICE_PRODUCT = "'.__('a product', 'wpshop') . '";
251
+	var WPSHOP_SEARCH_IN_ORDER_USER_CHOICE = "'.((!empty($entity_to_search)) ? $entity_to_search : 'customer') . '";
252
+	var WPSHOP_DELETE_ADDRESS_CONFIRMATION = "'.__('Do you really want to delete this address', 'wpshop') . '";
253
+
254
+	var wps_options_shipping_weight_for_custom_fees = "'.__('You must enter a weight', 'wpshop') . '";
255
+	var wps_options_country_choose_for_custom_fees = "'.__('You must a country for custom fees saving', 'wpshop') . '";
256
+	var wps_options_country_postcode_choose_for_custom_fees = "'.__('You must choose a country or write a postcode.', 'wpshop') . '";
257
+	var wps_an_error_occured = "'.__('An error occured', 'wpshop') . '";
258 258
 </script>';
259 259
 	}
260 260
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 		ob_end_clean();
270 270
 
271 271
 		echo '<script type="text/javascript">
272
-			var wp_version = "'.$wp_version.'";
273
-			'.$wpshop_product_js.'
272
+			var wp_version = "'.$wp_version . '";
273
+			'.$wpshop_product_js . '
274 274
 		</script>';
275 275
 	}
276 276
 
@@ -286,21 +286,21 @@  discard block
 block discarded – undo
286 286
 		wp_enqueue_script('jquery-ui-dialog');
287 287
 		wp_enqueue_script('jquery-form');
288 288
 		wp_enqueue_script('jquery-ui-slider');
289
-		wp_enqueue_script( 'jquery-ui-autocomplete' );
289
+		wp_enqueue_script('jquery-ui-autocomplete');
290 290
 		wp_enqueue_script('wpshop_main_function_js', WPSHOP_JS_URL . 'main_function.js', '', WPSHOP_VERSION);
291 291
 		wp_enqueue_script('wpshop_main_js', WPSHOP_JS_URL . 'main.js', '', WPSHOP_VERSION);
292 292
 		wp_enqueue_script('wpshop_jq_datatable', WPSHOP_JS_URL . 'jquery-libs/jquery.dataTables.min.js', '', WPSHOP_VERSION);
293
-		wp_enqueue_script('wpshop_jquery_chosen',  WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION);
293
+		wp_enqueue_script('wpshop_jquery_chosen', WPSHOP_JS_URL . 'jquery-libs/chosen.jquery.min.js', '', WPSHOP_VERSION);
294 294
 		wp_enqueue_script('jquery-effects-core');
295 295
 		wp_enqueue_script('jquery-effects-highlight');
296 296
 
297
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
297
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
298 298
 
299 299
 		/*	Include specific js file for the current page if existing	*/
300
-		if(isset($page) && is_file(WPSHOP_JS_DIR . 'pages/' . $page . '.js')){
300
+		if (isset($page) && is_file(WPSHOP_JS_DIR . 'pages/' . $page . '.js')) {
301 301
 			wp_enqueue_script($page . '_js', WPSHOP_JS_URL . 'pages/' . $page . '.js', '', WPSHOP_VERSION);
302 302
 		}
303
-		if((isset($page) && ($page == 'wpshop_dashboard'))) {
303
+		if ((isset($page) && ($page == 'wpshop_dashboard'))) {
304 304
 			wp_enqueue_script($page . '_js', WPSHOP_JS_URL . 'pages/' . WPSHOP_URL_SLUG_OPTION . '.js', '', WPSHOP_VERSION);
305 305
 			wp_register_style($page . '_css', WPSHOP_CSS_URL . 'pages/' . WPSHOP_URL_SLUG_OPTION . '.css', '', WPSHOP_VERSION);
306 306
 			wp_enqueue_style($page . '_css');
@@ -327,12 +327,12 @@  discard block
 block discarded – undo
327 327
 	 * @param array $classes
328 328
 	 * @return string
329 329
 	 */
330
-	public static function admin_body_class( $classes ) {
330
+	public static function admin_body_class($classes) {
331 331
 		global $post;
332 332
 
333
-		if ( !empty($post->ID) ) {
334
-			$post_type = get_post_type( $post->ID );
335
-			if ( is_admin() && in_array( $post_type, array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_COUPON, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS) ) ) {
333
+		if (!empty($post->ID)) {
334
+			$post_type = get_post_type($post->ID);
335
+			if (is_admin() && in_array($post_type, array(WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT, WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT_VARIATION, WPSHOP_NEWTYPE_IDENTIFIER_ORDER, WPSHOP_NEWTYPE_IDENTIFIER_MESSAGE, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS, WPSHOP_NEWTYPE_IDENTIFIER_COUPON, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS))) {
336 336
 				$classes .= ' wpshop-admin-body wpshop-admin-post-type-' . $post_type;
337 337
 			}
338 338
 		}
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
 		wp_enqueue_style('wpshop_chosen_css');
361 361
 
362 362
 		/*	Include specific css file for the current page if existing	*/
363
-		$page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : '';
364
-		if(isset($page) && is_file(WPSHOP_CSS_DIR . 'pages/' . $page . '.css')){
363
+		$page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
364
+		if (isset($page) && is_file(WPSHOP_CSS_DIR . 'pages/' . $page . '.css')) {
365 365
 			wp_register_style($page . '_css', WPSHOP_CSS_URL . 'pages/' . $page . '.css', '', WPSHOP_VERSION);
366 366
 			wp_enqueue_style($page . '_css');
367 367
 		}
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
 		wp_register_style('wpshop_default_wps_style_css', WPSHOP_TEMPLATES_URL . 'wpshop/css/wps_style.css', '', WPSHOP_VERSION);
404 404
 		wp_enqueue_style('wpshop_default_wps_style_css');
405 405
 
406
-		if( file_exists( get_stylesheet_directory().'/wpshop/css/wps_style.css' ) ) {
407
-			wp_deregister_style( 'wpshop_default_wps_style_css' );
406
+		if (file_exists(get_stylesheet_directory() . '/wpshop/css/wps_style.css')) {
407
+			wp_deregister_style('wpshop_default_wps_style_css');
408 408
 			wp_register_style('wps_style_css', wpshop_display::get_template_file('wps_style.css', WPSHOP_TEMPLATES_URL, 'wpshop/css', 'output', true), '', WPSHOP_VERSION);
409 409
 			wp_enqueue_style('wps_style_css', 11);
410 410
 		}
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 		wp_register_style('wps_owl_caroussel_transitions', wpshop_display::get_template_file('owl.transitions.css', WPSHOP_TEMPLATES_URL, 'wpshop/css', 'output'), '', WPSHOP_VERSION);
417 417
 		wp_enqueue_style('wps_owl_caroussel_transitions');
418 418
 
419
-			wp_enqueue_style( 'dashicons' );
419
+			wp_enqueue_style('dashicons');
420 420
 	}
421 421
 
422 422
 	/**
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		wp_enqueue_script('jquery-ui-slider');
435 435
 		wp_enqueue_script('wpshop_frontend_main_js', wpshop_display::get_template_file('frontend_main.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
436 436
 // 		wp_enqueue_script('wpshop_jquery_jqzoom_core_js', wpshop_display::get_template_file('jquery.jqzoom-core.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
437
-		wp_enqueue_script('fancyboxmousewheel',WPSHOP_JS_URL . 'fancybox/jquery.mousewheel-3.0.4.pack.js', '', WPSHOP_VERSION, true);
437
+		wp_enqueue_script('fancyboxmousewheel', WPSHOP_JS_URL . 'fancybox/jquery.mousewheel-3.0.4.pack.js', '', WPSHOP_VERSION, true);
438 438
 		wp_enqueue_script('fancybox', WPSHOP_JS_URL . 'fancybox/jquery.fancybox-1.3.4.pack.js', '', WPSHOP_VERSION, true);
439 439
 		wp_enqueue_script('jquery_address', WPSHOP_JS_URL . 'jquery-libs/jquery.address-1.5.min.js', '', WPSHOP_VERSION);
440 440
 		wp_enqueue_script('wps_api', wpshop_display::get_template_file('wps-api.js', WPSHOP_TEMPLATES_URL, 'wpshop/js', 'output'), '', WPSHOP_VERSION, true);
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	var WPSHOP_MUST_CHOOSE_SHIPPING_MODE = "<?php _e('You must to choose a shipping mode', 'wpshop'); ?>";
458 458
 	var WPSHOP_NO_SHIPPING_MODE_AVAILABLE = "<?php _e('You can\'t order because no shipping mode is available.', 'wpshop'); ?>";
459 459
 	var WPSHOP_LOADER_ICON_JQUERY_ADDRESS = "<img src=\"<?php echo WPSHOP_LOADING_ICON; ?>\" alt=\"Loading...\" />";
460
-	var WPSHOP_CONFIRM_DELETE_ADDRESS = "<?php _e( 'Do you really want to delete this address ?', 'wpshop' ); ?>";
460
+	var WPSHOP_CONFIRM_DELETE_ADDRESS = "<?php _e('Do you really want to delete this address ?', 'wpshop'); ?>";
461 461
 	var wps_speed_slideUpDown = 200;
462 462
 	var MODAL_URL = '<?php echo WPSHOP_TEMPLATES_URL; ?>wpshop/modal.php';
463 463
 </script>
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		$product_class = new wpshop_products();
496 496
 		add_action('save_post', array($product_class, 'save_product_custom_informations'));
497 497
 		/*	Modification des paramètres de variation quand ils ne sont pas configurés individuellement	*/
498
-		add_filter('pre_update_option_' . 'wpshop_catalog_product_option', array('wpshop_products', 'update_wpshop_catalog_product_option'), 10, 2 );
498
+		add_filter('pre_update_option_' . 'wpshop_catalog_product_option', array('wpshop_products', 'update_wpshop_catalog_product_option'), 10, 2);
499 499
 
500 500
 		/*	Add wpshop product category term	*/
501 501
 		wpshop_categories::create_product_categories();
@@ -503,14 +503,14 @@  discard block
 block discarded – undo
503 503
 		/*	Add wpshop message term	*/
504 504
 
505 505
 
506
-		if ( $wpshop_shop_type == 'sale' ) {
506
+		if ($wpshop_shop_type == 'sale') {
507 507
 			/*	Add wpshop orders term	*/
508 508
 			wpshop_orders::create_orders_type();
509 509
 			add_action('add_meta_boxes', array('wpshop_orders', 'add_meta_boxes'));
510
-			add_action('manage_'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'_posts_custom_column',  array('wpshop_orders', 'orders_custom_columns'), 10, 2);
511
-			add_filter('manage_edit-'.WPSHOP_NEWTYPE_IDENTIFIER_ORDER.'_columns', array('wpshop_orders', 'orders_edit_columns'));
512
-			add_action('restrict_manage_posts', array('wpshop_orders', 'list_table_filters') );
513
-			add_filter('parse_query', array('wpshop_orders', 'list_table_filter_parse_query') );
510
+			add_action('manage_' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '_posts_custom_column', array('wpshop_orders', 'orders_custom_columns'), 10, 2);
511
+			add_filter('manage_edit-' . WPSHOP_NEWTYPE_IDENTIFIER_ORDER . '_columns', array('wpshop_orders', 'orders_edit_columns'));
512
+			add_action('restrict_manage_posts', array('wpshop_orders', 'list_table_filters'));
513
+			add_filter('parse_query', array('wpshop_orders', 'list_table_filter_parse_query'));
514 514
 		}
515 515
 
516 516
 		$args = array(
@@ -520,14 +520,14 @@  discard block
 block discarded – undo
520 520
 		$output = 'objects'; // names or objects, note names is the default
521 521
 		$operator = 'or'; // 'and' or 'or'
522 522
 
523
-		$wp_types_original=get_post_types($args,$output,$operator);
523
+		$wp_types_original = get_post_types($args, $output, $operator);
524 524
 		foreach ($wp_types_original as $type => $type_definition):
525 525
 			$wp_types[$type] = $type_definition->labels->name;
526 526
 		endforeach;
527
-		$to_exclude=unserialize(WPSHOP_INTERNAL_TYPES_TO_EXCLUDE);
528
-		if(!empty($to_exclude)):
529
-			foreach($to_exclude as $excluded_type):
530
-				if(isset($wp_types[$excluded_type]))unset($wp_types[$excluded_type]);
527
+		$to_exclude = unserialize(WPSHOP_INTERNAL_TYPES_TO_EXCLUDE);
528
+		if (!empty($to_exclude)):
529
+			foreach ($to_exclude as $excluded_type):
530
+				if (isset($wp_types[$excluded_type]))unset($wp_types[$excluded_type]);
531 531
 			endforeach;
532 532
 		endif;
533 533
 		DEFINE('WPSHOP_INTERNAL_TYPES', serialize(array_merge($wp_types, array('users' => __('Users', 'wpshop')))));
@@ -536,29 +536,29 @@  discard block
 block discarded – undo
536 536
 	/**
537 537
 	 * Send mail when new version is available
538 538
 	 */
539
-	public static function site_transient_update_plugins( $option ) {
540
-		if ( isset( $option->response[ WPSHOP_PLUGIN_NAME ] ) ) {
539
+	public static function site_transient_update_plugins($option) {
540
+		if (isset($option->response[WPSHOP_PLUGIN_NAME])) {
541 541
 			global $wpdb;
542 542
 			$message_mdl = new wps_message_mdl();
543
-			$admin_new_version_message = get_option( 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', null );
544
-			$shop_admin_email_option = get_option( 'wpshop_emails' );
545
-			$shop_admin_id = $wpdb->get_var( $wpdb->prepare( 'SELECT ID FROM ' . $wpdb->users . ' WHERE user_email = %s', $shop_admin_email_option['contact_email'] ) );
546
-			if ( ! is_null( $shop_admin_id ) && ! is_null( $admin_new_version_message ) ) {
547
-				$messages_histo = $message_mdl->get_messages_histo( $admin_new_version_message, $shop_admin_id );
548
-				if ( ! empty( $messages_histo ) ) {
549
-					foreach ( $messages_histo as $messages_histo_group ) {
550
-						foreach ( $messages_histo_group as $messages_histo ) {
551
-							if ( strpos( $messages_histo['mess_title'], $option->response[ WPSHOP_PLUGIN_NAME ]->new_version ) !== false
552
-							|| strpos( $messages_histo['mess_message'], $option->response[ WPSHOP_PLUGIN_NAME ]->new_version ) !== false ) {
543
+			$admin_new_version_message = get_option('WPSHOP_NEW_VERSION_ADMIN_MESSAGE', null);
544
+			$shop_admin_email_option = get_option('wpshop_emails');
545
+			$shop_admin_id = $wpdb->get_var($wpdb->prepare('SELECT ID FROM ' . $wpdb->users . ' WHERE user_email = %s', $shop_admin_email_option['contact_email']));
546
+			if (!is_null($shop_admin_id) && !is_null($admin_new_version_message)) {
547
+				$messages_histo = $message_mdl->get_messages_histo($admin_new_version_message, $shop_admin_id);
548
+				if (!empty($messages_histo)) {
549
+					foreach ($messages_histo as $messages_histo_group) {
550
+						foreach ($messages_histo_group as $messages_histo) {
551
+							if (strpos($messages_histo['mess_title'], $option->response[WPSHOP_PLUGIN_NAME]->new_version) !== false
552
+							|| strpos($messages_histo['mess_message'], $option->response[WPSHOP_PLUGIN_NAME]->new_version) !== false) {
553 553
 								return $option;
554 554
 							}
555 555
 						}
556 556
 					}
557 557
 				}
558 558
 				$wps_message = new wps_message_ctr();
559
-				$wps_message->wpshop_prepared_email( $shop_admin_email_option['contact_email'], 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', array(
560
-					'wpshop_version' => $option->response[ WPSHOP_PLUGIN_NAME ]->new_version,
561
-				) );
559
+				$wps_message->wpshop_prepared_email($shop_admin_email_option['contact_email'], 'WPSHOP_NEW_VERSION_ADMIN_MESSAGE', array(
560
+					'wpshop_version' => $option->response[WPSHOP_PLUGIN_NAME]->new_version,
561
+				));
562 562
 			}
563 563
 		}
564 564
 		return $option;
Please login to merge, or discard this patch.