Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

File Size: 394 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: brickfield_accessibility_test  - X-Ref

This handles importing DOM objects, adding items to the report and provides a few DOM-traversing methods

__construct(&$dom, &$css, &$path, $languagedomain = 'en', $options = null)   X-Ref
The class constructor. We pass items by reference so we can alter the DOM if necessary

param: object $dom The DOMDocument object
param: object $css The brickfieldCSS object
param: array $path The path of this request
param: string $languagedomain The langauge domain to user
param: mixed $options Any additional options passed by htmlchecker.

get_report()   X-Ref
Helper method to collect the report from this test. Some
tests do additional cleanup by overriding this method

return: array An array of ReportItem objects

get_severity()   X-Ref
Returns the default severity of the test

return: int The severity level

add_report($element = null, $message = null, $pass = null, $state = null, $manual = null)   X-Ref
Adds a new ReportItem to this current tests collection of reports.
Most reports pertain to a particular element (like an IMG with no Alt attribute);
however, some are document-level and just either pass or don't pass

param: object $element The DOMElement object that pertains to this report
param: string $message An additional message to add to the report
param: bool $pass Whether or not this report passed
param: object $state Extra information about the error state
param: bool $manual Whether the report needs a manual check

get_path($file)   X-Ref
Retrieves the full path for a file.

return: string The absolute path to the file.
param: string $file The path to a file

translation()   X-Ref
Returns a translated variable. If the translation is unavailable, English is returned
Because tests only really have one string array, we can get all of this info locally

return: mixed The translation for the object

get_all_elements($tags = null, string $options = '', bool $value = true)   X-Ref
Helper method to find all the elements that fit a particular query
in the document (either by tag name, or by attributes from the htmlElements object)

return: array An array of elements that fit the description
param: mixed $tags Either a single tag name in a string, or an array of tag names
param: string $options The kind of option to select an element by (see htmlElements)
param: bool $value The value of the above option

element_has_child($element, string $childtag)   X-Ref
Returns true if an element has a child with a given tag name

return: bool TRUE if the element does have a child with
param: object $element A DOMElement object
param: string $childtag The tag name of the child to find

get_element_ancestor($element, string $ancestortag, string $limittag = 'body')   X-Ref
Returns the first ancestor reached of a tag, or false if it hits
the document root or a given tag.

return: bool
param: object $element A DOMElement object
param: string $ancestortag The name of the tag we are looking for
param: string $limittag Where to stop searching

get_elements_by_attribute(string $tag, string $attribute, bool $unique = false)   X-Ref
Finds all the elements with a given tag name that has
an attribute

return: array An array of DOMElements with the attribute
param: string $tag The tag name to search for
param: string $attribute The attribute to search on
param: bool $unique Whether we only want one result per attribute

get_next_element($element)   X-Ref
Returns the next element after the current one.

return: mixed FALSE if there is no other element, or a DOMElement object
param: object $element A DOMElement object

property_is_equal($object, string $property, $value, bool $trim = false, bool $lower = false)   X-Ref
To minimize notices, this compares an object's property to the valus
and returns true or false. False will also be returned if the object is
not really an object, or if the property doesn't exist at all

return: bool
param: object $object The object too look at
param: string $property The name of the property
param: mixed $value The value to check against
param: bool $trim Whether the property value should be trimmed
param: bool $lower Whether the property value should be compared on lower case

get_parent($element, string $tagname, string $limiter)   X-Ref
Returns the parent of an elment that has a given tag Name, but
stops the search if it hits the $limiter tag

return: mixed FALSE if no parent is found, or the DOMElement object of the found parent
param: object $element The DOMElement object to search on
param: string $tagname The name of the tag of the parent to find
param: string $limiter The tag name of the element to stop searching on

image_is_animated($filename)   X-Ref
Returns if a GIF files is animated or not http://us.php.net/manual/en/function.imagecreatefromgif.php#88005

return: int
param: string $filename

element_contains_readable_text($element)   X-Ref
Returns if there are any printable/readable characters within an element.
This finds both node values or images with alt text.

return: bool TRUE if contains readable text, FALSE if otherwise
param: object $element The given element to look at

get_all_invalidlinkphrases()   X-Ref
Returns an array of the invalidlinkphrases for all enabled language packs.

return: array of the invalidlinkphrases for all enabled language packs.