• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

equalizedigital / accessibility-checker / 13161962549

05 Feb 2025 04:26PM UTC coverage: 24.679% (+0.003%) from 24.676%
13161962549

push

github

web-flow
Merge pull request #849 from equalizedigital/steve/8065492104/find-unique-missing-transcripts

updated: EDAC_Dom and missing_transcript to modify element output to ensure each unique element is stored

0 of 2 new or added lines in 2 files covered. (0.0%)

1751 of 7095 relevant lines covered (24.68%)

5.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.82
/includes/rules/missing_transcript.php
1
<?php // phpcs:ignore WordPress.Files.FileName.NotHyphenatedLowercase -- underscore is for valid function name.
2
/**
3
 * Accessibility Checker pluign file.
4
 *
5
 * @package Accessibility_Checker
6
 */
7

8
/**
9
 * Missing Transcript Check
10
 *
11
 * @param array  $content Array of content to check.
12
 * @param object $post Object to check.
13
 * @return array
14
 */
15
function edac_rule_missing_transcript( $content, $post ) { // phpcs:ignore -- $content is reserved for future use or for compliance with a specific interface.
16

17
        if ( empty( $post->post_content ) ) {
10✔
18
                return [];
×
19
        }
20

21
        $dom      = edac_str_get_html( $post->post_content );
10✔
22
        $errors   = [];
10✔
23
        $elements = [];
10✔
24
        if ( $dom ) {
10✔
25
                $elements = $dom->find_media_embeds( true );
10✔
26
        }
27

28
        $dom->convert_tag_to_marker( [ 'img', 'iframe', 'audio', 'video', '.is-type-video' ] );
10✔
29
        foreach ( $elements as $element ) {
10✔
30
                if ( ! $dom->text_around_element_contains( $element, __( 'transcript', 'accessibility-checker' ), 25 ) ) {
×
NEW
31
                        $errors[] = $element;
×
32
                }
33
        }
34
        $linked_media = $dom->find_linked_media( true );
10✔
35

36
        foreach ( $linked_media as $media_link ) {
10✔
37
                $href = $media_link->href;
8✔
38

39
                // Skip certain types of links.
40
                if ( strpos( $href, 'mailto:' ) === 0 
8✔
41
                        || strpos( $href, 'tel:' ) === 0 
8✔
42
                        || strpos( $href, '#' ) === 0 
8✔
43
                        || strpos( $href, 'javascript:' ) === 0
8✔
44
                ) {
45
                        continue;
×
46
                }
47
                
48
                if ( ! $dom->text_around_element_contains( $media_link, __( 'transcript', 'accessibility-checker' ), 25 ) ) {
8✔
49
                        $errors[] = $media_link;
6✔
50
                }
51
        }
52

53
        return $errors;
10✔
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc