Icons
in package
Provides SVG icon support.
Provides inline SVG icons.
Tags
Table of Contents
Constants
- SVG_KSES_RULES = array('svg' => array('aria-hidden' => true, 'aria-labelledby' => true, 'class' => true, 'fill' => true, 'focusable' => true, 'height' => true, 'preserveaspectratio' => true, 'role' => true, 'viewbox' => true, 'width' => true, 'xmlns' => true), 'circle' => array('cx' => true, 'cy' => true, 'fill' => true, 'r' => true), 'clipPath' => array('id' => true), 'defs' => array('id' => true), 'g' => array('fill' => true, 'clip-path' => true, 'mask' => true, 'transform' => true), 'line' => array('fill-rule' => true, 'fill' => true, 'stroke-width' => true, 'stroke' => true, 'transform' => true, 'x1' => true, 'x2' => true, 'y1' => true, 'y2' => true), 'mask' => array('fill' => true, 'height' => true, 'id' => true, 'maskUnits' => true, 'style' => true, 'width' => true, 'x' => true, 'y' => true), 'path' => array('clip-rule' => true, 'd' => true, 'fill-rule' => true, 'fill' => true), 'polygon' => array('fill-rule' => true, 'fill' => true, 'focusable' => true, 'points' => true, 'transform' => true), 'rect' => array('fill-rule' => true, 'fill' => true, 'height' => true, 'width' => true, 'x' => true, 'y' => true), 'symbol' => array('id' => true, 'viewbox' => true), 'use' => array('href' => true))
- KSES ruleset to apply to SVG elements.
Properties
- $instances : array<string|int, object>
- The array of instances of this class and sub-classes.
Methods
- get_icon() : string
- Get the SVG icon.
- get_instance() : object
- Creates and/or returns the instance of this class.
- get_kses_rules() : array<string|int, mixed>
- Return the allowed HTML for wp_kses rules.
- get_path() : string
- Get the path to the icons folder.
- get_url() : string
- Get the url of the icons folder.
- __construct() : void
- Initialise the class.
Constants
SVG_KSES_RULES
KSES ruleset to apply to SVG elements.
protected
array<string|int, mixed>
SVG_KSES_RULES
= array('svg' => array('aria-hidden' => true, 'aria-labelledby' => true, 'class' => true, 'fill' => true, 'focusable' => true, 'height' => true, 'preserveaspectratio' => true, 'role' => true, 'viewbox' => true, 'width' => true, 'xmlns' => true), 'circle' => array('cx' => true, 'cy' => true, 'fill' => true, 'r' => true), 'clipPath' => array('id' => true), 'defs' => array('id' => true), 'g' => array('fill' => true, 'clip-path' => true, 'mask' => true, 'transform' => true), 'line' => array('fill-rule' => true, 'fill' => true, 'stroke-width' => true, 'stroke' => true, 'transform' => true, 'x1' => true, 'x2' => true, 'y1' => true, 'y2' => true), 'mask' => array('fill' => true, 'height' => true, 'id' => true, 'maskUnits' => true, 'style' => true, 'width' => true, 'x' => true, 'y' => true), 'path' => array('clip-rule' => true, 'd' => true, 'fill-rule' => true, 'fill' => true), 'polygon' => array('fill-rule' => true, 'fill' => true, 'focusable' => true, 'points' => true, 'transform' => true), 'rect' => array('fill-rule' => true, 'fill' => true, 'height' => true, 'width' => true, 'x' => true, 'y' => true), 'symbol' => array('id' => true, 'viewbox' => true), 'use' => array('href' => true))
Tags
Properties
$instances
The array of instances of this class and sub-classes.
protected
static array<string|int, object>
$instances
= array()
Tags
Methods
get_icon()
Get the SVG icon.
public
get_icon(string $service) : string
Parameters
- $service : string
-
The service to retrieve an icon for.
Tags
Return values
string —The SVG element markup, or empty if no icon in assets folder.
get_instance()
Creates and/or returns the instance of this class.
public
static get_instance() : object
Tags
Return values
object —The instance of this class.
get_kses_rules()
Return the allowed HTML for wp_kses rules.
public
get_kses_rules(array<string|int, mixed> $allowed_tags, string $context) : array<string|int, mixed>
Parameters
- $allowed_tags : array<string|int, mixed>
-
The allowed HTML tags.
- $context : string
-
The wp_kses context.
Tags
Return values
array<string|int, mixed> —The settings for wp_kses to allow SVG use.
get_path()
Get the path to the icons folder.
public
get_path() : string
Tags
Return values
string —The fully qualified path to the icons folder.
get_url()
Get the url of the icons folder.
public
get_url() : string
Tags
Return values
string —The url of the icons folder.
__construct()
Initialise the class.
protected
__construct() : void