PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 3.1.4
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v3.1.4
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
← All changes | includes/builder/builder-cpt.php +24 -19 3.1.03.1.4 View file →
@@ -65,14 +65,12 @@
65 65 if (! $q->template_type) {
66 66 continue;
67 67 }
68 68
69 - $optionKey = Meta::TEMPLATE_ID . $q->template_type;
70 -
71 69 if ($q->post_status == 'publish') {
72 - update_option($optionKey, $q->ID);
70 + Meta::update_template_option($q->template_type, $q->ID);
73 71 } else {
74 - delete_option($optionKey, $q->ID);
72 + Meta::delete_template_option($q->template_type);
75 73 }
76 74 }
77 75 }
78 76
@@ -81,9 +79,9 @@
81 79 return;
82 80 }
83 81
84 82 if ($template = get_post_meta($postId, Meta::TEMPLATE_TYPE, true)) {
85 - delete_option(Meta::TEMPLATE_ID . $template);
83 + Meta::delete_template_option($template);
86 84 }
87 85 }
88 86
89 87 public function post_row_actions_filter($actions, $post) {
@@ -149,9 +147,12 @@
149 147 return array_slice($actions, 0, 1, true) + ['usk-edit-action' => $editActionLink] + array_slice($actions, 1, null, true);
150 148 }
151 149
152 150 public function set_post_columns($columns) {
153 - return array_slice($columns, 0, 2, true) + ['template_type' => 'Type', 'is_enabled' => 'Status'] + array_slice($columns, 2, null, true);
151 + return array_slice($columns, 0, 2, true) + [
152 + 'template_type' => esc_html__('Type', 'ultimate-store-kit'),
153 + 'is_enabled' => esc_html__('Status', 'ultimate-store-kit')
154 + ] + array_slice($columns, 2, null, true);
154 155 }
155 156
156 157 public function set_custom_column_value($column, $post_id) {
157 158 $templateType = get_post_meta(
@@ -168,9 +169,11 @@
168 169 echo ' <strong>-- ' . esc_html(ucwords($postType->name)) . '</strong>';
169 170 }
170 171 break;
171 172 case 'is_enabled':
172 - echo (Builder_Template_Helper::getTemplateId($templateType) == $post_id ? 'Active' : 'Inactive');
173 + echo Builder_Template_Helper::getTemplateId($templateType) == $post_id
174 + ? esc_html__('Active', 'ultimate-store-kit')
175 + : esc_html__('Inactive', 'ultimate-store-kit');
173 176 break;
174 177 }
175 178 }
176 179
@@ -180,10 +183,10 @@
180 183 if ($typenow !== Meta::POST_TYPE) {
181 184 return;
182 185 }
183 186
184 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Repopulates the admin list-table filter dropdown; nothing is written.
185 - $selected = isset($_GET['type']) ? sanitize_key(wp_unslash($_GET['type'])) : '';
187 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only admin list-table filter; the value only re-selects the current dropdown option.
188 + $selected = isset($_GET['type']) ? sanitize_text_field(wp_unslash($_GET['type'])) : '';
186 189 ?>
187 190 <select name="type" id="type">
188 191 <option value="all" <?php
189 192 selected('all', $selected); ?>><?php
@@ -251,11 +254,15 @@
251 254 && isset($_GET['type'])
252 255 && $_GET['type'] != ''
253 256 && $_GET['type'] != 'all'
254 257 ) {
255 - $query->query_vars['meta_key'] = Meta::TEMPLATE_TYPE;
256 - $query->query_vars['meta_value'] = sanitize_key(wp_unslash($_GET['type']));
257 - $query->query_vars['meta_compare'] = '=';
258 + $requested_type = sanitize_text_field(wp_unslash($_GET['type']));
259 +
260 + if (Builder_Template_Helper::getTemplateByIndex($requested_type)) {
261 + $query->query_vars['meta_key'] = Meta::TEMPLATE_TYPE;
262 + $query->query_vars['meta_value'] = $requested_type;
263 + $query->query_vars['meta_compare'] = '=';
264 + }
258 265 }
259 266 // phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.DB.SlowDBQuery
260 267 }
261 268
@@ -281,9 +288,9 @@
281 288 }
282 289
283 290 $templateId = isset($data['template_id']) ? absint($data['template_id']) : 0;
284 291 $name = isset($data['template_name']) ? sanitize_text_field($data['template_name']) : '';
285 - $type = isset($data['template_type']) ? sanitize_key($data['template_type']) : '';
292 + $type = isset($data['template_type']) ? sanitize_text_field($data['template_type']) : '';
286 293 $editWith = isset($data['edit_with']) ? sanitize_key($data['edit_with']) : 'elementor'; //gutenberg
287 294 $isEnabled = (isset($data['template_status']) && $data['template_status']) == 1 ? 1 : 0;
288 295
289 296 // Only these two editors are ever handled below, and the value ends up in a
@@ -332,14 +339,13 @@
332 339 }
333 340
334 341 $post_id = wp_insert_post($page_data);
335 342
336 - $enabledTemplate = strtolower(Meta::TEMPLATE_ID . $type);
337 343 if ($isEnabled == 1) {
338 - update_option($enabledTemplate, $post_id);
344 + Meta::update_template_option($type, $post_id);
339 345 } else {
340 - if (get_option($enabledTemplate) == $post_id) {
341 - delete_option($enabledTemplate);
346 + if (Meta::get_template_option($type) == $post_id) {
347 + Meta::delete_template_option($type);
342 348 }
343 349 }
344 350
345 351
@@ -391,10 +397,9 @@
391 397 $meta = get_post_meta($templateData->ID);
392 398
393 399
394 400 $templateType = isset($meta[Meta::TEMPLATE_TYPE][0]) ? $meta[Meta::TEMPLATE_TYPE][0] : '';
395 - $enabledTemplate = strtolower(Meta::TEMPLATE_ID . $templateType);
396 - $enabledTemplate = get_option($enabledTemplate);
401 + $enabledTemplate = Meta::get_template_option($templateType);
397 402
398 403 wp_send_json_success([
399 404 'id' => $templateData->ID,
400 405 'name' => $templateData->post_title,