@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | class wpshop_permissions { |
24 | 24 | |
25 | 25 | /** |
26 | - * Define the different permission for the plugin. Define an array containing the permission defined with a sub-array |
|
27 | - * |
|
28 | - * @return array $permission An array with the permission list for the plugin |
|
29 | - */ |
|
26 | + * Define the different permission for the plugin. Define an array containing the permission defined with a sub-array |
|
27 | + * |
|
28 | + * @return array $permission An array with the permission list for the plugin |
|
29 | + */ |
|
30 | 30 | function permission_list() { |
31 | 31 | $permission = array(); |
32 | 32 | |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
101 | - * Set the different permission for the administrator role. Add all existing permission for this role. |
|
102 | - * @see wpshop_permissions::permission_list() |
|
103 | - */ |
|
101 | + * Set the different permission for the administrator role. Add all existing permission for this role. |
|
102 | + * @see wpshop_permissions::permission_list() |
|
103 | + */ |
|
104 | 104 | function set_administrator_role_permission() { |
105 | 105 | $adminRole = get_role('administrator'); |
106 | 106 | $permissionList = wpshop_permissions::permission_list(); |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | * @see wpshop_permissions::permission_list() |
103 | 103 | */ |
104 | 104 | function set_administrator_role_permission() { |
105 | - $adminRole = get_role('administrator'); |
|
105 | + $adminRole = get_role('administrator'); |
|
106 | 106 | $permissionList = wpshop_permissions::permission_list(); |
107 | 107 | foreach ($permissionList as $permissionName => $permissionDef) { |
108 | - if ( ($adminRole != null) && !$adminRole->has_cap($permissionName) ) { |
|
108 | + if (($adminRole != null) && !$adminRole->has_cap($permissionName)) { |
|
109 | 109 | $adminRole->add_cap($permissionName); |
110 | 110 | } |
111 | 111 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | function wpshop_init_roles() { |
116 | 116 | global $wp_roles; |
117 | 117 | |
118 | - if (class_exists('WP_Roles')) if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); |
|
118 | + if (class_exists('WP_Roles')) if (!isset($wp_roles)) $wp_roles = new WP_Roles(); |
|
119 | 119 | |
120 | 120 | if (is_object($wp_roles)) : |
121 | 121 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -115,7 +117,9 @@ discard block |
||
115 | 117 | function wpshop_init_roles() { |
116 | 118 | global $wp_roles; |
117 | 119 | |
118 | - if (class_exists('WP_Roles')) if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); |
|
120 | + if (class_exists('WP_Roles')) { |
|
121 | + if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); |
|
122 | + } |
|
119 | 123 | |
120 | 124 | if (is_object($wp_roles)) : |
121 | 125 |
@@ -22,8 +22,8 @@ |
||
22 | 22 | */ |
23 | 23 | class wpshop_shipping_options { |
24 | 24 | /** |
25 | - * |
|
26 | - */ |
|
25 | + * |
|
26 | + */ |
|
27 | 27 | function declare_options(){ |
28 | 28 | |
29 | 29 | add_settings_section('wpshop_shipping_rules', '<span class="dashicons dashicons-admin-generic"></span>'.__('Shipping general configuration', 'wpshop'), array('wpshop_shipping_options', 'plugin_section_text'), 'wpshop_shipping_rules'); |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | /** |
25 | 25 | * |
26 | 26 | */ |
27 | - function declare_options(){ |
|
27 | + function declare_options() { |
|
28 | 28 | |
29 | - add_settings_section('wpshop_shipping_rules', '<span class="dashicons dashicons-admin-generic"></span>'.__('Shipping general configuration', 'wpshop'), array('wpshop_shipping_options', 'plugin_section_text'), 'wpshop_shipping_rules'); |
|
29 | + add_settings_section('wpshop_shipping_rules', '<span class="dashicons dashicons-admin-generic"></span>' . __('Shipping general configuration', 'wpshop'), array('wpshop_shipping_options', 'plugin_section_text'), 'wpshop_shipping_rules'); |
|
30 | 30 | register_setting('wpshop_options', 'wpshop_shipping_address_choice', array('wpshop_shipping_options', 'wpshop_shipping_address_validator')); |
31 | 31 | add_settings_field('wpshop_shipping_address_choice', __('Shipping address choice', 'wpshop'), array('wpshop_shipping_options', 'wpshop_shipping_address_field'), 'wpshop_shipping_rules', 'wpshop_shipping_rules'); |
32 | 32 | |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | echo ''; |
47 | 47 | } |
48 | 48 | |
49 | - public static function wpshop_shipping_address_validator($input){ |
|
50 | - $shipping_option = get_option( 'wpshop_shipping_address_choice' ); |
|
51 | - if( !empty($shipping_option) && !empty($shipping_option['display_model']) ) { |
|
49 | + public static function wpshop_shipping_address_validator($input) { |
|
50 | + $shipping_option = get_option('wpshop_shipping_address_choice'); |
|
51 | + if (!empty($shipping_option) && !empty($shipping_option['display_model'])) { |
|
52 | 52 | $input['display_model'] = $shipping_option['display_model']; |
53 | 53 | } |
54 | 54 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | public static function wpshop_shipping_address_field() { |
59 | 59 | global $wpdb; |
60 | 60 | $choice = get_option('wpshop_shipping_address_choice', unserialize(WPSHOP_SHOP_CUSTOM_SHIPPING)); |
61 | - $query = $wpdb->prepare('SELECT ID FROM ' .$wpdb->posts. ' WHERE post_name = "%s" AND post_type = "%s"', WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES); |
|
61 | + $query = $wpdb->prepare('SELECT ID FROM ' . $wpdb->posts . ' WHERE post_name = "%s" AND post_type = "%s"', WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS, WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES); |
|
62 | 62 | $entity_id = $wpdb->get_var($query); |
63 | 63 | |
64 | - $query = $wpdb->prepare('SELECT * FROM ' .WPSHOP_DBT_ATTRIBUTE_SET. ' WHERE entity_id = %d', $entity_id); |
|
64 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $entity_id); |
|
65 | 65 | $content = $wpdb->get_results($query); |
66 | 66 | |
67 | 67 | $input_def['name'] = 'wpshop_shipping_address_choice[choice]'; |
@@ -71,39 +71,39 @@ discard block |
||
71 | 71 | $input_def['value'] = $choice['choice']; |
72 | 72 | |
73 | 73 | $active = !empty($choice['activate']) ? $choice['activate'] : false; |
74 | - $display_model = ( !empty($choice['display_model']) ) ? addslashes( serialize( $choice['display_model'] ) ) : ''; |
|
74 | + $display_model = (!empty($choice['display_model'])) ? addslashes(serialize($choice['display_model'])) : ''; |
|
75 | 75 | |
76 | - echo '<input type="checkbox" name="wpshop_shipping_address_choice[activate]" id="wpshop_shipping_address_choice[activate]" '.($active ? 'checked="checked"' :null).'/> <label for="wpshop_shipping_address_choice[activate]">'.__('Activate shipping address','wpshop').'</label><br/> |
|
77 | - <div>' .wpshop_form::check_input_type($input_def). '</div>'; |
|
76 | + echo '<input type="checkbox" name="wpshop_shipping_address_choice[activate]" id="wpshop_shipping_address_choice[activate]" ' . ($active ? 'checked="checked"' : null) . '/> <label for="wpshop_shipping_address_choice[activate]">' . __('Activate shipping address', 'wpshop') . '</label><br/> |
|
77 | + <div>' .wpshop_form::check_input_type($input_def) . '</div>'; |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | public static function wpshop_shipping_cost_from_fields() { |
82 | 82 | $shipping_cost_from_option = get_option('wpshop_shipping_cost_from'); |
83 | - $output = '<input type="checkbox" id="wpshop_shipping_cost_from" name="wpshop_shipping_cost_from" ' . ( (!empty($shipping_cost_from_option)) ? 'checked="checked"' : '') . ' /> '; |
|
84 | - $output .= '<label for="wpshop_shipping_cost_from">' . __('Display "From" behind Shipping cost in cart while shipping address is undefined', 'wpshop'). '</label>'; |
|
83 | + $output = '<input type="checkbox" id="wpshop_shipping_cost_from" name="wpshop_shipping_cost_from" ' . ((!empty($shipping_cost_from_option)) ? 'checked="checked"' : '') . ' /> '; |
|
84 | + $output .= '<label for="wpshop_shipping_cost_from">' . __('Display "From" behind Shipping cost in cart while shipping address is undefined', 'wpshop') . '</label>'; |
|
85 | 85 | echo $output; |
86 | 86 | } |
87 | 87 | |
88 | - public static function wpshop_shipping_cost_from_validator( $input ) { |
|
88 | + public static function wpshop_shipping_cost_from_validator($input) { |
|
89 | 89 | |
90 | 90 | |
91 | 91 | return $input; |
92 | 92 | } |
93 | 93 | |
94 | - public static function wpshop_limit_country_list_validator( $input ) { |
|
94 | + public static function wpshop_limit_country_list_validator($input) { |
|
95 | 95 | return $input; |
96 | 96 | } |
97 | 97 | |
98 | 98 | public static function wpshop_limit_country_list_fields() { |
99 | 99 | $output = ''; |
100 | - $limit_countries_list = get_option( 'wpshop_limit_country_list' ); |
|
100 | + $limit_countries_list = get_option('wpshop_limit_country_list'); |
|
101 | 101 | $countries = unserialize(WPSHOP_COUNTRY_LIST); |
102 | - if ( !empty ($countries) ) { |
|
102 | + if (!empty ($countries)) { |
|
103 | 103 | $output .= '<select name="wpshop_limit_country_list[]" class="chosen_select" multiple data-placeholder="Choose a Country">'; |
104 | - foreach( $countries as $key => $country ) { |
|
105 | - $is_selected = ( !empty($limit_countries_list) && is_array($limit_countries_list) && in_array($key, $limit_countries_list) ) ? true : false; |
|
106 | - $output .= '<option value="' .$key. '" ' . ( ($is_selected) ? 'selected="selected"' : '' ) . '>' .$country. '</option>'; |
|
104 | + foreach ($countries as $key => $country) { |
|
105 | + $is_selected = (!empty($limit_countries_list) && is_array($limit_countries_list) && in_array($key, $limit_countries_list)) ? true : false; |
|
106 | + $output .= '<option value="' . $key . '" ' . (($is_selected) ? 'selected="selected"' : '') . '>' . $country . '</option>'; |
|
107 | 107 | } |
108 | 108 | $output .= '</select>'; |
109 | 109 | } |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | } |
112 | 112 | |
113 | 113 | public static function wpshop_country_default_choice_fields() { |
114 | - $default_country_choice = get_option( 'wpshop_country_default_choice' ); |
|
115 | - $output = '<select name="wpshop_country_default_choice">'; |
|
114 | + $default_country_choice = get_option('wpshop_country_default_choice'); |
|
115 | + $output = '<select name="wpshop_country_default_choice">'; |
|
116 | 116 | $countries = unserialize(WPSHOP_COUNTRY_LIST); |
117 | - foreach( $countries as $key => $country ) { |
|
118 | - $is_selected = ( !empty($default_country_choice) && $key == $default_country_choice ) ? true : false; |
|
119 | - $output .= '<option value="' .$key. '" ' . ( ($is_selected) ? 'selected="selected"' : '' ) . '>' .$country. '</option>'; |
|
117 | + foreach ($countries as $key => $country) { |
|
118 | + $is_selected = (!empty($default_country_choice) && $key == $default_country_choice) ? true : false; |
|
119 | + $output .= '<option value="' . $key . '" ' . (($is_selected) ? 'selected="selected"' : '') . '>' . $country . '</option>'; |
|
120 | 120 | } |
121 | 121 | $output .= '</select>'; |
122 | 122 | echo $output; |
123 | 123 | } |
124 | 124 | |
125 | - public static function wpshop_country_default_choice_validator( $input ) { |
|
125 | + public static function wpshop_country_default_choice_validator($input) { |
|
126 | 126 | return $input; |
127 | 127 | } |
128 | 128 | } |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -23,8 +23,8 @@ |
||
23 | 23 | class wpshop_company_options |
24 | 24 | { |
25 | 25 | /** |
26 | - * |
|
27 | - */ |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | public static function declare_options(){ |
29 | 29 | add_settings_section('wpshop_company_info', '<span class="dashicons dashicons-admin-home"></span>'.__('Company info', 'wpshop'), array('wpshop_company_options', 'plugin_section_text'), 'wpshop_company_info'); |
30 | 30 | register_setting('wpshop_options', 'wpshop_company_info', array('wpshop_company_options', 'wpshop_options_validate_company_info')); |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * |
27 | 27 | */ |
28 | - public static function declare_options(){ |
|
29 | - add_settings_section('wpshop_company_info', '<span class="dashicons dashicons-admin-home"></span>'.__('Company info', 'wpshop'), array('wpshop_company_options', 'plugin_section_text'), 'wpshop_company_info'); |
|
28 | + public static function declare_options() { |
|
29 | + add_settings_section('wpshop_company_info', '<span class="dashicons dashicons-admin-home"></span>' . __('Company info', 'wpshop'), array('wpshop_company_options', 'plugin_section_text'), 'wpshop_company_info'); |
|
30 | 30 | register_setting('wpshop_options', 'wpshop_company_info', array('wpshop_company_options', 'wpshop_options_validate_company_info')); |
31 | 31 | add_settings_field('wpshop_company_legal_statut', __('Legal status', 'wpshop'), array('wpshop_company_options', 'wpshop_company_legal_statut_field'), 'wpshop_company_info', 'wpshop_company_info'); |
32 | 32 | add_settings_field('wpshop_company_capital', __('Capital', 'wpshop'), array('wpshop_company_options', 'wpshop_company_capital_field'), 'wpshop_company_info', 'wpshop_company_info'); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /**/ |
47 | - public static function plugin_section_text(){ |
|
47 | + public static function plugin_section_text() { |
|
48 | 48 | |
49 | 49 | } |
50 | 50 | |
@@ -55,76 +55,76 @@ discard block |
||
55 | 55 | $options = get_option('wpshop_company_info'); |
56 | 56 | |
57 | 57 | $legal_status = self::get_legal_status(); |
58 | - $legal_status = apply_filters( 'wps_legal_status_extender', $legal_status ); |
|
58 | + $legal_status = apply_filters('wps_legal_status_extender', $legal_status); |
|
59 | 59 | |
60 | 60 | $select_legal_statut = '<select name="wpshop_company_info[company_legal_statut]">'; |
61 | - foreach($legal_status as $key=>$value) { |
|
62 | - $selected = $options['company_legal_statut']==$key ? ' selected="selected"' : null; |
|
63 | - $select_legal_statut .= '<option value="'.$key.'"'.$selected.'>'.__($value,'wpshop').'</option>'; |
|
61 | + foreach ($legal_status as $key=>$value) { |
|
62 | + $selected = $options['company_legal_statut'] == $key ? ' selected="selected"' : null; |
|
63 | + $select_legal_statut .= '<option value="' . $key . '"' . $selected . '>' . __($value, 'wpshop') . '</option>'; |
|
64 | 64 | } |
65 | 65 | $select_legal_statut .= '</select>'; |
66 | - $select_legal_statut .= ' <a href="#" title="'.__('Legal status will appear in invoices','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
66 | + $select_legal_statut .= ' <a href="#" title="' . __('Legal status will appear in invoices', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
67 | 67 | echo $select_legal_statut; |
68 | 68 | } |
69 | 69 | public static function wpshop_company_capital_field() { |
70 | 70 | $options = get_option('wpshop_company_info'); |
71 | - echo '<input name="wpshop_company_info[company_capital]" type="text" value="'.$options['company_capital'].'" /> |
|
72 | - <a href="#" title="'.__('Capital of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
71 | + echo '<input name="wpshop_company_info[company_capital]" type="text" value="' . $options['company_capital'] . '" /> |
|
72 | + <a href="#" title="'.__('Capital of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
73 | 73 | } |
74 | 74 | public static function wpshop_company_name_field() { |
75 | 75 | $options = get_option('wpshop_company_info'); |
76 | - echo '<input name="wpshop_company_info[company_name]" type="text" value="'.$options['company_name'].'" /> |
|
77 | - <a href="#" title="'.__('Name of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
76 | + echo '<input name="wpshop_company_info[company_name]" type="text" value="' . $options['company_name'] . '" /> |
|
77 | + <a href="#" title="'.__('Name of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
78 | 78 | } |
79 | 79 | public static function wpshop_company_street_field() { |
80 | 80 | $options = get_option('wpshop_company_info'); |
81 | - echo '<input name="wpshop_company_info[company_street]" type="text" value="'.$options['company_street'].'" /> |
|
82 | - <a href="#" title="'.__('Street of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
81 | + echo '<input name="wpshop_company_info[company_street]" type="text" value="' . $options['company_street'] . '" /> |
|
82 | + <a href="#" title="'.__('Street of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
83 | 83 | } |
84 | 84 | public static function wpshop_company_postcode_field() { |
85 | 85 | $options = get_option('wpshop_company_info'); |
86 | - echo '<input name="wpshop_company_info[company_postcode]" type="text" value="'.$options['company_postcode'].'" /> |
|
87 | - <a href="#" title="'.__('Postcode of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
86 | + echo '<input name="wpshop_company_info[company_postcode]" type="text" value="' . $options['company_postcode'] . '" /> |
|
87 | + <a href="#" title="'.__('Postcode of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
88 | 88 | } |
89 | 89 | public static function wpshop_company_city_field() { |
90 | 90 | $options = get_option('wpshop_company_info'); |
91 | - echo '<input name="wpshop_company_info[company_city]" type="text" value="'.$options['company_city'].'" /> |
|
92 | - <a href="#" title="'.__('The city in which your company is based','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
91 | + echo '<input name="wpshop_company_info[company_city]" type="text" value="' . $options['company_city'] . '" /> |
|
92 | + <a href="#" title="'.__('The city in which your company is based', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
93 | 93 | } |
94 | 94 | public static function wpshop_company_country_field() { |
95 | 95 | $options = get_option('wpshop_company_info'); |
96 | - echo '<input name="wpshop_company_info[company_country]" type="text" value="'.$options['company_country'].'" /> |
|
97 | - <a href="#" title="'.__('Country of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
96 | + echo '<input name="wpshop_company_info[company_country]" type="text" value="' . $options['company_country'] . '" /> |
|
97 | + <a href="#" title="'.__('Country of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
98 | 98 | } |
99 | 99 | public static function wpshop_company_tva_intra_field() { |
100 | 100 | $options = get_option('wpshop_company_info'); |
101 | - echo '<input name="wpshop_company_info[company_tva_intra]" type="text" value="'.$options['company_tva_intra'].'" /> |
|
102 | - <a href="#" title="'.__('Intracommunity VAT of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
101 | + echo '<input name="wpshop_company_info[company_tva_intra]" type="text" value="' . $options['company_tva_intra'] . '" /> |
|
102 | + <a href="#" title="'.__('Intracommunity VAT of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
103 | 103 | } |
104 | 104 | public static function wpshop_company_phone_field() { |
105 | 105 | $options = get_option('wpshop_company_info'); |
106 | - echo '<input name="wpshop_company_info[company_phone]" type="text" value="'.$options['company_phone'].'" /> |
|
107 | - <a href="#" title="'.__('Phone number of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
106 | + echo '<input name="wpshop_company_info[company_phone]" type="text" value="' . $options['company_phone'] . '" /> |
|
107 | + <a href="#" title="'.__('Phone number of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
108 | 108 | } |
109 | 109 | public static function wpshop_company_rcs_field() { |
110 | 110 | $options = get_option('wpshop_company_info'); |
111 | - echo '<input name="wpshop_company_info[company_rcs]" type="text" value="'.$options['company_rcs'].'" /> |
|
112 | - <a href="#" title="'.__('RCS of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
111 | + echo '<input name="wpshop_company_info[company_rcs]" type="text" value="' . $options['company_rcs'] . '" /> |
|
112 | + <a href="#" title="'.__('RCS of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
113 | 113 | } |
114 | 114 | public static function wpshop_company_siret_field() { |
115 | 115 | $options = get_option('wpshop_company_info'); |
116 | - echo '<input name="wpshop_company_info[company_siret]" type="text" value="'.$options['company_siret'].'" /> |
|
117 | - <a href="#" title="'.__('SIRET of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
116 | + echo '<input name="wpshop_company_info[company_siret]" type="text" value="' . $options['company_siret'] . '" /> |
|
117 | + <a href="#" title="'.__('SIRET of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
118 | 118 | } |
119 | 119 | public static function wpshop_company_siren_field() { |
120 | 120 | $options = get_option('wpshop_company_info'); |
121 | - echo '<input name="wpshop_company_info[company_siren]" type="text" value="'.$options['company_siren'].'" /> |
|
122 | - <a href="#" title="'.__('SIREN of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
121 | + echo '<input name="wpshop_company_info[company_siren]" type="text" value="' . $options['company_siren'] . '" /> |
|
122 | + <a href="#" title="'.__('SIREN of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
123 | 123 | } |
124 | 124 | public static function wpshop_company_fax_field() { |
125 | 125 | $options = get_option('wpshop_company_info'); |
126 | - echo '<input name="wpshop_company_info[company_fax]" type="text" value="'.$options['company_fax'].'" /> |
|
127 | - <a href="#" title="'.__('Fax number of your company','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
126 | + echo '<input name="wpshop_company_info[company_fax]" type="text" value="' . $options['company_fax'] . '" /> |
|
127 | + <a href="#" title="'.__('Fax number of your company', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /* Processing */ |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | 'sa' => 'SA', |
148 | 148 | 'sas' => 'SAS', |
149 | 149 | 'sasu' => 'SASU', |
150 | - 'association' => __( 'Assocation', 'wpshop'), |
|
150 | + 'association' => __('Assocation', 'wpshop'), |
|
151 | 151 | 'sci' => 'SCI', |
152 | 152 | 'scp' => 'SCP', |
153 | 153 | 'scm' => 'SCM', |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -162,8 +162,8 @@ |
||
162 | 162 | |
163 | 163 | |
164 | 164 | /** |
165 | - * Declare the different options for the plugin |
|
166 | - */ |
|
165 | + * Declare the different options for the plugin |
|
166 | + */ |
|
167 | 167 | public static function add_options(){ |
168 | 168 | global $wpshop_display_option; |
169 | 169 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | $groups = array(); |
44 | 44 | |
45 | 45 | $groups['wpshop_general_option'] = |
46 | - array( 'label' => __('General', 'wpshop'), |
|
46 | + array('label' => __('General', 'wpshop'), |
|
47 | 47 | 'subgroups' => array( |
48 | 48 | 'wpshop_general_config' => array('class' => 'wpshop_admin_box_options_general'), |
49 | 49 | 'wpshop_company_info' => array('class' => 'wpshop_admin_box_options_company'), |
50 | 50 | ), |
51 | 51 | ); |
52 | 52 | $groups['wpshop_catalog_option'] = |
53 | - array( 'label' => __('Catalog', 'wpshop'), |
|
53 | + array('label' => __('Catalog', 'wpshop'), |
|
54 | 54 | 'subgroups' => array( |
55 | 55 | 'wpshop_catalog_product_option' => array('class' => ' wpshop_admin_box_options_product'), |
56 | 56 | 'wpshop_catalog_main_option' => array('class' => ' wpshop_admin_box_options_catalog'), |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | ), |
59 | 59 | ); |
60 | 60 | $groups['wpshop_pages_option'] = |
61 | - array( 'label' => __('Pages', 'wpshop'), |
|
61 | + array('label' => __('Pages', 'wpshop'), |
|
62 | 62 | 'subgroups' => array( |
63 | 63 | 'wpshop_pages_option' => array('class' => ' wpshop_admin_box_options_pages'), |
64 | 64 | ), |
65 | 65 | ); |
66 | 66 | $groups['wpshop_display_option'] = |
67 | - array( 'label' => __('Display', 'wpshop'), |
|
67 | + array('label' => __('Display', 'wpshop'), |
|
68 | 68 | 'subgroups' => array( |
69 | 69 | 'wpshop_display_option' => array('class' => ' wpshop_admin_box_options_display'), |
70 | 70 | 'wpshop_customize_display_option' => array('class' => ' wpshop_admin_box_options_display'), |
@@ -72,32 +72,32 @@ discard block |
||
72 | 72 | ), |
73 | 73 | ); |
74 | 74 | $groups['wpshop_emails_option'] = |
75 | - array( 'label' => __('Emails', 'wpshop'), |
|
75 | + array('label' => __('Emails', 'wpshop'), |
|
76 | 76 | 'subgroups' => array( |
77 | 77 | 'wpshop_emails' => array('class' => ' wpshop_admin_box_options_email'), |
78 | 78 | 'wpshop_messages' => array('class' => ' wpshop_admin_box_options_message'), |
79 | 79 | ), |
80 | 80 | ); |
81 | 81 | |
82 | - $wpshop_shop_type = !empty( $_POST['wpshop_shop_type'] ) ? sanitize_text_field( $_POST['wpshop_shop_type'] ) : ''; |
|
82 | + $wpshop_shop_type = !empty($_POST['wpshop_shop_type']) ? sanitize_text_field($_POST['wpshop_shop_type']) : ''; |
|
83 | 83 | |
84 | 84 | /** Some options are available only when sale mode is active */ |
85 | - if((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation'))) : |
|
85 | + if ((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation'))) : |
|
86 | 86 | $groups['wpshop_cart_option'] = |
87 | - array( 'label' => __('Cart', 'wpshop'), |
|
87 | + array('label' => __('Cart', 'wpshop'), |
|
88 | 88 | 'subgroups' => array( |
89 | 89 | 'wpshop_cart_info' => array('class' => ' wpshop_admin_box_options_cart'), |
90 | 90 | ), |
91 | 91 | ); |
92 | 92 | $groups['wpshop_payments_option'] = |
93 | - array( 'label' => __('Payments', 'wpshop'), |
|
93 | + array('label' => __('Payments', 'wpshop'), |
|
94 | 94 | 'subgroups' => array( |
95 | 95 | 'wpshop_paymentMethod' => array('class' => ' wpshop_admin_box_options_payment_method'), |
96 | 96 | 'wpshop_payment_partial_on_command' => array('class' => ' wpshop_admin_box_options_payment_partial'), |
97 | 97 | ), |
98 | 98 | ); |
99 | 99 | $groups['wpshop_shipping_option'] = |
100 | - array( 'label' => __('Shipping', 'wpshop'), |
|
100 | + array('label' => __('Shipping', 'wpshop'), |
|
101 | 101 | 'subgroups' => array( |
102 | 102 | 'wpshop_shipping_rules' => array('class' => ' wpshop_admin_box_options_shipping_rules') |
103 | 103 | ), |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | endif; |
106 | 106 | |
107 | 107 | $groups['wpshop_addons_option'] = |
108 | - array( 'label' => __('Addons', 'wpshop'), |
|
108 | + array('label' => __('Addons', 'wpshop'), |
|
109 | 109 | 'subgroups' => array( |
110 | 110 | 'wpshop_addons_options' => array('class' => ' wpshop_admin_box_options_addons'), |
111 | 111 | ), |
112 | 112 | ); |
113 | 113 | |
114 | 114 | $groups['wpshop_advanced_options'] = |
115 | - array( 'label' => __('Advanced options', 'wpshop'), |
|
115 | + array('label' => __('Advanced options', 'wpshop'), |
|
116 | 116 | 'subgroups' => array( |
117 | 117 | 'wpshop_extra_options' => array('class' => ' wpshop_admin_box_options_advanced'), |
118 | 118 | ), |
@@ -138,17 +138,17 @@ discard block |
||
138 | 138 | ob_end_clean(); |
139 | 139 | $tpl_component['ADMIN_OPTIONS_TAB_LIST'] = ''; |
140 | 140 | $tpl_component['ADMIN_OPTIONS_TAB_CONTENT_LIST'] = ''; |
141 | - if ( !empty($options_list) ) { |
|
142 | - foreach ( $options_list as $group_key => $group_content) { |
|
141 | + if (!empty($options_list)) { |
|
142 | + foreach ($options_list as $group_key => $group_content) { |
|
143 | 143 | $sub_tpl_component = array(); |
144 | - if ( !empty($group_content['subgroups']) && is_array($group_content['subgroups']) ) { |
|
144 | + if (!empty($group_content['subgroups']) && is_array($group_content['subgroups'])) { |
|
145 | 145 | $sub_tpl_component['ADMIN_OPTIONS_GROUP_CONTENT'] = ''; |
146 | 146 | $sub_tpl_component['ADMIN_OPTIONS_TAB_KEY'] = $group_key; |
147 | - $sub_tpl_component['ADMIN_OPTIONS_TAB_LABEL'] = ( !empty($group_content['label']) ) ? $group_content['label'] : ''; |
|
147 | + $sub_tpl_component['ADMIN_OPTIONS_TAB_LABEL'] = (!empty($group_content['label'])) ? $group_content['label'] : ''; |
|
148 | 148 | $tpl_component['ADMIN_OPTIONS_TAB_LIST'] .= wpshop_display::display_template_element('wpshop_admin_options_group_tab', $sub_tpl_component, array(), 'admin'); |
149 | - foreach ( $group_content['subgroups'] as $subgroup_key => $subgroup_def) { |
|
149 | + foreach ($group_content['subgroups'] as $subgroup_key => $subgroup_def) { |
|
150 | 150 | ob_start(); |
151 | - do_settings_sections( $subgroup_key ); |
|
151 | + do_settings_sections($subgroup_key); |
|
152 | 152 | $sub_tpl_component['ADMIN_OPTIONS_SUBGROUP_CONTENT'] = ob_get_contents(); |
153 | 153 | ob_end_clean(); |
154 | 154 | $sub_tpl_component['ADMIN_OPTIONS_SUBGROUP_CLASS'] = $subgroup_def['class']; |
@@ -166,21 +166,21 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * Declare the different options for the plugin |
168 | 168 | */ |
169 | - public static function add_options(){ |
|
169 | + public static function add_options() { |
|
170 | 170 | global $wpshop_display_option; |
171 | 171 | |
172 | 172 | |
173 | 173 | /*Catalog - Main */ |
174 | 174 | register_setting('wpshop_options', 'wpshop_catalog_main_option', array('wpshop_options', 'wpshop_options_validate_catalog_main_option')); |
175 | - add_settings_section('wpshop_catalog_main_section', '<span class="dashicons dashicons-category"></span>'.__('Catalog', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_main_option'); |
|
175 | + add_settings_section('wpshop_catalog_main_section', '<span class="dashicons dashicons-category"></span>' . __('Catalog', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_main_option'); |
|
176 | 176 | add_settings_field('wpshop_catalog_empty_price_behaviour', __('Empty price', 'wpshop'), array('wpshop_options', 'wpshop_catalog_empty_price_behaviour'), 'wpshop_catalog_main_option', 'wpshop_catalog_main_section'); |
177 | 177 | /* Catalog - Product */ |
178 | 178 | register_setting('wpshop_options', 'wpshop_catalog_product_option', array('wpshop_options', 'wpshop_options_validate_catalog_product_option')); |
179 | - add_settings_section('wpshop_catalog_product_section', '<span class="dashicons dashicons-archive"></span>'.__('Products', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_product_option'); |
|
179 | + add_settings_section('wpshop_catalog_product_section', '<span class="dashicons dashicons-archive"></span>' . __('Products', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_product_option'); |
|
180 | 180 | add_settings_field('wpshop_catalog_product_slug', __('Products common rewrite param', 'wpshop'), array('wpshop_options', 'wpshop_catalog_product_slug_field'), 'wpshop_catalog_product_option', 'wpshop_catalog_product_section'); |
181 | 181 | /* Catalog - Categories */ |
182 | 182 | register_setting('wpshop_options', 'wpshop_catalog_categories_option', array('wpshop_options', 'wpshop_options_validate_catalog_categories_option')); |
183 | - add_settings_section('wpshop_catalog_categories_section', '<span class="dashicons dashicons-portfolio"></span>'.__('Categories', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_categories_option'); |
|
183 | + add_settings_section('wpshop_catalog_categories_section', '<span class="dashicons dashicons-portfolio"></span>' . __('Categories', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_catalog_categories_option'); |
|
184 | 184 | add_settings_field('wpshop_catalog_categories_slug', __('Categories common rewrite param', 'wpshop'), array('wpshop_options', 'wpshop_catalog_categories_slug_field'), 'wpshop_catalog_categories_option', 'wpshop_catalog_categories_section'); |
185 | 185 | add_settings_field('wpshop_catalog_no_category_slug', __('Default category slug for unassociated product', 'wpshop'), array('wpshop_options', 'wpshop_catalog_no_category_slug_field'), 'wpshop_catalog_categories_option', 'wpshop_catalog_categories_section'); |
186 | 186 | |
@@ -191,16 +191,16 @@ discard block |
||
191 | 191 | wpshop_company_options::declare_options(); |
192 | 192 | |
193 | 193 | /* Payments */ |
194 | - $wpshop_shop_type = !empty( $_POST['wpshop_shop_type'] ) ? sanitize_text_field( $_POST['wpshop_shop_type'] ) : ''; |
|
195 | - $old_wpshop_shop_type = !empty( $_POST['old_wpshop_shop_type'] ) ? sanitize_text_field( $_POST['old_wpshop_shop_type'] ) : ''; |
|
196 | - if((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))){ |
|
194 | + $wpshop_shop_type = !empty($_POST['wpshop_shop_type']) ? sanitize_text_field($_POST['wpshop_shop_type']) : ''; |
|
195 | + $old_wpshop_shop_type = !empty($_POST['old_wpshop_shop_type']) ? sanitize_text_field($_POST['old_wpshop_shop_type']) : ''; |
|
196 | + if ((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))) { |
|
197 | 197 | wpshop_payment_options::declare_options(); |
198 | 198 | } |
199 | 199 | |
200 | 200 | /* Cart */ |
201 | - if((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))){ |
|
201 | + if ((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))) { |
|
202 | 202 | register_setting('wpshop_options', 'wpshop_cart_option', array('wpshop_options', 'wpshop_options_validate_cart')); |
203 | - add_settings_section('wpshop_cart_info', '<span class="dashicons dashicons-cart"></span>'.__('Cart', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_cart_info'); |
|
203 | + add_settings_section('wpshop_cart_info', '<span class="dashicons dashicons-cart"></span>' . __('Cart', 'wpshop'), array('wpshop_options', 'plugin_section_text'), 'wpshop_cart_info'); |
|
204 | 204 | add_settings_field('wpshop_cart_product_added_behaviour', __('Action when produt is added succesfully into cart', 'wpshop'), array('wpshop_options', 'wpshop_cart_product_added_behaviour_field'), 'wpshop_cart_info', 'wpshop_cart_info'); |
205 | 205 | add_settings_field('wpshop_cart_product_added_to_quotation_behaviour', __('Action when produt is added succesfully into a quotation', 'wpshop'), array('wpshop_options', 'wpshop_cart_product_added_to_quotation_behaviour_field'), 'wpshop_cart_info', 'wpshop_cart_info'); |
206 | 206 | add_settings_field('wpshop_cart_total_item_nb', __('Only a limited number of products in cart', 'wpshop'), array('wpshop_options', 'wpshop_cart_total_item_nb_field'), 'wpshop_cart_info', 'wpshop_cart_info'); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $wpshop_advanced_settings->declare_options(); |
228 | 228 | |
229 | 229 | /* Shipping section */ |
230 | - if((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))){ |
|
230 | + if ((WPSHOP_DEFINED_SHOP_TYPE == 'sale') && !isset($wpshop_shop_type) || (isset($wpshop_shop_type) && ($wpshop_shop_type != 'presentation')) && !isset($old_wpshop_shop_type) || (isset($old_wpshop_shop_type) && ($old_wpshop_shop_type != 'presentation'))) { |
|
231 | 231 | $wpshop_shipping_options = new wpshop_shipping_options(); |
232 | 232 | $wpshop_shipping_options->declare_options(); |
233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $options = get_option('wpshop_catalog_main_option'); |
246 | 246 | echo '<input type="checkbox"' . (!empty($options['wpshop_catalog_empty_price_behaviour']) ? ' checked="checked" ' : '') . ' value="yes" name="wpshop_catalog_main_option[wpshop_catalog_empty_price_behaviour]" id="wpshop_catalog_empty_price_behaviour" /> <label for="wpshop_catalog_empty_price_behaviour" >' . __('Hide price and add to cart button when price is empty or equal to 0', 'wpshop') . '</label>'; |
247 | 247 | } |
248 | - public static function wpshop_catalog_product_slug_field(){ |
|
248 | + public static function wpshop_catalog_product_slug_field() { |
|
249 | 249 | $options = get_option('wpshop_catalog_product_option'); |
250 | 250 | $catalog_cat_options = get_option('wpshop_catalog_categories_option'); |
251 | 251 | echo '<input type="checkbox"' . (!empty($options['wpshop_catalog_product_slug_with_category']) ? ' checked="checked" ' : '') . ' value="yes" name="wpshop_catalog_product_option[wpshop_catalog_product_slug_with_category]" id="wpshop_catalog_product_slug_with_category" /> <label for="wpshop_catalog_product_slug_with_category">' . __('Use product category in url', 'wpshop') . '</label><br/> |
@@ -253,24 +253,24 @@ discard block |
||
253 | 253 | <div class="alignleft wpshop_options_catalog_product_rewrite" ><input type="text" name="wpshop_catalog_product_option[wpshop_catalog_product_slug]" value="' . (!empty($options['wpshop_catalog_product_slug']) ? $options['wpshop_catalog_product_slug'] : WPSHOP_CATALOG_PRODUCT_SLUG) . '" /></div> |
254 | 254 | <div class="alignleft wpshop_options_catalog_product_rewrite" ><span class="wpshop_catalog_product_slug_category' . (empty($options['wpshop_catalog_product_slug_with_category']) ? ' disable' : '') . '" >/' . (!empty($catalog_cat_options['wpshop_catalog_categories_slug']) ? $catalog_cat_options['wpshop_catalog_categories_slug'] : WPSHOP_CATALOG_CATEGORIES_SLUG) . '</span></div> |
255 | 255 | <div class="alignleft wpshop_options_catalog_product_rewrite" >/' . __('Your_product_slug', 'wpshop') . '</div> |
256 | - <div class="alignleft" ><a href="#" title="'.__('This slug will be used in url to describe products page','wpshop').'" class="wpshop_infobulle_marker">?</a></div><br /><br /> |
|
257 | - <div><span style="color: red;" class="dashicons dashicons-megaphone"></span> '.__('"/" permit to disable slug of products (<b>but don\'t work with rewrites plugins</b>)','wpshop').'</div>'; |
|
256 | + <div class="alignleft" ><a href="#" title="'.__('This slug will be used in url to describe products page', 'wpshop') . '" class="wpshop_infobulle_marker">?</a></div><br /><br /> |
|
257 | + <div><span style="color: red;" class="dashicons dashicons-megaphone"></span> '.__('"/" permit to disable slug of products (<b>but don\'t work with rewrites plugins</b>)', 'wpshop') . '</div>'; |
|
258 | 258 | } |
259 | - public static function wpshop_catalog_categories_slug_field(){ |
|
259 | + public static function wpshop_catalog_categories_slug_field() { |
|
260 | 260 | $options = get_option('wpshop_catalog_categories_option'); |
261 | 261 | echo '<input type="text" name="wpshop_catalog_categories_option[wpshop_catalog_categories_slug]" value="' . (!empty($options['wpshop_catalog_categories_slug']) ? $options['wpshop_catalog_categories_slug'] : WPSHOP_CATALOG_CATEGORIES_SLUG) . '" /> |
262 | - <a href="#" title="'.__('This slug will be used in url to describe catagories page','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
262 | + <a href="#" title="'.__('This slug will be used in url to describe catagories page', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
263 | 263 | } |
264 | - public static function wpshop_catalog_no_category_slug_field(){ |
|
264 | + public static function wpshop_catalog_no_category_slug_field() { |
|
265 | 265 | $options = get_option('wpshop_catalog_categories_option'); |
266 | 266 | echo '<input type="text" name="wpshop_catalog_categories_option[wpshop_catalog_no_category_slug]" value="' . (!empty($options['wpshop_catalog_no_category_slug']) ? $options['wpshop_catalog_no_category_slug'] : WPSHOP_CATALOG_PRODUCT_NO_CATEGORY) . '" /> |
267 | - <a href="#" title="'.__('This slug will be used for products not being related to any category ','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
267 | + <a href="#" title="'.__('This slug will be used for products not being related to any category ', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /* Processing */ |
271 | - public static function wpshop_options_validate_catalog_product_option($input){ |
|
272 | - foreach($input as $option_key => $option_value){ |
|
273 | - switch($option_key){ |
|
271 | + public static function wpshop_options_validate_catalog_product_option($input) { |
|
272 | + foreach ($input as $option_key => $option_value) { |
|
273 | + switch ($option_key) { |
|
274 | 274 | default: |
275 | 275 | $new_input[$option_key] = $option_value; |
276 | 276 | break; |
@@ -279,9 +279,9 @@ discard block |
||
279 | 279 | |
280 | 280 | return $new_input; |
281 | 281 | } |
282 | - public static function wpshop_options_validate_catalog_categories_option($input){ |
|
283 | - foreach($input as $option_key => $option_value){ |
|
284 | - switch($option_key){ |
|
282 | + public static function wpshop_options_validate_catalog_categories_option($input) { |
|
283 | + foreach ($input as $option_key => $option_value) { |
|
284 | + switch ($option_key) { |
|
285 | 285 | default: |
286 | 286 | $new_input[$option_key] = $option_value; |
287 | 287 | break; |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | |
291 | 291 | return $new_input; |
292 | 292 | } |
293 | - public static function wpshop_options_validate_catalog_main_option($input){ |
|
293 | + public static function wpshop_options_validate_catalog_main_option($input) { |
|
294 | 294 | $new_input = $input; |
295 | - if ( !empty($input) && is_array( $input ) ) { |
|
296 | - foreach($input as $option_key => $option_value){ |
|
297 | - switch($option_key){ |
|
295 | + if (!empty($input) && is_array($input)) { |
|
296 | + foreach ($input as $option_key => $option_value) { |
|
297 | + switch ($option_key) { |
|
298 | 298 | default: |
299 | 299 | $new_input[$option_key] = $option_value; |
300 | 300 | break; |
@@ -305,16 +305,16 @@ discard block |
||
305 | 305 | return $new_input; |
306 | 306 | } |
307 | 307 | |
308 | - public static function wpshop_catalog_varition_product_field () { |
|
308 | + public static function wpshop_catalog_varition_product_field() { |
|
309 | 309 | $catalog_product_option = get_option('wpshop_catalog_product_option'); |
310 | - $output = '<input type="checkbox" name="wpshop_catalog_product_option[price_display][text_from]" id="wpshop_catalog_product_option_price_display_text_from" ' .( ( !empty($catalog_product_option) && !empty($catalog_product_option['price_display']) && !empty($catalog_product_option['price_display']['text_from']) ) ? 'checked="checked"' : '' ). ' /> '; |
|
311 | - $output .= '<label for="wpshop_catalog_product_option_price_display_text_from">'. __('Display "price from" before basic price of product', 'wpshop').'</label><br/>'; |
|
312 | - $output .= '<input type="checkbox" name="wpshop_catalog_product_option[price_display][lower_price]" id="wpshop_catalog_product_option_price_display_lower_price" ' .( ( !empty($catalog_product_option) && !empty($catalog_product_option['price_display']) && !empty($catalog_product_option['price_display']['lower_price']) ) ? 'checked="checked"' : '' ). ' /> '; |
|
313 | - $output .= '<label for="wpshop_catalog_product_option_price_display_lower_price">'. __('Display the lowest price of variation', 'wpshop').'</label>'; |
|
310 | + $output = '<input type="checkbox" name="wpshop_catalog_product_option[price_display][text_from]" id="wpshop_catalog_product_option_price_display_text_from" ' . ((!empty($catalog_product_option) && !empty($catalog_product_option['price_display']) && !empty($catalog_product_option['price_display']['text_from'])) ? 'checked="checked"' : '') . ' /> '; |
|
311 | + $output .= '<label for="wpshop_catalog_product_option_price_display_text_from">' . __('Display "price from" before basic price of product', 'wpshop') . '</label><br/>'; |
|
312 | + $output .= '<input type="checkbox" name="wpshop_catalog_product_option[price_display][lower_price]" id="wpshop_catalog_product_option_price_display_lower_price" ' . ((!empty($catalog_product_option) && !empty($catalog_product_option['price_display']) && !empty($catalog_product_option['price_display']['lower_price'])) ? 'checked="checked"' : '') . ' /> '; |
|
313 | + $output .= '<label for="wpshop_catalog_product_option_price_display_lower_price">' . __('Display the lowest price of variation', 'wpshop') . '</label>'; |
|
314 | 314 | echo $output; |
315 | 315 | } |
316 | 316 | |
317 | - public static function wpshop_catalog_product_variation_option_validate ($input) { |
|
317 | + public static function wpshop_catalog_product_variation_option_validate($input) { |
|
318 | 318 | return $input; |
319 | 319 | } |
320 | 320 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $input_def['id'] = 'wpshop_cart_option_total_nb_of_item_allowed'; |
331 | 331 | $input_def['type'] = 'text'; |
332 | 332 | $input_def['value'] = !empty($cart_option['total_nb_of_item_allowed']) ? $cart_option['total_nb_of_item_allowed'][0] : ''; |
333 | - $output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[total_nb_of_item_allowed]') . '<a href="#" title="'.__('This value count all quantities in cart. Example : 2 products A + 3 products B = 5 products','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
333 | + $output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[total_nb_of_item_allowed]') . '<a href="#" title="' . __('This value count all quantities in cart. Example : 2 products A + 3 products B = 5 products', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
334 | 334 | |
335 | 335 | echo $output; |
336 | 336 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $input_def['id'] = 'wpshop_cart_option_nb_of_same_item_allowed'; |
344 | 344 | $input_def['type'] = 'text'; |
345 | 345 | $input_def['value'] = $cart_option['total_nb_of_same_item_allowed'][0]; |
346 | - $output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[total_nb_of_same_item_allowed]') . '<a href="#" title="'.__('Empty for no restriction','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
346 | + $output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[total_nb_of_same_item_allowed]') . '<a href="#" title="' . __('Empty for no restriction', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
347 | 347 | |
348 | 348 | echo $output; |
349 | 349 | } |
@@ -362,11 +362,11 @@ discard block |
||
362 | 362 | $input_def['options_label']['container'] = true; |
363 | 363 | $output .= wpshop_form::check_input_type($input_def, 'wpshop_cart_option[product_added_to_cart]'); |
364 | 364 | |
365 | - $hide = ( (!empty($cart_option) && !empty($cart_option['product_added_to_cart'][0]) && $cart_option['product_added_to_cart'][0] == 'cart_page') ? 'wpshopHide' : null); |
|
366 | - $output .= '<div id="wpshop_cart_option_animation_cart_type" class="' .$hide. '"><label for="wpshop_cart_option[animation_cart_type]">' .__('Cart animation type', 'wpshop'). '</label>'; |
|
365 | + $hide = ((!empty($cart_option) && !empty($cart_option['product_added_to_cart'][0]) && $cart_option['product_added_to_cart'][0] == 'cart_page') ? 'wpshopHide' : null); |
|
366 | + $output .= '<div id="wpshop_cart_option_animation_cart_type" class="' . $hide . '"><label for="wpshop_cart_option[animation_cart_type]">' . __('Cart animation type', 'wpshop') . '</label>'; |
|
367 | 367 | $output .= '<select name="wpshop_cart_option[animation_cart_type]" id="wpshop_cart_option[animation_cart_type]">'; |
368 | - $output .= '<option value="pop-in" ' .( ( !empty($cart_option['animation_cart_type']) && $cart_option['animation_cart_type'] == 'pop-in') ? 'selected="selected"' : null). '>' .__('Dialog box', 'wpshop'). '</option>'; |
|
369 | - $output .= '<option value="animation" ' .( ( !empty($cart_option['animation_cart_type']) && $cart_option['animation_cart_type'] == 'animation') ? 'selected="selected"' : null). '>' .__('Image animation', 'wpshop'). '</option>'; |
|
368 | + $output .= '<option value="pop-in" ' . ((!empty($cart_option['animation_cart_type']) && $cart_option['animation_cart_type'] == 'pop-in') ? 'selected="selected"' : null) . '>' . __('Dialog box', 'wpshop') . '</option>'; |
|
369 | + $output .= '<option value="animation" ' . ((!empty($cart_option['animation_cart_type']) && $cart_option['animation_cart_type'] == 'animation') ? 'selected="selected"' : null) . '>' . __('Image animation', 'wpshop') . '</option>'; |
|
370 | 370 | $output .= '</select></div>'; |
371 | 371 | |
372 | 372 | echo $output; |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $input_def['id'] = 'wpshop_cart_option_action_after_product_added_to_quotation'; |
385 | 385 | $input_def['type'] = 'radio'; |
386 | 386 | $input_def['valueToPut'] = 'index'; |
387 | - $input_def['value'] = ( !empty($cart_option['product_added_to_quotation']) ? $cart_option['product_added_to_quotation'] : null ); |
|
387 | + $input_def['value'] = (!empty($cart_option['product_added_to_quotation']) ? $cart_option['product_added_to_quotation'] : null); |
|
388 | 388 | $input_def['possible_value'] = array('dialog_msg' => __('Display the dialog allowing to choose between continue shopping or go to cart', 'wpshop'), 'cart_page' => __('Automaticaly send user to cart page', 'wpshop')); |
389 | 389 | $input_def['options_label']['original'] = true; |
390 | 390 | $input_def['options_label']['container'] = true; |
@@ -392,14 +392,14 @@ discard block |
||
392 | 392 | |
393 | 393 | echo $output; |
394 | 394 | } |
395 | - public static function wpshop_options_validate_cart( $input ) { |
|
395 | + public static function wpshop_options_validate_cart($input) { |
|
396 | 396 | |
397 | - if ( empty( $input ) || empty( $input[ 'display_newsletter' ] ) || empty( $input[ 'display_newsletter' ][ 'partner_subscription' ] ) ) { |
|
398 | - $input[ 'display_newsletter' ][ 'partner_subscription' ] = 'no'; |
|
397 | + if (empty($input) || empty($input['display_newsletter']) || empty($input['display_newsletter']['partner_subscription'])) { |
|
398 | + $input['display_newsletter']['partner_subscription'] = 'no'; |
|
399 | 399 | } |
400 | 400 | |
401 | - if ( empty( $input ) || empty( $input[ 'display_newsletter' ] ) || empty( $input[ 'display_newsletter' ][ 'site_subscription' ] ) ) { |
|
402 | - $input[ 'display_newsletter' ][ 'site_subscription' ] = 'no'; |
|
401 | + if (empty($input) || empty($input['display_newsletter']) || empty($input['display_newsletter']['site_subscription'])) { |
|
402 | + $input['display_newsletter']['site_subscription'] = 'no'; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | return $input; |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | * @package wpshop |
21 | 21 | * @subpackage librairies |
22 | 22 | */ |
23 | -class wpshop_addons_settings{ |
|
23 | +class wpshop_addons_settings { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Déclaration des différentes options |
27 | 27 | */ |
28 | - function declare_options(){ |
|
28 | + function declare_options() { |
|
29 | 29 | // add_settings_section('wpshop_addons_options', __('Wpshop "addons"', 'wpshop'), array('wpshop_advanced_settings', 'plugin_section_text'), 'wpshop_addons_options'); |
30 | 30 | // register_setting('wpshop_options', 'wpshop_addons_options', array('wpshop_addons_settings', 'validate_options')); |
31 | 31 | // add_settings_field('wpshop_addons_settings_field', '', array('wpshop_addons_settings', 'addons_definition_fields'), 'wpshop_addons_options', 'wpshop_addons_options'); |
@@ -42,33 +42,33 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @param unknown_type $input |
44 | 44 | */ |
45 | - public static function validate_options($input){ |
|
45 | + public static function validate_options($input) { |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Définition des champs pour l'activation des addons |
51 | 51 | */ |
52 | - function addons_definition_fields () { |
|
52 | + function addons_definition_fields() { |
|
53 | 53 | $content = ''; |
54 | 54 | |
55 | - $content .= '<input type="hidden" name="wpshop_ajax_addons_nonce" id="wpshop_ajax_addons_nonce" value="'.wp_create_nonce('wpshop_ajax_activate_addons').'" />'; |
|
55 | + $content .= '<input type="hidden" name="wpshop_ajax_addons_nonce" id="wpshop_ajax_addons_nonce" value="' . wp_create_nonce('wpshop_ajax_activate_addons') . '" />'; |
|
56 | 56 | |
57 | 57 | $addons_options = get_option('wpshop_addons', array()); |
58 | 58 | $addons_list = unserialize(WPSHOP_ADDONS_LIST); |
59 | 59 | foreach ($addons_list as $addon => $addon_def) { |
60 | 60 | $activated_status = false; |
61 | - if ( array_key_exists($addon, $addons_options) && ( $addons_options[$addon]['activate'] )) { |
|
61 | + if (array_key_exists($addon, $addons_options) && ($addons_options[$addon]['activate'])) { |
|
62 | 62 | $activated_status = true; |
63 | 63 | } |
64 | - $activated_string = $activated_status ? __('Activated','wpshop') : __('Desactivated','wpshop'); |
|
64 | + $activated_string = $activated_status ? __('Activated', 'wpshop') : __('Desactivated', 'wpshop'); |
|
65 | 65 | $activated_class = unserialize(WPSHOP_ADDONS_STATES_CLASS); |
66 | - $content .= '<strong>' . __($addon_def[0], 'wpshop') . '</strong>: <span class="'.$activated_class[$activated_status].'" id="addon_'.$addon.'_state" >'.$activated_string.'</span>'; |
|
66 | + $content .= '<strong>' . __($addon_def[0], 'wpshop') . '</strong>: <span class="' . $activated_class[$activated_status] . '" id="addon_' . $addon . '_state" >' . $activated_string . '</span>'; |
|
67 | 67 | if (!$activated_status) { |
68 | - $content .= ' <input type="text" name="'.$addon.'" id="'.$addon.'" value="" /> <input type="button" name="'.$addon.'_button" id="'.$addon.'_button" class="addons_activating_button button-primary" value="'.__('Activate this addon','wpshop').'" />'; |
|
68 | + $content .= ' <input type="text" name="' . $addon . '" id="' . $addon . '" value="" /> <input type="button" name="' . $addon . '_button" id="' . $addon . '_button" class="addons_activating_button button-primary" value="' . __('Activate this addon', 'wpshop') . '" />'; |
|
69 | 69 | } |
70 | 70 | else { |
71 | - $content .= ' <input type="button" name="'.$addon.'_button" id="'.$addon.'_button" class="addons_desactivating_button button-secondary" value="'.__('Desactivate this addon','wpshop').'" />'; |
|
71 | + $content .= ' <input type="button" name="' . $addon . '_button" id="' . $addon . '_button" class="addons_desactivating_button button-secondary" value="' . __('Desactivate this addon', 'wpshop') . '" />'; |
|
72 | 72 | } |
73 | 73 | $content .= '<br/>'; |
74 | 74 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -66,8 +68,7 @@ discard block |
||
66 | 68 | $content .= '<strong>' . __($addon_def[0], 'wpshop') . '</strong>: <span class="'.$activated_class[$activated_status].'" id="addon_'.$addon.'_state" >'.$activated_string.'</span>'; |
67 | 69 | if (!$activated_status) { |
68 | 70 | $content .= ' <input type="text" name="'.$addon.'" id="'.$addon.'" value="" /> <input type="button" name="'.$addon.'_button" id="'.$addon.'_button" class="addons_activating_button button-primary" value="'.__('Activate this addon','wpshop').'" />'; |
69 | - } |
|
70 | - else { |
|
71 | + } else { |
|
71 | 72 | $content .= ' <input type="button" name="'.$addon.'_button" id="'.$addon.'_button" class="addons_desactivating_button button-secondary" value="'.__('Desactivate this addon','wpshop').'" />'; |
72 | 73 | } |
73 | 74 | $content .= '<br/>'; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Payment options management |
4 | 4 | * |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | /** Check if file is include. No direct access possible with file url */ |
13 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
14 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
13 | +if (!defined('WPSHOP_VERSION')) { |
|
14 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -27,21 +27,21 @@ discard block |
||
27 | 27 | public static function declare_options() { |
28 | 28 | |
29 | 29 | $options = get_option('wpshop_paymentMethod'); |
30 | - add_settings_section('wpshop_paymentMethod', '<span class="dashicons dashicons-admin-settings"></span>'.__('Payment method', 'wpshop'), array('wpshop_payment_options', 'plugin_section_text'), 'wpshop_paymentMethod'); |
|
30 | + add_settings_section('wpshop_paymentMethod', '<span class="dashicons dashicons-admin-settings"></span>' . __('Payment method', 'wpshop'), array('wpshop_payment_options', 'plugin_section_text'), 'wpshop_paymentMethod'); |
|
31 | 31 | |
32 | 32 | register_setting('wpshop_options', 'wpshop_paymentMethod', array('wpshop_payment_options', 'wpshop_options_validate_default_payment_method')); |
33 | 33 | register_setting('wpshop_options', 'wpshop_paymentMethod_options', array('wpshop_payment_options', 'wpshop_options_validate_payment_method_options')); |
34 | 34 | register_setting('wpshop_options', 'wpshop_paymentAddress', array('wpshop_payment_options', 'wpshop_options_validate_paymentAddress')); |
35 | 35 | register_setting('wpshop_options', 'wpshop_paypalEmail', array('wpshop_payment_options', 'wpshop_options_validate_paypalEmail')); |
36 | 36 | register_setting('wpshop_options', 'wpshop_paypalMode', array('wpshop_payment_options', 'wpshop_options_validate_paypalMode')); |
37 | - if(WPSHOP_PAYMENT_METHOD_CIC || !empty($options['cic'])) register_setting('wpshop_options', 'wpshop_cmcic_params', array('wpshop_payment_options', 'wpshop_options_validate_cmcic_params')); |
|
37 | + if (WPSHOP_PAYMENT_METHOD_CIC || !empty($options['cic'])) register_setting('wpshop_options', 'wpshop_cmcic_params', array('wpshop_payment_options', 'wpshop_options_validate_cmcic_params')); |
|
38 | 38 | |
39 | 39 | register_setting('wpshop_options', 'wpshop_payment_partial', array('wpshop_payment_options', 'partial_payment_saver')); |
40 | - add_settings_section('wpshop_payment_partial_on_command', '<span class="dashicons dashicons-clipboard"></span>'.__('Partial payment', 'wpshop'), array('wpshop_payment_options', 'partial_payment_explanation'), 'wpshop_payment_partial_on_command'); |
|
40 | + add_settings_section('wpshop_payment_partial_on_command', '<span class="dashicons dashicons-clipboard"></span>' . __('Partial payment', 'wpshop'), array('wpshop_payment_options', 'partial_payment_explanation'), 'wpshop_payment_partial_on_command'); |
|
41 | 41 | add_settings_field('wpshop_payment_partial', '', array('wpshop_payment_options', 'partial_payment'), 'wpshop_payment_partial_on_command', 'wpshop_payment_partial_on_command'); |
42 | 42 | |
43 | 43 | register_setting('wpshop_options', 'wpshop_send_invoice', array('wpshop_payment_options', 'allow_send_invoice_saver')); |
44 | - add_settings_section('wpshop_send_invoice_section','<span class="dashicons dashicons-email-alt"></span>'. __('Allow WPShop to send invoices', 'wpshop'), array(), 'wpshop_payment_partial_on_command'); |
|
44 | + add_settings_section('wpshop_send_invoice_section', '<span class="dashicons dashicons-email-alt"></span>' . __('Allow WPShop to send invoices', 'wpshop'), array(), 'wpshop_payment_partial_on_command'); |
|
45 | 45 | add_settings_field('wpshop_send_invoice', '', array('wpshop_payment_options', 'wpshop_send_invoice'), 'wpshop_payment_partial_on_command', 'wpshop_send_invoice_section'); |
46 | 46 | } |
47 | 47 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | /* Processing */ |
57 | 57 | public static function wpshop_options_validate_paymentMethod($input) { |
58 | 58 | foreach ($input as $k => $i) { |
59 | - if ( $k != 'default_method' && !is_array($i) ) { |
|
60 | - $input[$k] = !empty($input[$k]) && ($input[$k]=='on'); |
|
59 | + if ($k != 'default_method' && !is_array($i)) { |
|
60 | + $input[$k] = !empty($input[$k]) && ($input[$k] == 'on'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | return $input; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return $input; |
84 | 84 | } |
85 | 85 | |
86 | - public static function allow_send_invoice_saver( $input ) { |
|
86 | + public static function allow_send_invoice_saver($input) { |
|
87 | 87 | return $input; |
88 | 88 | } |
89 | 89 | |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | $partial_payment_current_config = get_option('wpshop_payment_partial', array('for_all' => array())); |
114 | 114 | |
115 | 115 | $partial_for_all_is_activate = false; |
116 | - if ( !empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && !empty($partial_payment_current_config['for_all']['activate']) ) { |
|
116 | + if (!empty($partial_payment_current_config) && !empty($partial_payment_current_config['for_all']) && !empty($partial_payment_current_config['for_all']['activate'])) { |
|
117 | 117 | $partial_for_all_is_activate = true; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $output .= ' |
121 | -<input type="checkbox" name="wpshop_payment_partial[for_all][activate]"' . ($partial_for_all_is_activate ? ' checked="checked"' : '') . ' id="wpshop_payment_partial_on_command_activation_state" /> <label for="wpshop_payment_partial_on_command_activation_state" >' . __('Activate partial command for all order', 'wpshop') . '</label><a href="#" title="'.__('If you want that customer pay a part o f total amount of there order, check this box then fill fields below','wpshop').'" class="wpshop_infobulle_marker">?</a> |
|
121 | +<input type="checkbox" name="wpshop_payment_partial[for_all][activate]"' . ($partial_for_all_is_activate ? ' checked="checked"' : '') . ' id="wpshop_payment_partial_on_command_activation_state" /> <label for="wpshop_payment_partial_on_command_activation_state" >' . __('Activate partial command for all order', 'wpshop') . '</label><a href="#" title="' . __('If you want that customer pay a part o f total amount of there order, check this box then fill fields below', 'wpshop') . '" class="wpshop_infobulle_marker">?</a> |
|
122 | 122 | <div class="wpshop_partial_payment_config_container' . ($partial_for_all_is_activate ? '' : ' wpshopHide') . '" id="wpshop_partial_payment_config_container" > |
123 | 123 | <div class="alignleft" > |
124 | 124 | ' . __('Value of partial payment', 'wpshop') . '<br/> |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | |
139 | 139 | |
140 | 140 | public static function wpshop_send_invoice() { |
141 | - $send_invoice_option = get_option( 'wpshop_send_invoice' ); |
|
142 | - $output = '<input type="checkbox" id="wpshop_send_invoice" name="wpshop_send_invoice" ' . ( ( !empty($send_invoice_option) ) ? 'checked="checked"' : '' ) . '/>'; |
|
143 | - $output .= ' <label for="wpshop_send_invoice">' .__('Allow WPshop to send invoice in PDF format when order is completed', 'wpshop' ). '</label>'; |
|
141 | + $send_invoice_option = get_option('wpshop_send_invoice'); |
|
142 | + $output = '<input type="checkbox" id="wpshop_send_invoice" name="wpshop_send_invoice" ' . ((!empty($send_invoice_option)) ? 'checked="checked"' : '') . '/>'; |
|
143 | + $output .= ' <label for="wpshop_send_invoice">' . __('Allow WPshop to send invoice in PDF format when order is completed', 'wpshop') . '</label>'; |
|
144 | 144 | echo $output; |
145 | 145 | } |
146 | 146 | |
147 | - public static function wpshop_options_validate_default_payment_method ($input) { |
|
147 | + public static function wpshop_options_validate_default_payment_method($input) { |
|
148 | 148 | return $input; |
149 | 149 | } |
150 | 150 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Payment options management |
4 | 6 | * |
@@ -34,7 +36,9 @@ discard block |
||
34 | 36 | register_setting('wpshop_options', 'wpshop_paymentAddress', array('wpshop_payment_options', 'wpshop_options_validate_paymentAddress')); |
35 | 37 | register_setting('wpshop_options', 'wpshop_paypalEmail', array('wpshop_payment_options', 'wpshop_options_validate_paypalEmail')); |
36 | 38 | register_setting('wpshop_options', 'wpshop_paypalMode', array('wpshop_payment_options', 'wpshop_options_validate_paypalMode')); |
37 | - if(WPSHOP_PAYMENT_METHOD_CIC || !empty($options['cic'])) register_setting('wpshop_options', 'wpshop_cmcic_params', array('wpshop_payment_options', 'wpshop_options_validate_cmcic_params')); |
|
39 | + if(WPSHOP_PAYMENT_METHOD_CIC || !empty($options['cic'])) { |
|
40 | + register_setting('wpshop_options', 'wpshop_cmcic_params', array('wpshop_payment_options', 'wpshop_options_validate_cmcic_params')); |
|
41 | + } |
|
38 | 42 | |
39 | 43 | register_setting('wpshop_options', 'wpshop_payment_partial', array('wpshop_payment_options', 'partial_payment_saver')); |
40 | 44 | add_settings_section('wpshop_payment_partial_on_command', '<span class="dashicons dashicons-clipboard"></span>'.__('Partial payment', 'wpshop'), array('wpshop_payment_options', 'partial_payment_explanation'), 'wpshop_payment_partial_on_command'); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -140,8 +142,7 @@ discard block |
||
140 | 142 | $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "yes", is_used_in_variation = "yes" WHERE code = "product_price"'); |
141 | 143 | $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "yes" WHERE code = "tx_tva"'); |
142 | 144 | $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "no", is_used_in_variation = "no" WHERE code = "price_ht"'); |
143 | - } |
|
144 | - elseif ( ($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_HT) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']) ) { |
|
145 | + } elseif ( ($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_HT) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']) ) { |
|
145 | 146 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['id'])); |
146 | 147 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['id'])); |
147 | 148 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | class wpshop_general_options { |
24 | 24 | |
25 | 25 | /** |
26 | - * |
|
27 | - */ |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | public static function declare_options(){ |
29 | 29 | $page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; |
30 | 30 |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * |
27 | 27 | */ |
28 | - public static function declare_options(){ |
|
29 | - $page = !empty( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : ''; |
|
28 | + public static function declare_options() { |
|
29 | + $page = !empty($_GET['page']) ? sanitize_text_field($_GET['page']) : ''; |
|
30 | 30 | |
31 | - if ( isset($page) && ( substr($page, 0, 13 ) == 'wpshop_option' || $page == 'wps-installer' ) ) { |
|
31 | + if (isset($page) && (substr($page, 0, 13) == 'wpshop_option' || $page == 'wps-installer')) { |
|
32 | 32 | wp_enqueue_media(); |
33 | 33 | } |
34 | - add_settings_section('wpshop_general_config','<span class="dashicons dashicons-info"></span>'. __('Shop main configuration', 'wpshop'), array('wpshop_general_options', 'plugin_section_text'), 'wpshop_general_config'); |
|
34 | + add_settings_section('wpshop_general_config', '<span class="dashicons dashicons-info"></span>' . __('Shop main configuration', 'wpshop'), array('wpshop_general_options', 'plugin_section_text'), 'wpshop_general_config'); |
|
35 | 35 | |
36 | 36 | register_setting('wpshop_options', 'wpshop_shop_type', array('wpshop_general_options', 'wpshop_options_validate_wpshop_shop_type')); |
37 | 37 | add_settings_field('wpshop_shop_type', __('Shop type', 'wpshop'), array('wpshop_general_options', 'wpshop_shop_type'), 'wpshop_general_config', 'wpshop_general_config'); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | /* Default currecy for the entire shop */ |
62 | 62 | public static function wpshop_shop_default_currency_field() { |
63 | - echo wpshop_attributes_unit::wpshop_shop_currency_list_field() . '<a href="#" title="'.__('This is the currency the shop will use','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
63 | + echo wpshop_attributes_unit::wpshop_shop_currency_list_field() . '<a href="#" title="' . __('This is the currency the shop will use', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public static function wpshop_default_weight_unity_field() { |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | $current_weight = get_option('wpshop_shop_default_weight_unity'); |
71 | 71 | |
72 | 72 | $weight_options = ''; |
73 | - if ( !empty ($weight_group) ) { |
|
74 | - $query = $wpdb->prepare('SELECT * FROM ' .WPSHOP_DBT_ATTRIBUTE_UNIT. ' WHERE group_id = %d', $weight_group); |
|
73 | + if (!empty ($weight_group)) { |
|
74 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_UNIT . ' WHERE group_id = %d', $weight_group); |
|
75 | 75 | $weight_units = $wpdb->get_results($query); |
76 | - foreach ( $weight_units as $weight_unit) { |
|
77 | - $weight_options .= '<option value="'.$weight_unit->id.'"'.( ($weight_unit->id == $current_weight) ? ' selected="selected"' : null).'>'.$weight_unit->name.' ('.$weight_unit->unit.')</option>'; |
|
76 | + foreach ($weight_units as $weight_unit) { |
|
77 | + $weight_options .= '<option value="' . $weight_unit->id . '"' . (($weight_unit->id == $current_weight) ? ' selected="selected"' : null) . '>' . $weight_unit->name . ' (' . $weight_unit->unit . ')</option>'; |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - echo '<select name="wpshop_shop_default_weight_unity">'.$weight_options.'</select> |
|
82 | - <a href="#" title="'.__('This is the weight unity the shop will use','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
81 | + echo '<select name="wpshop_shop_default_weight_unity">' . $weight_options . '</select> |
|
82 | + <a href="#" title="'.__('This is the weight unity the shop will use', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public static function wpshop_options_validate_default_currency($input) { |
@@ -94,30 +94,30 @@ discard block |
||
94 | 94 | $current_piloting = get_option('wpshop_shop_price_piloting', WPSHOP_PRODUCT_PRICE_PILOT); |
95 | 95 | |
96 | 96 | $piloting_options = ''; |
97 | - foreach(self::$wpshop_price_piloting_types as $price_type) { |
|
98 | - $piloting_options .= '<option value="'.$price_type.'"'.(($price_type==$current_piloting) ? ' selected="selected"' : null).'>'.$price_type.'</option>'; |
|
97 | + foreach (self::$wpshop_price_piloting_types as $price_type) { |
|
98 | + $piloting_options .= '<option value="' . $price_type . '"' . (($price_type == $current_piloting) ? ' selected="selected"' : null) . '>' . $price_type . '</option>'; |
|
99 | 99 | } |
100 | - echo '<select name="wpshop_shop_price_piloting">'.$piloting_options.'</select> |
|
101 | - <a href="#" title=\''. __('You can choose if the price you will enter in each product is the "all tax include" price or the "tax free price"','wpshop') .'\' class="wpshop_infobulle_marker">?</a>'; |
|
100 | + echo '<select name="wpshop_shop_price_piloting">' . $piloting_options . '</select> |
|
101 | + <a href="#" title=\''. __('You can choose if the price you will enter in each product is the "all tax include" price or the "tax free price"', 'wpshop') . '\' class="wpshop_infobulle_marker">?</a>'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
105 | 105 | public static function wpshop_ga_account_id_field() { |
106 | 106 | $ga_account_id = get_option('wpshop_ga_account_id'); |
107 | - echo '<input type="text" name="wpshop_ga_account_id" value="'.$ga_account_id.'" />'; |
|
107 | + echo '<input type="text" name="wpshop_ga_account_id" value="' . $ga_account_id . '" />'; |
|
108 | 108 | } |
109 | 109 | |
110 | - public static function wpshop_options_validate_ga_account_id ($input) { |
|
110 | + public static function wpshop_options_validate_ga_account_id($input) { |
|
111 | 111 | return $input; |
112 | 112 | } |
113 | 113 | |
114 | - public static function wpshop_options_validate_default_weight_unity ($input) { |
|
114 | + public static function wpshop_options_validate_default_weight_unity($input) { |
|
115 | 115 | return $input; |
116 | 116 | } |
117 | 117 | public static function wpshop_options_validate_price_piloting($input) { |
118 | 118 | global $wpdb; |
119 | 119 | |
120 | - $price_pilot_attribute_code = constant('WPSHOP_PRODUCT_PRICE_'.$input); |
|
120 | + $price_pilot_attribute_code = constant('WPSHOP_PRODUCT_PRICE_' . $input); |
|
121 | 121 | |
122 | 122 | $query = $wpdb->prepare( |
123 | 123 | "SELECT ATTRIBUTE.code, ATTR_SET_SECTION_DETAILS.id, ATTR_SET_SECTION_DETAILS.attribute_group_id, ATTR_SET_SECTION_DETAILS.position |
@@ -134,23 +134,23 @@ discard block |
||
134 | 134 | |
135 | 135 | $new_def = array(); |
136 | 136 | foreach ($attributes_order as $attribute_group_id => $attribute_price_def) : |
137 | - if ( ($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_TTC) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']) ) { |
|
137 | + if (($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_TTC) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'])) { |
|
138 | 138 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['id'])); |
139 | 139 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['id'])); |
140 | 140 | |
141 | 141 | /** Update entries for quick add and variations */ |
142 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "yes", is_used_in_variation = "yes" WHERE code = "product_price"'); |
|
143 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "yes" WHERE code = "tx_tva"'); |
|
144 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "no", is_used_in_variation = "no" WHERE code = "price_ht"'); |
|
142 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "yes", is_used_in_variation = "yes" WHERE code = "product_price"'); |
|
143 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "yes" WHERE code = "tx_tva"'); |
|
144 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "no", is_used_in_variation = "no" WHERE code = "price_ht"'); |
|
145 | 145 | } |
146 | - elseif ( ($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_HT) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']) ) { |
|
146 | + elseif (($price_pilot_attribute_code == WPSHOP_PRODUCT_PRICE_HT) && (!empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']) && !empty($attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'])) && ($attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position'] > $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position'])) { |
|
147 | 147 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['id'])); |
148 | 148 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE_DETAILS, array('last_update_date' => current_time('mysql', 0), 'position' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_HT]['position']), array('id' => $attribute_price_def[WPSHOP_PRODUCT_PRICE_TTC]['id'])); |
149 | 149 | |
150 | 150 | /** Update entries for quick add and variations */ |
151 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "yes", is_used_in_variation = "yes" WHERE code = "price_ht"'); |
|
152 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "no" WHERE code = "tx_tva"'); |
|
153 | - $wpdb->query('UPDATE ' .WPSHOP_DBT_ATTRIBUTE.' SET is_used_in_quick_add_form = "no", is_used_in_variation = "no" WHERE code = "product_price"'); |
|
151 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "yes", is_used_in_variation = "yes" WHERE code = "price_ht"'); |
|
152 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "no" WHERE code = "tx_tva"'); |
|
153 | + $wpdb->query('UPDATE ' . WPSHOP_DBT_ATTRIBUTE . ' SET is_used_in_quick_add_form = "no", is_used_in_variation = "no" WHERE code = "product_price"'); |
|
154 | 154 | } |
155 | 155 | endforeach; |
156 | 156 | |
@@ -161,37 +161,37 @@ discard block |
||
161 | 161 | public static function wpshop_shop_type() { |
162 | 162 | $shop_types = unserialize(WPSHOP_SHOP_TYPES); |
163 | 163 | $shop_types_options = ''; |
164 | - foreach($shop_types as $type) { |
|
165 | - $shop_types_options .= '<option value="'.$type.'"'.(($type==WPSHOP_DEFINED_SHOP_TYPE) ? ' selected="selected"' : null).'>'.__($type, 'wpshop').'</option>'; |
|
164 | + foreach ($shop_types as $type) { |
|
165 | + $shop_types_options .= '<option value="' . $type . '"' . (($type == WPSHOP_DEFINED_SHOP_TYPE) ? ' selected="selected"' : null) . '>' . __($type, 'wpshop') . '</option>'; |
|
166 | 166 | } |
167 | - echo '<select name="wpshop_shop_type">'.$shop_types_options.'</select><input type="hidden" name="old_wpshop_shop_type" value="'.WPSHOP_DEFINED_SHOP_TYPE.'" /> |
|
168 | - <a href="#" title="'.__('Define if you have a shop to sale item or just for item showing','wpshop').'" class="wpshop_infobulle_marker">?</a>'; |
|
167 | + echo '<select name="wpshop_shop_type">' . $shop_types_options . '</select><input type="hidden" name="old_wpshop_shop_type" value="' . WPSHOP_DEFINED_SHOP_TYPE . '" /> |
|
168 | + <a href="#" title="'.__('Define if you have a shop to sale item or just for item showing', 'wpshop') . '" class="wpshop_infobulle_marker">?</a>'; |
|
169 | 169 | } |
170 | 170 | |
171 | - public static function wpshop_logo_field () { |
|
171 | + public static function wpshop_logo_field() { |
|
172 | 172 | $logo_option = get_option('wpshop_logo'); |
173 | 173 | |
174 | - $output = '<a href="#" id="wps-add-logo-picture" class="wps-bton-first-mini-rounded">' .__( 'Upload your logo', 'wpshop' ). '</a><br/>'; |
|
175 | - $output .= '<img id="wpshop_logo_thumbnail" src="' .( ( !empty($logo_option) ) ? $logo_option : WPSHOP_DEFAULT_CATEGORY_PICTURE ). '" alt="Logo" style="height : 40px; width : auto; border : 5px solid #E8E8E8; margin-top : 8px;" />'; |
|
176 | - $output .= '<input type="hidden" name="wpshop_logo" id="wpshop_logo_field" value="' .$logo_option. '" />'; |
|
177 | - $output .= '<br/><a href="#" id="wps-delete-shop-logo" '.( empty($logo_option) ? 'class="wpshopHide"' : '' ) .'>' . __( 'Delete this logo', 'wpshop' ) . '</a>'; |
|
174 | + $output = '<a href="#" id="wps-add-logo-picture" class="wps-bton-first-mini-rounded">' . __('Upload your logo', 'wpshop') . '</a><br/>'; |
|
175 | + $output .= '<img id="wpshop_logo_thumbnail" src="' . ((!empty($logo_option)) ? $logo_option : WPSHOP_DEFAULT_CATEGORY_PICTURE) . '" alt="Logo" style="height : 40px; width : auto; border : 5px solid #E8E8E8; margin-top : 8px;" />'; |
|
176 | + $output .= '<input type="hidden" name="wpshop_logo" id="wpshop_logo_field" value="' . $logo_option . '" />'; |
|
177 | + $output .= '<br/><a href="#" id="wps-delete-shop-logo" ' . (empty($logo_option) ? 'class="wpshopHide"' : '') . '>' . __('Delete this logo', 'wpshop') . '</a>'; |
|
178 | 178 | |
179 | 179 | echo $output; |
180 | 180 | } |
181 | 181 | |
182 | - public static function wpshop_options_validate_logo ($input) { |
|
182 | + public static function wpshop_options_validate_logo($input) { |
|
183 | 183 | return $input; |
184 | 184 | } |
185 | 185 | |
186 | 186 | public static function wpshop_options_validate_wpshop_shop_type($input) { |
187 | 187 | global $current_db_version; |
188 | 188 | |
189 | - $current_installation_step = get_option( 'wps-installation-current-step', 1 ); |
|
190 | - if ( WPSINSTALLER_STEPS_COUNT <= $current_installation_step || ( !empty( $current_db_version ) && !empty( $current_db_version[ 'db_version' ] ) && ( 51 < $current_db_version[ 'db_version' ] ) ) ) { |
|
189 | + $current_installation_step = get_option('wps-installation-current-step', 1); |
|
190 | + if (WPSINSTALLER_STEPS_COUNT <= $current_installation_step || (!empty($current_db_version) && !empty($current_db_version['db_version']) && (51 < $current_db_version['db_version']))) { |
|
191 | 191 | $current_db_version['installation_state'] = 'completed'; |
192 | 192 | update_option('wpshop_db_options', $current_db_version); |
193 | - if ( $input == 'sale' ) { |
|
194 | - wpshop_install::wpshop_insert_default_pages( $input ); |
|
193 | + if ($input == 'sale') { |
|
194 | + wpshop_install::wpshop_insert_default_pages($input); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | return $input; |
@@ -23,8 +23,8 @@ |
||
23 | 23 | class wpshop_advanced_settings{ |
24 | 24 | |
25 | 25 | /** |
26 | - * |
|
27 | - */ |
|
26 | + * |
|
27 | + */ |
|
28 | 28 | function declare_options(){ |
29 | 29 | add_settings_section('wpshop_extra_options', '<span class="dashicons dashicons-carrot"></span>'.__('Advanced configurations', 'wpshop'), array('wpshop_advanced_settings', 'plugin_section_text'), 'wpshop_extra_options'); |
30 | 30 | register_setting('wpshop_options', 'wpshop_extra_options', array('wpshop_advanced_settings', 'validate_options')); |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | * @package wpshop |
21 | 21 | * @subpackage librairies |
22 | 22 | */ |
23 | -class wpshop_advanced_settings{ |
|
23 | +class wpshop_advanced_settings { |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * |
27 | 27 | */ |
28 | - function declare_options(){ |
|
29 | - add_settings_section('wpshop_extra_options', '<span class="dashicons dashicons-carrot"></span>'.__('Advanced configurations', 'wpshop'), array('wpshop_advanced_settings', 'plugin_section_text'), 'wpshop_extra_options'); |
|
28 | + function declare_options() { |
|
29 | + add_settings_section('wpshop_extra_options', '<span class="dashicons dashicons-carrot"></span>' . __('Advanced configurations', 'wpshop'), array('wpshop_advanced_settings', 'plugin_section_text'), 'wpshop_extra_options'); |
|
30 | 30 | register_setting('wpshop_options', 'wpshop_extra_options', array('wpshop_advanced_settings', 'validate_options')); |
31 | 31 | add_settings_field('wpshop_advanced_settings_field', '', array('wpshop_advanced_settings', 'advanced_settings_field'), 'wpshop_extra_options', 'wpshop_extra_options'); |
32 | 32 | } |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | echo __('This options screen allows you to add functionnalities to the plugin by adding some parameters we defined', 'wpshop'); |
37 | 37 | } |
38 | 38 | |
39 | - public static function validate_options($input){ |
|
39 | + public static function validate_options($input) { |
|
40 | 40 | $new_input = array(); |
41 | - if ( !empty($input['new']) && !empty($input['new']['key']) && !empty($input['new']['value']) ) { |
|
41 | + if (!empty($input['new']) && !empty($input['new']['key']) && !empty($input['new']['value'])) { |
|
42 | 42 | $new_input[$input['new']['key']] = $input['new']['value']; |
43 | 43 | } |
44 | - if ( !empty($input['existing']) ) { |
|
45 | - foreach ( $input['existing'] as $extra_params_to_update ) { |
|
46 | - if ( !empty($extra_params_to_update['key']) && !empty($extra_params_to_update['value']) ) |
|
44 | + if (!empty($input['existing'])) { |
|
45 | + foreach ($input['existing'] as $extra_params_to_update) { |
|
46 | + if (!empty($extra_params_to_update['key']) && !empty($extra_params_to_update['value'])) |
|
47 | 47 | $new_input[$extra_params_to_update['key']] = $extra_params_to_update['value']; |
48 | 48 | } |
49 | 49 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $new_input; |
52 | 52 | } |
53 | 53 | |
54 | - public static function advanced_settings_field($input){ |
|
54 | + public static function advanced_settings_field($input) { |
|
55 | 55 | /* |
56 | 56 | WPSHOP_DEBUG_MODE_ALLOWED_IP |
57 | 57 | WPSHOP_DEBUG_MODE |
@@ -69,16 +69,16 @@ discard block |
||
69 | 69 | <ul>'; |
70 | 70 | $wpshop_advanced_settings = get_option('wpshop_extra_options', array()); |
71 | 71 | |
72 | - if ( !empty($wpshop_advanced_settings) ) { |
|
73 | - $i=0; |
|
72 | + if (!empty($wpshop_advanced_settings)) { |
|
73 | + $i = 0; |
|
74 | 74 | |
75 | - foreach($wpshop_advanced_settings as $setting_name => $setting_value){ |
|
76 | - $advanced_settings_output .= '<li><div class="alignleft wpshop_advanced_options_container" ><p>'.__('Extra parameter key', 'wpshop').'</p>' . wpshop_form::form_input('wpshop_extra_options[existing]['.$i.'][key]', 'wpshop_extra_options_new_key', $setting_name, 'text') . '</div><div class="alignleft wpshop_advanced_options_container" ><p>'.__('Extra parameter value', 'wpshop').'</p>' . wpshop_form::form_input('wpshop_extra_options[existing]['.$i.'][value]', 'wpshop_extra_options_new_value', $setting_value, 'text') . '</div><div class="wpshop_cls" ></div></li>'; |
|
75 | + foreach ($wpshop_advanced_settings as $setting_name => $setting_value) { |
|
76 | + $advanced_settings_output .= '<li><div class="alignleft wpshop_advanced_options_container" ><p>' . __('Extra parameter key', 'wpshop') . '</p>' . wpshop_form::form_input('wpshop_extra_options[existing][' . $i . '][key]', 'wpshop_extra_options_new_key', $setting_name, 'text') . '</div><div class="alignleft wpshop_advanced_options_container" ><p>' . __('Extra parameter value', 'wpshop') . '</p>' . wpshop_form::form_input('wpshop_extra_options[existing][' . $i . '][value]', 'wpshop_extra_options_new_value', $setting_value, 'text') . '</div><div class="wpshop_cls" ></div></li>'; |
|
77 | 77 | $i++; |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - $advanced_settings_output .= '<li><div class="alignleft wpshop_advanced_options_container" ><p>'.__('New extra parameter key', 'wpshop').'</p>' . wpshop_form::form_input('wpshop_extra_options[new][key]', 'wpshop_extra_options_new_key', '', 'text') . '</div><div class="alignleft wpshop_advanced_options_container" ><p>'.__('New extra parameter value', 'wpshop').'</p>' . wpshop_form::form_input('wpshop_extra_options[new][value]', 'wpshop_extra_options_new_value', '', 'text') . '</div><div class="wpshop_cls" ></div></li> |
|
81 | + $advanced_settings_output .= '<li><div class="alignleft wpshop_advanced_options_container" ><p>' . __('New extra parameter key', 'wpshop') . '</p>' . wpshop_form::form_input('wpshop_extra_options[new][key]', 'wpshop_extra_options_new_key', '', 'text') . '</div><div class="alignleft wpshop_advanced_options_container" ><p>' . __('New extra parameter value', 'wpshop') . '</p>' . wpshop_form::form_input('wpshop_extra_options[new][value]', 'wpshop_extra_options_new_value', '', 'text') . '</div><div class="wpshop_cls" ></div></li> |
|
82 | 82 | </ul>'; |
83 | 83 | |
84 | 84 | echo $advanced_settings_output; |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |
@@ -43,8 +45,9 @@ discard block |
||
43 | 45 | } |
44 | 46 | if ( !empty($input['existing']) ) { |
45 | 47 | foreach ( $input['existing'] as $extra_params_to_update ) { |
46 | - if ( !empty($extra_params_to_update['key']) && !empty($extra_params_to_update['value']) ) |
|
47 | - $new_input[$extra_params_to_update['key']] = $extra_params_to_update['value']; |
|
48 | + if ( !empty($extra_params_to_update['key']) && !empty($extra_params_to_update['value']) ) { |
|
49 | + $new_input[$extra_params_to_update['key']] = $extra_params_to_update['value']; |
|
50 | + } |
|
48 | 51 | } |
49 | 52 | } |
50 | 53 |
@@ -1,8 +1,8 @@ discard block |
||
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 | /** |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * Declare options |
27 | 27 | */ |
28 | 28 | public static function declare_options() { |
29 | - add_settings_section('wpshop_pages_option', '<span class="dashicons dashicons-welcome-write-blog"></span>'.__('WPShop pages configuration', 'wpshop'), array('wpshop_page_options', 'plugin_section_text'), 'wpshop_pages_option'); |
|
29 | + add_settings_section('wpshop_pages_option', '<span class="dashicons dashicons-welcome-write-blog"></span>' . __('WPShop pages configuration', 'wpshop'), array('wpshop_page_options', 'plugin_section_text'), 'wpshop_pages_option'); |
|
30 | 30 | |
31 | 31 | /** Get default messages defined into xml files */ |
32 | - $default_pages = new SimpleXMLElement( file_get_contents( WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/assets/datas/default_pages.xml' ) ); |
|
32 | + $default_pages = new SimpleXMLElement(file_get_contents(WP_PLUGIN_DIR . '/' . WPSHOP_PLUGIN_DIR . '/assets/datas/default_pages.xml')); |
|
33 | 33 | /** Read default emails for options creation */ |
34 | - foreach ( $default_pages->xpath( '//pages/page' ) as $page ) { |
|
35 | - if ( ( WPSHOP_DEFINED_SHOP_TYPE == (string)$page->attributes()->shop_type ) || ( 'sale' == WPSHOP_DEFINED_SHOP_TYPE ) ) { |
|
36 | - register_setting( 'wpshop_options', (string)$page->attributes()->code, array( 'wpshop_page_options', 'wpshop_options_validate_wpshop_shop_pages' ) ); |
|
37 | - add_settings_field( (string)$page->attributes()->code, __( (string)$page->description, 'wpshop' ), array( 'wpshop_page_options', 'wps_pages_field' ), 'wpshop_pages_option', 'wpshop_pages_option', array( 'code' => (string)$page->attributes()->code, ) ); |
|
34 | + foreach ($default_pages->xpath('//pages/page') as $page) { |
|
35 | + if ((WPSHOP_DEFINED_SHOP_TYPE == (string)$page->attributes()->shop_type) || ('sale' == WPSHOP_DEFINED_SHOP_TYPE)) { |
|
36 | + register_setting('wpshop_options', (string)$page->attributes()->code, array('wpshop_page_options', 'wpshop_options_validate_wpshop_shop_pages')); |
|
37 | + add_settings_field((string)$page->attributes()->code, __((string)$page->description, 'wpshop'), array('wpshop_page_options', 'wps_pages_field'), 'wpshop_pages_option', 'wpshop_pages_option', array('code' => (string)$page->attributes()->code,)); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
@@ -43,26 +43,26 @@ discard block |
||
43 | 43 | * Common section description |
44 | 44 | */ |
45 | 45 | public static function plugin_section_text() { |
46 | - printf( __( 'We define default pages content and layout, however you have possibility to %sedit them%s', 'wpshop' ), '<a href="' . admin_url( 'edit.php?post_type=page' ) . '" target="_wps_content_customisation" >', '</a>'); |
|
46 | + printf(__('We define default pages content and layout, however you have possibility to %sedit them%s', 'wpshop'), '<a href="' . admin_url('edit.php?post_type=page') . '" target="_wps_content_customisation" >', '</a>'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Shop pages configurations |
51 | 51 | */ |
52 | - public static function wps_pages_field( $args ) { |
|
52 | + public static function wps_pages_field($args) { |
|
53 | 53 | $content = ''; |
54 | 54 | |
55 | - $current_page_id = get_option( $args['code'], '' ); |
|
55 | + $current_page_id = get_option($args['code'], ''); |
|
56 | 56 | $post_list = get_pages(); |
57 | 57 | if (!empty($post_list)) { |
58 | 58 | $content .= '<select name="' . $args['code'] . '" class="chosen_select shop-content-customisation" ><option value="" >' . __('Choose a page to associate', 'wpshop') . '</option>'; |
59 | - $p=1; |
|
59 | + $p = 1; |
|
60 | 60 | $error = false; |
61 | 61 | foreach ($post_list as $post) { |
62 | 62 | $selected = (!empty($current_page_id) && ($current_page_id == $post->ID)) ? ' selected="selected"' : ''; |
63 | - $content .= '<option'.$selected.' value="' . $post->ID . '" >' . $post->post_title . '</option>'; |
|
63 | + $content .= '<option' . $selected . ' value="' . $post->ID . '" >' . $post->post_title . '</option>'; |
|
64 | 64 | } |
65 | - $content .= '</select> <a id="wps-page-' . $current_page_id . '" title="' . __( 'Edit current selected page', 'wpshop' ) . '" href="' . admin_url( 'post.php?post=' . $current_page_id . '&action=edit' ) . '" target="_wps_content_customisation" class="shop-content-customisation shop-content-customisation-page dashicons dashicons-edit"></a>'; |
|
65 | + $content .= '</select> <a id="wps-page-' . $current_page_id . '" title="' . __('Edit current selected page', 'wpshop') . '" href="' . admin_url('post.php?post=' . $current_page_id . '&action=edit') . '" target="_wps_content_customisation" class="shop-content-customisation shop-content-customisation-page dashicons dashicons-edit"></a>'; |
|
66 | 66 | } |
67 | 67 | wp_reset_query(); |
68 | 68 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if ( !defined( 'ABSPATH' ) ) { |
|
2 | + exit; |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /* Check if file is include. No direct access possible with file url */ |
4 | 6 | if ( !defined( 'WPSHOP_VERSION' ) ) { |