PluginProbe
WP Directory Kit / 1.1.0
WP Directory Kit v1.1.0
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / admin / class-wpdirectorykit-admin.php

class-wpdirectorykit-admin.php in WP Directory Kit 1.1.0, at admin/class-wpdirectorykit-admin.php

264 lines 10.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The admin-specific functionality of the plugin.
5 *
6 * @link listing-themes.com
7 * @since 1.0.0
8 *
9 * @package Wpdirectorykit
10 * @subpackage Wpdirectorykit/admin
11 */
12
13 /**
14 * The admin-specific functionality of the plugin.
15 *
16 * Defines the plugin name, version, and two examples hooks for how to
17 * enqueue the admin-specific stylesheet and JavaScript.
18 *
19 * @package Wpdirectorykit
20 * @subpackage Wpdirectorykit/admin
21 * @author listing-themes.com <dev@listing-themes.com>
22 */
23
24 if ( ! defined( 'ABSPATH' ) ) {
25 exit; // Exit if accessed directly.
26 }
27 class Wpdirectorykit_Admin {
28
29 /**
30 * The ID of this plugin.
31 *
32 * @since 1.0.0
33 * @access private
34 * @var string $plugin_name The ID of this plugin.
35 */
36 private $plugin_name;
37
38 /**
39 * The version of this plugin.
40 *
41 * @since 1.0.0
42 * @access private
43 * @var string $version The current version of this plugin.
44 */
45 private $version;
46
47 /**
48 * Initialize the class and set its properties.
49 *
50 * @since 1.0.0
51 * @param string $plugin_name The name of this plugin.
52 * @param string $version The version of this plugin.
53 */
54 public function __construct( $plugin_name, $version ) {
55
56 $this->plugin_name = $plugin_name;
57 $this->version = $version;
58
59 }
60
61 /**
62 * Register the stylesheets for the admin area.
63 *
64 * @since 1.0.0
65 */
66 public function enqueue_styles() {
67
68 /**
69 * This function is provided for demonstration purposes only.
70 *
71 * An instance of this class should be passed to the run() function
72 * defined in Wpdirectorykit_Loader as all of the hooks are defined
73 * in that particular class.
74 *
75 * The Wpdirectorykit_Loader will then create the relationship
76 * between the defined hooks and the functions defined in this
77 * class.
78 */
79
80 wp_register_style( 'wdk-treefield', WPDIRECTORYKIT_URL . 'public/js/wdk_treefield/treefield.css', array(), '1.0.0' );
81 wp_register_style( 'wdk-modal', WPDIRECTORYKIT_URL. 'public/css/wdk-modal.css', array(), $this->version, 'all');
82 wp_register_style( 'wdk-notify', WPDIRECTORYKIT_URL. 'public/css/wdk-notify.css', array(), $this->version, 'all');
83 wp_register_style( 'leaflet', WPDIRECTORYKIT_URL. 'public/js/openstreetmap/leaflet.css', array(), '1.7.1', 'all' );
84
85 wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpdirectorykit-admin.css', array(), $this->version, 'all' );
86 wp_enqueue_style( $this->plugin_name.'-responsive', plugin_dir_url( __FILE__ ) . 'css/wpdirectorykit-admin-responsive.css', array(), $this->version, 'all' );
87 wp_register_style('jquery-ui', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css', array(), null );
88 }
89
90 /**
91 * Register the JavaScript for the admin area.
92 *
93 * @since 1.0.0
94 */
95 public function enqueue_scripts() {
96
97 /**
98 * This function is provided for demonstration purposes only.
99 *
100 * An instance of this class should be passed to the run() function
101 * defined in Wpdirectorykit_Loader as all of the hooks are defined
102 * in that particular class.
103 *
104 * The Wpdirectorykit_Loader will then create the relationship
105 * between the defined hooks and the functions defined in this
106 * class.
107 */
108
109 wp_register_script( 'wdk-treefield', WPDIRECTORYKIT_URL . 'public/js/wdk_treefield/treefield.js', array( 'jquery' ), false, false );
110 wp_register_script( 'wpmediaelement_file', WPDIRECTORYKIT_URL . 'admin/js/jquery.wpmediaelement_file.js', array( 'jquery' ), false, false );
111
112 wp_register_script( 'wdk-modal', WPDIRECTORYKIT_URL. 'public/js/wdk-modal.js', array( 'jquery' ), $this->version, false);
113 wp_register_script( 'wdk-notify', WPDIRECTORYKIT_URL. 'public/js/wdk-notify.js', array( 'jquery' ), $this->version, false);
114 wp_register_script( 'leaflet', WPDIRECTORYKIT_URL. 'public/js/openstreetmap/leaflet.js', array( 'jquery' ), '1.7.1', false );
115
116 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wpdirectorykit-admin.js', array( 'jquery' ), $this->version, false );
117 }
118
119 /**
120 * Admin AJAX
121 */
122
123 public function ajax_admin()
124 {
125 global $Winter_MVC_WDK;
126
127 $page = '';
128 $function = '';
129
130 if(isset($_POST['page']))$page = sanitize_text_field($_POST['page']);
131 if(isset($_POST['function']))$function = sanitize_text_field($_POST['function']);
132
133 $Winter_MVC_WDK->load_controller($page, $function, array());
134 }
135
136 /**
137 * Admin Page Display
138 */
139 public function admin_page_display() {
140 global $Winter_MVC_WDK, $submenu, $menu;
141
142 $page = '';
143 $function = '';
144
145 if(isset($_GET['page']))$page = sanitize_text_field($_GET['page']);
146 if(isset($_GET['function']))$function = sanitize_text_field($_GET['function']);
147
148 $Winter_MVC_WDK->load_controller($page, $function, array());
149 }
150
151 /**
152 * To add Plugin Menu and Settings page
153 */
154 public function plugin_menu() {
155
156 ob_start();
157
158 //require_once WPDIRECTORYKIT_PATH . 'vendor/boo-settings-helper/class-boo-settings-helper.php';
159
160 add_menu_page(__('Directory Kit','wpdirectorykit'), __('Directory Kit','wpdirectorykit'),
161 'manage_options', 'wdk', array($this, 'admin_page_display'),
162 //plugin_dir_url( __FILE__ ) . 'resources/logo.png',
163 'dashicons-category',
164 28 );
165
166 add_submenu_page('wdk',
167 __('Listings','wpdirectorykit'),
168 __('Listings','wpdirectorykit'),
169 'manage_options', 'wdk', array($this, 'admin_page_display'));
170
171 add_submenu_page('wdk',
172 __('Add Listing','wpdirectorykit'),
173 __('Add Listing','wpdirectorykit'),
174 'manage_options', 'wdk_listing', array($this, 'admin_page_display'));
175
176 add_submenu_page('wdk',
177 __('Fields','wpdirectorykit'),
178 __('Fields','wpdirectorykit'),
179 'manage_options', 'wdk_fields', array($this, 'admin_page_display'));
180
181 if(get_option('wdk_is_category_enabled', FALSE))
182 add_submenu_page('wdk',
183 __('Categories','wpdirectorykit'),
184 __('Categories','wpdirectorykit'),
185 'manage_options', 'wdk_category', array($this, 'admin_page_display'));
186
187 if(get_option('wdk_is_location_enabled', FALSE))
188 add_submenu_page('wdk',
189 __('Locations','wpdirectorykit'),
190 __('Locations','wpdirectorykit'),
191 'manage_options', 'wdk_location', array($this, 'admin_page_display'));
192
193 add_submenu_page('wdk',
194 __('Search Form','wpdirectorykit'),
195 __('Search Form','wpdirectorykit'),
196 'manage_options', 'wdk_searchform', array($this, 'admin_page_display'));
197
198 add_submenu_page('wdk',
199 __('Result Card','wpdirectorykit'),
200 __('Result Card','wpdirectorykit'),
201 'manage_options', 'wdk_resultitem', array($this, 'admin_page_display'));
202
203 add_submenu_page('wdk',
204 __('Change Currency','wpdirectorykit'),
205 __('Change Currency','wpdirectorykit'),
206 'manage_options', 'wdk_change_currency', array($this, 'admin_page_display'));
207
208 add_submenu_page('wdk',
209 __('Messages','wpdirectorykit'),
210 __('Messages','wpdirectorykit'),
211 'manage_options', 'wdk_messages', array($this, 'admin_page_display'));
212
213 add_submenu_page('wdk',
214 __('Settings','wpdirectorykit'),
215 __('Settings','wpdirectorykit'),
216 'manage_options', 'wdk_settings', array($this, 'admin_page_display'));
217
218 add_submenu_page('wdk',
219 __('Documentation','wpdirectorykit'),
220 __('Documentation','wpdirectorykit'),
221 'manage_options', 'https://wpdirectorykit.com/documentation');
222
223 if(!file_exists(WPDIRECTORYKIT_PATH . 'premium_functions.php') || defined('WDK_FS_DISABLE'))
224 {
225
226 if(!file_exists(WP_PLUGIN_DIR.'/wdk-currency-conversion') || !is_plugin_active( 'wdk-currency-conversion/wdk-currency-conversion.php' ))
227 add_submenu_page('wdk',
228 __('Currencies Addon','wpdirectorykit'),
229 __('Currencies Addon','wpdirectorykit'),
230 'manage_options', 'wdk_addons_currencies', array($this, 'admin_page_display'));
231
232 if(!file_exists(WP_PLUGIN_DIR.'/wdk-membership') || !is_plugin_active( 'wdk-membership/wdk-membership.php' ))
233 add_submenu_page('wdk',
234 __('Membership Addon','wpdirectorykit'),
235 __('Membership Addon','wpdirectorykit'),
236 'manage_options', 'wdk_addons_membership', array($this, 'admin_page_display'));
237
238 if(!file_exists(WP_PLUGIN_DIR.'/wdk-bookings') || !is_plugin_active( 'wdk-bookings/wdk-bookings.php' ))
239 add_submenu_page('wdk',
240 __('Booking Addon','wpdirectorykit'),
241 __('Booking Addon','wpdirectorykit'),
242 'manage_options', 'wdk_addons_bookings', array($this, 'admin_page_display'));
243
244 add_submenu_page('wdk',
245 __('More Addons','wpdirectorykit'),
246 __('More Addons','wpdirectorykit'),
247 'manage_options', 'wdk_addons', array($this, 'admin_page_display'));
248
249 add_submenu_page('wdk',
250 __('Support Forum','wpdirectorykit'),
251 __('Support Forum','wpdirectorykit'),
252 'manage_options', 'https://wordpress.org/support/plugin/wpdirectorykit/');
253
254 add_submenu_page('wdk',
255 __('Contact','wpdirectorykit'),
256 __('Contact','wpdirectorykit'),
257 'manage_options', 'https://wpdirectorykit.com/contact.html');
258 }
259
260
261 }
262
263 }
264