%4$s',
$width,
$height,
$viewbox,
$icon,
$name
);
}
/**
* Echo an icon in a safe mode.
*
* @param string $name The name of the icon.
* @param int $width The width.
* @param int $height The height.
* @param string $viewbox The viewbox, will be auto-built from width and height if not set.
* @param string $color The fill color (optional).
*
* @return void
*/
function wpconsent_icon( $name, $width = 20, $height = 20, $viewbox = '', $color = '' ) {
$icon = wpconsent_get_icon( $name, $width, $height, $viewbox, $color );
if ( ! empty( $icon ) ) {
echo wp_kses(
$icon,
wpconsent_get_icon_allowed_tags()
);
}
}
/**
* Get the allowed tags for svg icons, to be used in wp_kses.
*
* @return array
* @see wpconsent_icon()
* @see wp_kses()
*/
function wpconsent_get_icon_allowed_tags() {
return array(
'svg' => array(
'class' => true,
'aria-hidden' => true,
'aria-labelledby' => true,
'role' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
),
'g' => array(
'fill' => true,
'clip-path' => true,
'transform' => true,
'stroke' => true,
),
'title' => array( 'title' => true ),
'path' => array(
'd' => true,
'fill' => true,
'fill-rule' => true,
'clip-rule' => true,
),
'circle' => array(
'cx' => true,
'cy' => true,
'r' => true,
'stroke' => true,
'stroke-width' => true,
'fill' => true,
),
'rect' => array(
'x' => true,
'y' => true,
'width' => true,
'height' => true,
'fill' => true,
),
'clipPath' => array(
'id' => true,
),
'defs' => array(),
);
}
/**
* Get the whole array of WPConsent SVG icons.
*
* @return array
*/
function wpconsent_icons() {
return (array) apply_filters(
'wpconsent_icons',
array(
'logo' => '',
'logo-text' => '',
'logo-mono' => '',
'close' => '',
'layout' => '',
'style' => '',
'content' => '',
'chevron-right' => '',
'chevron-left' => '',
'drag' => '',
'visibility' => '',
'edit' => '',
'delete' => '',
'lock' => '',
'checkmark' => '',
'preferences' => '',
'inbox' => '',
'info' => '',
'success' => '',
'warning' => '',
'cookie' => '',
'plus' => '',
'announcement' => '',
'generate' => '',
'help' => '',
'globe' => '',
'settings' => '',
'cookie-icon' => '',
'lock-icon' => '',
'cookie-off' => '',
'shield' => '',
'policy' => '',
'list' => '',
'wrench' => '',
'tune' => '',
'pencil' => '',
'facebook' => '',
'x' => '',
'search' => '',
'folder' => '',
'arrow' => '',
'file' => '',
'file-text' => '',
'support' => '',
)
);
}
/**
* Returns the site domain.
*
* @return string
*/
function wpconsent_get_site_domain() {
return wp_parse_url( home_url(), PHP_URL_HOST );
}