PluginProbe
Image Hotspot – Map Image Annotation / 2.5
Image Hotspot – Map Image Annotation v2.5
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 / home.php

home.php in Image Hotspot – Map Image Annotation 2.5, at home.php

64 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (! defined('ABSPATH')) {
3 exit;
4 }
5 if (! current_user_can('manage_options')) {
6 wp_die(__('You do not have sufficient permissions to access this page.'));
7 }
8
9 if (! empty($_POST['delete']) && isset($_POST['id']) && is_numeric($_POST['id'])) {
10 $nonce = $_REQUEST['_wpnonce'];
11 if (! wp_verify_nonce($nonce, 'tss_nonce_field_delete')) {
12 die('You do not have sufficient permissions to access this page.');
13 } else {
14 $id = (int) sanitize_text_field($_POST['id']);
15 $wpdb->query($wpdb->prepare("DELETE FROM {$style_table} WHERE id = %d", $id));
16 }
17 }
18 if (!empty($_POST['duplicate']) && isset($_POST['id']) && is_numeric($_POST['id'])) {
19 $nonce = $_REQUEST['_wpnonce'];
20 if (!wp_verify_nonce($nonce, 'imh_6310_nonce_field_duplicate')) {
21 die('You do not have sufficient permissions to access this page.');
22 } else {
23 $id = (int) $_POST['id'];
24 $selectedData = $wpdb->get_row($wpdb->prepare("SELECT * FROM $style_table WHERE id = %d ", $id), ARRAY_A);
25 $dupList = array(
26 $selectedData['name'],
27 $selectedData['style_name'],
28 $selectedData['css'],
29 $selectedData['itemids']);
30 $wpdb->query($wpdb->prepare("INSERT INTO {$style_table} (name, style_name, css,itemids) VALUES ( %s, %s, %s, %s )", $dupList));
31 }
32 }
33
34 ?>
35
36 <h3 style="display: flex; width: 100%;">Image Map Annotation/Hotspot</h3>
37 <button class="imh-6310-btn-success imh-6310-add-new-button"><a href="<?php echo admin_url("admin.php?page=imh-6310-image-map-hotspot&action=preview") ?>">Add New</a></button>
38
39 <table class="imh-6310-table">
40 <tr style="background-color: #f5f5f5">
41 <td style="width: 130px">Service Name</td>
42 <td>Shortcode</td>
43 <td style="width: 130px">Manage</td>
44 </tr>
45 <?php
46 $data = $wpdb->get_results('SELECT * FROM '.$style_table.' ORDER BY id DESC', ARRAY_A);
47 foreach ($data as $value) {
48 echo '<tr class="imh-6310-row-select">';
49 echo '<td>'.imh_6310_replace(esc_attr($value['name'])).'</td>';
50 echo '<td><span>Shortcode <input type="text" class="imh-6310-6330-shortcode" onclick="this.setSelectionRange(0, this.value.length)" value="[imh_6310_image_map id=&quot;'.esc_attr($value['id']).'&quot;]"></span>';
51 echo '<td>
52 <a href="'.admin_url("admin.php?page=imh-6310-image-map-hotspot&action=preview&styleid=".esc_attr($value['id'])).'" title="Edit" class=" imh-6310-margin-right-10 imh-6310-first"><button class="imh-6310-btn-success"><i class="fas fa-edit" aria-hidden="true"></i></button></a>
53
54 <form method="post">
55 '.wp_nonce_field('tss_nonce_field_delete').'
56 <input type="hidden" name="id" value="'.esc_attr($value['id']).'">
57 <button class="imh-6310-btn-danger imh-6310-third" title="Delete" type="submit" value="delete" name="delete" onclick="return confirm(\'Do you want to delete?\');"><i class="far fa-times-circle" aria-hidden="true"></i></button>
58 </form>
59
60 </td>';
61 echo ' </tr>';
62 }
63 ?>
64 </table>