diff --git a/includes/classes/class-edac-frontend-highlight.php b/includes/classes/class-edac-frontend-highlight.php deleted file mode 100644 index 67d80d94..00000000 --- a/includes/classes/class-edac-frontend-highlight.php +++ /dev/null @@ -1,110 +0,0 @@ -prefix . 'accessibility_checker'; - $post_id = intval( $post_id ); - $siteid = get_current_blog_id(); - $results = $wpdb->get_results( $wpdb->prepare( 'SELECT id, rule, ignre, object, ruletype FROM %i where postid = %d and siteid = %d', $table_name, $post_id, $siteid ), ARRAY_A ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Safe variable used for table name. - if ( ! $results ) { - return null; - } - return $results; - } - - /** - * AJAX handler function for frontend highlighting requests. - */ - public function ajax() { - - // nonce security. - if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_REQUEST['nonce'] ), 'ajax-nonce' ) ) { - $error = new WP_Error( '-1', 'Permission Denied' ); - wp_send_json_error( $error ); - } - - if ( ! isset( $_REQUEST['post_id'] ) ) { - $error = new WP_Error( '-2', 'The id value was not set' ); - wp_send_json_error( $error ); - } - - $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0; - $results = $this->get_issues( $post_id ); - - if ( ! $results ) { - $error = new WP_Error( '-3', 'Issue query returned no results' ); - wp_send_json_error( $error ); - } - - $rules = edac_register_rules(); - - $output = array(); - foreach ( $results as $result ) { - $array = array(); - $rule = edac_filter_by_value( $rules, 'slug', $result['rule'] ); - $rule_type = ( true === boolval( $result['ignre'] ) ) ? 'ignored' : $rule[0]['rule_type']; - - $array['rule_type'] = $rule_type; - $array['slug'] = $rule[0]['slug']; - $array['rule_title'] = $rule[0]['title']; - $array['summary'] = $rule[0]['summary']; - $array['link'] = edac_documentation_link( $rule[0] ); - $array['object'] = html_entity_decode( esc_html( $result['object'] ) ); - $array['id'] = $result['id']; - $array['ignored'] = $result['ignre']; - - $output[] = $array; - } - - if ( ! $output ) { - - $error = new WP_Error( '-5', 'Object query returned no results' ); - wp_send_json_error( $error ); - - } - - wp_send_json_success( wp_json_encode( $output ) ); - } -} - -if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { - $ajax = new \EDAC\Frontend_Highlight(); - $ajax->init_hooks(); -}