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

xemlock / htmlpurifier-html5 / 16898969866

12 Aug 2025 04:28AM UTC coverage: 99.276%. Remained the same
16898969866

Pull #87

github

web-flow
Bump actions/checkout from 4 to 5

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #87: Bump actions/checkout from 4 to 5

1508 of 1519 relevant lines covered (99.28%)

3883.48 hits per line

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

100.0
/library/HTMLPurifier/AttrDef/HTML5/Rel.php
1
<?php
2

3
/**
4
 * Shared validation logic for 'rel' attribute on <a>, <area>, <form> and <link> elements,
5
 * as defined by the HTML5 spec and the MicroFormats link type extensions tables.
6
 *
7
 * @see https://html.spec.whatwg.org/multipage/links.html#linkTypes
8
 */
9
abstract class HTMLPurifier_AttrDef_HTML5_Rel extends HTMLPurifier_AttrDef
10
{
11
    /**
12
     * Lookup table for valid rel values.
13
     * Stored as a static variable to minimize serialization footprint.
14
     * @var array
15
     */
16
    protected static $values = array();
17

18
    /**
19
     * Lazy loaded lookup for allowed rel values, based on provided config.
20
     * @var array
21
     */
22
    protected $allowed;
23

24
    /**
25
     * @param string $string
26
     * @param HTMLPurifier_Config $config
27
     * @param HTMLPurifier_Context $context
28
     * @return bool|string
29
     */
30
    public function validate($string, $config, $context)
31
    {
32
        if ($this->allowed === null) {
228✔
33
            $allowedRel = (array) $config->get('Attr.AllowedRel');
228✔
34
            if (empty($allowedRel)) {
228✔
35
                $allowed = array();
24✔
36
            } else {
4✔
37
                $allowed = array_intersect_key($allowedRel, static::$values);
204✔
38
            }
39
            $this->allowed = $allowed;
228✔
40
        }
38✔
41

42
        $string = $this->parseCDATA($string);
228✔
43
        $parts = explode(' ', $string);
228✔
44

45
        $result = array();
228✔
46
        foreach ($parts as $part) {
228✔
47
            // Link type keywords are always ASCII case-insensitive, and must be compared as such.
48
            // https://html.spec.whatwg.org/multipage/links.html#linkTypes
49
            $part = strtolower(trim($part));
228✔
50
            if (!isset($this->allowed[$part])) {
228✔
51
                continue;
84✔
52
            }
53
            $result[$part] = true;
204✔
54
        }
38✔
55

56
        if (empty($result)) {
228✔
57
            return false;
60✔
58
        }
59

60
        return implode(' ', array_keys($result));
204✔
61
    }
62
}
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