PluginProbe
Image Hotspot – Map Image Annotation / 3.4
Image Hotspot – Map Image Annotation v3.4
3.8 3.7 3.6 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 All 30 releases
image-map-hotspots / settings / save.php

save.php in Image Hotspot – Map Image Annotation 3.4, at settings/save.php

38 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!empty($_POST['update_style_change']) && $_POST['update_style_change'] == 'Save' && $_POST['id'] != '') {
3 $nonce = $_REQUEST['_wpnonce'];
4 if (!wp_verify_nonce($nonce, 'imh_6310_nonce_field_form')) {
5 die('You do not have sufficient permissions to access this pagess.');
6 } else {
7 $id = sanitize_text_field($_POST['id']);
8 $name = sanitize_text_field($_POST['name']);
9 $css = imh_6310_extract_data($_POST);
10 if ($id) {
11 $wpdb->query($wpdb->prepare("UPDATE $style_table SET name = %s, css = %s WHERE id = %d", $name, $css, $id));
12 } else {
13 $wpdb->query($wpdb->prepare("INSERT into $style_table SET name = %s, css = %s", $name, $css));
14 $redirect_id = $wpdb->insert_id;
15 $url = admin_url("admin.php?page=imh-6310-image-map-hotspot&action=preview&styleid=$redirect_id");
16 wp_register_script('imh-6310-redirect-script', '');
17 wp_enqueue_script('imh-6310-redirect-script');
18 wp_add_inline_script('imh-6310-redirect-script', "document.location.href = '" . $url . "';");
19 }
20 }
21 }
22 $cssData = [];
23 if ($ids) {
24 $styledata = $wpdb->get_row($wpdb->prepare("SELECT * FROM $style_table WHERE id = %d ", $ids), ARRAY_A);
25 $css = explode("!!##!!", $styledata['css']);
26 $key = explode(",", $css[0]);
27 $value = explode("||##||", $css[1]);
28 $filterKey = [];
29 $filterValue = [];
30 for ($i = 0; $i < count($key); $i++) {
31 $filterKey[] = esc_attr($key[$i]);
32 }
33 for ($i = 0; $i < count($value); $i++) {
34 $filterValue[] = esc_attr($value[$i]);
35 }
36 $cssData = array_combine($filterKey, $filterValue);
37 }
38 $jsonData = isset($cssData['json_data']) ? json_decode(stripslashes(html_entity_decode($cssData['json_data']))) : [];