source on its own array key, without adding either
* the `width` or `height` attributes, since these are added dynamically,
* before rendering the SVG code.
*/
class Eksell_SVG_Icons {
/**
* User Interface icons – SVG sources.
*/
protected static $icons = array(
'arrow-left' => '',
'arrow-right' => '',
'chevron-down' => '',
'close' => '',
'link' => '',
'menu' => '',
'menu-search' => '',
'search' => '',
);
/**
* Social Icons – SVG sources.
*/
protected static $social_icons = array(
'500px' => '',
'amazon' => '',
'bandcamp' => '',
'behance' => '',
'codepen' => '',
'deviantart' => '',
'dribbble' => '',
'dropbox' => '',
'etsy' => '',
'facebook' => '',
'feed' => '',
'flickr' => '',
'foursquare' => '',
'goodreads' => '',
'google' => '',
'github' => '',
'instagram' => '',
'lastfm' => '',
'linkedin' => '',
'mail' => '',
'mastodon' => '',
'medium' => '',
'meetup' => '',
'pinterest' => '',
'pocket' => '',
'reddit' => '',
'skype' => '',
'snapchat' => '',
'soundcloud' => '',
'spotify' => '',
'tumblr' => '',
'twitch' => '',
'twitter' => '',
'vimeo' => '',
'vk' => '',
'wordpress' => '',
'yelp' => '',
'youtube' => '',
);
/**
* Social Icons – domain mappings.
*
* By default, each Icon ID is matched against a .com TLD. To override this behavior,
* specify all the domains it covers (including the .com TLD too, if applicable).
*/
protected static $social_icons_map = array(
'amazon' => array(
'amazon.com',
'amazon.cn',
'amazon.in',
'amazon.fr',
'amazon.de',
'amazon.it',
'amazon.nl',
'amazon.es',
'amazon.co',
'amazon.ca',
),
'behance' => array(
'behance.net',
),
'codepen' => array(
'codepen.io',
),
'facebook' => array(
'facebook.com',
'fb.me',
),
'feed' => array(
'feed',
),
'lastfm' => array(
'last.fm',
),
'mail' => array(
'mailto:',
),
'pocket' => array(
'getpocket.com',
),
'twitch' => array(
'twitch.tv',
),
'wordpress' => array(
'wordpress.com',
'wordpress.org',
),
);
/**
* Gets the SVG code for a given icon.
*
* @param string $group the icon group.
* @param string $icon The icon.
* @param int $size The icon-size in pixels.
*
* @return string
*/
public static function get_svg( $group, $icon, $width = 24, $height = 24 ) {
if ( 'ui' === $group ) {
$arr = self::$icons;
} elseif ( 'social' === $group ) {
$arr = self::$social_icons;
} else {
$arr = array();
}
/**
* Filters Eksells array of icons.
*
* The dynamic portion of the hook name, `$group`, refers to
* the name of the group of icons, either "ui" or "social".
*
* @param array $arr Array of icons.
*/
$arr = apply_filters( "eksell_svg_icons_{$group}", $arr );
$svg = '';
if ( array_key_exists( $icon, $arr ) ) {
$repl = sprintf( '