statement = $statement; } /** * Generate the complete accessibility statement HTML */ public function generate() { $html = $this->get_css(); $html .= '
'; $html .= $this->generate_basic_info(); $html .= $this->generate_efforts(); $html .= $this->generate_conformance_status(); $html .= $this->generate_additional_considerations(); $html .= $this->generate_known_issues(); $html .= $this->generate_unresolved_barriers(); $html .= $this->generate_content_outside_scope(); $html .= $this->generate_technical_specifications(); $html .= $this->generate_known_incompatibilities(); $html .= $this->generate_assessment_approach(); $html .= $this->generate_related_evidence(); $html .= $this->generate_feedback(); $html .= $this->generate_footer(); $html .= '
'; return $html; } /** * Format date string */ private function format_date( $date_string ) { if ( empty( $date_string ) ) { return '[Month Day, Year]'; } $date = new DateTime( $date_string ); return $date->format( 'F j, Y' ); } /** * Get standard text */ private function get_standard_text() { $standard = $this->statement['conformanceStatus']['standard'] ?? ''; if ( 'other' === $standard ) { return $this->statement['conformanceStatus']['customStandard'] ?? '_______'; } $standardMap = array( 'wcag22-aa' => 'WCAG 2.2 AA', 'wcag21-aa' => 'WCAG 2.1 AA', 'wcag20-aa' => 'WCAG 2.0 AA', ); return $standardMap[ $standard ] ?? '[WCAG 2.2 AA/WCAG 2.1 AA/ WCAG 2.0 AA]'; } /** * Get conformance text */ private function get_conformance_text() { $level = $this->statement['conformanceStatus']['conformanceLevel'] ?? ''; $levelMap = array( 'fully-conformant' => 'fully conformant', 'partially-conformant' => 'partially conformant', 'non-conformant' => 'non conformant', 'not-assessed' => 'not assessed', ); return $levelMap[ $level ] ?? '_______'; } /** * Render company name with optional link */ private function render_company_name( $link = true ) { $company_name = $this->statement['basicInfo']['companyName'] ?? ''; $website_url = $this->statement['basicInfo']['websiteUrl'] ?? ''; if ( $link && $company_name && $website_url ) { return sprintf( '%s', htmlspecialchars( $website_url ), htmlspecialchars( $company_name ) ); } return htmlspecialchars( $company_name ? $company_name : '[Organization Name]' ); } /** * Generate basic information section */ private function generate_basic_info() { $company_name = $this->render_company_name( false ); $website_url = $this->statement['basicInfo']['websiteUrl'] ?? ''; $publication_date = $this->format_date( $this->statement['basicInfo']['publicationDate'] ?? '' ); $html = '
'; $html .= sprintf( '

Accessibility Statement for %s

', $company_name ); $html .= ''; $html .= '
'; $html .= '

'; $html .= 'Website: '; if ( $website_url ) { $html .= sprintf( '%s', htmlspecialchars( $website_url ), htmlspecialchars( $website_url ), htmlspecialchars( $website_url ) ); } else { $html .= '[website url]'; } $html .= '
'; $html .= sprintf( 'Last Revised: %s', $publication_date ); $html .= '

'; $html .= '
'; $html .= '

'; $html .= sprintf( 'At %s, we are committed to ensuring that our website and all digital services are accessible to everyone, including people with disabilities. This document describes our accessibility practices, the standards we follow, and how you can provide feedback.', $this->render_company_name() ); $html .= '

'; $html .= '
'; return $html; } /** * Generate efforts section */ private function generate_efforts() { $selected_efforts = $this->statement['efforts']['selectedEfforts'] ?? array(); $additional_efforts = $this->statement['efforts']['additionalEfforts'] ?? array(); // Filter out empty additional efforts $additional_efforts = array_filter( $additional_efforts, function ( $effort ) { return ! empty( trim( $effort ) ); } ); if ( empty( $selected_efforts ) && empty( $additional_efforts ) ) { return ''; } $html = '
'; $html .= sprintf( '

%s takes the following measures to ensure accessibility:

', $this->render_company_name() ); if ( ! empty( $selected_efforts ) ) { $html .= ''; } if ( ! empty( $additional_efforts ) ) { $html .= ''; } $html .= '
'; return $html; } /** * Generate conformance status section */ private function generate_conformance_status() { $standard = $this->statement['conformanceStatus']['standard'] ?? ''; $conformance_level = $this->statement['conformanceStatus']['conformanceLevel'] ?? ''; $website_name = $this->statement['basicInfo']['websiteName'] ?? '[Website Name]'; if ( empty( $standard ) && empty( $conformance_level ) ) { return ''; } $html = '
'; $html .= '

Conformance status

'; $html .= '

'; $html .= 'The Web Content Accessibility Guidelines (WCAG) is a set of standards that must be adhered to in order to ensure accessibility for people with disabilities. There are 3 defined levels of conformance: A, AA and AAA.'; $html .= '

'; $html .= '

'; $html .= sprintf( '%s is %s with %s. This means that there are some parts of the content that do not conform to the accessibility standard.', htmlspecialchars( $website_name ), $this->get_conformance_text(), $this->get_standard_text() ); $html .= '

'; $html .= '
'; return $html; } /** * Generate additional considerations section */ private function generate_additional_considerations() { $considerations = $this->statement['conformanceStatus']['additionalConsiderations'] ?? ''; if ( empty( $considerations ) ) { return ''; } $html = '
'; $html .= '

Additional accessibility considerations

'; $html .= sprintf( '

%s

', htmlspecialchars( $considerations ) ); $html .= '
'; return $html; } /** * Generate known issues section */ private function generate_known_issues() { $known_issues = $this->statement['conformanceStatus']['knownIssues'] ?? array(); // Filter out empty issues $known_issues = array_filter( $known_issues, function ( $issue ) { return ! empty( $issue['title'] ) || ! empty( $issue['description'] ); } ); if ( empty( $known_issues ) ) { return ''; } $html = '
'; $html .= '

Known accessibility limitation

'; $html .= '
Features or content that do not meet accessibility standards:
'; $html .= '
    '; foreach ( $known_issues as $issue ) { $html .= '
  1. '; $html .= sprintf( '%s:
    %s', htmlspecialchars( $issue['title'] ? $issue['title'] : 'Issue' ), htmlspecialchars( $issue['description'] ? $issue['description'] : '[Description]' ) ); $html .= '
  2. '; } $html .= '
'; $html .= '
'; return $html; } /** * Generate unresolved barriers section */ private function generate_unresolved_barriers() { $barriers = $this->statement['conformanceStatus']['unresolvedBarriers'] ?? ''; if ( empty( $barriers ) ) { return ''; } $html = '
'; $html .= '
Unresolved accessibility barriers due to budget or technical limitations (Disproportionate burden):
'; $html .= sprintf( '

%s

', htmlspecialchars( $barriers ) ); $html .= '
'; return $html; } /** * Generate content outside scope section */ private function generate_content_outside_scope() { $content = $this->statement['conformanceStatus']['contentOutsideScope'] ?? ''; if ( empty( $content ) ) { return ''; } $html = '
'; $html .= '
Content outside the scope of accessibility legislation:
'; $html .= sprintf( '

%s

', htmlspecialchars( $content ) ); $html .= '
'; return $html; } /** * Generate technical specifications section */ private function generate_technical_specifications() { $tech_specs = $this->statement['technicalSpecs'] ?? array(); $website_name = $this->statement['basicInfo']['websiteName'] ?? '[Website Name]'; $has_compatibilities = $this->has_any_compatibilities( $tech_specs['knownCompatibilities'] ?? array() ); $has_technology_reliance = ! empty( $tech_specs['technologyReliance']['selected'] ?? array() ); if ( ! $has_compatibilities && ! $has_technology_reliance ) { return ''; } $html = '
'; $html .= ''; $html .= '
'; $html .= '

Technical specifications

'; $html .= sprintf( '

Accessibility of %s depends on the following technologies:

', htmlspecialchars( $website_name ) ); $html .= ''; $html .= '

Compatibility with user environment

'; // Browsers $browsers = $tech_specs['knownCompatibilities']['browsers'] ?? array(); $browsers = array_filter( $browsers, function ( $browser ) { return ! empty( trim( $browser ) ); } ); if ( ! empty( $browsers ) ) { $html .= '
'; $html .= '

This site is designed to be compatible with the following browsers:

'; $html .= '
    '; foreach ( $browsers as $browser ) { $html .= sprintf( '
  • %s
  • ', htmlspecialchars( $browser ) ); } $html .= '
'; $html .= '
'; } // Operating Systems $operating_systems = $tech_specs['knownCompatibilities']['operatingSystems'] ?? array(); $operating_systems = array_filter( $operating_systems, function ( $os ) { return ! empty( trim( $os ) ); } ); if ( ! empty( $operating_systems ) ) { $html .= '
'; $html .= '

This site is designed to be compatible with the following operating systems:

'; $html .= '
    '; foreach ( $operating_systems as $os ) { $html .= sprintf( '
  • %s
  • ', htmlspecialchars( $os ) ); } $html .= '
'; $html .= '
'; } // Assistive Technologies $assistive_tech = $tech_specs['knownCompatibilities']['assistiveTechnologies'] ?? array(); $assistive_tech = array_filter( $assistive_tech, function ( $at ) { return ! empty( trim( $at ) ); } ); if ( ! empty( $assistive_tech ) ) { $html .= '
'; $html .= '

This site is designed to be compatible with the following assistive technologies:

'; $html .= '
    '; foreach ( $assistive_tech as $at ) { $html .= sprintf( '
  • %s
  • ', htmlspecialchars( $at ) ); } $html .= '
'; $html .= '
'; } $html .= '
'; $html .= '
'; return $html; } /** * Check if any compatibilities exist */ private function has_any_compatibilities( $compatibilities ) { $browsers = array_filter( $compatibilities['browsers'] ?? array(), function ( $browser ) { return ! empty( trim( $browser ) ); } ); $operating_systems = array_filter( $compatibilities['operatingSystems'] ?? array(), function ( $os ) { return ! empty( trim( $os ) ); } ); $assistive_technologies = array_filter( $compatibilities['assistiveTechnologies'] ?? array(), function ( $at ) { return ! empty( trim( $at ) ); } ); return ! empty( $browsers ) || ! empty( $operating_systems ) || ! empty( $assistive_technologies ); } /** * Generate known incompatibilities section */ private function generate_known_incompatibilities() { $incompatibilities = $this->statement['technicalSpecs']['knownIncompatibilities'] ?? array(); $has_incompatibilities = $this->has_any_compatibilities( $incompatibilities ); if ( ! $has_incompatibilities ) { return ''; } $html = '
'; $html .= '

Known Incompatibilities

'; // Browsers $browsers = array_filter( $incompatibilities['browsers'] ?? array(), function ( $browser ) { return ! empty( trim( $browser ) ); } ); if ( ! empty( $browsers ) ) { $html .= '
'; $html .= '
This site is not compatible with the following browsers:
'; $html .= ''; $html .= '
'; } // Operating Systems $operating_systems = array_filter( $incompatibilities['operatingSystems'] ?? array(), function ( $os ) { return ! empty( trim( $os ) ); } ); if ( ! empty( $operating_systems ) ) { $html .= '
'; $html .= '
This site is not compatible with the following operating systems:
'; $html .= ''; $html .= '
'; } // Assistive Technologies $assistive_tech = array_filter( $incompatibilities['assistiveTechnologies'] ?? array(), function ( $at ) { return ! empty( trim( $at ) ); } ); if ( ! empty( $assistive_tech ) ) { $html .= '
'; $html .= '
This site is not compatible with the following assistive technologies:
'; $html .= ''; $html .= '
'; } $html .= '
'; return $html; } /** * Generate assessment approach section */ private function generate_assessment_approach() { $assessment_approach = $this->statement['technicalSpecs']['assessmentApproach'] ?? array(); $website_name = $this->statement['basicInfo']['websiteName'] ?? '[Website Name]'; $selected_methods = $assessment_approach['selected'] ?? array(); $other_methods = array_filter( $assessment_approach['otherMethods'] ?? array(), function ( $method ) { return ! empty( trim( $method ) ); } ); if ( empty( $selected_methods ) && empty( $other_methods ) ) { return ''; } $html = '
'; $html .= '

Assessment methods

'; $html .= sprintf( '

%s assessed the accessibility of this site using the following method(s):

', htmlspecialchars( $website_name ) ); $html .= ''; $html .= '
'; return $html; } /** * Generate related evidence section */ private function generate_related_evidence() { $related_evidence = $this->statement['relatedEvidence'] ?? array(); $html = ''; // Recent Evaluation Report $report_url = $related_evidence['recentEvaluationReport'] ?? ''; if ( ! empty( $report_url ) ) { $html .= '
'; $html .= '

Accessibility evaluation report

'; $html .= '

You can access our accessibility evaluation report at:

'; $html .= '

'; $html .= sprintf( '%s', htmlspecialchars( $report_url ), htmlspecialchars( $report_url ) ); $html .= '

'; $html .= '
'; } // Evaluation Statement $statement_url = $related_evidence['evaluationStatement'] ?? ''; if ( ! empty( $statement_url ) ) { $html .= '
'; $html .= '

Accessibility evaluation statement

'; $html .= '

You can access our accessibility evaluation statement at:

'; $html .= '

'; $html .= sprintf( '%s', htmlspecialchars( $statement_url ), htmlspecialchars( $statement_url ) ); $html .= '

'; $html .= '
'; } // Other Evidence $other_evidence = array_filter( $related_evidence['otherEvidence'] ?? array(), function ( $evidence ) { return ! empty( trim( $evidence ) ); } ); if ( ! empty( $other_evidence ) ) { $html .= '
'; $html .= '

Other evidence

'; $html .= '

You can access our other evidence at:

'; $html .= ''; $html .= '
'; } return $html; } /** * Generate feedback section */ private function generate_feedback() { $feedback = $this->statement['feedback'] ?? array(); $website_name = $this->statement['basicInfo']['websiteName'] ?? ''; $has_contact_info = ! empty( $feedback['companyPhoneNumber'] ) || ! empty( $feedback['companyEmailAddress'] ) || ! empty( $feedback['companyVisitorAddress'] ) || ! empty( $feedback['companyPostalAddress'] ); $html = '
'; if ( $has_contact_info ) { $html .= ''; $html .= '

Feedback process

'; $html .= sprintf( '

We welcome your feedback on the accessibility of %s Please contact us via one of the following methods:

', htmlspecialchars( $website_name ) ); $html .= '

'; // Phone if ( ! empty( $feedback['companyPhoneNumber'] ) ) { $html .= sprintf( 'Phone: %s
', htmlspecialchars( $feedback['companyPhoneNumber'] ), htmlspecialchars( $feedback['companyPhoneNumber'] ), htmlspecialchars( $feedback['companyPhoneNumber'] ) ); } else { $html .= 'Phone: [phone number]
'; } // Email if ( ! empty( $feedback['companyEmailAddress'] ) ) { $html .= sprintf( 'E-mail: %s
', htmlspecialchars( $feedback['companyEmailAddress'] ), htmlspecialchars( $feedback['companyEmailAddress'] ), htmlspecialchars( $feedback['companyEmailAddress'] ) ); } // Visitor Address if ( ! empty( $feedback['companyVisitorAddress'] ) ) { $html .= sprintf( 'Visitor Address: %s
', htmlspecialchars( $feedback['companyVisitorAddress'] ) ); } // Postal Address if ( ! empty( $feedback['companyPostalAddress'] ) ) { $html .= sprintf( 'Postal Address: %s
', htmlspecialchars( $feedback['companyPostalAddress'] ) ); } // Other Contact Options if ( ! empty( $feedback['otherContactOptions'] ) ) { $html .= sprintf( 'Other contact options: %s
', htmlspecialchars( $feedback['otherContactOptions'] ) ); } $html .= '

'; } // Response Duration $response_duration = $feedback['typicalDurationForResponse'] ?? ''; if ( ! empty( $response_duration ) ) { $html .= sprintf( '

We aim to respond to feedback within %s.

', htmlspecialchars( $response_duration ) ); } // Enforcement Team $enforcement_team = $feedback['enforcementTeam'] ?? array(); $enforcement_team = array_filter( $enforcement_team, function ( $team ) { return ! empty( $team['name'] ) || ! empty( $team['linkToEnforcementProcedure'] ) || ! empty( $team['contactDetails'] ); } ); if ( ! empty( $enforcement_team ) ) { $html .= '

Formal complaints

'; $html .= '

If you haven\'t receive a timely or adequate response to the accessibility issue. Please raise a formal complaint to the given enforcement team:

'; foreach ( $enforcement_team as $index => $team ) { $html .= sprintf( '
Enforcement team %d
', $index + 1 ); if ( ! empty( $team['name'] ) ) { $html .= sprintf( '
Name: %s
', htmlspecialchars( $team['name'] ) ); } if ( ! empty( $team['linkToEnforcementProcedure'] ) ) { $html .= sprintf( '
Link to the enforcement procedure or authority: %s
', htmlspecialchars( $team['linkToEnforcementProcedure'] ), htmlspecialchars( $team['linkToEnforcementProcedure'] ) ); } if ( ! empty( $team['contactDetails'] ) ) { $html .= '
Contact details:'; $html .= sprintf( '
%s
', htmlspecialchars( $team['contactDetails'] ) ); $html .= '
'; } $html .= '
'; } } $html .= '
'; return $html; } /** * Generate footer */ private function generate_footer() { $html = '
'; $html .= 'Generated using the '; $html .= 'WebYes Web Accessibility Statement Generator.'; $html .= '
'; return $html; } /** * Get CSS styles */ private function get_css() { return ''; } } // Usage example: /* $statement = [ 'basicInfo' => [ 'companyName' => 'Example Company', 'websiteUrl' => 'https://example.com', 'websiteName' => 'Example Website', 'publicationDate' => '2024-01-15' ], 'efforts' => [ 'selectedEfforts' => ['Include accessibility as part of our mission statement'], 'additionalEfforts' => ['Custom effort 1', 'Custom effort 2'] ], 'conformanceStatus' => [ 'standard' => 'wcag21-aa', 'conformanceLevel' => 'partially-conformant', 'additionalConsiderations' => 'We also follow Section 508 guidelines', 'knownIssues' => [ [ 'title' => 'Image alt text', 'description' => 'Some images lack descriptive alt text' ] ], 'unresolvedBarriers' => 'Some legacy content may not be fully accessible', 'contentOutsideScope' => 'Third-party content is outside our control' ], 'technicalSpecs' => [ 'knownCompatibilities' => [ 'browsers' => ['Chrome', 'Firefox', 'Safari'], 'operatingSystems' => ['Windows', 'macOS', 'Linux'], 'assistiveTechnologies' => ['NVDA', 'JAWS', 'VoiceOver'] ], 'knownIncompatibilities' => [ 'browsers' => ['Internet Explorer'], 'operatingSystems' => [], 'assistiveTechnologies' => [] ], 'technologyReliance' => [ 'selected' => ['HTML', 'CSS', 'JavaScript'], 'other' => '' ], 'assessmentApproach' => [ 'selected' => ['Self-evaluation'], 'otherMethods' => ['Manual testing with screen readers'] ] ], 'feedback' => [ 'companyPhoneNumber' => '+1-555-123-4567', 'companyEmailAddress' => 'accessibility@example.com', 'companyVisitorAddress' => '123 Main St, City, State 12345', 'companyPostalAddress' => '123 Main St, City, State 12345', 'sameAsVisitorAddress' => true, 'otherContactOptions' => 'Contact form on website', 'typicalDurationForResponse' => '2 business days', 'enforcementTeam' => [ [ 'name' => 'Department of Justice', 'linkToEnforcementProcedure' => 'https://www.ada.gov/', 'contactDetails' => 'Phone: 1-800-514-0301' ] ] ], 'relatedEvidence' => [ 'recentEvaluationReport' => 'https://example.com/accessibility-report.pdf', 'evaluationStatement' => '', 'otherEvidence' => ['https://example.com/accessibility-audit.pdf'] ] ]; $generator = new AccessibilityStatementGenerator($statement); echo $generator->generate(); */ // phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound