@@ -1,30 +1,30 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | define('ABSPATH', dirname(dirname(dirname(dirname(dirname(__FILE__))))) . DIRECTORY_SEPARATOR); |
3 | - define('WP_PLUGIN_DIR', dirname(dirname(dirname(__FILE__))) ); |
|
3 | + define('WP_PLUGIN_DIR', dirname(dirname(dirname(__FILE__)))); |
|
4 | 4 | define('WP_LANG_DIR', 'FR'); |
5 | 5 | define('WP_CONTENT_DIR', 'wp-content'); |
6 | 6 | |
7 | - function __( $str ) |
|
7 | + function __($str) |
|
8 | 8 | { |
9 | 9 | $translate = "Result Testing text"; |
10 | 10 | echo "[+] Requesting __ -> " . $str . PHP_EOL; |
11 | 11 | return $translate; |
12 | 12 | } |
13 | 13 | |
14 | - function add_action( $init, $object ) |
|
14 | + function add_action($init, $object) |
|
15 | 15 | { |
16 | 16 | $length = 0; |
17 | 17 | $hooked = ""; |
18 | 18 | $oType = gettype($object); |
19 | - if($oType == "object" || $oType == "array") |
|
19 | + if ($oType == "object" || $oType == "array") |
|
20 | 20 | { |
21 | 21 | $hooked = "["; |
22 | - foreach($object as $hook) |
|
22 | + foreach ($object as $hook) |
|
23 | 23 | { |
24 | 24 | $length++; |
25 | 25 | $type = gettype($hook); |
26 | 26 | |
27 | - switch($type) |
|
27 | + switch ($type) |
|
28 | 28 | { |
29 | 29 | case "integer": |
30 | 30 | case "boolean": |
@@ -37,27 +37,27 @@ discard block |
||
37 | 37 | break; |
38 | 38 | } |
39 | 39 | } |
40 | - if($length > 0) $hooked = rtrim($hooked, ","); |
|
40 | + if ($length > 0) $hooked = rtrim($hooked, ","); |
|
41 | 41 | $hooked .= "]"; |
42 | 42 | } |
43 | 43 | else $hooked .= $object; |
44 | 44 | echo "[+] Adding action -> " . $init . " in " . $hooked . PHP_EOL; |
45 | 45 | } |
46 | 46 | |
47 | - function register_activation_hook( $file , $object ) |
|
47 | + function register_activation_hook($file, $object) |
|
48 | 48 | { |
49 | 49 | $length = 0; |
50 | 50 | $hooked = ""; |
51 | 51 | $oType = gettype($object); |
52 | - if($oType == "object" || $oType == "array") |
|
52 | + if ($oType == "object" || $oType == "array") |
|
53 | 53 | { |
54 | 54 | $hooked = "["; |
55 | - foreach($object as $hook) |
|
55 | + foreach ($object as $hook) |
|
56 | 56 | { |
57 | 57 | $length++; |
58 | 58 | $type = gettype($hook); |
59 | 59 | |
60 | - switch($type) |
|
60 | + switch ($type) |
|
61 | 61 | { |
62 | 62 | case "integer": |
63 | 63 | case "boolean": |
@@ -70,27 +70,27 @@ discard block |
||
70 | 70 | break; |
71 | 71 | } |
72 | 72 | } |
73 | - if($length > 0) $hooked = rtrim($hooked, ","); |
|
73 | + if ($length > 0) $hooked = rtrim($hooked, ","); |
|
74 | 74 | $hooked .= "]"; |
75 | 75 | } |
76 | 76 | else $hooked .= $object; |
77 | 77 | echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL; |
78 | 78 | } |
79 | 79 | |
80 | - function register_deactivation_hook( $file , $object ) |
|
80 | + function register_deactivation_hook($file, $object) |
|
81 | 81 | { |
82 | 82 | $length = 0; |
83 | 83 | $hooked = ""; |
84 | 84 | $oType = gettype($object); |
85 | - if($oType == "object" || $oType == "array") |
|
85 | + if ($oType == "object" || $oType == "array") |
|
86 | 86 | { |
87 | 87 | $hooked = "["; |
88 | - foreach($object as $hook) |
|
88 | + foreach ($object as $hook) |
|
89 | 89 | { |
90 | 90 | $length++; |
91 | 91 | $type = gettype($hook); |
92 | 92 | |
93 | - switch($type) |
|
93 | + switch ($type) |
|
94 | 94 | { |
95 | 95 | case "integer": |
96 | 96 | case "boolean": |
@@ -103,29 +103,29 @@ discard block |
||
103 | 103 | break; |
104 | 104 | } |
105 | 105 | } |
106 | - if($length > 0) $hooked = rtrim($hooked, ","); |
|
106 | + if ($length > 0) $hooked = rtrim($hooked, ","); |
|
107 | 107 | $hooked .= "]"; |
108 | 108 | } |
109 | 109 | else $hooked .= $object; |
110 | 110 | echo "[+] Registering actiovation hook -> " . $file . " in " . $hooked . PHP_EOL; |
111 | 111 | } |
112 | 112 | |
113 | - function add_filter( $name, $fn, $nbr = "") |
|
113 | + function add_filter($name, $fn, $nbr = "") |
|
114 | 114 | { |
115 | 115 | echo "[+] Adding filter -> " . $name . " X" . $nbr . PHP_EOL; |
116 | 116 | } |
117 | 117 | |
118 | - function add_shortcode( $name ) |
|
118 | + function add_shortcode($name) |
|
119 | 119 | { |
120 | 120 | echo "[+] Adding shortcode -> " . $name . PHP_EOL; |
121 | 121 | } |
122 | 122 | |
123 | - function add_option( $name, $conf) |
|
123 | + function add_option($name, $conf) |
|
124 | 124 | { |
125 | 125 | echo "[+] Adding option -> " . $name . " conf:" . $conf . PHP_EOL; |
126 | 126 | } |
127 | 127 | |
128 | - function update_option( $name, $conf) |
|
128 | + function update_option($name, $conf) |
|
129 | 129 | { |
130 | 130 | echo "[+] Updating option -> " . $name . " conf:" . $conf . PHP_EOL; |
131 | 131 | } |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | function plugin_dir_path($path) |
154 | 154 | { |
155 | 155 | echo "[+] Plugin path -> " . $path . PHP_EOL; |
156 | - return trailingslashit( dirname( $path ) ); |
|
156 | + return trailingslashit(dirname($path)); |
|
157 | 157 | } |
158 | 158 | |
159 | - function trailingslashit( $string ) |
|
159 | + function trailingslashit($string) |
|
160 | 160 | { |
161 | - return untrailingslashit( $string ) . '/'; |
|
161 | + return untrailingslashit($string) . '/'; |
|
162 | 162 | } |
163 | 163 | |
164 | - function untrailingslashit( $string ) |
|
164 | + function untrailingslashit($string) |
|
165 | 165 | { |
166 | - return rtrim( $string, '/\\' ); |
|
166 | + return rtrim($string, '/\\'); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | function site_url() |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | return $dir; |
216 | 216 | } |
217 | 217 | |
218 | - function add_theme_support( $theme ) |
|
218 | + function add_theme_support($theme) |
|
219 | 219 | { |
220 | 220 | echo "[+] Adding theme support -> " . $theme . PHP_EOL; |
221 | 221 | } |
222 | 222 | |
223 | - function add_image_size( $image, $x, $y, $bool ) |
|
223 | + function add_image_size($image, $x, $y, $bool) |
|
224 | 224 | { |
225 | 225 | echo "[+] Adding image size -> " . $image . " x:" . $x . " y:" . $y . " bool:" . $bool . PHP_EOL; |
226 | 226 | } |
@@ -232,24 +232,24 @@ discard block |
||
232 | 232 | return $lang; |
233 | 233 | } |
234 | 234 | |
235 | - function load_plugin_textdomain( $name, $bool, $dir) |
|
235 | + function load_plugin_textdomain($name, $bool, $dir) |
|
236 | 236 | { |
237 | 237 | echo "[+] Loading plugin textdomain -> " . $name . " bool:" . $bool . " dir:" . $dir . PHP_EOL; |
238 | 238 | } |
239 | 239 | |
240 | - function get_option( $name, $int = 0 ) |
|
240 | + function get_option($name, $int = 0) |
|
241 | 241 | { |
242 | 242 | echo "[+] Getting option -> " . $name . " int:" . $int . PHP_EOL; |
243 | 243 | return ""; |
244 | 244 | } |
245 | 245 | |
246 | - function get_site_option( $name, $int = 0 ) |
|
246 | + function get_site_option($name, $int = 0) |
|
247 | 247 | { |
248 | 248 | echo "[+] Getting site option -> " . $name . " int:" . $int . PHP_EOL; |
249 | 249 | return ""; |
250 | 250 | } |
251 | 251 | |
252 | - function current_time( $str ) |
|
252 | + function current_time($str) |
|
253 | 253 | { |
254 | 254 | $time = " 2005-08-05 10:41:13"; |
255 | 255 | echo "[+] Requesting current_time -> " . $str . PHP_EOL; |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | |
259 | 259 | class WPDB |
260 | 260 | { |
261 | - function prepare( $request = "" ) |
|
261 | + function prepare($request = "") |
|
262 | 262 | { |
263 | 263 | echo "[+] Preparing -> " . $request . PHP_EOL; |
264 | 264 | } |
265 | 265 | |
266 | - public static function get_var( $request = "" ) |
|
266 | + public static function get_var($request = "") |
|
267 | 267 | { |
268 | 268 | echo "[+] Requesting get var -> " . $request . PHP_EOL; |
269 | 269 | } |
270 | 270 | |
271 | - public static function get_charset_collate( $request = "" ) |
|
271 | + public static function get_charset_collate($request = "") |
|
272 | 272 | { |
273 | 273 | echo "[+] Requesting get charset collate -> " . $request . PHP_EOL; |
274 | 274 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | $unitList = searchFiles('.' . DIRECTORY_SEPARATOR, END_TEST); |
11 | 11 | |
12 | 12 | // Loop on unitList |
13 | -foreach($unitList as $test) |
|
13 | +foreach ($unitList as $test) |
|
14 | 14 | { |
15 | 15 | echo "[+] Testing -> " . $test . PHP_EOL; |
16 | 16 | include($test); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $ite = new RecursiveIteratorIterator($dir); |
29 | 29 | $files = new RegexIterator($ite, $pattern, RegexIterator::GET_MATCH); |
30 | 30 | $fileList = array(); |
31 | - foreach($files as $file) |
|
31 | + foreach ($files as $file) |
|
32 | 32 | { |
33 | 33 | $fileList[] = $file[0]; |
34 | 34 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | 2 | /** |
3 | 3 | * Define utilities to manage entities |
4 | 4 | * |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | /* |
12 | 12 | * Check if file is include. No direct access possible with file url |
13 | 13 | */ |
14 | -if ( !defined( 'WPSHOP_VERSION' ) ) { |
|
15 | - die( __('Access is not allowed by this way', 'wpshop') ); |
|
14 | +if (!defined('WPSHOP_VERSION')) { |
|
15 | + die(__('Access is not allowed by this way', 'wpshop')); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | /** |
@@ -31,20 +31,20 @@ discard block |
||
31 | 31 | public static function create_wpshop_entities_type() { |
32 | 32 | register_post_type(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, array( |
33 | 33 | 'labels' => array( |
34 | - 'name' => __( 'Entities', 'wpshop' ), |
|
35 | - 'singular_name' => __( 'Entity', 'wpshop' ), |
|
36 | - 'add_new_item' => __( 'Add new entity', 'wpshop' ), |
|
37 | - 'add_new' => __( 'Add new entity', 'wpshop' ), |
|
38 | - 'add_new_item' => __( 'Add new entity', 'wpshop' ), |
|
39 | - 'edit_item' => __( 'Edit entity', 'wpshop' ), |
|
40 | - 'new_item' => __( 'New entity', 'wpshop' ), |
|
41 | - 'view_item' => __( 'View entity', 'wpshop' ), |
|
42 | - 'search_items' => __( 'Search entities', 'wpshop' ), |
|
43 | - 'not_found' => __( 'No entities found', 'wpshop' ), |
|
44 | - 'not_found_in_trash' => __( 'No entities found in Trash', 'wpshop' ), |
|
34 | + 'name' => __('Entities', 'wpshop'), |
|
35 | + 'singular_name' => __('Entity', 'wpshop'), |
|
36 | + 'add_new_item' => __('Add new entity', 'wpshop'), |
|
37 | + 'add_new' => __('Add new entity', 'wpshop'), |
|
38 | + 'add_new_item' => __('Add new entity', 'wpshop'), |
|
39 | + 'edit_item' => __('Edit entity', 'wpshop'), |
|
40 | + 'new_item' => __('New entity', 'wpshop'), |
|
41 | + 'view_item' => __('View entity', 'wpshop'), |
|
42 | + 'search_items' => __('Search entities', 'wpshop'), |
|
43 | + 'not_found' => __('No entities found', 'wpshop'), |
|
44 | + 'not_found_in_trash' => __('No entities found in Trash', 'wpshop'), |
|
45 | 45 | 'parent_item_colon' => '', |
46 | 46 | ), |
47 | - 'supports' => array( 'title', 'editor', 'page-attributes' ), |
|
47 | + 'supports' => array('title', 'editor', 'page-attributes'), |
|
48 | 48 | 'public' => true, |
49 | 49 | 'has_archive' => true, |
50 | 50 | 'publicly_queryable' => false, |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | /** Metabox allowgin to choose a custome rewrite for an entiy */ |
75 | 75 | add_meta_box(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES . '_rewrite', __('Rewrite for entity', 'wpshop'), array('wpshop_entities', 'wpshop_entity_rewrite'), WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, 'normal', 'high'); |
76 | 76 | |
77 | - if ( !in_array( $post->post_name, unserialize( WPSHOP_DEFAULT_CUSTOM_TYPES ) ) ) { |
|
77 | + if (!in_array($post->post_name, unserialize(WPSHOP_DEFAULT_CUSTOM_TYPES))) { |
|
78 | 78 | /** Display or not address in admin menu */ |
79 | 79 | add_meta_box(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES . '_admin_menu_display', __('Display in admin menu', 'wpshop'), array('wpshop_entities', 'wpshop_display_entity_in_admin_menu'), WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, 'side', 'low'); |
80 | 80 | } |
81 | 81 | |
82 | 82 | /** Join address to entity */ |
83 | - if ( !in_array( $post->post_name, array( WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS ) ) ) { |
|
83 | + if (!in_array($post->post_name, array(WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS))) { |
|
84 | 84 | add_meta_box(WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES . '_join_address_to_entity', __('Join Address to this entity', 'wpshop'), array('wpshop_entities', 'wpshop_join_address_to_entity'), WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, 'side', 'low'); |
85 | 85 | } |
86 | 86 | } |
@@ -90,24 +90,24 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param object $post The entity type being edited |
92 | 92 | */ |
93 | - public static function wpshop_entity_support_section( $entity ) { |
|
93 | + public static function wpshop_entity_support_section($entity) { |
|
94 | 94 | $output = ''; |
95 | 95 | $support_list = unserialize(WPSHOP_REGISTER_POST_TYPE_SUPPORT); |
96 | 96 | |
97 | 97 | $current_entity_params = get_post_meta($entity->ID, '_wpshop_entity_params', true); |
98 | 98 | |
99 | - unset($input_def);$input_def=array(); |
|
99 | + unset($input_def); $input_def = array(); |
|
100 | 100 | $input_def['type'] = 'checkbox'; |
101 | 101 | |
102 | - foreach ( $support_list as $support ) { |
|
102 | + foreach ($support_list as $support) { |
|
103 | 103 | $input_def['id'] = 'wpshop_entity_support'; |
104 | 104 | $input_def['name'] = $support; |
105 | 105 | $input_def['possible_value'] = array($support); |
106 | - if ( !empty($current_entity_params['support']) && in_array($support, $current_entity_params['support']) ) { |
|
106 | + if (!empty($current_entity_params['support']) && in_array($support, $current_entity_params['support'])) { |
|
107 | 107 | $input_def['value'] = $support; |
108 | 108 | } |
109 | 109 | |
110 | - $output .= '<p class="wpshop_entities_support_type wpshop_entities_support_type_' . $support . '" >' . wpshop_form::check_input_type($input_def, 'wpshop_entity_support') . ' <label for="'.$input_def['id'].'_'.$support.'">' . __($support, 'wpshop') . '</label></p>'; |
|
110 | + $output .= '<p class="wpshop_entities_support_type wpshop_entities_support_type_' . $support . '" >' . wpshop_form::check_input_type($input_def, 'wpshop_entity_support') . ' <label for="' . $input_def['id'] . '_' . $support . '">' . __($support, 'wpshop') . '</label></p>'; |
|
111 | 111 | } |
112 | 112 | $output .= '<p class="wpshop_cls" ></p>'; |
113 | 113 | |
@@ -119,32 +119,32 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @param unknown_type $entity |
121 | 121 | */ |
122 | - public static function wpshop_entity_rewrite( $entity ) { |
|
122 | + public static function wpshop_entity_rewrite($entity) { |
|
123 | 123 | $output = ''; |
124 | 124 | |
125 | 125 | $current_entity_params = get_post_meta($entity->ID, '_wpshop_entity_params', true); |
126 | 126 | |
127 | - unset($input_def);$input_def=array(); |
|
127 | + unset($input_def); $input_def = array(); |
|
128 | 128 | $input_def['type'] = 'text'; |
129 | 129 | $input_def['id'] = 'wpshop_entity_rewrite'; |
130 | 130 | $input_def['name'] = 'wpshop_entity_rewrite[slug]'; |
131 | - $input_def['value'] = (!empty($current_entity_params['rewrite']['slug']) ? $current_entity_params['rewrite']['slug'] :''); |
|
131 | + $input_def['value'] = (!empty($current_entity_params['rewrite']['slug']) ? $current_entity_params['rewrite']['slug'] : ''); |
|
132 | 132 | |
133 | - $output .= '<p><label for="'.$input_def['id'].'">' . __('Choose how this entity will be rewrite in front side. If you let it empty default will be taken', 'wpshop') . '</label><br/>' . wpshop_form::check_input_type($input_def) . '</p>'; |
|
133 | + $output .= '<p><label for="' . $input_def['id'] . '">' . __('Choose how this entity will be rewrite in front side. If you let it empty default will be taken', 'wpshop') . '</label><br/>' . wpshop_form::check_input_type($input_def) . '</p>'; |
|
134 | 134 | |
135 | 135 | echo $output; |
136 | 136 | } |
137 | 137 | |
138 | 138 | public static function wpshop_display_entity_in_admin_menu() { |
139 | 139 | $checked = ''; |
140 | - if ( !empty($_GET['post']) ) { |
|
140 | + if (!empty($_GET['post'])) { |
|
141 | 141 | $current_entity_params = get_post_meta(wpshop_tools::varSanitizer($_GET['post']), '_wpshop_entity_params', true); |
142 | 142 | |
143 | - if ( !empty($current_entity_params['display_admin_menu']) ) { |
|
143 | + if (!empty($current_entity_params['display_admin_menu'])) { |
|
144 | 144 | $checked = 'checked ="checked"'; |
145 | 145 | } |
146 | 146 | } |
147 | - $output = '<input type="checkbox" id="wpshop_display_in_admin_menu" name="wpshop_display_in_admin_menu" ' .$checked. '/><label for="wpshop_display_in_admin_menu"> '.__('Display in admin menu', 'wpshop').'</label>'; |
|
147 | + $output = '<input type="checkbox" id="wpshop_display_in_admin_menu" name="wpshop_display_in_admin_menu" ' . $checked . '/><label for="wpshop_display_in_admin_menu"> ' . __('Display in admin menu', 'wpshop') . '</label>'; |
|
148 | 148 | echo $output; |
149 | 149 | } |
150 | 150 | |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | * Save custom information for entity type |
153 | 153 | */ |
154 | 154 | public static function save_entity_type_custom_informations() { |
155 | - $post_id = !empty($_POST['post_ID']) ? intval( wpshop_tools::varSanitizer($_POST['post_ID']) ) : null; |
|
155 | + $post_id = !empty($_POST['post_ID']) ? intval(wpshop_tools::varSanitizer($_POST['post_ID'])) : null; |
|
156 | 156 | $post_support = !empty($_POST['wpshop_entity_support']) ? $_POST['wpshop_entity_support'] : null; |
157 | 157 | $wpshop_entity_rewrite = !empty($_POST['wpshop_entity_rewrite']) ? $_POST['wpshop_entity_rewrite'] : null; |
158 | 158 | $wpshop_entity_display_menu = !empty($_POST['wpshop_display_in_admin_menu']) ? $_POST['wpshop_display_in_admin_menu'] : null; |
159 | 159 | |
160 | - if ( !empty ($_POST['address_type']) ) { |
|
160 | + if (!empty ($_POST['address_type'])) { |
|
161 | 161 | $save_array = array(); |
162 | - foreach ( $_POST['address_type'] as $key=>$value ) { |
|
163 | - $save_array[] = intval( wpshop_tools::varSanitizer($value) ); |
|
162 | + foreach ($_POST['address_type'] as $key=>$value) { |
|
163 | + $save_array[] = intval(wpshop_tools::varSanitizer($value)); |
|
164 | 164 | } |
165 | - update_post_meta( $post_id, '_wpshop_entity_attached_address', $save_array ); |
|
165 | + update_post_meta($post_id, '_wpshop_entity_attached_address', $save_array); |
|
166 | 166 | } |
167 | 167 | |
168 | - if ( get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES ) { |
|
168 | + if (get_post_type($post_id) == WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) { |
|
169 | 169 | update_post_meta($post_id, '_wpshop_entity_params', array('support' => $post_support, 'rewrite' => $wpshop_entity_rewrite, 'display_admin_menu'=>$wpshop_entity_display_menu)); |
170 | 170 | flush_rewrite_rules(); |
171 | 171 | } |
@@ -174,19 +174,19 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * Permite to join one or several address to an entity |
176 | 176 | */ |
177 | - public static function wpshop_join_address_to_entity () { |
|
177 | + public static function wpshop_join_address_to_entity() { |
|
178 | 178 | global $wpdb; |
179 | 179 | // Select the id of the entity address |
180 | - $query = $wpdb->prepare('SELECT id FROM ' .$wpdb->posts. ' WHERE post_type = %s AND post_name = %s', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS); |
|
181 | - $entity_id = $wpdb->get_var( $query ); |
|
180 | + $query = $wpdb->prepare('SELECT id FROM ' . $wpdb->posts . ' WHERE post_type = %s AND post_name = %s', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS); |
|
181 | + $entity_id = $wpdb->get_var($query); |
|
182 | 182 | //Get the Post_meta |
183 | - $attached_address_values = get_post_meta( intval(wpshop_tools::varSanitizer( (!empty($_GET['post']) ? $_GET['post'] : '') )), '_wpshop_entity_attached_address', true ); |
|
183 | + $attached_address_values = get_post_meta(intval(wpshop_tools::varSanitizer((!empty($_GET['post']) ? $_GET['post'] : ''))), '_wpshop_entity_attached_address', true); |
|
184 | 184 | //Select and Display all addresses type |
185 | - $query = $wpdb->prepare('SELECT * FROM ' .WPSHOP_DBT_ATTRIBUTE_SET. ' WHERE entity_id = %d', $entity_id); |
|
186 | - $addresses = $wpdb->get_results( $query); |
|
185 | + $query = $wpdb->prepare('SELECT * FROM ' . WPSHOP_DBT_ATTRIBUTE_SET . ' WHERE entity_id = %d', $entity_id); |
|
186 | + $addresses = $wpdb->get_results($query); |
|
187 | 187 | $output = ''; |
188 | - foreach ( $addresses as $address ) { |
|
189 | - $output .= '<p><input type="checkbox" id="' .$address->name.'_'.$address->id.'" name="address_type[' .$address->name. ']" value="'.$address->id.'" ' .( ( !empty($attached_address_values) && in_array( $address->id, $attached_address_values) ) ? 'checked="checked"' : '' ). ' /> <label for="' .$address->name.'_'.$address->id.'">'.$address->name.'</label></p>'; |
|
188 | + foreach ($addresses as $address) { |
|
189 | + $output .= '<p><input type="checkbox" id="' . $address->name . '_' . $address->id . '" name="address_type[' . $address->name . ']" value="' . $address->id . '" ' . ((!empty($attached_address_values) && in_array($address->id, $attached_address_values)) ? 'checked="checked"' : '') . ' /> <label for="' . $address->name . '_' . $address->id . '">' . $address->name . '</label></p>'; |
|
190 | 190 | } |
191 | 191 | echo $output; |
192 | 192 | } |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | /* |
207 | 207 | * Read the entity list for custom type declaration |
208 | 208 | */ |
209 | - if ( !empty($entities) ) { |
|
210 | - foreach ( $entities as $entity ) { |
|
211 | - $wpshop_builtin_types = unserialize( WPSHOP_DEFAULT_CUSTOM_TYPES ); |
|
212 | - if ( !empty( $entity->post_name ) && !in_array( $entity->post_name, $wpshop_builtin_types ) ) { |
|
209 | + if (!empty($entities)) { |
|
210 | + foreach ($entities as $entity) { |
|
211 | + $wpshop_builtin_types = unserialize(WPSHOP_DEFAULT_CUSTOM_TYPES); |
|
212 | + if (!empty($entity->post_name) && !in_array($entity->post_name, $wpshop_builtin_types)) { |
|
213 | 213 | $current_entity_params = get_post_meta($entity->ID, '_wpshop_entity_params', true); |
214 | - if ( !empty($current_entity_params['display_admin_menu']) ) { |
|
214 | + if (!empty($current_entity_params['display_admin_menu'])) { |
|
215 | 215 | $show_in_menu = WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES; |
216 | 216 | } |
217 | 217 | else { |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | } |
220 | 220 | $post_type_params = array( |
221 | 221 | 'labels' => array( |
222 | - 'name' => __( $entity->post_title , 'wpshop' ), |
|
223 | - 'singular_name' => __( $entity->post_title, 'wpshop' ), |
|
224 | - 'add_new_item' => sprintf( __( 'Add new %s', 'wpshop' ), $entity->post_title), |
|
225 | - 'add_new' => sprintf( __( 'Add new %s', 'wpshop' ), $entity->post_title), |
|
226 | - 'add_new_item' => sprintf( __( 'Add new %s', 'wpshop' ), $entity->post_title), |
|
227 | - 'edit_item' => sprintf( __( 'Edit %s', 'wpshop' ), $entity->post_title), |
|
228 | - 'new_item' => sprintf( __( 'New %s', 'wpshop' ), $entity->post_title), |
|
229 | - 'view_item' => sprintf( __( 'View %s', 'wpshop' ), $entity->post_title), |
|
230 | - 'search_items' => sprintf( __( 'Search %s', 'wpshop' ), $entity->post_title), |
|
231 | - 'not_found' => sprintf( __( 'No %s found', 'wpshop' ), $entity->post_title), |
|
232 | - 'not_found_in_trash' => sprintf( __( 'No %s found in Trash', 'wpshop' ), $entity->post_title), |
|
222 | + 'name' => __($entity->post_title, 'wpshop'), |
|
223 | + 'singular_name' => __($entity->post_title, 'wpshop'), |
|
224 | + 'add_new_item' => sprintf(__('Add new %s', 'wpshop'), $entity->post_title), |
|
225 | + 'add_new' => sprintf(__('Add new %s', 'wpshop'), $entity->post_title), |
|
226 | + 'add_new_item' => sprintf(__('Add new %s', 'wpshop'), $entity->post_title), |
|
227 | + 'edit_item' => sprintf(__('Edit %s', 'wpshop'), $entity->post_title), |
|
228 | + 'new_item' => sprintf(__('New %s', 'wpshop'), $entity->post_title), |
|
229 | + 'view_item' => sprintf(__('View %s', 'wpshop'), $entity->post_title), |
|
230 | + 'search_items' => sprintf(__('Search %s', 'wpshop'), $entity->post_title), |
|
231 | + 'not_found' => sprintf(__('No %s found', 'wpshop'), $entity->post_title), |
|
232 | + 'not_found_in_trash' => sprintf(__('No %s found in Trash', 'wpshop'), $entity->post_title), |
|
233 | 233 | 'parent_item_colon' => '', |
234 | 234 | ), |
235 | 235 | 'description' => $entity->post_content, |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | 'rewrite' => !empty($current_entity_params['rewrite']) ? $current_entity_params['rewrite'] : array(), |
244 | 244 | 'hierarchical' => true, |
245 | 245 | ); |
246 | - register_post_type($entity->post_name, $post_type_params ); |
|
246 | + register_post_type($entity->post_name, $post_type_params); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** Add basic metabox */ |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | } |
256 | 256 | |
257 | - add_filter( 'map_meta_cap', array('wpshop_entities', 'map_meta_cap'), 10, 4 ); |
|
257 | + add_filter('map_meta_cap', array('wpshop_entities', 'map_meta_cap'), 10, 4); |
|
258 | 258 | /* |
259 | 259 | * Reset query for security reasons |
260 | 260 | */ |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | * @param integer $user_id |
270 | 270 | * @param array $args |
271 | 271 | */ |
272 | - public static function map_meta_cap( $caps, $cap, $user_id, $args ) { |
|
273 | - if ( !empty($args) ) { |
|
272 | + public static function map_meta_cap($caps, $cap, $user_id, $args) { |
|
273 | + if (!empty($args)) { |
|
274 | 274 | $post = get_post($args[0]); |
275 | - if ( false && !empty($post) && is_object($post) && ($post->post_type == WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) && (($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) || ($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) || ($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS)) && ($cap == 'delete_product') ) { |
|
275 | + if (false && !empty($post) && is_object($post) && ($post->post_type == WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES) && (($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) || ($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) || ($post->post_name == WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS)) && ($cap == 'delete_product')) { |
|
276 | 276 | $caps = 'wpshop_view_dashboard'; |
277 | 277 | } |
278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /** |
285 | 285 | * Add metaboxes to the custom post types defined by entities |
286 | 286 | */ |
287 | - public static function add_meta_boxes_to_custom_types( $post ) { |
|
287 | + public static function add_meta_boxes_to_custom_types($post) { |
|
288 | 288 | global $post, |
289 | 289 | $wpdb; |
290 | 290 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | /* |
300 | 300 | * Product are managed from another place |
301 | 301 | */ |
302 | - if ( $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT ) { |
|
302 | + if ($post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) { |
|
303 | 303 | /* |
304 | 304 | * Get the attribute set list for current entity |
305 | 305 | */ |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | */ |
311 | 311 | $attribute_set_id = get_post_meta($post->ID, sprintf(WPSHOP_ATTRIBUTE_SET_ID_META_KEY, $post->post_type), true); |
312 | 312 | |
313 | - if(((count($attribute_set_list) == 1) || ((count($attribute_set_list) > 1) && !empty($attribute_set_id)))){ |
|
314 | - if((count($attribute_set_list) == 1) || empty($attribute_set_id)){ |
|
313 | + if (((count($attribute_set_list) == 1) || ((count($attribute_set_list) > 1) && !empty($attribute_set_id)))) { |
|
314 | + if ((count($attribute_set_list) == 1) || empty($attribute_set_id)) { |
|
315 | 315 | $attribute_set_id = $attribute_set_list[0]->id; |
316 | 316 | } |
317 | 317 | |
@@ -324,28 +324,28 @@ discard block |
||
324 | 324 | /* |
325 | 325 | * Read the different element for building output for current entity |
326 | 326 | */ |
327 | - if ( !empty($currentTabContent['box']) && is_array($currentTabContent['box']) ) { |
|
327 | + if (!empty($currentTabContent['box']) && is_array($currentTabContent['box'])) { |
|
328 | 328 | foreach ($currentTabContent['box'] as $boxIdentifier => $boxTitle) { |
329 | - if (!empty($currentTabContent['box'][$boxIdentifier.'_backend_display_type']) &&( $currentTabContent['box'][$boxIdentifier.'_backend_display_type']=='movable-tab')) { |
|
329 | + if (!empty($currentTabContent['box'][$boxIdentifier . '_backend_display_type']) && ($currentTabContent['box'][$boxIdentifier . '_backend_display_type'] == 'movable-tab')) { |
|
330 | 330 | add_meta_box($post->post_type . '_' . $boxIdentifier, __($boxTitle, 'wpshop'), array('wpshop_entities', 'meta_box_content'), $post->post_type, 'normal', 'default', array('currentTabContent' => $currentTabContent['boxContent'][$boxIdentifier])); |
331 | 331 | } |
332 | 332 | else $fixed_box_exist = true; |
333 | 333 | } |
334 | 334 | } |
335 | - if ($fixed_box_exist && $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS ) { |
|
335 | + if ($fixed_box_exist && $post->post_type != WPSHOP_NEWTYPE_IDENTIFIER_CUSTOMERS) { |
|
336 | 336 | add_meta_box($post->post_type . '_fixed_tab', __('Informations', 'wpshop'), array('wpshop_entities', 'meta_box_content_datas'), $post->post_type, 'normal', 'high', array('currentTabContent' => $currentTabContent)); |
337 | 337 | } |
338 | 338 | } |
339 | 339 | elseif (count($attribute_set_list) > 1) { |
340 | - $input_def['id'] = $post->post_type.'_attribute_set_id'; |
|
341 | - $input_def['name'] = $post->post_type.'_attribute_set_id'; |
|
340 | + $input_def['id'] = $post->post_type . '_attribute_set_id'; |
|
341 | + $input_def['name'] = $post->post_type . '_attribute_set_id'; |
|
342 | 342 | $input_def['value'] = ''; |
343 | 343 | $input_def['type'] = 'select'; |
344 | 344 | $input_def['possible_value'] = $attribute_set_list; |
345 | 345 | |
346 | 346 | $input_def['value'] = ''; |
347 | 347 | foreach ($attribute_set_list as $set) { |
348 | - if( $set->default_set == 'yes' ) { |
|
348 | + if ($set->default_set == 'yes') { |
|
349 | 349 | $input_def['value'] = $set->id; |
350 | 350 | } |
351 | 351 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | $currentTabContent = ' |
354 | 354 | <ul class="attribute_set_selector" > |
355 | 355 | <li class="attribute_set_selector_title_select" ><label for="title" >' . sprintf(__('Choose a title for the %s', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))) . '</label></li> |
356 | - <li class="attribute_set_selector_group_selector" ><label for="' . $input_def['id'] . '" >' . sprintf(__('Choose an attribute group for this %s', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))) . '</label> '.wpshop_form::check_input_type($input_def).'</li> |
|
356 | + <li class="attribute_set_selector_group_selector" ><label for="' . $input_def['id'] . '" >' . sprintf(__('Choose an attribute group for this %s', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))) . '</label> ' . wpshop_form::check_input_type($input_def) . '</li> |
|
357 | 357 | <li class="attribute_set_selector_save_instruction" >' . sprintf(__('Save the %s with the "Save draft" button on the right side', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))) . '</li> |
358 | 358 | <li class="attribute_set_selector_after_save_instruction" >' . __('Once the group chosen, the different attribute will be displayed here', 'wpshop') . '</li> |
359 | 359 | </ul>'; |
360 | 360 | |
361 | - add_meta_box($post->post_type . '_attribute_set_selector',sprintf( __('%s attributes', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))), array('wpshop_entities', 'meta_box_content'), $post->post_type, 'normal', 'high', array('currentTabContent' => $currentTabContent)); |
|
361 | + add_meta_box($post->post_type . '_attribute_set_selector', sprintf(__('%s attributes', 'wpshop'), get_the_title(wpshop_entities::get_entity_identifier_from_code($post->post_type))), array('wpshop_entities', 'meta_box_content'), $post->post_type, 'normal', 'high', array('currentTabContent' => $currentTabContent)); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | } |
@@ -388,22 +388,22 @@ discard block |
||
388 | 388 | |
389 | 389 | echo '<div id="fixed-tabs" class="wpshop_tabs wpshop_detail_tabs entities_attribute_tabs ' . $post->post_type . '_attribute_tabs" > |
390 | 390 | <ul>'; |
391 | - if(!empty($currentTabContent['box'])){ |
|
392 | - foreach($currentTabContent['box'] as $boxIdentifier => $boxTitle){ |
|
393 | - if(!empty($currentTabContent['boxContent'][$boxIdentifier])) { |
|
394 | - if($currentTabContent['box'][$boxIdentifier.'_backend_display_type']=='fixed-tab') { |
|
395 | - echo '<li><a href="#tabs-'.$boxIdentifier.'">'.__($boxTitle, 'wpshop').'</a></li>'; |
|
391 | + if (!empty($currentTabContent['box'])) { |
|
392 | + foreach ($currentTabContent['box'] as $boxIdentifier => $boxTitle) { |
|
393 | + if (!empty($currentTabContent['boxContent'][$boxIdentifier])) { |
|
394 | + if ($currentTabContent['box'][$boxIdentifier . '_backend_display_type'] == 'fixed-tab') { |
|
395 | + echo '<li><a href="#tabs-' . $boxIdentifier . '">' . __($boxTitle, 'wpshop') . '</a></li>'; |
|
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | 399 | } |
400 | 400 | echo '</ul>'; |
401 | 401 | |
402 | - if(!empty($currentTabContent['box'])){ |
|
403 | - foreach($currentTabContent['box'] as $boxIdentifier => $boxTitle){ |
|
404 | - if(!empty($currentTabContent['boxContent'][$boxIdentifier])) { |
|
405 | - if($currentTabContent['box'][$boxIdentifier.'_backend_display_type']=='fixed-tab') { |
|
406 | - echo '<div id="tabs-'.$boxIdentifier.'">'.$currentTabContent['boxContent'][$boxIdentifier].'</div>'; |
|
402 | + if (!empty($currentTabContent['box'])) { |
|
403 | + foreach ($currentTabContent['box'] as $boxIdentifier => $boxTitle) { |
|
404 | + if (!empty($currentTabContent['boxContent'][$boxIdentifier])) { |
|
405 | + if ($currentTabContent['box'][$boxIdentifier . '_backend_display_type'] == 'fixed-tab') { |
|
406 | + echo '<div id="tabs-' . $boxIdentifier . '">' . $currentTabContent['boxContent'][$boxIdentifier] . '</div>'; |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -418,33 +418,33 @@ discard block |
||
418 | 418 | /** |
419 | 419 | * Save informations for current entity |
420 | 420 | */ |
421 | - public static function save_entities_custom_informations( $post ) { |
|
421 | + public static function save_entities_custom_informations($post) { |
|
422 | 422 | global $wpdb; |
423 | 423 | global $wpshop_account; |
424 | - $post_id = !empty($_REQUEST['post_ID']) ? intval( wpshop_tools::varSanitizer($_REQUEST['post_ID']) ) : null; |
|
424 | + $post_id = !empty($_REQUEST['post_ID']) ? intval(wpshop_tools::varSanitizer($_REQUEST['post_ID'])) : null; |
|
425 | 425 | |
426 | - if ( !empty($post_id) && empty($_POST['edit_other_thing']) || ( !empty($_REQUEST['post_ID']) && !(bool)$_POST['edit_other_thing'] && get_post_type($_REQUEST['post_ID']) != WPSHOP_NEWTYPE_IDENTIFIER_ORDER ) ) { |
|
426 | + if (!empty($post_id) && empty($_POST['edit_other_thing']) || (!empty($_REQUEST['post_ID']) && !(bool)$_POST['edit_other_thing'] && get_post_type($_REQUEST['post_ID']) != WPSHOP_NEWTYPE_IDENTIFIER_ORDER)) { |
|
427 | 427 | $current_post_type = get_post_type($post_id); |
428 | 428 | |
429 | 429 | |
430 | 430 | |
431 | 431 | |
432 | 432 | /* Vérification de l'existence de l'envoi de l'identifiant du set d'attribut */ |
433 | - if ( !empty($_REQUEST[$current_post_type . '_attribute_set_id']) ) { |
|
434 | - $attribute_set_id = intval( wpshop_tools::varSanitizer($_REQUEST[$current_post_type . '_attribute_set_id']) ); |
|
433 | + if (!empty($_REQUEST[$current_post_type . '_attribute_set_id'])) { |
|
434 | + $attribute_set_id = intval(wpshop_tools::varSanitizer($_REQUEST[$current_post_type . '_attribute_set_id'])); |
|
435 | 435 | $attribet_set_infos = wpshop_attributes_set::getElement($attribute_set_id, "'valid'", 'id'); |
436 | 436 | |
437 | - if ( $attribet_set_infos->entity == $_REQUEST['post_type'] ) { |
|
437 | + if ($attribet_set_infos->entity == $_REQUEST['post_type']) { |
|
438 | 438 | /* Enregistrement de l'identifiant du set d'attribut associé à l'entité */ |
439 | 439 | update_post_meta($post_id, sprintf(WPSHOP_ATTRIBUTE_SET_ID_META_KEY, $current_post_type), $attribute_set_id); |
440 | 440 | |
441 | 441 | /* Enregistrement de tous les attributs */ |
442 | - if ( !empty($_REQUEST[$current_post_type . '_attribute']) ) { |
|
442 | + if (!empty($_REQUEST[$current_post_type . '_attribute'])) { |
|
443 | 443 | /* Traduction des virgule en point pour la base de donnees */ |
444 | - if ( !empty($_REQUEST[$current_post_type . '_attribute']['decimal']) ) { |
|
445 | - foreach($_REQUEST[$current_post_type . '_attribute']['decimal'] as $attributeName => $attributeValue){ |
|
446 | - if(!is_array($attributeValue)){ |
|
447 | - $_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName] = str_replace(',','.',$_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName]); |
|
444 | + if (!empty($_REQUEST[$current_post_type . '_attribute']['decimal'])) { |
|
445 | + foreach ($_REQUEST[$current_post_type . '_attribute']['decimal'] as $attributeName => $attributeValue) { |
|
446 | + if (!is_array($attributeValue)) { |
|
447 | + $_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName] = str_replace(',', '.', $_REQUEST[$current_post_type . '_attribute']['decimal'][$attributeName]); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | |
454 | 454 | /* Enregistrement des valeurs des attributs dans les metas de l'entité => Permet de profiter de la recherche native de wordpress */ |
455 | 455 | $productMetaDatas = array(); |
456 | - foreach ( $_REQUEST[$current_post_type . '_attribute'] as $attributeType => $attributeValues ) { |
|
457 | - foreach ( $attributeValues as $attributeCode => $attributeValue ) { |
|
456 | + foreach ($_REQUEST[$current_post_type . '_attribute'] as $attributeType => $attributeValues) { |
|
457 | + foreach ($attributeValues as $attributeCode => $attributeValue) { |
|
458 | 458 | $productMetaDatas[$attributeCode] = $attributeValue; |
459 | 459 | } |
460 | 460 | } |
@@ -463,42 +463,42 @@ discard block |
||
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
466 | - if ( !empty($_REQUEST['attribute']) ) { |
|
466 | + if (!empty($_REQUEST['attribute'])) { |
|
467 | 467 | $current_id = array(); |
468 | - foreach ( $_REQUEST['attribute'] as $key=>$values ) { |
|
468 | + foreach ($_REQUEST['attribute'] as $key=>$values) { |
|
469 | 469 | $ad_id = ''; |
470 | 470 | $addresses_id = get_post_meta($_REQUEST['post_ID'], '_wpshop_attached_address', true); |
471 | - if ( !empty($addresses_id) ) { |
|
472 | - foreach ( $addresses_id as $address_id) { |
|
471 | + if (!empty($addresses_id)) { |
|
472 | + foreach ($addresses_id as $address_id) { |
|
473 | 473 | $address_type = get_post_meta($address_id, '_wpshop_address_attribute_set_id', true); |
474 | 474 | if ($address_type == $key) { |
475 | 475 | $ad_id = $address_id; |
476 | 476 | } |
477 | 477 | } |
478 | 478 | } |
479 | - if( !empty( $ad_id ) ) { |
|
479 | + if (!empty($ad_id)) { |
|
480 | 480 | $_REQUEST['item_id'] = $ad_id; |
481 | - $result = wps_address::save_address_infos( $key ); |
|
481 | + $result = wps_address::save_address_infos($key); |
|
482 | 482 | $current_id[] = $result['current_id']; |
483 | 483 | } |
484 | 484 | } |
485 | - if( !empty( $current_id ) ) { |
|
486 | - update_post_meta ($_REQUEST['post_ID'], '_wpshop_attached_address', $current_id); |
|
485 | + if (!empty($current_id)) { |
|
486 | + update_post_meta($_REQUEST['post_ID'], '_wpshop_attached_address', $current_id); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | else { |
490 | 490 | $current_id = array(); |
491 | - if ( !empty ($_REQUEST['address_type']) ) { |
|
492 | - foreach ( $_REQUEST['address_type'] as $key=>$value ) { |
|
491 | + if (!empty ($_REQUEST['address_type'])) { |
|
492 | + foreach ($_REQUEST['address_type'] as $key=>$value) { |
|
493 | 493 | $current_id[] = $value; |
494 | 494 | } |
495 | 495 | } |
496 | - update_post_meta ($_REQUEST['post_ID'], '_wpshop_entity_attached_address', $current_id); |
|
496 | + update_post_meta($_REQUEST['post_ID'], '_wpshop_entity_attached_address', $current_id); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
500 | 500 | /** Save price infos **/ |
501 | - if ( !empty($_REQUEST) && !empty($_REQUEST['post_ID']) && !empty( $_REQUEST['post_type']) && $_REQUEST['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT ) { |
|
501 | + if (!empty($_REQUEST) && !empty($_REQUEST['post_ID']) && !empty($_REQUEST['post_type']) && $_REQUEST['post_type'] == WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT) { |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | 'posts_per_page' => '-1', |
522 | 522 | )); |
523 | 523 | |
524 | - if ( !empty($entities) ) { |
|
524 | + if (!empty($entities)) { |
|
525 | 525 | foreach ($entities as $entity_index => $entity) { |
526 | 526 | $entities_list[$entity->ID] = $entity->post_title; |
527 | 527 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | global $wpdb; |
559 | 559 | |
560 | 560 | /* Get current post information */ |
561 | - $post_infos = get_post( $post_id, ARRAY_A ); |
|
561 | + $post_infos = get_post($post_id, ARRAY_A); |
|
562 | 562 | /* Set new information for post that will be created */ |
563 | 563 | unset($post_infos['ID']); |
564 | 564 | $post_infos['post_date'] = current_time('mysql', 1); |
@@ -576,18 +576,18 @@ discard block |
||
576 | 576 | $last_post = wp_insert_post($post_infos); |
577 | 577 | |
578 | 578 | /* If there is no error then duplicate meta informations */ |
579 | - if ( is_int($last_post) && !empty($last_post) ) { |
|
579 | + if (is_int($last_post) && !empty($last_post)) { |
|
580 | 580 | $meta_creation = true; |
581 | 581 | |
582 | 582 | $current_post_meta = get_post_meta($post_id); |
583 | - foreach ( $current_post_meta as $post_meta_key => $post_meta_value ) { |
|
584 | - $meta_is_array = !empty( $post_meta_value[0] ) ? @unserialize($post_meta_value[0]) : ''; |
|
583 | + foreach ($current_post_meta as $post_meta_key => $post_meta_value) { |
|
584 | + $meta_is_array = !empty($post_meta_value[0]) ? @unserialize($post_meta_value[0]) : ''; |
|
585 | 585 | $meta_real_value = (is_array($meta_is_array) ? $meta_is_array : $post_meta_value[0]); |
586 | 586 | $meta_creation = update_post_meta($last_post, $post_meta_key, $meta_real_value); |
587 | 587 | } |
588 | 588 | /* Duplicate element taxonomy */ |
589 | 589 | /* Check the taxonomy to get */ |
590 | - switch ( get_post_type($post_id) ) { |
|
590 | + switch (get_post_type($post_id)) { |
|
591 | 591 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
592 | 592 | $taxonomy = WPSHOP_NEWTYPE_IDENTIFIER_CATEGORIES; |
593 | 593 | break; |
@@ -595,17 +595,17 @@ discard block |
||
595 | 595 | $taxonomy = ''; |
596 | 596 | break; |
597 | 597 | } |
598 | - $post_taxonomies = wp_get_post_terms( $post_id, $taxonomy); |
|
599 | - foreach ( $post_taxonomies as $post_taxonomy ) { |
|
600 | - wp_set_post_terms( $last_post, $post_taxonomy->term_id, $taxonomy, true); |
|
598 | + $post_taxonomies = wp_get_post_terms($post_id, $taxonomy); |
|
599 | + foreach ($post_taxonomies as $post_taxonomy) { |
|
600 | + wp_set_post_terms($last_post, $post_taxonomy->term_id, $taxonomy, true); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /* Create a post meta allowing to know if the element has been duplicated from another */ |
604 | 604 | update_post_meta($last_post, '_wpshop_duplicate_element', $post_id); |
605 | 605 | |
606 | 606 | $new_element_link = '<a class="wpshop_cls wpshop_duplicate_entity_element_link" href="' . admin_url('post.php?post=' . $last_post . '&action=edit') . '" >' . __('Go on the new element edit page', 'wpshop') . '</a>'; |
607 | - if ( $meta_creation ) { |
|
608 | - return array('true', '<br/>' . $new_element_link, $last_post ); |
|
607 | + if ($meta_creation) { |
|
608 | + return array('true', '<br/>' . $new_element_link, $last_post); |
|
609 | 609 | } |
610 | 610 | else { |
611 | 611 | return array('true', '<br/>' . __('Some errors occured while duplicating meta information, but element has been created.', 'wpshop') . ' ' . $new_element_link); |
@@ -631,12 +631,12 @@ discard block |
||
631 | 631 | $query = $wpdb->prepare("SELECT code, frontend_label FROM " . WPSHOP_DBT_ATTRIBUTE . " AS ATT WHERE status=%s AND is_used_in_admin_listing_column=%s AND entity_id=%d", 'valid', 'yes', self::get_entity_identifier_from_code($post_type)); |
632 | 632 | $attributes_list = $wpdb->get_results($query); |
633 | 633 | $wpshop_custom_columns = array(); |
634 | - foreach ( $attributes_list as $attribute ) { |
|
634 | + foreach ($attributes_list as $attribute) { |
|
635 | 635 | $wpshop_custom_columns[$attribute->code] = __($attribute->frontend_label, 'wpshop'); |
636 | 636 | } |
637 | 637 | |
638 | 638 | /* Check the current entity to display custom column correctly. Add the custom column into default column list */ |
639 | - switch ( $post_type ) { |
|
639 | + switch ($post_type) { |
|
640 | 640 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
641 | 641 | $columns = array_merge(array( |
642 | 642 | 'cb' => '<input type="checkbox" />', |
@@ -663,34 +663,34 @@ discard block |
||
663 | 663 | public static function custom_columns_content($column, $post_id) { |
664 | 664 | $post_type = get_post_type($post_id); |
665 | 665 | |
666 | - switch ( $post_type ) { |
|
666 | + switch ($post_type) { |
|
667 | 667 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
668 | 668 | $column_content = '<strong>-</strong>'; |
669 | 669 | $product = wpshop_products::get_product_data($post_id); |
670 | 670 | |
671 | 671 | switch ($column) { |
672 | 672 | case 'picture' : |
673 | - $column_content = get_the_post_thumbnail( $post_id, 'thumbnail'); |
|
673 | + $column_content = get_the_post_thumbnail($post_id, 'thumbnail'); |
|
674 | 674 | break; |
675 | 675 | case "product_stock": |
676 | - if( !empty($product['product_stock']) ) |
|
677 | - $column_content = (int)$product['product_stock'].' '.__('unit(s)','wpshop'); |
|
676 | + if (!empty($product['product_stock'])) |
|
677 | + $column_content = (int)$product['product_stock'] . ' ' . __('unit(s)', 'wpshop'); |
|
678 | 678 | break; |
679 | 679 | |
680 | 680 | case "product_price": |
681 | - if( !empty($product['product_price']) ) |
|
682 | - $column_content = wpshop_prices::get_product_price( $product, 'price_display', 'complete_sheet'); |
|
681 | + if (!empty($product['product_price'])) |
|
682 | + $column_content = wpshop_prices::get_product_price($product, 'price_display', 'complete_sheet'); |
|
683 | 683 | break; |
684 | 684 | |
685 | 685 | case "tx_tva": |
686 | - if( !empty($product['product_price']) ) |
|
687 | - $column_content = number_format($product[$column],2,'.', ' ').' %'; |
|
686 | + if (!empty($product['product_price'])) |
|
687 | + $column_content = number_format($product[$column], 2, '.', ' ') . ' %'; |
|
688 | 688 | break; |
689 | 689 | default: |
690 | - if ( !empty($product[$column]) ) { |
|
690 | + if (!empty($product[$column])) { |
|
691 | 691 | $attribute_prices = unserialize(WPSHOP_ATTRIBUTE_PRICES); |
692 | - if ( in_array($column, $attribute_prices) ) { |
|
693 | - $column_content = number_format($product[$column],2,'.', ' ').' '.wpshop_tools::wpshop_get_currency(); |
|
692 | + if (in_array($column, $attribute_prices)) { |
|
693 | + $column_content = number_format($product[$column], 2, '.', ' ') . ' ' . wpshop_tools::wpshop_get_currency(); |
|
694 | 694 | |
695 | 695 | } |
696 | 696 | else |
@@ -711,37 +711,37 @@ discard block |
||
711 | 711 | * Display a form allowing to create an entity from frontend with a shortcode |
712 | 712 | * @param array $shortcode_args The different parameters for the shortocde: the field list for the form, different parameters for the entity to create |
713 | 713 | */ |
714 | - public static function wpshop_entities_shortcode( $shortcode_args ) { |
|
714 | + public static function wpshop_entities_shortcode($shortcode_args) { |
|
715 | 715 | global $wpshop_account, $wpdb; |
716 | 716 | $output = $form_content = ''; |
717 | - if ( get_current_user_id() > 0 ) { |
|
718 | - if ( !empty( $_POST['quick_entity_add_button'] ) ) { |
|
717 | + if (get_current_user_id() > 0) { |
|
718 | + if (!empty($_POST['quick_entity_add_button'])) { |
|
719 | 719 | $attributes = array(); |
720 | - foreach ( $_POST['attribute'] as $attribute_type => $attribute ) { |
|
721 | - foreach ( $attribute as $attribute_code => $attribute_value ) { |
|
720 | + foreach ($_POST['attribute'] as $attribute_type => $attribute) { |
|
721 | + foreach ($attribute as $attribute_code => $attribute_value) { |
|
722 | 722 | $attributes[$attribute_code] = $attribute_value; |
723 | 723 | } |
724 | 724 | } |
725 | 725 | $result = wpshop_products::addProduct($_POST['wp_fields']['post_title'], '', $attributes, 'complete'); |
726 | 726 | } |
727 | 727 | |
728 | - if ( empty($shortcode_args['attribute_set_id']) || empty($shortcode_args['post_type']) ) { |
|
728 | + if (empty($shortcode_args['attribute_set_id']) || empty($shortcode_args['post_type'])) { |
|
729 | 729 | $output = __('This form page is invalid because no set or type or content is defined. Please contact administrator with this error message', 'wpshop'); |
730 | 730 | } |
731 | 731 | else { |
732 | 732 | $entity_identifier = wpshop_entities::get_entity_identifier_from_code($shortcode_args['post_type']); |
733 | 733 | $attribute_set_def = wpshop_attributes_set::getElement($shortcode_args['attribute_set_id'], "'valid'"); |
734 | 734 | |
735 | - if ( empty($entity_identifier) || empty($attribute_set_def) || ($entity_identifier != $attribute_set_def->entity_id) ) { |
|
735 | + if (empty($entity_identifier) || empty($attribute_set_def) || ($entity_identifier != $attribute_set_def->entity_id)) { |
|
736 | 736 | $output = __('This form page is invalid because type and set are not linked. Please contact administrator with this error message', 'wpshop'); |
737 | 737 | } |
738 | 738 | else { |
739 | 739 | /** Display wordpress fields */ |
740 | - foreach ( explode(', ', $shortcode_args['fields']) as $field_name ) { |
|
740 | + foreach (explode(', ', $shortcode_args['fields']) as $field_name) { |
|
741 | 741 | $label = ''; |
742 | - switch ( $field_name ) { |
|
742 | + switch ($field_name) { |
|
743 | 743 | case 'post_title': |
744 | - switch ( $shortcode_args['post_type'] ) { |
|
744 | + switch ($shortcode_args['post_type']) { |
|
745 | 745 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
746 | 746 | $label = __('Product title', 'wpshop'); |
747 | 747 | break; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | $field_type = 'text'; |
754 | 754 | break; |
755 | 755 | case 'post_thumbnail': |
756 | - switch ( $shortcode_args['post_type'] ) { |
|
756 | + switch ($shortcode_args['post_type']) { |
|
757 | 757 | case WPSHOP_NEWTYPE_IDENTIFIER_PRODUCT: |
758 | 758 | $label = __('Product picture', 'wpshop'); |
759 | 759 | break; |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | break; |
767 | 767 | } |
768 | 768 | |
769 | - if ( !empty( $label ) ) { |
|
769 | + if (!empty($label)) { |
|
770 | 770 | $template_part = 'quick_entity_wp_internal_field_' . $field_type; |
771 | 771 | $tpl_component = array(); |
772 | 772 | $tpl_component['WP_FIELD_NAME'] = $field_name; |
@@ -799,20 +799,20 @@ discard block |
||
799 | 799 | ORDER BY ATT_GROUP.position, ATTR_DET.position" |
800 | 800 | , 'yes', 'valid', wpshop_entities::get_entity_identifier_from_code($shortcode_args['post_type']), $shortcode_args['attribute_set_id']); |
801 | 801 | $attribute_for_creation = $wpdb->get_results($query); |
802 | - foreach ( $attribute_for_creation as $attribute ) { |
|
803 | - $attr_field = wpshop_attributes::display_attribute( $attribute->code, 'frontend'/* (is_admin() ? 'admin' : 'frontend') */ ); |
|
802 | + foreach ($attribute_for_creation as $attribute) { |
|
803 | + $attr_field = wpshop_attributes::display_attribute($attribute->code, 'frontend'/* (is_admin() ? 'admin' : 'frontend') */); |
|
804 | 804 | $form_content .= $attr_field['field']; |
805 | 805 | } |
806 | 806 | |
807 | 807 | /** Check if there are extra parameters */ |
808 | - if ( !empty( $shortcode_args['extra_element'] ) ) { |
|
808 | + if (!empty($shortcode_args['extra_element'])) { |
|
809 | 809 | $extra_element = explode(', ', $shortcode_args['extra_element']); |
810 | - foreach ( $extra_element as $element) { |
|
810 | + foreach ($extra_element as $element) { |
|
811 | 811 | $element_def = explode('!#wps#!', $element); |
812 | 812 | $element_type = $element_def[0]; |
813 | 813 | $element_id = $element_def[1]; |
814 | 814 | |
815 | - if ( $element_type == WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS ) { |
|
815 | + if ($element_type == WPSHOP_NEWTYPE_IDENTIFIER_ADDRESS) { |
|
816 | 816 | $form_content .= '<div class="wpshop_entity_address_container">'; |
817 | 817 | // $form_content .= $wpshop_account->display_form_fields($element_id, null, 'not'); |
818 | 818 | $form_content .= '</div><div class="wpshop_cls"></div>'; |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $template_part = 'quick_entity_add_form'; |
826 | 826 | $tpl_component = array(); |
827 | 827 | $tpl_component['ENTITY_TYPE'] = $shortcode_args['post_type']; |
828 | - $tpl_component['ENTITY_ATTRIBUTE_SET_ID'] = !empty( $shortcode_args['attribute_set_id'] ) ? $shortcode_args['attribute_set_id'] : 0; |
|
828 | + $tpl_component['ENTITY_ATTRIBUTE_SET_ID'] = !empty($shortcode_args['attribute_set_id']) ? $shortcode_args['attribute_set_id'] : 0; |
|
829 | 829 | $tpl_component['NEW_ENTITY_FORM_DETAILS'] = $form_content; |
830 | 830 | $tpl_component['ENTITY_QUICK_ADDING_FORM_NONCE'] = wp_create_nonce("wpshop_add_new_entity_ajax_nonce"); |
831 | 831 | $tpl_component['ENTITY_QUICK_ADD_BUTTON_TEXT'] = __($shortcode_args['button_text'], 'wpshop'); |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | $dialog_identifier = 'new_value_for_entity'; |
836 | 836 | $dialog_input_identifier = 'wpshop_new_attribute_option_value'; |
837 | 837 | ob_start(); |
838 | - include(WPSHOP_TEMPLATES_DIR.'admin/add_new_element_dialog.tpl.php'); |
|
838 | + include(WPSHOP_TEMPLATES_DIR . 'admin/add_new_element_dialog.tpl.php'); |
|
839 | 839 | $tpl_component['DIALOG_BOX'] = ob_get_contents(); |
840 | 840 | ob_end_clean(); |
841 | 841 | $tpl_component['DIALOG_BOX'] .= '<input type="hidden" name="wpshop_attribute_type_select_code" value="" id="wpshop_attribute_type_select_code" />'; |
@@ -877,14 +877,14 @@ discard block |
||
877 | 877 | /** Add the new product */ |
878 | 878 | $entity_id = wp_insert_post($entity_args); |
879 | 879 | |
880 | - do_action( 'wps_entity_more_action' , $entity_id, $attributes); |
|
880 | + do_action('wps_entity_more_action', $entity_id, $attributes); |
|
881 | 881 | |
882 | 882 | /** Update the attribute set id for the current product */ |
883 | - if ( !empty($extra_params['attribute_set_id']) ) { |
|
883 | + if (!empty($extra_params['attribute_set_id'])) { |
|
884 | 884 | $attribute_set_id = $extra_params['attribute_set_id']; |
885 | 885 | } |
886 | 886 | else { |
887 | - $query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE status = %s AND entity_id = %d AND default_set = %s", 'valid', wpshop_entities::get_entity_identifier_from_code($entity_type) , 'yes'); |
|
887 | + $query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE_SET . " WHERE status = %s AND entity_id = %d AND default_set = %s", 'valid', wpshop_entities::get_entity_identifier_from_code($entity_type), 'yes'); |
|
888 | 888 | $attribute_set_id = $wpdb->get_var($query); |
889 | 889 | } |
890 | 890 | update_post_meta($entity_id, '_' . $entity_type . '_attribute_set_id', $attribute_set_id); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | * |
903 | 903 | * @return array The different response element for the request. $result: Boolean representing if creation is OK / $container: Where the result must be placed into output code / $output: The html content to output |
904 | 904 | */ |
905 | - public static function create_cpt_from_csv_file( $identifier, $custom_file = '' ) { |
|
905 | + public static function create_cpt_from_csv_file($identifier, $custom_file = '') { |
|
906 | 906 | global $wpdb; |
907 | 907 | $output = ''; |
908 | 908 | $container = ''; |
@@ -922,47 +922,47 @@ discard block |
||
922 | 922 | $custom_post_type_identifier = $wpdb->get_var($query); |
923 | 923 | $container = 'wpshop_cpt_' . $identifier; |
924 | 924 | |
925 | - $file_uri = !empty( $custom_file ) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '.csv'; |
|
926 | - if ( is_file( $file_uri ) && empty($custom_post_type_identifier) ) { |
|
925 | + $file_uri = !empty($custom_file) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '.csv'; |
|
926 | + if (is_file($file_uri) && empty($custom_post_type_identifier)) { |
|
927 | 927 | $csv_file_default_data = file($file_uri, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
928 | 928 | |
929 | - $db_field_definition = explode( ";", $csv_file_default_data[0] ); |
|
930 | - $db_datas_definition = explode( ";", $csv_file_default_data[1] ); |
|
929 | + $db_field_definition = explode(";", $csv_file_default_data[0]); |
|
930 | + $db_datas_definition = explode(";", $csv_file_default_data[1]); |
|
931 | 931 | |
932 | 932 | $has_error = false; |
933 | 933 | $errors = array(); |
934 | - foreach ( $custom_post_type_default_structure as $field_name => $field_default_value ) { |
|
935 | - if ( !in_array( str_replace( 'post_', '', $field_name ) , $db_field_definition ) ) { |
|
936 | - if ( $field_name == 'post_name' ) { |
|
934 | + foreach ($custom_post_type_default_structure as $field_name => $field_default_value) { |
|
935 | + if (!in_array(str_replace('post_', '', $field_name), $db_field_definition)) { |
|
936 | + if ($field_name == 'post_name') { |
|
937 | 937 | $db_datas_definition[] = $identifier; |
938 | - $db_field_definition[] = str_replace( 'post_', '', $field_name ); |
|
938 | + $db_field_definition[] = str_replace('post_', '', $field_name); |
|
939 | 939 | } |
940 | - else if ( $field_default_value == 'mandatory' ) { |
|
940 | + else if ($field_default_value == 'mandatory') { |
|
941 | 941 | $has_error = true; |
942 | 942 | $errors[] = $field_name; |
943 | 943 | } |
944 | 944 | else { |
945 | 945 | $db_datas_definition[] = $field_default_value; |
946 | - $db_field_definition[] = str_replace( 'post_', '', $field_name ); |
|
946 | + $db_field_definition[] = str_replace('post_', '', $field_name); |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
951 | - if ( $has_error ) { |
|
951 | + if ($has_error) { |
|
952 | 952 | $result = false; |
953 | - $output = sprintf( __('You have to fill %s, they are mandatory for custom type creation', 'wpshop'), implode(',', $errors) ); |
|
953 | + $output = sprintf(__('You have to fill %s, they are mandatory for custom type creation', 'wpshop'), implode(',', $errors)); |
|
954 | 954 | } |
955 | 955 | else { |
956 | 956 | $custom_post_type_def = array(); |
957 | - foreach ( $db_field_definition as $field_position => $field_name ) { |
|
957 | + foreach ($db_field_definition as $field_position => $field_name) { |
|
958 | 958 | $custom_post_type_def['post_' . $field_name] = $db_datas_definition[$field_position]; |
959 | 959 | } |
960 | - $new_custom_post_type = wp_insert_post( $custom_post_type_def ); |
|
961 | - if ( is_int($new_custom_post_type) && !empty($new_custom_post_type) ) { |
|
960 | + $new_custom_post_type = wp_insert_post($custom_post_type_def); |
|
961 | + if (is_int($new_custom_post_type) && !empty($new_custom_post_type)) { |
|
962 | 962 | $result = true; |
963 | 963 | } |
964 | 964 | |
965 | - $check_cpt = wpshop_entities::check_default_custom_post_type( $identifier, array(), $result, $custom_file ); |
|
965 | + $check_cpt = wpshop_entities::check_default_custom_post_type($identifier, array(), $result, $custom_file); |
|
966 | 966 | $output = $check_cpt[1]; |
967 | 967 | } |
968 | 968 | } |
@@ -978,20 +978,20 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return array The different response element for the request. $has_error: A boolean result of request / $output: The complete html output for custom post type check / $tpl_componene: A mode complete list of element of templates |
980 | 980 | */ |
981 | - public static function check_default_custom_post_type( $identifier, $tpl_component ) { |
|
981 | + public static function check_default_custom_post_type($identifier, $tpl_component) { |
|
982 | 982 | global $wpdb; |
983 | 983 | $has_error = false; |
984 | 984 | |
985 | 985 | /** Check if custom post type exists */ |
986 | 986 | $query = $wpdb->prepare("SELECT post_title FROM " . $wpdb->posts . " WHERE post_name = %s", $identifier); |
987 | 987 | $custom_post_type_title = $wpdb->get_var($query); |
988 | - if ( !empty($custom_post_type_title) ) { |
|
988 | + if (!empty($custom_post_type_title)) { |
|
989 | 989 | $tpl_component['CUSTOM_POST_TYPE_IDENTIFIER'] = '<img class="wpshop_tools_check_icon no_error" src="' . WPSHOP_MEDIAS_ICON_URL . 'informations/success_s.png" /> ' . $custom_post_type_title . ' (' . $identifier . ')'; |
990 | 990 | $tpl_component['TOOLS_CUSTOM_POST_TYPE_CONTAINER_CLASS'] = ' no_error'; |
991 | 991 | $tpl_component['CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES'] = ''; |
992 | 992 | $template_part = 'wpshop_admin_tools_default_datas_check_main_element_content_no_error'; |
993 | 993 | |
994 | - $attributes_for_cpt = wpshop_entities::check_default_cpt_attributes( $identifier, $tpl_component, $has_error ); |
|
994 | + $attributes_for_cpt = wpshop_entities::check_default_cpt_attributes($identifier, $tpl_component, $has_error); |
|
995 | 995 | $has_error = $attributes_for_cpt[0]; |
996 | 996 | $tpl_component['CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES'] = $attributes_for_cpt[1]; |
997 | 997 | } |
@@ -1016,39 +1016,39 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return array The different response element for the request. $has_error: A boolean information for request result / $output: The complete html output for attribute check |
1018 | 1018 | */ |
1019 | - public static function check_default_cpt_attributes( $identifier, $tpl_component, $has_error, $custom_file = '' ) { |
|
1019 | + public static function check_default_cpt_attributes($identifier, $tpl_component, $has_error, $custom_file = '') { |
|
1020 | 1020 | global $wpdb, $attribute_displayed_field; |
1021 | 1021 | $output = ''; |
1022 | 1022 | |
1023 | - $cpt_attributes_file_uri = !empty( $custom_file ) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '-attributes.csv'; |
|
1024 | - if ( is_file( $cpt_attributes_file_uri ) ) { |
|
1023 | + $cpt_attributes_file_uri = !empty($custom_file) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '-attributes.csv'; |
|
1024 | + if (is_file($cpt_attributes_file_uri)) { |
|
1025 | 1025 | /** Read lines into file defining default datas */ |
1026 | 1026 | $csv_file_default_data = file($cpt_attributes_file_uri, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
1027 | - if ( !empty($csv_file_default_data) ) { |
|
1027 | + if (!empty($csv_file_default_data)) { |
|
1028 | 1028 | $header_line = explode(';', $csv_file_default_data[0]); |
1029 | 1029 | unset($csv_file_default_data[0]); |
1030 | 1030 | $code_column = null; |
1031 | 1031 | $available_columns = array(); |
1032 | - foreach ( $header_line as $column_key => $column_value ) { |
|
1033 | - if ( $column_value == 'code' ) { |
|
1032 | + foreach ($header_line as $column_key => $column_value) { |
|
1033 | + if ($column_value == 'code') { |
|
1034 | 1034 | $code_column = $column_key; |
1035 | 1035 | // $available_columns[$column_value] = $column_key; |
1036 | 1036 | } |
1037 | - else if ( in_array( $column_value, array('frontend_label')/* $attribute_displayed_field */ ) ) { |
|
1037 | + else if (in_array($column_value, array('frontend_label')/* $attribute_displayed_field */)) { |
|
1038 | 1038 | $available_columns[$column_value] = $column_key; |
1039 | 1039 | } |
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | /** Read the complete file content */ |
1043 | 1043 | $attribute_ok = $attribute_not_ok = ' '; |
1044 | - foreach ( $csv_file_default_data as $line_index => $line_content ) { |
|
1044 | + foreach ($csv_file_default_data as $line_index => $line_content) { |
|
1045 | 1045 | $line_contents = explode(';', $line_content); |
1046 | 1046 | $query = $wpdb->prepare("SELECT id, frontend_label FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE code = %s AND entity_id = %d", $line_contents[$code_column], wpshop_entities::get_entity_identifier_from_code($identifier)); |
1047 | - $attribute = $wpdb->get_row( $query ); |
|
1048 | - if ( !empty($line_contents) ) { |
|
1049 | - foreach ( $line_contents as $line_column => $line_column_value ) { |
|
1050 | - if ( in_array( $line_column, $available_columns ) ) { |
|
1051 | - if ( !empty($attribute) ) { |
|
1047 | + $attribute = $wpdb->get_row($query); |
|
1048 | + if (!empty($line_contents)) { |
|
1049 | + foreach ($line_contents as $line_column => $line_column_value) { |
|
1050 | + if (in_array($line_column, $available_columns)) { |
|
1051 | + if (!empty($attribute)) { |
|
1052 | 1052 | $attribute_ok .= $attribute->frontend_label . ', '; |
1053 | 1053 | } |
1054 | 1054 | else { |
@@ -1059,18 +1059,18 @@ discard block |
||
1059 | 1059 | } |
1060 | 1060 | } |
1061 | 1061 | } |
1062 | - $attribute_not_ok = substr( $attribute_not_ok, 2, -2 ); |
|
1063 | - if ( !empty($attribute_not_ok) ) { |
|
1064 | - $output .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element_content_attributes_error', array_merge( $tpl_component, array( 'CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES_LIST' => $attribute_not_ok )), array(), 'admin'); |
|
1062 | + $attribute_not_ok = substr($attribute_not_ok, 2, -2); |
|
1063 | + if (!empty($attribute_not_ok)) { |
|
1064 | + $output .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element_content_attributes_error', array_merge($tpl_component, array('CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES_LIST' => $attribute_not_ok)), array(), 'admin'); |
|
1065 | 1065 | } |
1066 | - $attribute_ok = substr( $attribute_ok, 2, -2 ); |
|
1067 | - if ( !empty($attribute_ok) ) { |
|
1068 | - $output .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element_content_attributes_no_error', array_merge( $tpl_component, array( 'CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES_LIST' => $attribute_ok )), array(), 'admin'); |
|
1066 | + $attribute_ok = substr($attribute_ok, 2, -2); |
|
1067 | + if (!empty($attribute_ok)) { |
|
1068 | + $output .= wpshop_display::display_template_element('wpshop_admin_tools_default_datas_check_main_element_content_attributes_no_error', array_merge($tpl_component, array('CUSTOM_POST_TYPE_DEFAULT_ATTRIBUTES_LIST' => $attribute_ok)), array(), 'admin'); |
|
1069 | 1069 | } |
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | |
1073 | - return array( $has_error, $output ); |
|
1073 | + return array($has_error, $output); |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | /** |
@@ -1080,60 +1080,60 @@ discard block |
||
1080 | 1080 | * |
1081 | 1081 | * @return array The different response element for the request. $result: Boolean representing if creation is OK / $container: Where the result must be placed into output code / $output: The html content to output |
1082 | 1082 | */ |
1083 | - public static function create_cpt_attributes_from_csv_file( $identifier, $custom_file = '' ) { |
|
1083 | + public static function create_cpt_attributes_from_csv_file($identifier, $custom_file = '') { |
|
1084 | 1084 | global $wpdb; |
1085 | 1085 | |
1086 | 1086 | $output = $container = ''; |
1087 | 1087 | $result = true; |
1088 | 1088 | $container = 'wpshop_cpt_' . $identifier . ' ul.wpshop_tools_default_datas_repair_attribute_container'; |
1089 | - $excluded_column = array( 'available_values' ); |
|
1089 | + $excluded_column = array('available_values'); |
|
1090 | 1090 | |
1091 | - $file_uri = !empty( $custom_file ) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '-attributes.csv'; |
|
1092 | - if ( is_file( $file_uri ) ) { |
|
1091 | + $file_uri = !empty($custom_file) ? $custom_file : WPSHOP_TEMPLATES_DIR . 'default_datas/' . $identifier . '-attributes.csv'; |
|
1092 | + if (is_file($file_uri)) { |
|
1093 | 1093 | $entity_id = wpshop_entities::get_entity_identifier_from_code($identifier); |
1094 | 1094 | $csv_file_default_data = file($file_uri, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
1095 | 1095 | |
1096 | - $db_field_definition = explode( ";", $csv_file_default_data[0] ); |
|
1096 | + $db_field_definition = explode(";", $csv_file_default_data[0]); |
|
1097 | 1097 | $code_column = null; |
1098 | - foreach ( $db_field_definition as $column_index => $column_name ) { |
|
1099 | - if ( $column_name == 'code' ) { |
|
1098 | + foreach ($db_field_definition as $column_index => $column_name) { |
|
1099 | + if ($column_name == 'code') { |
|
1100 | 1100 | $code_column = $column_index; |
1101 | 1101 | continue; |
1102 | 1102 | } |
1103 | 1103 | } |
1104 | 1104 | unset($csv_file_default_data[0]); |
1105 | 1105 | |
1106 | - if ( !empty($code_column) || ($code_column == 0) ) { |
|
1107 | - foreach ( $csv_file_default_data as $line_index => $line_content ) { |
|
1108 | - $attribute_definition = explode( ";", $line_content ); |
|
1109 | - $query = $wpdb->prepare( "SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE code = %s AND entity_id = %d", $attribute_definition[$code_column], $entity_id); |
|
1106 | + if (!empty($code_column) || ($code_column == 0)) { |
|
1107 | + foreach ($csv_file_default_data as $line_index => $line_content) { |
|
1108 | + $attribute_definition = explode(";", $line_content); |
|
1109 | + $query = $wpdb->prepare("SELECT id FROM " . WPSHOP_DBT_ATTRIBUTE . " WHERE code = %s AND entity_id = %d", $attribute_definition[$code_column], $entity_id); |
|
1110 | 1110 | $attribute_identifier = $wpdb->get_var($query); |
1111 | 1111 | |
1112 | - if ( empty($attribute_identifier) ) { |
|
1112 | + if (empty($attribute_identifier)) { |
|
1113 | 1113 | $attribute_def = array(); |
1114 | 1114 | $attribute_values = $default_value = null; |
1115 | - foreach ( $db_field_definition as $column_index => $column_name ) { |
|
1115 | + foreach ($db_field_definition as $column_index => $column_name) { |
|
1116 | 1116 | $column_name = trim($column_name); |
1117 | - if ( !empty($column_name) && !in_array($column_name, $excluded_column) ) { |
|
1117 | + if (!empty($column_name) && !in_array($column_name, $excluded_column)) { |
|
1118 | 1118 | $column_value = $attribute_definition[$column_index]; |
1119 | - switch ( $column_name ) { |
|
1119 | + switch ($column_name) { |
|
1120 | 1120 | case 'frontend_label': |
1121 | - $column_value = __( $column_value, 'wpshop' ); |
|
1121 | + $column_value = __($column_value, 'wpshop'); |
|
1122 | 1122 | break; |
1123 | 1123 | } |
1124 | - $attribute_def[$column_name] = ( !empty($attribute_definition[$column_index]) ) ? $column_value : ''; |
|
1124 | + $attribute_def[$column_name] = (!empty($attribute_definition[$column_index])) ? $column_value : ''; |
|
1125 | 1125 | } |
1126 | 1126 | else { |
1127 | - switch ( $column_name ) { |
|
1127 | + switch ($column_name) { |
|
1128 | 1128 | case 'available_values': |
1129 | 1129 | $attribute_values = $attribute_definition[$column_index]; |
1130 | 1130 | break; |
1131 | 1131 | } |
1132 | 1132 | } |
1133 | 1133 | |
1134 | - switch ( $column_name ) { |
|
1134 | + switch ($column_name) { |
|
1135 | 1135 | case 'default_value': |
1136 | - $default_value = __( $attribute_definition[$column_index], 'wpshop' ); |
|
1136 | + $default_value = __($attribute_definition[$column_index], 'wpshop'); |
|
1137 | 1137 | break; |
1138 | 1138 | } |
1139 | 1139 | } |
@@ -1142,14 +1142,14 @@ discard block |
||
1142 | 1142 | $last_attribute_id = $wpdb->insert_id; |
1143 | 1143 | |
1144 | 1144 | /** Create values for select element */ |
1145 | - if ( !empty($attribute_values) ) { |
|
1146 | - $list_of_values_to_create = explode( ',', $attribute_values ); |
|
1147 | - if ( !empty($list_of_values_to_create) ) { |
|
1148 | - foreach ( $list_of_values_to_create as $value ) { |
|
1149 | - $value_element = explode( '!:!:!', $value); |
|
1150 | - $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'attribute_id' => $last_attribute_id, 'label' => __( $value_element[0], 'wpshop' ), 'value' => __( (!empty($value_element[1]) ? $value_element[1] : strtolower($value_element[0]) ), 'wpshop' ))); |
|
1151 | - |
|
1152 | - if ( $default_value == (!empty($value_element[1]) ? $value_element[1] : strtolower($value_element[0])) ) { |
|
1145 | + if (!empty($attribute_values)) { |
|
1146 | + $list_of_values_to_create = explode(',', $attribute_values); |
|
1147 | + if (!empty($list_of_values_to_create)) { |
|
1148 | + foreach ($list_of_values_to_create as $value) { |
|
1149 | + $value_element = explode('!:!:!', $value); |
|
1150 | + $wpdb->insert(WPSHOP_DBT_ATTRIBUTE_VALUES_OPTIONS, array('status' => 'valid', 'creation_date' => current_time('mysql', 0), 'attribute_id' => $last_attribute_id, 'label' => __($value_element[0], 'wpshop'), 'value' => __((!empty($value_element[1]) ? $value_element[1] : strtolower($value_element[0])), 'wpshop'))); |
|
1151 | + |
|
1152 | + if ($default_value == (!empty($value_element[1]) ? $value_element[1] : strtolower($value_element[0]))) { |
|
1153 | 1153 | $wpdb->update(WPSHOP_DBT_ATTRIBUTE, array('last_update_date' => current_time('mysql', 0), 'default_value' => $wpdb->insert_id), array('id' => $last_attribute_id, 'default_value' => $default_value)); |
1154 | 1154 | } |
1155 | 1155 | } |
@@ -1161,7 +1161,7 @@ discard block |
||
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - $check_cpt = wpshop_entities::check_default_cpt_attributes( $identifier, array(), false, $custom_file ); |
|
1164 | + $check_cpt = wpshop_entities::check_default_cpt_attributes($identifier, array(), false, $custom_file); |
|
1165 | 1165 | $output = $check_cpt[1]; |
1166 | 1166 | |
1167 | 1167 | return array($result, $container, $output); |
@@ -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 | |
@@ -12,36 +12,36 @@ discard block |
||
12 | 12 | * @package wpshop |
13 | 13 | * @subpackage librairies |
14 | 14 | */ |
15 | -class wpshop_attributes_custom_List_table extends WP_List_Table{ |
|
15 | +class wpshop_attributes_custom_List_table extends WP_List_Table { |
|
16 | 16 | var $datas; |
17 | 17 | |
18 | 18 | /** ************************************************************************ |
19 | 19 | * REQUIRED. Set up a constructor that references the parent constructor. We |
20 | 20 | * use the parent reference to set some default configs. |
21 | 21 | ***************************************************************************/ |
22 | - function __construct(){ |
|
22 | + function __construct() { |
|
23 | 23 | global $status, $page; |
24 | 24 | |
25 | 25 | //Set parent defaults |
26 | - parent::__construct( array( |
|
27 | - 'singular' => __('attribute\'s', 'wpshop'), //singular name of the listed records |
|
28 | - 'plural' => __('attributes\'', 'wpshop'), //plural name of the listed records |
|
26 | + parent::__construct(array( |
|
27 | + 'singular' => __('attribute\'s', 'wpshop'), //singular name of the listed records |
|
28 | + 'plural' => __('attributes\'', 'wpshop'), //plural name of the listed records |
|
29 | 29 | 'ajax' => true //does this table support ajax? |
30 | - ) ); |
|
30 | + )); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /* Allows to set different listings for attributes */ |
34 | - function get_views(){ |
|
34 | + function get_views() { |
|
35 | 35 | $wpshop_attribute_links = array(); |
36 | 36 | |
37 | 37 | $active_nb = wpshop_attributes::getElement('', "'valid'"); |
38 | 38 | $unactive_nb = wpshop_attributes::getElement('', "'moderated', 'notused'"); |
39 | 39 | $deleted_nb = wpshop_attributes::getElement('', "'deleted'"); |
40 | 40 | |
41 | - $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_valid'.(empty($_REQUEST['attribute_status'])?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING).'" >'.__('Used attributes', 'wpshop').' ('.count($active_nb).')</a>'; |
|
42 | - $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_moderated'.(!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status']=='unactive')?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING.'&attribute_status=unactive').'" >'.__('Unactive attributes', 'wpshop').' ('.count($unactive_nb).')</a>'; |
|
43 | - $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_deleted'.(!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status']=='deleted')?' current':'')] = '<a href="'.admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING.'&attribute_status=deleted').'" >'.__('Trashed attributes', 'wpshop').' ('.count($deleted_nb).')</a>'; |
|
44 | - $wpshop_attribute_links['unit_management_link'] = '<a href="#" id="wpshop_attribute_unit_manager_opener">'.__('Unit management', 'wpshop').'</a>'; |
|
41 | + $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_valid' . (empty($_REQUEST['attribute_status']) ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING) . '" >' . __('Used attributes', 'wpshop') . ' (' . count($active_nb) . ')</a>'; |
|
42 | + $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_moderated' . (!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status'] == 'unactive') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING . '&attribute_status=unactive') . '" >' . __('Unactive attributes', 'wpshop') . ' (' . count($unactive_nb) . ')</a>'; |
|
43 | + $wpshop_attribute_links['wpshop_attributes_links wpshop_attributes_links_deleted' . (!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status'] == 'deleted') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . WPSHOP_URL_SLUG_ATTRIBUTE_LISTING . '&attribute_status=deleted') . '" >' . __('Trashed attributes', 'wpshop') . ' (' . count($deleted_nb) . ')</a>'; |
|
44 | + $wpshop_attribute_links['unit_management_link'] = '<a href="#" id="wpshop_attribute_unit_manager_opener">' . __('Unit management', 'wpshop') . '</a>'; |
|
45 | 45 | $wpshop_attribute_links['unit_management_dialog'] = '<div id="wpshop_attribute_unit_manager"title="' . __('Unit management', 'wpshop') . '" class="wpshopHide" ><div class="loading_picture_container" id="product_chooser_picture" ><img src="' . WPSHOP_LOADING_ICON . '" alt="loading..." /></div></div>'; |
46 | 46 | return $wpshop_attribute_links; |
47 | 47 | } |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @see WP_List_Table::::single_row_columns() |
60 | 60 | * @return array An associative array containing column information: 'slugs'=>'Visible Titles' |
61 | 61 | **************************************************************************/ |
62 | - function get_columns(){ |
|
62 | + function get_columns() { |
|
63 | 63 | $columns = array( |
64 | - 'cb' => '',//'<input type="checkbox" />', //Render a checkbox instead of text |
|
64 | + 'cb' => '', //'<input type="checkbox" />', //Render a checkbox instead of text |
|
65 | 65 | 'id' => __('Id.', 'wpshop'), |
66 | 66 | 'name' => __('Name', 'wpshop'), |
67 | 67 | 'status' => __('Status', 'wpshop'), |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * @param array $column_name The name/slug of the column to be processed |
93 | 93 | * @return string Text or HTML to be placed inside the column <td> |
94 | 94 | **************************************************************************/ |
95 | - function column_default($item, $column_name){ |
|
96 | - switch($column_name){ |
|
95 | + function column_default($item, $column_name) { |
|
96 | + switch ($column_name) { |
|
97 | 97 | default: |
98 | - return print_r($item,true); //Show the whole array for troubleshooting purposes |
|
98 | + return print_r($item, true); //Show the whole array for troubleshooting purposes |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param array $item A singular item (one full row's worth of data) |
116 | 116 | * @return string Text to be placed inside the column <td> (movie title only) |
117 | 117 | **************************************************************************/ |
118 | - function column_id($item){ |
|
118 | + function column_id($item) { |
|
119 | 119 | return $item['id']; |
120 | 120 | } |
121 | 121 | /** ************************************************************************ |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $item A singular item (one full row's worth of data) |
135 | 135 | * @return string Text to be placed inside the column <td> (movie title only) |
136 | 136 | **************************************************************************/ |
137 | - function column_status($item){ |
|
137 | + function column_status($item) { |
|
138 | 138 | return __($item['status'], 'wpshop'); |
139 | 139 | } |
140 | 140 | /** ************************************************************************ |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @param array $item A singular item (one full row's worth of data) |
154 | 154 | * @return string Text to be placed inside the column <td> (movie title only) |
155 | 155 | **************************************************************************/ |
156 | - function column_code($item){ |
|
156 | + function column_code($item) { |
|
157 | 157 | return $item['code']; |
158 | 158 | } |
159 | 159 | /** ************************************************************************ |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | * @param array $item A singular item (one full row's worth of data) |
173 | 173 | * @return string Text to be placed inside the column <td> (movie title only) |
174 | 174 | **************************************************************************/ |
175 | - function column_entity($item){ |
|
176 | - return __($item['entity'],'wpshop'); |
|
175 | + function column_entity($item) { |
|
176 | + return __($item['entity'], 'wpshop'); |
|
177 | 177 | } |
178 | 178 | /** ************************************************************************ |
179 | 179 | * Recommended. This is a custom column method and is responsible for what |
@@ -191,27 +191,27 @@ discard block |
||
191 | 191 | * @param array $item A singular item (one full row's worth of data) |
192 | 192 | * @return string Text to be placed inside the column <td> (movie title only) |
193 | 193 | **************************************************************************/ |
194 | - function column_name($item){ |
|
194 | + function column_name($item) { |
|
195 | 195 | $attribute_undeletable = unserialize(WPSHOP_ATTRIBUTE_UNDELETABLE); |
196 | 196 | |
197 | - $link_format = admin_url('admin.php').'?page=%2$s&action=%3$s&id=%4$s'; |
|
198 | - $default_action='edit'; |
|
199 | - $default_action_text=__('Edit', 'wpshop'); |
|
200 | - if(!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status']=='deleted')){ |
|
201 | - $default_action='activate'; |
|
202 | - $default_action_text=__('Restore', 'wpshop'); |
|
197 | + $link_format = admin_url('admin.php') . '?page=%2$s&action=%3$s&id=%4$s'; |
|
198 | + $default_action = 'edit'; |
|
199 | + $default_action_text = __('Edit', 'wpshop'); |
|
200 | + if (!empty($_REQUEST['attribute_status']) && ($_REQUEST['attribute_status'] == 'deleted')) { |
|
201 | + $default_action = 'activate'; |
|
202 | + $default_action_text = __('Restore', 'wpshop'); |
|
203 | 203 | } |
204 | 204 | //Build row actions |
205 | 205 | $actions = array( |
206 | - 'edit' => sprintf('<a href="'.$link_format.'">'.$default_action_text.'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,$default_action,$item['id']) |
|
206 | + 'edit' => sprintf('<a href="' . $link_format . '">' . $default_action_text . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, $default_action, $item['id']) |
|
207 | 207 | ); |
208 | - if(empty($_REQUEST['attribute_status']) && (!in_array($item['code'], $attribute_undeletable))){ |
|
209 | - $actions['delete'] = sprintf('<a href="'.$link_format.'">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,'delete',$item['id']); |
|
208 | + if (empty($_REQUEST['attribute_status']) && (!in_array($item['code'], $attribute_undeletable))) { |
|
209 | + $actions['delete'] = sprintf('<a href="' . $link_format . '">' . __('Delete', 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, 'delete', $item['id']); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | //Return the title contents |
213 | 213 | return sprintf('%1$s%2$s', |
214 | - /*$1%s*/ sprintf('<a href="'.$link_format.'">'.__($item['name'], 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING,$default_action,$item['id']), |
|
214 | + /*$1%s*/ sprintf('<a href="' . $link_format . '">' . __($item['name'], 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_LISTING, $default_action, $item['id']), |
|
215 | 215 | /*$3%s*/ $this->row_actions($actions) |
216 | 216 | ); |
217 | 217 | } |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | * @param array $item A singular item (one full row's worth of data) |
225 | 225 | * @return string Text to be placed inside the column <td> (movie title only) |
226 | 226 | **************************************************************************/ |
227 | - function column_cb($item){ |
|
227 | + function column_cb($item) { |
|
228 | 228 | return ''; |
229 | 229 | return sprintf( |
230 | 230 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
231 | - /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie") |
|
231 | + /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie") |
|
232 | 232 | /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id |
233 | 233 | ); |
234 | 234 | } |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | **************************************************************************/ |
250 | 250 | function get_sortable_columns() { |
251 | 251 | $sortable_columns = array( |
252 | - 'name' => array('frontend_label',true), //true means its already sorted |
|
253 | - 'status' => array('status',true) |
|
252 | + 'name' => array('frontend_label', true), //true means its already sorted |
|
253 | + 'status' => array('status', true) |
|
254 | 254 | ); |
255 | 255 | return $sortable_columns; |
256 | 256 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | **************************************************************************/ |
286 | 286 | function process_bulk_action() { |
287 | 287 | //Detect when a bulk action is being triggered... |
288 | - if( 'delete'===$this->current_action() ) { |
|
288 | + if ('delete' === $this->current_action()) { |
|
289 | 289 | wp_die('Items deleted (or they would be if we had items to delete)!'); |
290 | 290 | } |
291 | 291 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | **************************************************************************/ |
307 | 307 | function prepare_items() { |
308 | 308 | /* First, lets decide how many records per page to show */ |
309 | - $per_page = 10;//$this->get_items_per_page('attributes_per_page', 10); |
|
309 | + $per_page = 10; //$this->get_items_per_page('attributes_per_page', 10); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * REQUIRED. Now we need to define our column headers. This includes a complete |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * to ensure that the data is trimmed to only the current page. We can use |
365 | 365 | * array_slice() to |
366 | 366 | */ |
367 | - $data = array_slice($data,(($current_page-1)*$per_page),$per_page); |
|
367 | + $data = array_slice($data, (($current_page - 1) * $per_page), $per_page); |
|
368 | 368 | |
369 | 369 | /** |
370 | 370 | * REQUIRED. Now we can add our *sorted* data to the items property, where |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | $this->items = $data; |
374 | 374 | |
375 | 375 | /* REQUIRED. We also have to register our pagination options & calculations. */ |
376 | - $this->set_pagination_args( array( |
|
377 | - 'total_items' => $total_items, //WE have to calculate the total number of items |
|
378 | - 'per_page' => $per_page, //WE have to determine how many items to show on a page |
|
379 | - 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages |
|
380 | - ) ); |
|
376 | + $this->set_pagination_args(array( |
|
377 | + 'total_items' => $total_items, //WE have to calculate the total number of items |
|
378 | + 'per_page' => $per_page, //WE have to determine how many items to show on a page |
|
379 | + 'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages |
|
380 | + )); |
|
381 | 381 | } |
382 | 382 | } |
@@ -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 | |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @package wpshop |
12 | 12 | * @subpackage librairies |
13 | 13 | */ |
14 | -class wpshop_attributes_set_custom_List_table extends WP_List_Table{ |
|
14 | +class wpshop_attributes_set_custom_List_table extends WP_List_Table { |
|
15 | 15 | |
16 | 16 | var $datas; |
17 | 17 | |
@@ -19,26 +19,26 @@ discard block |
||
19 | 19 | * REQUIRED. Set up a constructor that references the parent constructor. We |
20 | 20 | * use the parent reference to set some default configs. |
21 | 21 | ***************************************************************************/ |
22 | - function __construct(){ |
|
22 | + function __construct() { |
|
23 | 23 | global $status, $page; |
24 | 24 | |
25 | 25 | //Set parent defaults |
26 | - parent::__construct( array( |
|
27 | - 'singular' => __('attribute\'s set', 'wpshop'), //singular name of the listed records |
|
28 | - 'plural' => __('attributes\' set', 'wpshop'), //plural name of the listed records |
|
26 | + parent::__construct(array( |
|
27 | + 'singular' => __('attribute\'s set', 'wpshop'), //singular name of the listed records |
|
28 | + 'plural' => __('attributes\' set', 'wpshop'), //plural name of the listed records |
|
29 | 29 | 'ajax' => true //does this table support ajax? |
30 | - ) ); |
|
30 | + )); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /* Allows to set different listings for attributes */ |
34 | - function get_views(){ |
|
34 | + function get_views() { |
|
35 | 35 | $wpshop_attribute_links = array(); |
36 | 36 | |
37 | 37 | $active_nb = wpshop_attributes_set::getElement('', "'moderated','valid'"); |
38 | 38 | $deleted_nb = wpshop_attributes_set::getElement('', "'deleted'"); |
39 | 39 | |
40 | - $wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_valid'.(empty($_REQUEST['attribute_groups_status'])?' current':'')] = '<a href="'.admin_url('admin.php?page='.wpshop_attributes_set::getEditionSlug()).'" >'.__('Attribute groups', 'wpshop').' ('.count($active_nb).')</a>'; |
|
41 | - $wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_deleted'.(!empty($_REQUEST['attribute_groups_status']) && ($_REQUEST['attribute_groups_status']=='deleted')?' current':'')] = '<a href="'.admin_url('admin.php?page='.wpshop_attributes_set::getEditionSlug().'&attribute_groups_status=deleted').'" >'.__('Trashed attribute groups', 'wpshop').' ('.count($deleted_nb).')</a>'; |
|
40 | + $wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_valid' . (empty($_REQUEST['attribute_groups_status']) ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . wpshop_attributes_set::getEditionSlug()) . '" >' . __('Attribute groups', 'wpshop') . ' (' . count($active_nb) . ')</a>'; |
|
41 | + $wpshop_attribute_links['wpshop_attribute_groups_links wpshop_attribute_groups_links_deleted' . (!empty($_REQUEST['attribute_groups_status']) && ($_REQUEST['attribute_groups_status'] == 'deleted') ? ' current' : '')] = '<a href="' . admin_url('admin.php?page=' . wpshop_attributes_set::getEditionSlug() . '&attribute_groups_status=deleted') . '" >' . __('Trashed attribute groups', 'wpshop') . ' (' . count($deleted_nb) . ')</a>'; |
|
42 | 42 | |
43 | 43 | return $wpshop_attribute_links; |
44 | 44 | } |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | * @see WP_List_Table::::single_row_columns() |
57 | 57 | * @return array An associative array containing column information: 'slugs'=>'Visible Titles' |
58 | 58 | **************************************************************************/ |
59 | - function get_columns(){ |
|
59 | + function get_columns() { |
|
60 | 60 | $columns = array( |
61 | - 'cb' => '',//'<input type="checkbox" />', //Render a checkbox instead of text |
|
61 | + 'cb' => '', //'<input type="checkbox" />', //Render a checkbox instead of text |
|
62 | 62 | 'id' => 'Id.', |
63 | 63 | 'name' => 'Nom', |
64 | 64 | 'status' => 'Statut', |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * @param array $column_name The name/slug of the column to be processed |
90 | 90 | * @return string Text or HTML to be placed inside the column <td> |
91 | 91 | **************************************************************************/ |
92 | - function column_default($item, $column_name){ |
|
93 | - switch($column_name){ |
|
92 | + function column_default($item, $column_name) { |
|
93 | + switch ($column_name) { |
|
94 | 94 | default: |
95 | - return print_r($item,true); //Show the whole array for troubleshooting purposes |
|
95 | + return print_r($item, true); //Show the whole array for troubleshooting purposes |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param array $item A singular item (one full row's worth of data) |
113 | 113 | * @return string Text to be placed inside the column <td> (movie title only) |
114 | 114 | **************************************************************************/ |
115 | - function column_id($item){ |
|
115 | + function column_id($item) { |
|
116 | 116 | return $item['id']; |
117 | 117 | } |
118 | 118 | /** ************************************************************************ |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param array $item A singular item (one full row's worth of data) |
132 | 132 | * @return string Text to be placed inside the column <td> (movie title only) |
133 | 133 | **************************************************************************/ |
134 | - function column_status($item){ |
|
134 | + function column_status($item) { |
|
135 | 135 | return __($item['status'], 'wpshop'); |
136 | 136 | } |
137 | 137 | /** ************************************************************************ |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param array $item A singular item (one full row's worth of data) |
151 | 151 | * @return string Text to be placed inside the column <td> (movie title only) |
152 | 152 | **************************************************************************/ |
153 | - function column_content($item){ |
|
153 | + function column_content($item) { |
|
154 | 154 | return $item['content']; |
155 | 155 | } |
156 | 156 | /** ************************************************************************ |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @param array $item A singular item (one full row's worth of data) |
170 | 170 | * @return string Text to be placed inside the column <td> (movie title only) |
171 | 171 | **************************************************************************/ |
172 | - function column_entity($item){ |
|
173 | - return __($item['entity'],'wpshop'); |
|
172 | + function column_entity($item) { |
|
173 | + return __($item['entity'], 'wpshop'); |
|
174 | 174 | } |
175 | 175 | /** ************************************************************************ |
176 | 176 | * Recommended. This is a custom column method and is responsible for what |
@@ -188,22 +188,22 @@ discard block |
||
188 | 188 | * @param array $item A singular item (one full row's worth of data) |
189 | 189 | * @return string Text to be placed inside the column <td> (movie title only) |
190 | 190 | **************************************************************************/ |
191 | - function column_name($item){ |
|
191 | + function column_name($item) { |
|
192 | 192 | //Build row actions |
193 | - $default_action='edit'; |
|
194 | - $default_action_text=__('Edit', 'wpshop'); |
|
195 | - if(!empty($_REQUEST['attribute_groups_status']) && ($_REQUEST['attribute_groups_status']=='deleted')){ |
|
196 | - $default_action='activate'; |
|
197 | - $default_action_text=__('Restore', 'wpshop'); |
|
193 | + $default_action = 'edit'; |
|
194 | + $default_action_text = __('Edit', 'wpshop'); |
|
195 | + if (!empty($_REQUEST['attribute_groups_status']) && ($_REQUEST['attribute_groups_status'] == 'deleted')) { |
|
196 | + $default_action = 'activate'; |
|
197 | + $default_action_text = __('Restore', 'wpshop'); |
|
198 | 198 | } |
199 | - $actions['edit']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&action=%3$s&id=%4$s">'.$default_action_text.'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,$default_action,$item['id']); |
|
199 | + $actions['edit'] = sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&action=%3$s&id=%4$s">' . $default_action_text . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, $default_action, $item['id']); |
|
200 | 200 | |
201 | 201 | if (empty($_REQUEST['attribute_groups_status'])) |
202 | - $actions['delete']=sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&action=%3$s&id=%4$s">'.__('Delete', 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'delete',$item['id']); |
|
202 | + $actions['delete'] = sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&action=%3$s&id=%4$s">' . __('Delete', 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, 'delete', $item['id']); |
|
203 | 203 | |
204 | 204 | //Return the title contents |
205 | 205 | return sprintf('%1$s%2$s', |
206 | - /*$1%s*/ sprintf('<a href="'.admin_url('admin.php').'?page=%2$s&action=%3$s&id=%4$s">'.__($item['name'], 'wpshop').'</a>',WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING,'edit',$item['id']), |
|
206 | + /*$1%s*/ sprintf('<a href="' . admin_url('admin.php') . '?page=%2$s&action=%3$s&id=%4$s">' . __($item['name'], 'wpshop') . '</a>', WPSHOP_NEWTYPE_IDENTIFIER_ENTITIES, WPSHOP_URL_SLUG_ATTRIBUTE_SET_LISTING, 'edit', $item['id']), |
|
207 | 207 | /*$3%s*/ $this->row_actions($actions) |
208 | 208 | ); |
209 | 209 | } |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | * @param array $item A singular item (one full row's worth of data) |
217 | 217 | * @return string Text to be placed inside the column <td> (movie title only) |
218 | 218 | **************************************************************************/ |
219 | - function column_cb($item){ |
|
219 | + function column_cb($item) { |
|
220 | 220 | return ''; |
221 | 221 | return sprintf( |
222 | 222 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
223 | - /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie") |
|
223 | + /*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("movie") |
|
224 | 224 | /*$2%s*/ $item['id'] //The value of the checkbox should be the record's id |
225 | 225 | ); |
226 | 226 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | **************************************************************************/ |
277 | 277 | function process_bulk_action() { |
278 | 278 | //Detect when a bulk action is being triggered... |
279 | - if( 'delete'===$this->current_action() ) { |
|
279 | + if ('delete' === $this->current_action()) { |
|
280 | 280 | wp_die('Items deleted (or they would be if we had items to delete)!'); |
281 | 281 | } |
282 | 282 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * to ensure that the data is trimmed to only the current page. We can use |
356 | 356 | * array_slice() to |
357 | 357 | */ |
358 | - $data = array_slice($data,(($current_page-1)*$per_page),$per_page); |
|
358 | + $data = array_slice($data, (($current_page - 1) * $per_page), $per_page); |
|
359 | 359 | |
360 | 360 | /** |
361 | 361 | * REQUIRED. Now we can add our *sorted* data to the items property, where |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | /** |
367 | 367 | * REQUIRED. We also have to register our pagination options & calculations. |
368 | 368 | */ |
369 | - $this->set_pagination_args( array( |
|
370 | - 'total_items' => $total_items, //WE have to calculate the total number of items |
|
371 | - 'per_page' => $per_page, //WE have to determine how many items to show on a page |
|
372 | - 'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages |
|
373 | - ) ); |
|
369 | + $this->set_pagination_args(array( |
|
370 | + 'total_items' => $total_items, //WE have to calculate the total number of items |
|
371 | + 'per_page' => $per_page, //WE have to determine how many items to show on a page |
|
372 | + 'total_pages' => ceil($total_items / $per_page) //WE have to calculate the total number of pages |
|
373 | + )); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | } |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helveticaBI']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, |
|
6 | - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, |
|
8 | - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, |
|
14 | - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helveticaBI'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>333, '"'=>474, '#'=>556, '$'=>556, '%'=>889, '&'=>722, '\''=>238, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>333, ';'=>333, '<'=>584, '='=>584, '>'=>584, '?'=>611, '@'=>975, 'A'=>722, |
|
6 | + 'B'=>722, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>556, 'K'=>722, 'L'=>611, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>584, '_'=>556, '`'=>333, 'a'=>556, 'b'=>611, 'c'=>556, 'd'=>611, 'e'=>556, 'f'=>333, 'g'=>611, 'h'=>611, 'i'=>278, 'j'=>278, 'k'=>556, 'l'=>278, 'm'=>889, |
|
8 | + 'n'=>611, 'o'=>611, 'p'=>611, 'q'=>611, 'r'=>389, 's'=>556, 't'=>333, 'u'=>611, 'v'=>556, 'w'=>778, 'x'=>556, 'y'=>556, 'z'=>500, '{'=>389, '|'=>280, '}'=>389, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>278, chr(131)=>556, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>278, chr(146)=>278, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>556, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>280, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>611, chr(182)=>556, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>556, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>611, chr(241)=>611, |
|
14 | + chr(242)=>611, chr(243)=>611, chr(244)=>611, chr(245)=>611, chr(246)=>611, chr(247)=>584, chr(248)=>611, chr(249)=>611, chr(250)=>611, chr(251)=>611, chr(252)=>611, chr(253)=>556, chr(254)=>611, chr(255)=>556); |
|
15 | 15 | ?> |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['times']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, |
|
6 | - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, |
|
8 | - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['times'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>408, '#'=>500, '$'=>500, '%'=>833, '&'=>778, '\''=>180, '('=>333, ')'=>333, '*'=>500, '+'=>564, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>278, ';'=>278, '<'=>564, '='=>564, '>'=>564, '?'=>444, '@'=>921, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>667, 'D'=>722, 'E'=>611, 'F'=>556, 'G'=>722, 'H'=>722, 'I'=>333, 'J'=>389, 'K'=>722, 'L'=>611, 'M'=>889, 'N'=>722, 'O'=>722, 'P'=>556, 'Q'=>722, 'R'=>667, 'S'=>556, 'T'=>611, 'U'=>722, 'V'=>722, 'W'=>944, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>611, '['=>333, '\\'=>278, ']'=>333, '^'=>469, '_'=>500, '`'=>333, 'a'=>444, 'b'=>500, 'c'=>444, 'd'=>500, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>500, 'i'=>278, 'j'=>278, 'k'=>500, 'l'=>278, 'm'=>778, |
|
8 | + 'n'=>500, 'o'=>500, 'p'=>500, 'q'=>500, 'r'=>333, 's'=>389, 't'=>278, 'u'=>500, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>480, '|'=>200, '}'=>480, '~'=>541, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>444, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>889, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>444, chr(148)=>444, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>980, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>200, chr(167)=>500, chr(168)=>333, chr(169)=>760, chr(170)=>276, chr(171)=>500, chr(172)=>564, chr(173)=>333, chr(174)=>760, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>564, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>500, chr(182)=>453, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>310, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>444, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>889, chr(199)=>667, chr(200)=>611, chr(201)=>611, chr(202)=>611, chr(203)=>611, chr(204)=>333, chr(205)=>333, chr(206)=>333, chr(207)=>333, chr(208)=>722, chr(209)=>722, chr(210)=>722, chr(211)=>722, chr(212)=>722, chr(213)=>722, chr(214)=>722, chr(215)=>564, chr(216)=>722, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>556, chr(223)=>500, chr(224)=>444, chr(225)=>444, chr(226)=>444, chr(227)=>444, chr(228)=>444, chr(229)=>444, chr(230)=>667, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>500, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>564, chr(248)=>500, chr(249)=>500, chr(250)=>500, chr(251)=>500, chr(252)=>500, chr(253)=>500, chr(254)=>500, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['timesB']=array( |
|
3 | - chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, |
|
4 | - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, |
|
5 | - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, |
|
7 | - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, |
|
8 | - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, |
|
9 | - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, |
|
14 | - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['timesB'] = array( |
|
3 | + chr(0)=>250, chr(1)=>250, chr(2)=>250, chr(3)=>250, chr(4)=>250, chr(5)=>250, chr(6)=>250, chr(7)=>250, chr(8)=>250, chr(9)=>250, chr(10)=>250, chr(11)=>250, chr(12)=>250, chr(13)=>250, chr(14)=>250, chr(15)=>250, chr(16)=>250, chr(17)=>250, chr(18)=>250, chr(19)=>250, chr(20)=>250, chr(21)=>250, |
|
4 | + chr(22)=>250, chr(23)=>250, chr(24)=>250, chr(25)=>250, chr(26)=>250, chr(27)=>250, chr(28)=>250, chr(29)=>250, chr(30)=>250, chr(31)=>250, ' '=>250, '!'=>333, '"'=>555, '#'=>500, '$'=>500, '%'=>1000, '&'=>833, '\''=>278, '('=>333, ')'=>333, '*'=>500, '+'=>570, |
|
5 | + ','=>250, '-'=>333, '.'=>250, '/'=>278, '0'=>500, '1'=>500, '2'=>500, '3'=>500, '4'=>500, '5'=>500, '6'=>500, '7'=>500, '8'=>500, '9'=>500, ':'=>333, ';'=>333, '<'=>570, '='=>570, '>'=>570, '?'=>500, '@'=>930, 'A'=>722, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>778, 'I'=>389, 'J'=>500, 'K'=>778, 'L'=>667, 'M'=>944, 'N'=>722, 'O'=>778, 'P'=>611, 'Q'=>778, 'R'=>722, 'S'=>556, 'T'=>667, 'U'=>722, 'V'=>722, 'W'=>1000, |
|
7 | + 'X'=>722, 'Y'=>722, 'Z'=>667, '['=>333, '\\'=>278, ']'=>333, '^'=>581, '_'=>500, '`'=>333, 'a'=>500, 'b'=>556, 'c'=>444, 'd'=>556, 'e'=>444, 'f'=>333, 'g'=>500, 'h'=>556, 'i'=>278, 'j'=>333, 'k'=>556, 'l'=>278, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>500, 'p'=>556, 'q'=>556, 'r'=>444, 's'=>389, 't'=>333, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>444, '{'=>394, '|'=>220, '}'=>394, '~'=>520, chr(127)=>350, chr(128)=>500, chr(129)=>350, chr(130)=>333, chr(131)=>500, |
|
9 | + chr(132)=>500, chr(133)=>1000, chr(134)=>500, chr(135)=>500, chr(136)=>333, chr(137)=>1000, chr(138)=>556, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>667, chr(143)=>350, chr(144)=>350, chr(145)=>333, chr(146)=>333, chr(147)=>500, chr(148)=>500, chr(149)=>350, chr(150)=>500, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>389, chr(155)=>333, chr(156)=>722, chr(157)=>350, chr(158)=>444, chr(159)=>722, chr(160)=>250, chr(161)=>333, chr(162)=>500, chr(163)=>500, chr(164)=>500, chr(165)=>500, chr(166)=>220, chr(167)=>500, chr(168)=>333, chr(169)=>747, chr(170)=>300, chr(171)=>500, chr(172)=>570, chr(173)=>333, chr(174)=>747, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>570, chr(178)=>300, chr(179)=>300, chr(180)=>333, chr(181)=>556, chr(182)=>540, chr(183)=>250, chr(184)=>333, chr(185)=>300, chr(186)=>330, chr(187)=>500, chr(188)=>750, chr(189)=>750, chr(190)=>750, chr(191)=>500, chr(192)=>722, chr(193)=>722, chr(194)=>722, chr(195)=>722, chr(196)=>722, chr(197)=>722, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>389, chr(205)=>389, chr(206)=>389, chr(207)=>389, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>570, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>722, chr(222)=>611, chr(223)=>556, chr(224)=>500, chr(225)=>500, chr(226)=>500, chr(227)=>500, chr(228)=>500, chr(229)=>500, chr(230)=>722, chr(231)=>444, chr(232)=>444, chr(233)=>444, chr(234)=>444, chr(235)=>444, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>500, chr(241)=>556, |
|
14 | + chr(242)=>500, chr(243)=>500, chr(244)=>500, chr(245)=>500, chr(246)=>500, chr(247)=>570, chr(248)=>500, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |
@@ -1,15 +1,15 @@ |
||
1 | -<?php if ( !defined( 'ABSPATH' ) ) exit; |
|
2 | -$fpdf_charwidths['helvetica']=array( |
|
3 | - chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, |
|
4 | - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, |
|
5 | - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, |
|
6 | - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, |
|
7 | - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, |
|
8 | - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, |
|
9 | - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, |
|
10 | - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, |
|
11 | - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, |
|
12 | - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, |
|
13 | - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, |
|
14 | - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); |
|
1 | +<?php if (!defined('ABSPATH')) exit; |
|
2 | +$fpdf_charwidths['helvetica'] = array( |
|
3 | + chr(0)=>278, chr(1)=>278, chr(2)=>278, chr(3)=>278, chr(4)=>278, chr(5)=>278, chr(6)=>278, chr(7)=>278, chr(8)=>278, chr(9)=>278, chr(10)=>278, chr(11)=>278, chr(12)=>278, chr(13)=>278, chr(14)=>278, chr(15)=>278, chr(16)=>278, chr(17)=>278, chr(18)=>278, chr(19)=>278, chr(20)=>278, chr(21)=>278, |
|
4 | + chr(22)=>278, chr(23)=>278, chr(24)=>278, chr(25)=>278, chr(26)=>278, chr(27)=>278, chr(28)=>278, chr(29)=>278, chr(30)=>278, chr(31)=>278, ' '=>278, '!'=>278, '"'=>355, '#'=>556, '$'=>556, '%'=>889, '&'=>667, '\''=>191, '('=>333, ')'=>333, '*'=>389, '+'=>584, |
|
5 | + ','=>278, '-'=>333, '.'=>278, '/'=>278, '0'=>556, '1'=>556, '2'=>556, '3'=>556, '4'=>556, '5'=>556, '6'=>556, '7'=>556, '8'=>556, '9'=>556, ':'=>278, ';'=>278, '<'=>584, '='=>584, '>'=>584, '?'=>556, '@'=>1015, 'A'=>667, |
|
6 | + 'B'=>667, 'C'=>722, 'D'=>722, 'E'=>667, 'F'=>611, 'G'=>778, 'H'=>722, 'I'=>278, 'J'=>500, 'K'=>667, 'L'=>556, 'M'=>833, 'N'=>722, 'O'=>778, 'P'=>667, 'Q'=>778, 'R'=>722, 'S'=>667, 'T'=>611, 'U'=>722, 'V'=>667, 'W'=>944, |
|
7 | + 'X'=>667, 'Y'=>667, 'Z'=>611, '['=>278, '\\'=>278, ']'=>278, '^'=>469, '_'=>556, '`'=>333, 'a'=>556, 'b'=>556, 'c'=>500, 'd'=>556, 'e'=>556, 'f'=>278, 'g'=>556, 'h'=>556, 'i'=>222, 'j'=>222, 'k'=>500, 'l'=>222, 'm'=>833, |
|
8 | + 'n'=>556, 'o'=>556, 'p'=>556, 'q'=>556, 'r'=>333, 's'=>500, 't'=>278, 'u'=>556, 'v'=>500, 'w'=>722, 'x'=>500, 'y'=>500, 'z'=>500, '{'=>334, '|'=>260, '}'=>334, '~'=>584, chr(127)=>350, chr(128)=>556, chr(129)=>350, chr(130)=>222, chr(131)=>556, |
|
9 | + chr(132)=>333, chr(133)=>1000, chr(134)=>556, chr(135)=>556, chr(136)=>333, chr(137)=>1000, chr(138)=>667, chr(139)=>333, chr(140)=>1000, chr(141)=>350, chr(142)=>611, chr(143)=>350, chr(144)=>350, chr(145)=>222, chr(146)=>222, chr(147)=>333, chr(148)=>333, chr(149)=>350, chr(150)=>556, chr(151)=>1000, chr(152)=>333, chr(153)=>1000, |
|
10 | + chr(154)=>500, chr(155)=>333, chr(156)=>944, chr(157)=>350, chr(158)=>500, chr(159)=>667, chr(160)=>278, chr(161)=>333, chr(162)=>556, chr(163)=>556, chr(164)=>556, chr(165)=>556, chr(166)=>260, chr(167)=>556, chr(168)=>333, chr(169)=>737, chr(170)=>370, chr(171)=>556, chr(172)=>584, chr(173)=>333, chr(174)=>737, chr(175)=>333, |
|
11 | + chr(176)=>400, chr(177)=>584, chr(178)=>333, chr(179)=>333, chr(180)=>333, chr(181)=>556, chr(182)=>537, chr(183)=>278, chr(184)=>333, chr(185)=>333, chr(186)=>365, chr(187)=>556, chr(188)=>834, chr(189)=>834, chr(190)=>834, chr(191)=>611, chr(192)=>667, chr(193)=>667, chr(194)=>667, chr(195)=>667, chr(196)=>667, chr(197)=>667, |
|
12 | + chr(198)=>1000, chr(199)=>722, chr(200)=>667, chr(201)=>667, chr(202)=>667, chr(203)=>667, chr(204)=>278, chr(205)=>278, chr(206)=>278, chr(207)=>278, chr(208)=>722, chr(209)=>722, chr(210)=>778, chr(211)=>778, chr(212)=>778, chr(213)=>778, chr(214)=>778, chr(215)=>584, chr(216)=>778, chr(217)=>722, chr(218)=>722, chr(219)=>722, |
|
13 | + chr(220)=>722, chr(221)=>667, chr(222)=>667, chr(223)=>611, chr(224)=>556, chr(225)=>556, chr(226)=>556, chr(227)=>556, chr(228)=>556, chr(229)=>556, chr(230)=>889, chr(231)=>500, chr(232)=>556, chr(233)=>556, chr(234)=>556, chr(235)=>556, chr(236)=>278, chr(237)=>278, chr(238)=>278, chr(239)=>278, chr(240)=>556, chr(241)=>556, |
|
14 | + chr(242)=>556, chr(243)=>556, chr(244)=>556, chr(245)=>556, chr(246)=>556, chr(247)=>584, chr(248)=>611, chr(249)=>556, chr(250)=>556, chr(251)=>556, chr(252)=>556, chr(253)=>500, chr(254)=>556, chr(255)=>500); |
|
15 | 15 | ?> |