\s*', '><', $svg); // Remove white space between SVG tags.
return $svg;
}
return null;
}
static function get_theme_svg_name($url)
{
static $regex_map; // Only compute regex map once, for performance.
if (!isset($regex_map)) {
$regex_map = array();
$map = BigBulletin_SVG_Icons::$social_icons_map; // Use reference instead of copy, to save memory.
foreach (array_keys(BigBulletin_SVG_Icons::$icons) as $icon) {
$domains = array_key_exists($icon, $map) ? $map[$icon] : array(sprintf('%s.com', $icon));
$domains = array_map('trim', $domains); // Remove leading/trailing spaces, to prevent regex from failing to match.
$domains = array_map('preg_quote', $domains);
$regex_map[$icon] = sprintf('/(%s)/i', implode('|', $domains));
}
}
foreach ($regex_map as $icon => $regex) {
if (preg_match($regex, $url)) {
return bigbulletin_get_theme_svg($icon);
}
}
return bigbulletin_get_theme_svg('chain');
}
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',
),
'apple' => array(
'apple.com',
'itunes.com',
),
'behance' => array(
'behance.net',
),
'codepen' => array(
'codepen.io',
),
'facebook' => array(
'facebook.com',
'fb.me',
),
'feed' => array(
'feed',
),
'lastfm' => array(
'last.fm',
),
'mail' => array(
'mailto:',
),
'slideshare' => array(
'slideshare.net',
),
'pocket' => array(
'getpocket.com',
),
'twitch' => array(
'twitch.tv',
),
'wp' => array(
'wordpress.com',
'wordpress.org',
),
);
/* --------------------------------------------------------------------
ICON STORAGE
Store the code for all SVGs in an array
-------------------------------------------------------------------- */
static $icons = array(
'menu' => '',
'home' => '',
'plus' => '',
'minus' => '',
'arrow-down' => '',
'arrow-left' => '',
'arrow-right' => '',
'arrow-up' => '',
'chevron-down' => '',
'chevron-up' => '',
'chevron-left' => '',
'chevron-right' => '',
'bookmark' => '',
'calendar' => '',
'clock' => '',
'calendar-full' => '',
'viewer' => '',
'comment' => '',
'cross' => '',
'edit' => '',
'folder' => '',
'search' => '',
'tag' => '',
'user' => '',
'recent' => '',
'blaze' => '',
'star' => '',
'latest' => '',
'close' => '',
'moon' => '',
'sun' => '',
'play' => '',
'pause' => '',
'mute' => '',
'unmute' => '',
'audio' => '',
'gallery' => '',
'image' => '',
'video' => '',
'quote' => '',
'amazon' => '',
'apple' => '',
'bandcamp' => '',
'behance' => '',
'chain' => '',
'codepen' => '',
'deviantart' => '',
'digg' => '',
'dribbble' => '',
'dropbox' => '',
'etsy' => '',
'facebook' => '',
'feed' => '',
'flickr' => '',
'foursquare' => '',
'goodreads' => '',
'github' => '',
'instagram' => '',
'lastfm' => '',
'linkedin' => '',
'mail' => '',
'meetup' => '',
'medium' => '',
'pinterest' => '',
'pocket' => '',
'reddit' => '',
'skype' => '',
'slideshare' => '',
'snapchat' => '',
'soundcloud' => '',
'spotify' => '',
'stumbleupon' => '',
'tumblr' => '',
'twitch' => '',
'twitter' => '',
'vimeo' => '',
'vk' => '',
'wp' => '',
'yelp' => '',
'youtube' => '',
'whatsapp' => '',
'tiktok' => '',
'seperator' => '',
'signal' => '',
'searc-not-found' => '',
);
}
endif;