PluginProbe
Maps Plugin using Google Maps for WordPress – WP Google Map / trunk
Maps Plugin using Google Maps for WordPress – WP Google Map vtrunk
1.9.7 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 All 96 releases
gmap-embed / admin / includes / categories.php

categories.php in Maps Plugin using Google Maps for WordPress – WP Google Map trunk, at admin/includes/categories.php

138 lines 9.7 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
6 global $wpdb;
7 // Fetch categories for the parent dropdown
8 $gmap_embed_admin_categories = wp_cache_get('wgm_categories_list', 'gmap-embed');
9 if (false === $gmap_embed_admin_categories) {
10 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter
11 $gmap_embed_admin_categories = $wpdb->get_results("SELECT id, name FROM {$wpdb->prefix}wgm_categories ORDER BY name ASC");
12 wp_cache_set('wgm_categories_list', $gmap_embed_admin_categories, 'gmap-embed', 12 * HOUR_IN_SECONDS);
13 }
14 ?>
15
16 <div class="wrap wp-gmap-wrap wgm-categories-page">
17 <h1 class="wp-heading-inline"><?php esc_html_e('Categories', 'gmap-embed'); ?></h1>
18 <hr class="wp-header-end">
19
20 <?php if (!_wgm_is_premium()) : ?>
21 <!-- Pro Upgrade Banner for Categories -->
22 <div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 15px 20px; border-radius: 8px; margin: 15px 0; box-shadow: 0 4px 6px rgba(0,0,0,0.1); border-left: 5px solid #ffd700; position: relative; z-index: 100;">
23 <div style="display: flex; align-items: center; gap: 15px;">
24 <span class="dashicons dashicons-star-filled" style="font-size: 28px; color: #ffd700; width: 28px; height: 28px;"></span>
25 <div style="flex: 1;">
26 <h3 style="margin: 0 0 5px 0; color: white; font-size: 16px;"><?php esc_html_e('Unlock Marker Categories (Premium Feature)', 'gmap-embed'); ?></h3>
27 <p style="margin: 0; font-size: 13px; opacity: 0.95; line-height: 1.4;">
28 <?php
29 echo sprintf(
30 /* translators: %s: Premium version URL. */
31 esc_html__('Organize your markers into categories and filter them on the frontend. This feature and many more are available in the %s.', 'gmap-embed'),
32 '<a href="' . esc_url('https://wpgooglemap.com/pricing?utm_source=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=upgrade-to-pro&utm_content=categories-page-banner') . '" target="_blank" style="color: #ffd700; text-decoration: underline; font-weight: bold;">' . esc_html__('Premium Version', 'gmap-embed') . '</a>'
33 );
34 ?>
35 </p>
36 </div>
37 <a href="<?php echo esc_url('https://wpgooglemap.com/pricing?utm_source=gmap-embed&utm_medium=wordpress-plugin&utm_campaign=upgrade-to-pro&utm_content=categories-page-upgrade-btn'); ?>" target="_blank" class="button" style="background: #ffd700; color: #764ba2; border: none; padding: 8px 20px; font-weight: bold; box-shadow: 0 2px 4px rgba(0,0,0,0.2); height: auto; line-height: 1.4; border-radius: 4px;"><?php esc_html_e('Upgrade Now', 'gmap-embed'); ?></a>
38 </div>
39 </div>
40 <?php endif; ?>
41
42 <div class="wgm-row wgm-categories-container <?php echo !_wgm_is_premium() ? 'wgm-locked-feature' : ''; ?>">
43 <!-- Add/Edit Category Form -->
44 <div class="wgm-col-4 wgm-category-form-col" style="flex: 0 0 350px;">
45 <div class="postbox wgm-category-postbox">
46 <div class="postbox-header">
47 <h2 class="hndle ui-sortable-handle" id="wgm-category-form-title"><?php esc_html_e('Add New Category', 'gmap-embed'); ?></h2>
48 </div>
49 <div class="inside wgm-category-inside">
50 <form id="wgm-category-form">
51 <input type="hidden" name="category_id" id="wgm-category-id" value="0">
52
53 <div class="wgm-field-group">
54 <label for="wgm-category-name"><b><?php esc_html_e('Category Name', 'gmap-embed'); ?></b></label>
55 <input type="text" id="wgm-category-name" name="name" class="regular-text" style="width: 100%;" required <?php echo !_wgm_is_premium() ? 'disabled="disabled"' : ''; ?>>
56 </div>
57
58 <div class="wgm-field-group">
59 <label><b><?php esc_html_e('Category Icon', 'gmap-embed'); ?></b></label>
60 <div class="wgm-icon-picker-wrap">
61 <img id="wgm-category-icon-preview" src="<?php echo esc_url(WGM_PLUGIN_URL . 'admin/assets/images/markers/default.png'); ?>" width="32" height="32" style="background: #f0f0f0; padding: 2px; border: 1px solid #ddd; border-radius: 4px; object-fit: contain;">
62 <div class="wgm-icon-actions">
63 <button type="button" class="button" id="wgm-category-icon-upload" <?php echo !_wgm_is_premium() ? 'disabled="disabled"' : ''; ?>><?php esc_html_e('Choose Icon', 'gmap-embed'); ?></button>
64 <button type="button" class="button" id="wgm-category-icon-remove" style="display: none; color: #a00;" <?php echo !_wgm_is_premium() ? 'disabled="disabled"' : ''; ?>><?php esc_html_e('Remove', 'gmap-embed'); ?></button>
65 </div>
66 <input type="hidden" name="icon" id="wgm-category-icon-url" value="">
67 </div>
68 </div>
69
70 <div class="wgm-field-group">
71 <label for="wgm-category-parent"><b><?php esc_html_e('Parent Category', 'gmap-embed'); ?></b></label>
72 <select id="wgm-category-parent" name="parent_id" style="width: 100%;" <?php echo !_wgm_is_premium() ? 'disabled="disabled"' : ''; ?>>
73 <option value="0"><?php esc_html_e('None', 'gmap-embed'); ?></option>
74 <?php if ($gmap_embed_admin_categories) : ?>
75 <?php foreach ($gmap_embed_admin_categories as $gmap_embed_cat) : ?>
76 <option value="<?php echo intval($gmap_embed_cat->id); ?>"><?php echo esc_html($gmap_embed_cat->name); ?></option>
77 <?php endforeach; ?>
78 <?php endif; ?>
79 </select>
80 </div>
81
82 <div class="wgm-form-actions">
83 <button type="submit" class="button button-primary" id="wgm-category-submit" <?php echo !_wgm_is_premium() ? 'disabled="disabled"' : ''; ?>>
84 <?php esc_html_e('Save Category', 'gmap-embed'); ?>
85 </button>
86 <button type="button" class="button" id="wgm-category-cancel" style="display: none;">
87 <?php esc_html_e('Cancel', 'gmap-embed'); ?>
88 </button>
89 <span class="spinner" id="wgm-category-spinner"></span>
90 </div>
91 </form>
92 </div>
93 <?php if (!_wgm_is_premium()) : ?>
94 <div class="wgm-lock-overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.2); backdrop-filter: blur(1.1px); border-radius: inherit; z-index: 10;">
95 <span class="dashicons dashicons-lock" style="font-size: 50px; color: #764ba2; width: 50px; height: 50px; opacity: 0.6;"></span>
96 </div>
97 <?php endif; ?>
98 </div>
99 </div>
100
101 <!-- Categories List Table -->
102 <div class="wgm-col-8 wgm-category-list-col" style="flex: 1;">
103 <div class="postbox wgm-category-postbox">
104 <div class="postbox-header">
105 <h2 class="hndle ui-sortable-handle"><?php esc_html_e('All Categories', 'gmap-embed'); ?></h2>
106 </div>
107 <div class="inside wgm-category-inside">
108 <div class="wgm-table-container">
109 <table id="wgm-categories-table" class="display" style="width:100%">
110 <thead>
111 <tr>
112 <th><?php esc_html_e('ID', 'gmap-embed'); ?></th>
113 <th><?php esc_html_e('Icon', 'gmap-embed'); ?></th>
114 <th><?php esc_html_e('Name', 'gmap-embed'); ?></th>
115 <th><?php esc_html_e('Parent', 'gmap-embed'); ?></th>
116 <th><?php esc_html_e('Action', 'gmap-embed'); ?></th>
117 </tr>
118 </thead>
119 <tbody></tbody>
120 </table>
121 </div>
122 </div>
123 <?php if (!_wgm_is_premium()) : ?>
124 <div class="wgm-lock-overlay" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.4); backdrop-filter: blur(1.1px); border-radius: inherit; z-index: 10;">
125 <span class="dashicons dashicons-lock" style="font-size: 50px; color: #764ba2; width: 50px; height: 50px; opacity: 0.6;"></span>
126 </div>
127 <?php endif; ?>
128 </div>
129 </div>
130 </div>
131 </div>
132
133 <style>
134 .wgm_error { border-color: #d63638 !important; box-shadow: 0 0 2px rgba(214, 54, 56, .8) !important; }
135 #wgm-categories-table_wrapper { padding-top: 10px; }
136 .wgm-edit-category, .wgm-delete-category { margin-right: 5px !important; }
137 </style>
138