Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
__construct (string $value='', string $guideline='wcag2aaa', string $type='string', string $reporter='static', string $domain='en') | |
The class constructor. | |
add_css (string $css) | |
Helper method to add an additional CSS file. | |
cleanup () | |
A general cleanup function which just does some memory cleanup by unsetting the particularly large local vars. | |
get_absolute_path (string $absolute, string $relative) | |
Returns an absolute path from a relative one. | |
get_base_from_file (string $file) | |
Retrieves the absolute path to a file. | |
get_css_object () | |
Loads the brickfield_accessibility_css object. | |
get_error (string $error) | |
Retrives a single error from the current reporter. | |
get_report (array $options=[]) | |
Returns a formatted report from the current reporter. | |
get_test (string $test) | |
Runs one test on the current DOMDocument. | |
get_test_severity (string $test) | |
Retrieves the default severity of a test. | |
is_valid () | |
Checks that the DOM object is valid or not. | |
load_reporter (array $options=[]) | |
A local method to load the required file for a reporter and set it for the current object. | |
prepare_base_url (string $value, string $type) | |
Formats the base URL for either a file or uri request. | |
prepare_dom () | |
Prepares the DOMDocument object for brickfield_accessibility. | |
prepare_value () | |
If the CMS mode options are set, then we remove some items front the HTML value before sending it back. | |
run_check ($options=null) | |
Starts running automated checks. | |
set_option ($variable, $value=null) | |
Set global predefined options for brickfield_accessibility. | |
set_uri (string $uri) | |
Sets the URI if this is for a string or to change where Will look for resources like CSS files. | |
Static Public Member Functions | |
static | match_urls (string $text, string $href) |
Determines if the link text is the same as the link URL, without necessarily being an exact match. | |
Public Attributes | |
string | $baseurl |
The base URL for any request of type URI. | |
object | $css |
The brickfieldCSS object. | |
array | $cssfiles = [] |
An array of additional CSS files to load (useful for CMS content) | |
object | $dom |
The central DOMDocument object. | |
string | $domain |
The translation domain of the current library. | |
object | $guideline |
The central guideline object. | |
string | $guidelinename = 'wcag' |
The name of the guideline. | |
bool | $isvalid = true |
An indicator if the DOMDocument loaded. | |
array | $options |
An array of additional options. | |
array | $path = [] |
An array of the current file or URI path. | |
object | $reporter |
A reporting object. | |
string | $reportername = 'static' |
The name of the reporter to use. | |
string | $type |
The type of request this is (either 'string', 'file', or 'uri'. | |
string | $uri = '' |
The base URI of the current request (used to rebuild page if necessary) | |
string | $value |
The value of the request. | |
string const | BA_ERROR_TAG = 'bferror' |
Tag identifier to enclose all error HTML fragments in. | |
int const | BA_TEST_MODERATE = 2 |
Failure level moderate. | |
int const | BA_TEST_SEVERE = 1 |
Failure level severe. | |
int const | BA_TEST_SUGGESTION = 3 |
Failure level seggestion. | |
tool_brickfield\local\htmlchecker\brickfield_accessibility::__construct | ( | string | $value = '', |
string | $guideline = 'wcag2aaa', | ||
string | $type = 'string', | ||
string | $reporter = 'static', | ||
string | $domain = 'en' ) |
The class constructor.
string | $value | Either the HTML string to check or the file/uri of the request |
string | $guideline | The name of the guideline |
string | $type | The type of the request (either file, uri, or string) |
string | $reporter | The name of the reporter to use |
string | $domain | The domain of the translation language to use |
tool_brickfield\local\htmlchecker\brickfield_accessibility::add_css | ( | string | $css | ) |
Helper method to add an additional CSS file.
string | $css | The URI or file path to a CSS file |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_absolute_path | ( | string | $absolute, |
string | $relative ) |
Returns an absolute path from a relative one.
string | $absolute | The absolute URL |
string | $relative | The relative path |
string | A new path |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_base_from_file | ( | string | $file | ) |
Retrieves the absolute path to a file.
string | $file | The path to a file |
string | The absolute path to a file |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_error | ( | string | $error | ) |
Retrives a single error from the current reporter.
string | $error | The error key |
object | A ReportItem object |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_report | ( | array | $options = [] | ) |
Returns a formatted report from the current reporter.
array | $options | An array of all the options |
mixed | See the documentation on your reporter's getReport method. |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_test | ( | string | $test | ) |
Runs one test on the current DOMDocument.
string | $test | The name of the test to run |
bool|array | The ReportItem returned from the test |
tool_brickfield\local\htmlchecker\brickfield_accessibility::get_test_severity | ( | string | $test | ) |
Retrieves the default severity of a test.
string | $test | The name of the test to run |
object | The severity level of the test |
tool_brickfield\local\htmlchecker\brickfield_accessibility::is_valid | ( | ) |
Checks that the DOM object is valid or not.
bool | Whether the DOMDocument is valid |
tool_brickfield\local\htmlchecker\brickfield_accessibility::load_reporter | ( | array | $options = [] | ) |
A local method to load the required file for a reporter and set it for the current object.
array | $options | An array of options for the reporter |
|
static |
Determines if the link text is the same as the link URL, without necessarily being an exact match.
For example, 'www.google.com' matches 'https://www.google.com'.
string | $text | |
string | $href |
bool |
tool_brickfield\local\htmlchecker\brickfield_accessibility::prepare_base_url | ( | string | $value, |
string | $type ) |
Formats the base URL for either a file or uri request.
We are essentially formatting a base url for future reporters to use to find CSS files or for tests that use external resources (images, objects, etc) to run tests on them.
string | $value | The path value |
string | $type | The type of request |
tool_brickfield\local\htmlchecker\brickfield_accessibility::prepare_dom | ( | ) |
Prepares the DOMDocument object for brickfield_accessibility.
It loads based on the file type declaration and first scrubs the value using prepareValue().
tool_brickfield\local\htmlchecker\brickfield_accessibility::run_check | ( | $options = null | ) |
Starts running automated checks.
Loads the CSS file parser and the guideline object.
null | $options |
bool |
tool_brickfield\local\htmlchecker\brickfield_accessibility::set_option | ( | $variable, | |
$value = null ) |
Set global predefined options for brickfield_accessibility.
First we check that the array key has been defined.
mixed | $variable | Either an array of values, or a variable name of the option |
mixed | $value | If this is a single option, the value of the option |
tool_brickfield\local\htmlchecker\brickfield_accessibility::set_uri | ( | string | $uri | ) |
Sets the URI if this is for a string or to change where Will look for resources like CSS files.
string | $uri | The URI to set |
bool tool_brickfield\local\htmlchecker\brickfield_accessibility::$isvalid = true |
An indicator if the DOMDocument loaded.
If not, this means that the HTML given to it was so munged it wouldn't even load.
array tool_brickfield\local\htmlchecker\brickfield_accessibility::$options |
An array of additional options.
string tool_brickfield\local\htmlchecker\brickfield_accessibility::$value |
The value of the request.
Either HTML, a URI, or the path to a file