interactive-image-map-builder
Last commit date
assets
3 months ago
settings
3 months ago
functions.php
3 months ago
header.php
2 years ago
home.php
1 year ago
index.php
6 hours ago
license.php
2 years ago
output-common-css.css
10 months ago
output-css.php
2 years ago
readme.txt
6 hours ago
shortcode.php
1 year ago
template-menu.php
2 years ago
home.php
66 lines
| 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, 'tss_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'] . ' - copy', |
| 27 | $selectedData['css']); |
| 28 | $wpdb->query($wpdb->prepare("INSERT INTO {$style_table} (name, css) VALUES ( %s, %s )", $dupList)); |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | ?> |
| 33 | |
| 34 | <h3>Image builder</h3> |
| 35 | <button class="isimb-6310-btn-success isimb-6310-add-new-button"><a href="<?php echo admin_url("admin.php?page=isimb-6310-image-map-builder&action=preview") ?>">Add New</a></button> |
| 36 | |
| 37 | <table class="isimb-6310-table"> |
| 38 | <tr style="background-color: #f5f5f5"> |
| 39 | <td style="width: 250px">Service Name</td> |
| 40 | <td>Shortcode</td> |
| 41 | <td style="width: 160px">Manage</td> |
| 42 | </tr> |
| 43 | <?php |
| 44 | $data = $wpdb->get_results('SELECT * FROM '.$style_table.' ORDER BY id DESC', ARRAY_A); |
| 45 | foreach ($data as $value) { |
| 46 | echo '<tr class="isimb-6310-row-select">'; |
| 47 | echo '<td>'.isimb_6310_replace(esc_attr($value['name'])).'</td>'; |
| 48 | echo '<td><span>Shortcode <input type="text" class="isimb-6310-6330-shortcode" onclick="this.setSelectionRange(0, this.value.length)" value="[isimb_6310_builder id="'.esc_attr($value['id']).'"]"></span>'; |
| 49 | echo '<td> |
| 50 | <a href="'.admin_url("admin.php?page=isimb-6310-image-map-builder&action=preview&styleid=".esc_attr($value['id'])).'" title="Edit" class="isimb-6310-btn-success isimb-6310-margin-right-10 isimb-6310-first"><i class="fas fa-edit" aria-hidden="true"></i></a> |
| 51 | <form method="post"> |
| 52 | '.wp_nonce_field('tss_nonce_field_duplicate').' |
| 53 | <input type="hidden" name="id" value="'.esc_attr($value['id']).'"> |
| 54 | <button class="isimb-6310-btn-success isimb-6310-first" title="Duplicate" type="submit" value="duplicate" name="duplicate" onclick="return confirm(\'Do you want to duplicate it?\');"><i class="fas fa-clone" aria-hidden="true"></i></button> |
| 55 | </form> |
| 56 | <form method="post"> |
| 57 | '.wp_nonce_field('tss_nonce_field_delete').' |
| 58 | <input type="hidden" name="id" value="'.esc_attr($value['id']).'"> |
| 59 | <button class="isimb-6310-btn-danger isimb-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> |
| 60 | </form> |
| 61 | |
| 62 | </td>'; |
| 63 | echo ' </tr>'; |
| 64 | } |
| 65 | ?> |
| 66 | </table> |