Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | |
add_report ($element=null, $message=null, $pass=null, $state=null, $manual=null) | |
Adds a new ReportItem to this current tests collection of reports. | |
check () | |
Compares the WCAG contrast on the given color attributes of the <body> tag. | |
convert_color (string $color) | |
Converts multiple color or background styles into a simple hex string. | |
element_contains_readable_text ($element) | |
Returns if there are any printable/readable characters within an element. | |
element_has_child ($element, string $childtag) | |
Returns true if an element has a child with a given tag name. | |
get_all_elements ($tags=null, string $options='', bool $value=true) | |
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) | |
get_element_ancestor ($element, string $ancestortag, string $limittag='body') | |
Returns the first ancestor reached of a tag, or false if it hits the document root or a given tag. | |
get_elements_by_attribute (string $tag, string $attribute, bool $unique=false) | |
Finds all the elements with a given tag name that has an attribute. | |
get_fontsize (string $fontsize) | |
Helper method that finds the estimated font-size for the provided string font-size parameter. | |
get_luminosity (string $foreground, string $background) | |
Helper method that finds the luminosity between the provided foreground and background parameters. | |
get_next_element ($element) | |
Returns the next element after the current one. | |
get_parent ($element, string $tagname, string $limiter) | |
Returns the parent of an elment that has a given tag Name, but stops the search if it hits the $limiter tag. | |
get_path ($file) | |
Retrieves the full path for a file. | |
get_report () | |
Helper method to collect the report from this test. | |
get_rgb (string $color) | |
Returns the decimal equivalents for a HEX color. | |
get_severity () | |
Returns the default severity of the test. | |
get_wai_diffs (array $forergb, array $backrgb) | |
Get the wai differences. | |
get_wai_ert_brightness (string $foreground, string $background) | |
Returns the WAI ERT Brightness between two colors. | |
get_wai_ert_contrast (string $foreground, string $background) | |
Returns the WAIERT contrast between two colors. | |
image_is_animated ($filename) | |
Returns if a GIF files is animated or not http://us.php.net/manual/en/function.imagecreatefromgif.php#88005. | |
luminosity (string $r, string $r2, string $g, string $g2, string $b, string $b2) | |
Returns the luminosity between two colors. | |
property_is_equal ($object, string $property, $value, bool $trim=false, bool $lower=false) | |
To minimize notices, this compares an object's property to the valus and returns true or false. | |
translation () | |
Returns a translated variable. | |
Static Public Member Functions | |
static | get_all_invalidlinkphrases () |
Returns an array of the invalidlinkphrases for all enabled language packs. | |
static | get_all_newwindowphrases () |
Returns an array of the newwindowphrases for all enabled language packs. | |
static | is_text_readable (string $text) |
Assesses whether a string contains any readable text, which is text that contains any characters other than whitespace characters. | |
Public Attributes | |
string | $background = 'bgcolor' |
The attribute to check for the background color of the <body> tag. | |
string | $basepath |
The base path for this request. | |
bool | $cms = true |
Whether the test can be used in a CMS (content without HTML head) | |
string[] | $colornames |
Define colour codes. | |
object | $css |
The brickfieldCSS object. | |
int | $defaultseverity = tool_brickfield\local\htmlchecker\brickfield_accessibility::BA_TEST_SUGGESTION |
The fallback severity level for all tests. | |
object | $dom |
The DOMDocument object. | |
string[] | $fontsizenames |
Define estimated relative font-size codes to pt values. | |
string | $foreground = 'text' |
The attribute to check for the foreground color of the <body> tag. | |
array | $imageextensions = array('gif', 'jpg', 'png', 'jpeg', 'tiff', 'svn') |
An array of all the extensions that are images. | |
string | $lang = 'en' |
The language domain. | |
mixed | $options |
Any additional options passed by htmlchecker. | |
array | $path |
The path for the request. | |
array | $report = array() |
An array of ReportItem objects. | |
array | $strings = array('en' => '') |
An array of translatable strings. | |
Static Protected Member Functions | |
static | get_all_phrases (string $stringname) |
Returns an array of the relevant phrases for all enabled language packs. | |
|
inherited |
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
object | $element | The DOMElement object that pertains to this report |
string | $message | An additional message to add to the report |
bool | $pass | Whether or not this report passed |
object | $state | Extra information about the error state |
bool | $manual | Whether the report needs a manual check |
|
inherited |
Converts multiple color or background styles into a simple hex string.
string | $color | The color attribute to convert (this can also be a multi-value css background value) |
string | A standard CSS hex value for the color |
|
inherited |
Returns if there are any printable/readable characters within an element.
This finds both node values or images with alt text.
object | $element | The given element to look at |
bool | TRUE if contains readable text, FALSE if otherwise |
|
inherited |
Returns true if an element has a child with a given tag name.
object | $element | A DOMElement object |
string | $childtag | The tag name of the child to find |
bool | TRUE if the element does have a child with the given tag name, otherwise FALSE |
|
inherited |
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)
mixed | $tags | Either a single tag name in a string, or an array of tag names |
string | $options | The kind of option to select an element by (see htmlElements) |
bool | $value | The value of the above option |
array | An array of elements that fit the description |
|
staticinherited |
Returns an array of the invalidlinkphrases for all enabled language packs.
array | of the invalidlinkphrases for all enabled language packs. |
|
staticinherited |
Returns an array of the newwindowphrases for all enabled language packs.
array | of the newwindowphrases for all enabled language packs. |
|
staticprotectedinherited |
Returns an array of the relevant phrases for all enabled language packs.
string | $stringname | the language string identifier you want get the phrases for. |
array | of the invalidlinkphrases for all enabled language packs. |
|
inherited |
Returns the first ancestor reached of a tag, or false if it hits the document root or a given tag.
object | $element | A DOMElement object |
string | $ancestortag | The name of the tag we are looking for |
string | $limittag | Where to stop searching |
bool |
|
inherited |
Finds all the elements with a given tag name that has an attribute.
string | $tag | The tag name to search for |
string | $attribute | The attribute to search on |
bool | $unique | Whether we only want one result per attribute |
array | An array of DOMElements with the attribute value as the key. |
|
inherited |
Helper method that finds the estimated font-size for the provided string font-size parameter.
string | $fontsize | The css font-size, in various formats |
int | The estimated font-size |
|
inherited |
Helper method that finds the luminosity between the provided foreground and background parameters.
string | $foreground | The HEX value of the foreground color |
string | $background | The HEX value of the background color |
float | The luminosity contrast ratio between the colors |
|
inherited |
Returns the next element after the current one.
object | $element | A DOMElement object |
mixed | FALSE if there is no other element, or a DOMElement object |
|
inherited |
Returns the parent of an elment that has a given tag Name, but stops the search if it hits the $limiter tag.
object | $element | The DOMElement object to search on |
string | $tagname | The name of the tag of the parent to find |
string | $limiter | The tag name of the element to stop searching on regardless of the results (like search for a parent "P" tag of this node but stop if you reach "body") |
mixed | FALSE if no parent is found, or the DOMElement object of the found parent |
|
inherited |
Retrieves the full path for a file.
string | $file | The path to a file |
string | The absolute path to the file. |
|
inherited |
Helper method to collect the report from this test.
Some tests do additional cleanup by overriding this method
array | An array of ReportItem objects |
|
inherited |
Returns the decimal equivalents for a HEX color.
Returns null if it cannot be determined.
string | $color | The hex color value |
array|null | An array where 'r' is the Red value, 'g' is Green, and 'b' is Blue |
|
inherited |
Returns the default severity of the test.
int | The severity level |
|
inherited |
Get the wai differences.
array | $forergb | |
array | $backrgb |
array |
|
inherited |
Returns the WAI ERT Brightness between two colors.
string | $foreground | |
string | $background |
float|int |
|
inherited |
Returns the WAIERT contrast between two colors.
string | $foreground | |
string | $background |
array |
|
inherited |
Returns if a GIF files is animated or not http://us.php.net/manual/en/function.imagecreatefromgif.php#88005.
string | $filename |
int |
|
staticinherited |
Assesses whether a string contains any readable text, which is text that contains any characters other than whitespace characters.
string | $text |
bool |
|
inherited |
Returns the luminosity between two colors.
string | $r | The first Red value |
string | $r2 | The second Red value |
string | $g | The first Green value |
string | $g2 | The second Green value |
string | $b | The first Blue value |
string | $b2 | The second Blue value |
float | The luminosity contrast ratio between the colors |
|
inherited |
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
object | $object | The object too look at |
string | $property | The name of the property |
mixed | $value | The value to check against |
bool | $trim | Whether the property value should be trimmed |
bool | $lower | Whether the property value should be compared on lower case |
bool |
|
inherited |
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
mixed | The translation for the object |
|
inherited |
Define estimated relative font-size codes to pt values.