PluginProbe
Image Hotspot – Map Image Annotation / trunk
Image Hotspot – Map Image Annotation vtrunk
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 trunk, at settings/save.php

39 lines 1.8 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 $display_type = sanitize_text_field($_POST['display_type']);
10 $css = imh_6310_extract_data($_POST);
11 if ($id) {
12 $wpdb->query($wpdb->prepare("UPDATE $style_table SET name = %s, display_type = %d, css = %s WHERE id = %d", $name, $display_type, $css, $id));
13 } else {
14 $wpdb->query($wpdb->prepare("INSERT into $style_table SET name = %s, display_type = %d,css = %s", $name, $display_type, $css));
15 $redirect_id = $wpdb->insert_id;
16 $url = admin_url("admin.php?page=imh-6310-image-map-hotspot&action=preview&styleid=$redirect_id");
17 wp_register_script('imh-6310-redirect-script', '');
18 wp_enqueue_script('imh-6310-redirect-script');
19 wp_add_inline_script('imh-6310-redirect-script', "document.location.href = '" . $url . "';");
20 }
21 }
22 }
23 $cssData = [];
24 if ($ids) {
25 $styledata = $wpdb->get_row($wpdb->prepare("SELECT * FROM $style_table WHERE id = %d ", $ids), ARRAY_A);
26 $css = explode("!!##!!", $styledata['css']);
27 $key = explode(",", $css[0]);
28 $value = explode("||##||", $css[1]);
29 $filterKey = [];
30 $filterValue = [];
31 for ($i = 0; $i < count($key); $i++) {
32 $filterKey[] = esc_attr($key[$i]);
33 }
34 for ($i = 0; $i < count($value); $i++) {
35 $filterValue[] = esc_attr($value[$i]);
36 }
37 $cssData = array_combine($filterKey, $filterValue);
38 }
39 $jsonData = isset($cssData['json_data']) ? json_decode(stripslashes(html_entity_decode($cssData['json_data']))) : [];