Brickfield accessibility HTML checker library.
More...
|
| | __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 | match_urls (string $text, string $href) |
| | Determines if the link text is the same as the link URL, without necessarily being an exact match.
|
| |
|
|
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.
|
| |
Brickfield accessibility HTML checker library.
The main interface class for brickfield_accessibility.
- Copyright
- 2020 onward: Brickfield Education Labs, www.brickfield.ie
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::__construct |
( |
string | $value = '', |
|
|
string | $guideline = 'wcag2aaa', |
|
|
string | $type = 'string', |
|
|
string | $reporter = 'static', |
|
|
string | $domain = 'en' ) |
The class constructor.
- Parameters
-
| 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 |
◆ add_css()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::add_css |
( |
string | $css | ) |
|
Helper method to add an additional CSS file.
- Parameters
-
| string | $css | The URI or file path to a CSS file |
◆ get_absolute_path()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_absolute_path |
( |
string | $absolute, |
|
|
string | $relative ) |
Returns an absolute path from a relative one.
- Parameters
-
| string | $absolute | The absolute URL |
| string | $relative | The relative path |
- Return values
-
◆ get_base_from_file()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_base_from_file |
( |
string | $file | ) |
|
Retrieves the absolute path to a file.
- Parameters
-
| string | $file | The path to a file |
- Return values
-
| string | The absolute path to a file |
◆ get_error()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_error |
( |
string | $error | ) |
|
Retrives a single error from the current reporter.
- Parameters
-
| string | $error | The error key |
- Return values
-
| object | A ReportItem object |
◆ get_report()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_report |
( |
array | $options = [] | ) |
|
Returns a formatted report from the current reporter.
- Parameters
-
| array | $options | An array of all the options |
- Return values
-
| mixed | See the documentation on your reporter's getReport method. |
◆ get_test()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_test |
( |
string | $test | ) |
|
Runs one test on the current DOMDocument.
- Parameters
-
| string | $test | The name of the test to run |
- Return values
-
| bool|array | The ReportItem returned from the test |
◆ get_test_severity()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::get_test_severity |
( |
string | $test | ) |
|
Retrieves the default severity of a test.
- Parameters
-
| string | $test | The name of the test to run |
- Return values
-
| object | The severity level of the test |
◆ is_valid()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::is_valid |
( |
| ) |
|
Checks that the DOM object is valid or not.
- Return values
-
| bool | Whether the DOMDocument is valid |
◆ load_reporter()
| 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.
- Parameters
-
| array | $options | An array of options for the reporter |
◆ match_urls()
| static tool_brickfield\local\htmlchecker\brickfield_accessibility::match_urls |
( |
string | $text, |
|
|
string | $href ) |
|
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'.
- Parameters
-
- Return values
-
◆ prepare_base_url()
| 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.
- Parameters
-
| string | $value | The path value |
| string | $type | The type of request |
◆ prepare_dom()
| 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().
◆ run_check()
| tool_brickfield\local\htmlchecker\brickfield_accessibility::run_check |
( |
| $options = null | ) |
|
Starts running automated checks.
Loads the CSS file parser and the guideline object.
- Parameters
-
- Return values
-
◆ set_option()
| 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.
- Parameters
-
| 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 |
◆ set_uri()
| 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.
- Parameters
-
◆ $isvalid
| 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.
◆ $options
| array tool_brickfield\local\htmlchecker\brickfield_accessibility::$options |
Initial value:= [
'cms_mode' => false,
'start_element' => 0,
'end_element' => 0,
'cms_template' => []
]
An array of additional options.
◆ $value
| string tool_brickfield\local\htmlchecker\brickfield_accessibility::$value |
The value of the request.
Either HTML, a URI, or the path to a file
The documentation for this class was generated from the following file: