| @@ -19,8 +19,24 @@ | ||
| 19 | 19 | do_action( 'dfrapi_loaded' ); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | function ajax_search_form() { |
| 23 | + | |
| 24 | + check_ajax_referer( 'dfrapi_search_form', 'dfrapi_security' ); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Filters the capability required to use the search form's AJAX handler. | |
| 28 | + * | |
| 29 | + * @since 1.4.3 | |
| 30 | + * | |
| 31 | + * @param string $capability Default 'edit_posts'. | |
| 32 | + */ | |
| 33 | + $capability = apply_filters( 'dfrapi_search_form_capability', 'edit_posts' ); | |
| 34 | + | |
| 35 | + if ( ! current_user_can( $capability ) ) { | |
| 36 | + wp_die( -1, 403 ); | |
| 37 | + } | |
| 38 | + | |
| 23 | 39 | $sform = new Dfrapi_SearchForm(); |
| 24 | 40 | echo $sform->ajaxHandler(); |
| 25 | 41 | die; |
| 26 | 42 | } |