'; echo '

' . esc_html__( 'Accessibility statement', 'accessvane' ) . '

'; echo '

' . esc_html__( 'A published accessibility statement is required under the European Accessibility Act and expected under most other accessibility laws. This creates one as a normal page you can edit afterwards.', 'accessvane' ) . '

'; if ( isset( $_GET['accessvane_created'] ) && $page ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only notice flag. printf( '

%1$s %3$s · %5$s

', esc_html__( 'Your accessibility statement page has been created as a draft.', 'accessvane' ), esc_url( get_edit_post_link( $page->ID ) ), esc_html__( 'Review and publish it', 'accessvane' ), esc_url( get_permalink( $page->ID ) ), esc_html__( 'Preview', 'accessvane' ) ); } ?>

— post_status ) ); ?>

__( 'Accessibility statement', 'accessvane' ), 'post_name' => 'accessibility-statement', 'post_type' => 'page', // Created as a draft on purpose. This document makes legal // claims on the owner's behalf; it should not go live until a // person has read it. 'post_status' => 'draft', 'post_content' => wp_slash( $this->build_content( $organisation, $email, $phone, $conformance, $known ) ), ), true ); if ( is_wp_error( $page_id ) ) { wp_die( esc_html( $page_id->get_error_message() ) ); } AccessVane_Settings::set( 'statement_page_id', (int) $page_id ); wp_safe_redirect( add_query_arg( array( 'page' => 'accessvane-statement', 'accessvane_created' => '1', ), admin_url( 'admin.php' ) ) ); exit; } /** * Compose the statement body as block markup. * * @param string $organisation Organisation name. * @param string $email Contact email. * @param string $phone Contact phone. * @param string $conformance One of full|partial|none. * @param array $known Known outstanding issues. * @return string */ private function build_content( $organisation, $email, $phone, $conformance, array $known ) { $date = date_i18n( get_option( 'date_format' ) ); $site_name = $organisation; $statements = array( 'full' => __( 'This website is fully conformant with WCAG 2.2 Level AA. "Fully conformant" means the content meets the standard in full, verified by both automated and manual testing.', 'accessvane' ), 'partial' => __( 'This website is partially conformant with WCAG 2.2 Level AA. "Partially conformant" means some parts of the content do not yet fully meet the standard. The known exceptions are listed below.', 'accessvane' ), 'none' => __( 'This website is not yet conformant with WCAG 2.2 Level AA. We are actively working through the outstanding problems, and the main ones known to us are listed below.', 'accessvane' ), ); $blocks = array(); $blocks[] = $this->paragraph( sprintf( /* translators: %s: organisation name. */ __( '%s is committed to making this website usable by as many people as possible, including people with disabilities. This statement explains how accessible the site currently is, what we know is not right yet, and how to tell us when something blocks you.', 'accessvane' ), $site_name ) ); $blocks[] = $this->heading( __( 'How accessible this website is', 'accessvane' ) ); $blocks[] = $this->paragraph( $statements[ $conformance ] ); if ( $known ) { $blocks[] = $this->heading( __( 'Known problems', 'accessvane' ) ); $blocks[] = $this->paragraph( __( 'We are aware of the following, and they are on our list to fix:', 'accessvane' ) ); $blocks[] = $this->list_block( $known ); } $blocks[] = $this->heading( __( 'Tell us if you hit a barrier', 'accessvane' ) ); $contact = sprintf( /* translators: %s: contact email address. */ __( 'If you cannot use part of this website, or you need something in a different format, please contact us at %s. Tell us the page address and what happened, and we will get back to you.', 'accessvane' ), $email ); if ( '' !== $phone ) { $contact .= ' ' . sprintf( /* translators: %s: contact phone number. */ __( 'You can also call us on %s.', 'accessvane' ), $phone ); } $blocks[] = $this->paragraph( $contact ); $blocks[] = $this->heading( __( 'How we test this website', 'accessvane' ) ); $blocks[] = $this->paragraph( __( 'We test our pages with automated tools and by hand, including navigating the site using only a keyboard. Automated testing alone catches roughly a third of accessibility problems, so we do not rely on it by itself.', 'accessvane' ) ); $blocks[] = $this->heading( __( 'This statement', 'accessvane' ) ); $blocks[] = $this->paragraph( sprintf( /* translators: %s: date the statement was prepared. */ __( 'This statement was prepared on %s. We review it whenever the website changes significantly.', 'accessvane' ), $date ) ); return implode( "\n\n", $blocks ); } /** * A paragraph block. * * @param string $text Text. * @return string */ private function paragraph( $text ) { return "\n

" . esc_html( $text ) . "

\n"; } /** * A level-two heading block. * * @param string $text Text. * @return string */ private function heading( $text ) { return "\n

" . esc_html( $text ) . "

\n"; } /** * An unordered list block. * * @param array $items List items. * @return string */ private function list_block( array $items ) { $rendered = ''; foreach ( $items as $item ) { $rendered .= "\n
  • " . esc_html( $item ) . "
  • \n\n"; } return "\n\n"; } }