register_ajax_handlers(); } /** * Summary Ajax * * @return void * * - '-1' means that nonce could not be varified * - '-2' means that the post ID was not specified * - '-3' means that there isn't any summary data to return */ public function summary() { // nonce security. if ( ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_REQUEST['nonce'] ), 'ajax-nonce' ) ) { $error = new \WP_Error( '-1', __( 'Permission Denied', 'accessibility-checker' ) ); wp_send_json_error( $error ); } if ( ! isset( $_REQUEST['post_id'] ) ) { $error = new \WP_Error( '-2', __( 'The post ID was not set', 'accessibility-checker' ) ); wp_send_json_error( $error ); } $html = []; $html['content'] = ''; // password check. if ( (bool) get_option( 'edac_password_protected' ) === true ) { $admin_notices = new \EDAC\Admin\Admin_Notices(); $notice_text = $admin_notices->edac_password_protected_notice_text(); $html['password_protected'] = $notice_text; $html['content'] .= '
' . esc_html( $row['object'] ) . '';
$html .= 'Post Reading Grade Level: ' . ( ( 0 === $post_grade ) ? 'None' : $post_grade_readability ) . '
Your post has a reading level higher than 9th grade. Web Content Accessibility Guidelines (WCAG) at the AAA level require a simplified summary of your post that is 9th grade or below.
'; } elseif ( 0 === $post_grade ) { $html .= 'Your post does not contain enough content to calculate its reading level.
'; } else { $html .= 'A simplified summary is not necessary when content reading level is 9th grade or below. Choose when to prompt for a simplified summary on the settings page.
'; } $html .= 'Simplified Summary Reading Grade Level: ' . edac_ordinal( $simplified_summary_grade ) . '
Your simplified summary has a reading level ' . ( ( $simplified_summary_grade_failed ) ? 'higher' : 'lower' ) . ' than 9th grade.
Simplified summary is not being automatically inserted into the content.
Your Prompt for Simplified Summary is set to "never." If you would like the simplified summary to be displayed automatically, you can change this on the settings page.
Simplified summary is being automatically inserted ' . $simplified_summary_position . ' the content.
Set where the Simplified Summary is inserted into the content on the settings page.
Simplified summary is not being automatically inserted into the content.
Your Simplified Summary location is set to "manually" which requires a function be added to your page template. If you would like the simplified summary to be displayed automatically, you can change this on the settings page.