| @@ -93,8 +93,18 @@ | ||
| 93 | 93 | |
| 94 | 94 | wp_enqueue_style($this->plugin_name, plugin_dir_url(__FILE__) . 'css/wpdirectorykit-admin.css', array(), $this->version, 'all'); |
| 95 | 95 | wp_enqueue_style($this->plugin_name . '-responsive', plugin_dir_url(__FILE__) . 'css/wpdirectorykit-admin-responsive.css', array(), $this->version, 'all'); |
| 96 | 96 | wp_register_style('jquery-ui', WPDIRECTORYKIT_URL . 'public/css/jquery-ui.css', array(), null); |
| 97 | + | |
| 98 | + // Register and enqueue Tribute.js style | |
| 99 | + wp_register_style( | |
| 100 | + 'tribute-css', | |
| 101 | + WPDIRECTORYKIT_URL . 'public/js/tribute/tribute.css', | |
| 102 | + [], | |
| 103 | + '5.1.3' | |
| 104 | + ); | |
| 105 | + | |
| 106 | + | |
| 97 | 107 | } |
| 98 | 108 | |
| 99 | 109 | /** |
| 100 | 110 | * Register the JavaScript for the admin area. |
| @@ -115,8 +125,19 @@ | ||
| 115 | 125 | * between the defined hooks and the functions defined in this |
| 116 | 126 | * class. |
| 117 | 127 | */ |
| 118 | 128 | |
| 129 | + | |
| 130 | + // Register and enqueue Tribute.js script | |
| 131 | + wp_register_script( | |
| 132 | + 'tribute-js', | |
| 133 | + WPDIRECTORYKIT_URL . 'public/js/tribute/tribute.min.js', | |
| 134 | + [], | |
| 135 | + '5.1.3', | |
| 136 | + true | |
| 137 | + ); | |
| 138 | + | |
| 139 | + | |
| 119 | 140 | wp_register_script('wdk-treefield', WPDIRECTORYKIT_URL . 'public/js/wdk_treefield/treefield.js', array('jquery'), false, false); |
| 120 | 141 | wp_register_script('wpmediaelement_file', WPDIRECTORYKIT_URL . 'admin/js/jquery.wpmediaelement_file.js', array('jquery'), false, false); |
| 121 | 142 | |
| 122 | 143 | wp_register_script('wdk-modal', WPDIRECTORYKIT_URL . 'public/js/wdk-modal.js', array('jquery'), $this->version, false); |
| @@ -180,8 +201,9 @@ | ||
| 180 | 201 | ); |
| 181 | 202 | wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/wpdirectorykit-admin.js', array('jquery'), $this->version, false); |
| 182 | 203 | wp_localize_script($this->plugin_name, 'script_parameters', $params); |
| 183 | 204 | wp_localize_script($this->plugin_name, 'wdk_script_parameters', $params); |
| 205 | + | |
| 184 | 206 | } |
| 185 | 207 | |
| 186 | 208 | /** |
| 187 | 209 | * Admin AJAX |
| @@ -196,8 +218,14 @@ | ||
| 196 | 218 | |
| 197 | 219 | if (isset($_POST['page'])) $page = sanitize_text_field($_POST['page']); |
| 198 | 220 | if (isset($_POST['function'])) $function = sanitize_text_field($_POST['function']); |
| 199 | 221 | |
| 222 | + /* protect access only to ajax controller */ | |
| 223 | + if($page != 'wdk_frontendajax' && $page != 'wdk_backendajax' && $page != 'wdk_fields') { | |
| 224 | + exit(esc_html__('Access denied','wpdirectorykit')); | |
| 225 | + } | |
| 226 | + | |
| 227 | + | |
| 200 | 228 | $Winter_MVC_WDK->load_controller($page, $function, array()); |
| 201 | 229 | } |
| 202 | 230 | |
| 203 | 231 | /** |
| @@ -209,10 +237,10 @@ | ||
| 209 | 237 | |
| 210 | 238 | $page = ''; |
| 211 | 239 | $function = ''; |
| 212 | 240 | |
| 213 | - if (isset($_GET['page'])) $page = sanitize_text_field($_GET['page']); | |
| 214 | - if (isset($_GET['function'])) $function = sanitize_text_field($_GET['function']); | |
| 241 | + if (isset($_GET['page'])) $page = sanitize_text_field(wp_unslash($_GET['page'])); | |
| 242 | + if (isset($_GET['function'])) $function = sanitize_text_field(wp_unslash($_GET['function'])); | |
| 215 | 243 | |
| 216 | 244 | if (substr($function, 0, 1) == '_') { |
| 217 | 245 | exit(esc_html__('blocked for public', 'wpdirectorykit')); |
| 218 | 246 | } |
| @@ -324,17 +352,28 @@ | ||
| 324 | 352 | 'wdk_location', |
| 325 | 353 | array($this, 'admin_page_display') |
| 326 | 354 | ); |
| 327 | 355 | |
| 328 | - add_submenu_page( | |
| 329 | - 'wdk', | |
| 330 | - __('Search Form', 'wpdirectorykit'), | |
| 331 | - __('Search Form', 'wpdirectorykit'), | |
| 332 | - 'wdk_listings_manage', | |
| 333 | - 'wdk_searchform', | |
| 334 | - array($this, 'admin_page_display') | |
| 335 | - ); | |
| 336 | - | |
| 356 | + | |
| 357 | + add_submenu_page( | |
| 358 | + 'wdk', | |
| 359 | + __('Search Form', 'wpdirectorykit'), | |
| 360 | + __('Search Form', 'wpdirectorykit'), | |
| 361 | + 'wdk_listings_manage', | |
| 362 | + 'wdk_searchform', | |
| 363 | + array($this, 'admin_page_display') | |
| 364 | + ); | |
| 365 | + | |
| 366 | + if (function_exists('fpai_register_settings')) { | |
| 367 | + add_submenu_page( | |
| 368 | + 'wdk', | |
| 369 | + __('Ai Search', 'wpdirectorykit'), | |
| 370 | + __('Ai Search', 'wpdirectorykit'), | |
| 371 | + 'wdk_listings_manage', | |
| 372 | + 'wdk_aisearch', | |
| 373 | + array($this, 'admin_page_display') | |
| 374 | + ); | |
| 375 | + } | |
| 337 | 376 | add_submenu_page( |
| 338 | 377 | 'wdk', |
| 339 | 378 | __('Result Card', 'wpdirectorykit'), |
| 340 | 379 | __('Result Card', 'wpdirectorykit'), |