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 () | |
The main check function. | |
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_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_severity () | |
Returns the default severity of the test. | |
image_is_animated ($filename) | |
Returns if a GIF files is animated or not http://us.php.net/manual/en/function.imagecreatefromgif.php#88005. | |
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 | $basepath |
The base path for this request. | |
bool | $cms = true |
Whether the test can be used in a CMS (content without HTML head) | |
object | $css |
The brickfieldCSS object. | |
int | $defaultseverity = tool_brickfield\local\htmlchecker\brickfield_accessibility::BA_TEST_SEVERE |
The default severity code for this test. | |
object | $dom |
The DOMDocument object. | |
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 |
tool_brickfield\local\htmlchecker\common\checks\area_has_alt_value::check | ( | ) |
The main check function.
This is called by the parent class to actually check content
|
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 |
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 default severity of the test.
int | The severity level |
|
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 |
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 |