<?php
/**
 * Brand SVG Please
 *
 * @version 1.0.1
 * @link https://github.com/nk-o/brand-svg-please
 * @package bsp
 */

if ( ! class_exists( 'Brand_SVG_Please' ) ) :
    /**
     * Brand_SVG_Please Class
     */
    class Brand_SVG_Please {
        /**
         * Get the SVG string for a given icon.
         *
         * @param String $name - brand name.
         * @param Array  $data - svg icon data.
         *
         * @return String
         */
        public static function get( $name, $data = array() ) {
            $brand = self::find_brand( $name );

            if ( $brand ) {
                return self::get_svg_by_path( $brand['svg_path'], $data );
            }

            return null;
        }

        /**
         * Print the SVG string for a given icon.
         *
         * @param String $name - icon name.
         * @param Array  $data - svg icon data.
         */
        public static function get_e( $name, $data = array() ) {
            if ( self::exists( $name ) ) {
                echo wp_kses( self::get( $name, $data ), self::kses() );
            }
        }

        /**
         * Get the SVG string for a given icon.
         *
         * @param String $name - brand name.
         *
         * @return String
         */
        public static function get_name( $name ) {
            $brand = self::find_brand( $name );

            if ( $brand ) {
                return $brand['name'];
            }

            return null;
        }

        /**
         * Check if SVG icon exists.
         *
         * @param String $name - brand name.
         *
         * @return Boolean
         */
        public static function exists( $name ) {
            return ! ! self::find_brand( $name );
        }

        /**
         * Data for SVG useful in wp_kses function.
         *
         * @return Array
         */
        public static function kses() {
            return array(
                'svg'   => array(
                    'class'           => true,
                    'aria-hidden'     => true,
                    'aria-labelledby' => true,
                    'role'            => true,
                    'focusable'       => true,
                    'xmlns'           => true,
                    'width'           => true,
                    'height'          => true,
                    'viewbox'         => true,
                ),
                'g'     => array(
                    'fill' => true,
                ),
                'title' => array(
                    'title' => true,
                ),
                'path'  => array(
                    'd'    => true,
                    'fill' => true,
                ),
            );
        }

        /**
         * Find brand data.
         *
         * @param String $name - brand name.
         *
         * @return Null|Array
         */
        private static function find_brand( $name ) {
            $result = null;
            $brands = self::get_all_brands();

            // Find by key.
            if ( isset( $brands[ $name ] ) ) {
                $result = $brands[ $name ];
            }

            // Find by alternative keys.
            if ( ! $result ) {
                foreach ( $brands as $brand ) {
                    if ( ! $result && isset( $brand['keys'] ) && in_array( $name, $brand['keys'], true ) ) {
                        $result = $brand;
                    }
                }
            }

            return $result;
        }

        /**
         * Get the SVG string for a given icon.
         *
         * @param String $path - icon path.
         * @param Array  $data - svg icon data.
         *
         * @return String
         */
        private static function get_svg_by_path( $path, $data = array() ) {
            $data = array_merge(
                array(
                    'size'  => 24,
                    'class' => 'bsp-icon',
                ),
                $data
            );

            if ( file_exists( $path ) ) {
                // We can't use file_get_contents in WordPress themes.
                ob_start();
                include $path;
                $svg = ob_get_clean();

                // Add extra attributes to SVG code.
                // translators: %1$s - classname.
                // translators: %2$d - size.
                $repl = sprintf( '<svg class="%1$s" width="%2$d" height="%2$d" aria-hidden="true" role="img" focusable="false" ', $data['class'], $data['size'] );
                $svg  = preg_replace( '/^<svg /', $repl, trim( $svg ) );

                return $svg;
            }

            return null;
        }

        /**
         * Get all available brands.
         *
         * @param Boolean $get_svg - get SVG and insert it inside array.
         * @param Array   $svg_data - svg data.
         *
         * @return Array
         */
        public static function get_all_brands( $get_svg = false, $svg_data = array() ) {
            $brands = array(
                '500px'                     => esc_html__( '500px', 'cyberpress' ),
                'accusoft'                  => esc_html__( 'Accusoft', 'cyberpress' ),
                'acquisitions-incorporated' => esc_html__( 'Acquisitions Incorporated', 'cyberpress' ),
                'adn'                       => esc_html__( 'ADN', 'cyberpress' ),
                'adobe'                     => esc_html__( 'Adobe', 'cyberpress' ),
                'adversal'                  => esc_html__( 'Adversal', 'cyberpress' ),
                'airbnb'                    => esc_html__( 'Airbnb', 'cyberpress' ),
                'algolia'                   => esc_html__( 'Algolia', 'cyberpress' ),
                'alipay'                    => esc_html__( 'Alipay', 'cyberpress' ),
                'amazon-pay'                => esc_html__( 'Amazon Pay', 'cyberpress' ),
                'amazon'                    => esc_html__( 'Amazon', 'cyberpress' ),
                'amilia'                    => esc_html__( 'Amilia', 'cyberpress' ),
                'android'                   => esc_html__( 'Android', 'cyberpress' ),
                'angellist'                 => esc_html__( 'AngelList', 'cyberpress' ),
                'angrycreative'             => esc_html__( 'Angry Creative', 'cyberpress' ),
                'angular'                   => esc_html__( 'Angular', 'cyberpress' ),
                'app-store'                 => esc_html__( 'App Store', 'cyberpress' ),
                'apper'                     => esc_html__( 'Apper', 'cyberpress' ),
                'apple-pay'                 => esc_html__( 'Apple Pay', 'cyberpress' ),
                'apple'                     => esc_html__( 'Apple', 'cyberpress' ),
                'artstation'                => esc_html__( 'ArtStation', 'cyberpress' ),
                'asymmetrik'                => esc_html__( 'Asymmetrik', 'cyberpress' ),
                'atlassian'                 => esc_html__( 'Atlassian', 'cyberpress' ),
                'audible'                   => esc_html__( 'Audible', 'cyberpress' ),
                'autoprefixer'              => esc_html__( 'Autoprefixer', 'cyberpress' ),
                'avianex'                   => esc_html__( 'Avianex', 'cyberpress' ),
                'aviato'                    => esc_html__( 'Aviato', 'cyberpress' ),
                'bandcamp'                  => esc_html__( 'Bandcamp', 'cyberpress' ),
                'battle-net'                => esc_html__( 'Battle.net', 'cyberpress' ),
                'behance'                   => esc_html__( 'Behance', 'cyberpress' ),
                'bimobject'                 => esc_html__( 'BIMobject', 'cyberpress' ),
                'bitbucket'                 => esc_html__( 'Bitbucket', 'cyberpress' ),
                'bitcoin'                   => esc_html__( 'Bitcoin', 'cyberpress' ),
                'bity'                      => esc_html__( 'Bity', 'cyberpress' ),
                'black-tie'                 => esc_html__( 'Black Tie', 'cyberpress' ),
                'blackberry'                => esc_html__( 'BlackBerry', 'cyberpress' ),
                'blogger'                   => esc_html__( 'Blogger', 'cyberpress' ),
                'bluetooth'                 => esc_html__( 'Bluetooth', 'cyberpress' ),
                'bootstrap'                 => esc_html__( 'Bootstrap', 'cyberpress' ),
                'btc'                       => esc_html__( 'BTC', 'cyberpress' ),
                'buffer'                    => esc_html__( 'Buffer', 'cyberpress' ),
                'buromobelexperte'          => esc_html__( 'Büromöbel Experte', 'cyberpress' ),
                'buy-n-large'               => esc_html__( 'Buy n Large', 'cyberpress' ),
                'buysellads'                => esc_html__( 'BuySellAds', 'cyberpress' ),
                'canadian-maple-leaf'       => esc_html__( 'Canadian Gold Maple Leaf', 'cyberpress' ),
                'cc-amazon-pay'             => esc_html__( 'Amazon Pay', 'cyberpress' ),
                'cc-amex'                   => esc_html__( 'Amex', 'cyberpress' ),
                'cc-apple-pay'              => esc_html__( 'Apple Pay', 'cyberpress' ),
                'cc-diners-club'            => esc_html__( 'Diners Club', 'cyberpress' ),
                'cc-discover'               => esc_html__( 'Discover', 'cyberpress' ),
                'cc-jcb'                    => esc_html__( 'JCB', 'cyberpress' ),
                'cc-mastercard'             => esc_html__( 'Mastercard', 'cyberpress' ),
                'cc-paypal'                 => esc_html__( 'PayPal', 'cyberpress' ),
                'cc-stripe'                 => esc_html__( 'Stripe', 'cyberpress' ),
                'cc-visa'                   => esc_html__( 'Visa', 'cyberpress' ),
                'centercode'                => esc_html__( 'Centercode', 'cyberpress' ),
                'centos'                    => esc_html__( 'CentOS', 'cyberpress' ),
                'chrome'                    => esc_html__( 'Chrome', 'cyberpress' ),
                'chromecast'                => esc_html__( 'Chromecast', 'cyberpress' ),
                'cloudscale'                => esc_html__( 'CloudScale', 'cyberpress' ),
                'cloudsmith'                => esc_html__( 'Cloudsmith', 'cyberpress' ),
                'cloudversify'              => esc_html__( 'Cloudversify', 'cyberpress' ),
                'codepen'                   => esc_html__( 'CodePen', 'cyberpress' ),
                'codiepie'                  => esc_html__( 'CodiePie', 'cyberpress' ),
                'confluence'                => esc_html__( 'Confluence', 'cyberpress' ),
                'connectdevelop'            => esc_html__( 'Connect Develop', 'cyberpress' ),
                'contao'                    => esc_html__( 'Contao', 'cyberpress' ),
                'cotton-bureau'             => esc_html__( 'Cotton Bureau', 'cyberpress' ),
                'cpanel'                    => esc_html__( 'cPanel', 'cyberpress' ),
                'critical-role'             => esc_html__( 'Critical Role', 'cyberpress' ),
                'css3'                      => esc_html__( 'CSS3', 'cyberpress' ),
                'cuttlefish'                => esc_html__( 'Cuttlefish', 'cyberpress' ),
                'd-and-d-beyond'            => esc_html__( 'D&D Beyond', 'cyberpress' ),
                'd-and-d'                   => esc_html__( 'D&D', 'cyberpress' ),
                'dailymotion'               => esc_html__( 'Dailymotion', 'cyberpress' ),
                'dashcube'                  => esc_html__( 'Dashcube', 'cyberpress' ),
                'delicious'                 => esc_html__( 'Delicious', 'cyberpress' ),
                'deploydog'                 => array(
                    'name' => esc_html__( 'deploy.dog', 'cyberpress' ),
                    'kays' => array( 'dd' ),
                ),
                'deskpro'                   => esc_html__( 'Deskpro', 'cyberpress' ),
                'dev'                       => esc_html__( 'Dev', 'cyberpress' ),
                'deviantart'                => esc_html__( 'DeviantArt', 'cyberpress' ),
                'dhl'                       => esc_html__( 'DHL', 'cyberpress' ),
                'diaspora'                  => esc_html__( 'Diaspora', 'cyberpress' ),
                'digg'                      => esc_html__( 'Digg', 'cyberpress' ),
                'digital-ocean'             => esc_html__( 'Digital Ocean', 'cyberpress' ),
                'discord'                   => esc_html__( 'Discord', 'cyberpress' ),
                'discourse'                 => esc_html__( 'Discourse', 'cyberpress' ),
                'dochub'                    => esc_html__( 'DocHub', 'cyberpress' ),
                'docker'                    => esc_html__( 'Docker', 'cyberpress' ),
                'draft2digital'             => esc_html__( 'Draft2Digital', 'cyberpress' ),
                'dribbble'                  => esc_html__( 'Dribbble', 'cyberpress' ),
                'dropbox'                   => esc_html__( 'Dropbox', 'cyberpress' ),
                'drupal'                    => esc_html__( 'Drupal', 'cyberpress' ),
                'dyalog'                    => esc_html__( 'Dyalog', 'cyberpress' ),
                'earlybirds'                => esc_html__( 'Earlybirds', 'cyberpress' ),
                'ebay'                      => esc_html__( 'eBay', 'cyberpress' ),
                'edge'                      => esc_html__( 'Edge', 'cyberpress' ),
                'elementor'                 => esc_html__( 'Elementor', 'cyberpress' ),
                'ello'                      => esc_html__( 'Ello', 'cyberpress' ),
                'ember'                     => esc_html__( 'Ember', 'cyberpress' ),
                'empire'                    => esc_html__( 'Empire', 'cyberpress' ),
                'envira'                    => esc_html__( 'Envira', 'cyberpress' ),
                'erlang'                    => esc_html__( 'Erlang', 'cyberpress' ),
                'ethereum'                  => esc_html__( 'Ethereum', 'cyberpress' ),
                'etsy'                      => esc_html__( 'Etsy', 'cyberpress' ),
                'evernote'                  => esc_html__( 'Evernote', 'cyberpress' ),
                'expeditedssl'              => esc_html__( 'ExpeditedSSL', 'cyberpress' ),
                'facebook-messenger'        => esc_html__( 'Facebook Messenger', 'cyberpress' ),
                'facebook'                  => esc_html__( 'Facebook', 'cyberpress' ),
                'fantasy-flight-games'      => esc_html__( 'Fantasy Flight Games', 'cyberpress' ),
                'fedex'                     => esc_html__( 'FedEx', 'cyberpress' ),
                'fedora'                    => esc_html__( 'Fedora', 'cyberpress' ),
                'figma'                     => esc_html__( 'Figma', 'cyberpress' ),
                'firefox-browser'           => esc_html__( 'Firefox Browser', 'cyberpress' ),
                'firefox'                   => esc_html__( 'Firefox', 'cyberpress' ),
                'first-order'               => esc_html__( 'First Order', 'cyberpress' ),
                'firstdraft'                => esc_html__( 'Firstdraft', 'cyberpress' ),
                'flickr'                    => esc_html__( 'Flickr', 'cyberpress' ),
                'flipboard'                 => esc_html__( 'Flipboard', 'cyberpress' ),
                'fly'                       => esc_html__( 'Fly', 'cyberpress' ),
                'font-awesome'              => esc_html__( 'Font Awesome', 'cyberpress' ),
                'fonticons'                 => esc_html__( 'Fonticons', 'cyberpress' ),
                'fort-awesome'              => esc_html__( 'Fort Awesome', 'cyberpress' ),
                'forumbee'                  => esc_html__( 'Forumbee', 'cyberpress' ),
                'foursquare'                => esc_html__( 'Foursquare', 'cyberpress' ),
                'free-code-camp'            => esc_html__( 'freeCodeCamp', 'cyberpress' ),
                'freebsd'                   => esc_html__( 'FreeBSD', 'cyberpress' ),
                'fulcrum'                   => esc_html__( 'Fulcrum', 'cyberpress' ),
                'galactic-republic'         => esc_html__( 'Galactic Republic', 'cyberpress' ),
                'galactic-senate'           => esc_html__( 'Galactic Senate', 'cyberpress' ),
                'get-pocket'                => array(
                    'name' => esc_html__( 'Pocket', 'cyberpress' ),
                    'keys' => array( 'pocket' ),
                ),
                'gg'                        => esc_html__( 'GG', 'cyberpress' ),
                'git'                       => esc_html__( 'Git', 'cyberpress' ),
                'github'                    => esc_html__( 'GitHub', 'cyberpress' ),
                'gitkraken'                 => esc_html__( 'GitKraken', 'cyberpress' ),
                'gitlab'                    => esc_html__( 'GitLab', 'cyberpress' ),
                'gitter'                    => esc_html__( 'Gitter', 'cyberpress' ),
                'glide'                     => esc_html__( 'Glide', 'cyberpress' ),
                'gofore'                    => esc_html__( 'Gofore', 'cyberpress' ),
                'goodreads'                 => esc_html__( 'Goodreads', 'cyberpress' ),
                'google-drive'              => esc_html__( 'Google Drive', 'cyberpress' ),
                'google-play'               => esc_html__( 'Google Play', 'cyberpress' ),
                'google-plus'               => esc_html__( 'Google Plus', 'cyberpress' ),
                'google-wallet'             => esc_html__( 'Google Wallet', 'cyberpress' ),
                'google'                    => esc_html__( 'Google', 'cyberpress' ),
                'gratipay'                  => esc_html__( 'Gratipay', 'cyberpress' ),
                'grav'                      => esc_html__( 'Grav', 'cyberpress' ),
                'gripfire'                  => esc_html__( 'Gripfire', 'cyberpress' ),
                'grunt'                     => esc_html__( 'Grunt', 'cyberpress' ),
                'gulp'                      => esc_html__( 'Gulp', 'cyberpress' ),
                'hacker-news'               => esc_html__( 'Hacker News', 'cyberpress' ),
                'hackerrank'                => esc_html__( 'HackerRank', 'cyberpress' ),
                'hips'                      => esc_html__( 'HIPS', 'cyberpress' ),
                'hire-a-helper'             => esc_html__( 'HireAHelper', 'cyberpress' ),
                'hornbill'                  => esc_html__( 'Hornbill', 'cyberpress' ),
                'hotjar'                    => esc_html__( 'Hotjar', 'cyberpress' ),
                'houzz'                     => esc_html__( 'Houzz', 'cyberpress' ),
                'html5'                     => esc_html__( 'HTML5', 'cyberpress' ),
                'hubspot'                   => esc_html__( 'HubSpot', 'cyberpress' ),
                'ideal'                     => esc_html__( 'iDEAL', 'cyberpress' ),
                'imdb'                      => esc_html__( 'IMDb', 'cyberpress' ),
                'instagram'                 => esc_html__( 'Instagram', 'cyberpress' ),
                'intercom'                  => esc_html__( 'Intercom', 'cyberpress' ),
                'internet-explorer'         => array(
                    'name' => esc_html__( 'Internet Explorer', 'cyberpress' ),
                    'keys' => array( 'ie' ),
                ),
                'invision'                  => esc_html__( 'InVision', 'cyberpress' ),
                'ioxhost'                   => esc_html__( 'IoxHost', 'cyberpress' ),
                'itch-io'                   => esc_html__( 'itch.io', 'cyberpress' ),
                'itunes'                    => esc_html__( 'iTunes', 'cyberpress' ),
                'java'                      => esc_html__( 'Java', 'cyberpress' ),
                'jedi-order'                => esc_html__( 'Jedi Order', 'cyberpress' ),
                'jenkins'                   => esc_html__( 'Jenkins', 'cyberpress' ),
                'jira'                      => esc_html__( 'Jira', 'cyberpress' ),
                'joget'                     => esc_html__( 'Joget', 'cyberpress' ),
                'joomla'                    => esc_html__( 'Joomla', 'cyberpress' ),
                'js'                        => array(
                    'name' => esc_html__( 'JS', 'cyberpress' ),
                    'keys' => array( 'javascript' ),
                ),
                'jsfiddle'                  => esc_html__( 'JSFiddle', 'cyberpress' ),
                'kaggle'                    => esc_html__( 'Kaggle', 'cyberpress' ),
                'keybase'                   => esc_html__( 'Keybase', 'cyberpress' ),
                'keycdn'                    => esc_html__( 'KeyCDN', 'cyberpress' ),
                'kickstarter'               => esc_html__( 'Kickstarter', 'cyberpress' ),
                'korvue'                    => esc_html__( 'Korvue', 'cyberpress' ),
                'laravel'                   => esc_html__( 'Laravel', 'cyberpress' ),
                'lastfm'                    => esc_html__( 'Last.fm', 'cyberpress' ),
                'leanpub'                   => esc_html__( 'Leanpub', 'cyberpress' ),
                'less'                      => esc_html__( 'Less', 'cyberpress' ),
                'line'                      => esc_html__( 'Line', 'cyberpress' ),
                'linkedin'                  => esc_html__( 'LinkedIn', 'cyberpress' ),
                'linode'                    => esc_html__( 'Linode', 'cyberpress' ),
                'linux'                     => esc_html__( 'Linux', 'cyberpress' ),
                'lyft'                      => esc_html__( 'Lyft', 'cyberpress' ),
                'magento'                   => esc_html__( 'Magento', 'cyberpress' ),
                'mailchimp'                 => esc_html__( 'Mailchimp', 'cyberpress' ),
                'mandalorian'               => esc_html__( 'Mandalorian', 'cyberpress' ),
                'markdown'                  => array(
                    'name' => esc_html__( 'Markdown', 'cyberpress' ),
                    'keys' => array( 'md' ),
                ),
                'mastodon'                  => esc_html__( 'Mastodon', 'cyberpress' ),
                'maxcdn'                    => esc_html__( 'MaxCDN', 'cyberpress' ),
                'mdb'                       => esc_html__( 'MDB', 'cyberpress' ),
                'medapps'                   => esc_html__( 'MedApps', 'cyberpress' ),
                'medium'                    => esc_html__( 'Medium', 'cyberpress' ),
                'medrt'                     => esc_html__( 'Medrt', 'cyberpress' ),
                'meetup'                    => esc_html__( 'Meetup', 'cyberpress' ),
                'megaport'                  => esc_html__( 'Megaport', 'cyberpress' ),
                'mendeley'                  => esc_html__( 'Mendeley', 'cyberpress' ),
                'microblog'                 => esc_html__( 'Micro.blog', 'cyberpress' ),
                'microsoft'                 => esc_html__( 'Microsoft', 'cyberpress' ),
                'mix'                       => esc_html__( 'Mix', 'cyberpress' ),
                'mixcloud'                  => esc_html__( 'Mixcloud', 'cyberpress' ),
                'mixer'                     => esc_html__( 'Mixer', 'cyberpress' ),
                'mizuni'                    => esc_html__( 'Mizuni', 'cyberpress' ),
                'modx'                      => esc_html__( 'MODX', 'cyberpress' ),
                'monero'                    => esc_html__( 'Monero', 'cyberpress' ),
                'napster'                   => esc_html__( 'Mapster', 'cyberpress' ),
                'neos'                      => esc_html__( 'Neos', 'cyberpress' ),
                'nimblr'                    => esc_html__( 'Nimblr', 'cyberpress' ),
                'node-js'                   => esc_html__( 'Node.js', 'cyberpress' ),
                'node'                      => esc_html__( 'Node', 'cyberpress' ),
                'npm'                       => esc_html__( 'npm', 'cyberpress' ),
                'ns8'                       => esc_html__( 'NS8', 'cyberpress' ),
                'nutritionix'               => esc_html__( 'Nutritionix', 'cyberpress' ),
                'odnoklassniki'             => array(
                    'name' => esc_html__( 'Odnoklassniki', 'cyberpress' ),
                    'keys' => array( 'ok' ),
                ),
                'old-republic'              => esc_html__( 'Old Republic', 'cyberpress' ),
                'opencart'                  => esc_html__( 'OpenCart', 'cyberpress' ),
                'openid'                    => esc_html__( 'OpenID', 'cyberpress' ),
                'opera'                     => esc_html__( 'Opera', 'cyberpress' ),
                'optin-monster'             => esc_html__( 'OptinMonster', 'cyberpress' ),
                'orcid'                     => esc_html__( 'ORCID', 'cyberpress' ),
                'osi'                       => esc_html__( 'OSI', 'cyberpress' ),
                'page4'                     => esc_html__( 'PAGE4', 'cyberpress' ),
                'pagelines'                 => esc_html__( 'PageLines', 'cyberpress' ),
                'palfed'                    => esc_html__( 'PalFed', 'cyberpress' ),
                'patreon'                   => esc_html__( 'Patreon', 'cyberpress' ),
                'paypal'                    => esc_html__( 'PayPal', 'cyberpress' ),
                'penny-arcade'              => esc_html__( 'Penny Arcade', 'cyberpress' ),
                'periscope'                 => esc_html__( 'Periscope', 'cyberpress' ),
                'phabricator'               => esc_html__( 'Phabricator', 'cyberpress' ),
                'phoenix-framework'         => esc_html__( 'Phoenix Framework', 'cyberpress' ),
                'phoenix-squadron'          => esc_html__( 'Phoenix Squadron', 'cyberpress' ),
                'php'                       => esc_html__( 'PHP', 'cyberpress' ),
                'pinterest'                 => esc_html__( 'Pinterest', 'cyberpress' ),
                'playstation'               => array(
                    'name' => esc_html__( 'PlayStation', 'cyberpress' ),
                    'keys' => array( 'ps' ),
                ),
                'product-hunt'              => esc_html__( 'Product Hunt', 'cyberpress' ),
                'pushed'                    => esc_html__( 'Pushed', 'cyberpress' ),
                'python'                    => esc_html__( 'Python', 'cyberpress' ),
                'qq'                        => array(
                    'name' => esc_html__( 'QQ', 'cyberpress' ),
                    'keys' => array( 'tencent-qq' ),
                ),
                'quinscape'                 => esc_html__( 'QuinScape', 'cyberpress' ),
                'quora'                     => esc_html__( 'Quora', 'cyberpress' ),
                'r-project'                 => esc_html__( 'R', 'cyberpress' ),
                'raspberry-pi'              => esc_html__( 'Raspberry Pi', 'cyberpress' ),
                'ravelry'                   => esc_html__( 'Ravelry', 'cyberpress' ),
                'react'                     => esc_html__( 'React', 'cyberpress' ),
                'reacteurope'               => esc_html__( 'ReactEurope', 'cyberpress' ),
                'readme'                    => esc_html__( 'ReadMe', 'cyberpress' ),
                'rebel'                     => esc_html__( 'Rebel', 'cyberpress' ),
                'red-river'                 => esc_html__( 'Red River', 'cyberpress' ),
                'reddit'                    => esc_html__( 'reddit', 'cyberpress' ),
                'redhat'                    => esc_html__( 'Red Hat', 'cyberpress' ),
                'renren'                    => esc_html__( 'Renren', 'cyberpress' ),
                'replyd'                    => esc_html__( 'Replyd', 'cyberpress' ),
                'researchgate'              => esc_html__( 'ResearchGate', 'cyberpress' ),
                'resolving'                 => esc_html__( 'Resolving', 'cyberpress' ),
                'rev'                       => esc_html__( 'Rev', 'cyberpress' ),
                'rocketchat'                => esc_html__( 'Rocket.Chat', 'cyberpress' ),
                'rockrms'                   => esc_html__( 'Rock RMS', 'cyberpress' ),
                'safari'                    => esc_html__( 'Safari', 'cyberpress' ),
                'salesforce'                => esc_html__( 'Salesforce', 'cyberpress' ),
                'sass'                      => esc_html__( 'Sass', 'cyberpress' ),
                'schlix'                    => esc_html__( 'SCHLIX', 'cyberpress' ),
                'scribd'                    => esc_html__( 'Scribd', 'cyberpress' ),
                'searchengin'               => esc_html__( 'Searchengin', 'cyberpress' ),
                'sellcast'                  => esc_html__( 'SellCast', 'cyberpress' ),
                'sellsy'                    => esc_html__( 'Sellsy', 'cyberpress' ),
                'servicestack'              => esc_html__( 'ServiceStack', 'cyberpress' ),
                'shirtsinbulk'              => esc_html__( 'Shirts In Bulk', 'cyberpress' ),
                'shopify'                   => esc_html__( 'Shopify', 'cyberpress' ),
                'shopware'                  => esc_html__( 'Shopware', 'cyberpress' ),
                'simplybuilt'               => esc_html__( 'SimplyBuilt', 'cyberpress' ),
                'sistrix'                   => esc_html__( 'SISTRIX', 'cyberpress' ),
                'sith'                      => esc_html__( 'Sith', 'cyberpress' ),
                'sketch'                    => esc_html__( 'Sketch', 'cyberpress' ),
                'skyatlas'                  => esc_html__( 'SkyAtlas', 'cyberpress' ),
                'skype'                     => esc_html__( 'Skype', 'cyberpress' ),
                'slack'                     => esc_html__( 'Slack', 'cyberpress' ),
                'slideshare'                => esc_html__( 'SlideShare', 'cyberpress' ),
                'snapchat'                  => esc_html__( 'Snapchat', 'cyberpress' ),
                'soundcloud'                => esc_html__( 'SoundCloud', 'cyberpress' ),
                'sourcetree'                => esc_html__( 'Sourcetree', 'cyberpress' ),
                'speakap'                   => esc_html__( 'Speakap', 'cyberpress' ),
                'speaker-deck'              => esc_html__( 'Speaker Deck', 'cyberpress' ),
                'spotify'                   => esc_html__( 'Spotify', 'cyberpress' ),
                'squarespace'               => esc_html__( 'Squarespace', 'cyberpress' ),
                'stack-exchange'            => esc_html__( 'Stack Exchange', 'cyberpress' ),
                'stack-overflow'            => esc_html__( 'Stack Overflow', 'cyberpress' ),
                'stackpath'                 => esc_html__( 'StackPath', 'cyberpress' ),
                'staylinked'                => esc_html__( 'StayLinked', 'cyberpress' ),
                'steam'                     => esc_html__( 'Steam', 'cyberpress' ),
                'sticker-mule'              => esc_html__( 'Sticker Mule', 'cyberpress' ),
                'strava'                    => esc_html__( 'Strava', 'cyberpress' ),
                'stripe'                    => esc_html__( 'Stripe', 'cyberpress' ),
                'studiovinari'              => esc_html__( 'Studio Vinari', 'cyberpress' ),
                'stumbleupon'               => esc_html__( 'StumbleUpon', 'cyberpress' ),
                'superpowers'               => esc_html__( 'Superpowers', 'cyberpress' ),
                'supple'                    => esc_html__( 'Supple', 'cyberpress' ),
                'suse'                      => esc_html__( 'SuSE', 'cyberpress' ),
                'swift'                     => esc_html__( 'Swift', 'cyberpress' ),
                'symfony'                   => esc_html__( 'Symfony', 'cyberpress' ),
                'teamspeak'                 => esc_html__( 'SeamSpeak', 'cyberpress' ),
                'telegram'                  => esc_html__( 'Telegram', 'cyberpress' ),
                'tencent-weibo'             => esc_html__( 'Tencent Weibo', 'cyberpress' ),
                'the-red-yeti'              => esc_html__( 'The Red Yeti', 'cyberpress' ),
                'themeisle'                 => esc_html__( 'Themeisle', 'cyberpress' ),
                'think-peaks'               => esc_html__( 'ThinkPeaks', 'cyberpress' ),
                'tiktok'                    => esc_html__( 'TikTok', 'cyberpress' ),
                'trade-federation'          => esc_html__( 'Trade Federation', 'cyberpress' ),
                'trello'                    => esc_html__( 'Trello', 'cyberpress' ),
                'tripadvisor'               => esc_html__( 'Tripadvisor', 'cyberpress' ),
                'tumblr'                    => esc_html__( 'Tumblr', 'cyberpress' ),
                'twitch'                    => esc_html__( 'Twitch', 'cyberpress' ),
                'twitter'                   => esc_html__( 'Twitter', 'cyberpress' ),
                'typo3'                     => esc_html__( 'TYPO3', 'cyberpress' ),
                'uber'                      => esc_html__( 'Uber', 'cyberpress' ),
                'ubuntu'                    => esc_html__( 'Ubuntu', 'cyberpress' ),
                'uikit'                     => esc_html__( 'UIkit', 'cyberpress' ),
                'umbraco'                   => esc_html__( 'Umbraco', 'cyberpress' ),
                'uniregistry'               => esc_html__( 'Uniregistry', 'cyberpress' ),
                'unity'                     => esc_html__( 'Unity', 'cyberpress' ),
                'untappd'                   => esc_html__( 'Untappd', 'cyberpress' ),
                'ups'                       => esc_html__( 'UPS', 'cyberpress' ),
                'usps'                      => esc_html__( 'USPS', 'cyberpress' ),
                'ussunnah'                  => esc_html__( 'us-Sunnah', 'cyberpress' ),
                'vaadin'                    => esc_html__( 'Vaadin', 'cyberpress' ),
                'viacoin'                   => esc_html__( 'Viacoin', 'cyberpress' ),
                'viadeo'                    => esc_html__( 'Viadeo', 'cyberpress' ),
                'viber'                     => esc_html__( 'Viber', 'cyberpress' ),
                'vimeo'                     => esc_html__( 'Vimeo', 'cyberpress' ),
                'vine'                      => esc_html__( 'Vine', 'cyberpress' ),
                'vk'                        => array(
                    'name' => esc_html__( 'VK', 'cyberpress' ),
                    'keys' => array( 'vkontakte' ),
                ),
                'vnv'                       => esc_html__( 'VNV', 'cyberpress' ),
                'vuejs'                     => esc_html__( 'Vue.js', 'cyberpress' ),
                'waze'                      => esc_html__( 'Waze', 'cyberpress' ),
                'wechat'                    => array(
                    'name' => esc_html__( 'WeChat', 'cyberpress' ),
                    'keys' => array( 'weixin' ),
                ),
                'weebly'                    => esc_html__( 'Weebly', 'cyberpress' ),
                'weibo'                     => array(
                    'name' => esc_html__( 'Sina Weibo', 'cyberpress' ),
                    'keys' => array( 'sina-weibo' ),
                ),
                'weixin'                    => esc_html__( 'Weixin', 'cyberpress' ),
                'whatsapp'                  => esc_html__( 'WhatsApp', 'cyberpress' ),
                'whmcs'                     => esc_html__( 'WHMCS', 'cyberpress' ),
                'wikipedia'                 => esc_html__( 'Wikipedia', 'cyberpress' ),
                'windows'                   => esc_html__( 'Windows', 'cyberpress' ),
                'wix'                       => esc_html__( 'WIX', 'cyberpress' ),
                'wizards-of-the-coast'      => esc_html__( 'Wizards of the Coast', 'cyberpress' ),
                'wolf-pack-battalion'       => esc_html__( 'Wolf Pack Battalion', 'cyberpress' ),
                'wordpress'                 => esc_html__( 'WordPress', 'cyberpress' ),
                'wpbeginner'                => esc_html__( 'WPBeginner', 'cyberpress' ),
                'wpexplorer'                => esc_html__( 'WPExplorer', 'cyberpress' ),
                'wpforms'                   => esc_html__( 'WPForms', 'cyberpress' ),
                'wpressr'                   => esc_html__( 'WPressr', 'cyberpress' ),
                'xbox'                      => esc_html__( 'Xbox', 'cyberpress' ),
                'xing'                      => esc_html__( 'XING', 'cyberpress' ),
                'y-combinator'              => esc_html__( 'YCombinator', 'cyberpress' ),
                'yahoo'                     => esc_html__( 'Yahoo', 'cyberpress' ),
                'yammer'                    => esc_html__( 'Yammer', 'cyberpress' ),
                'yandex'                    => esc_html__( 'Yandex', 'cyberpress' ),
                'yarn'                      => esc_html__( 'Yarn', 'cyberpress' ),
                'yelp'                      => esc_html__( 'Yelp', 'cyberpress' ),
                'yoast'                     => esc_html__( 'Yoast', 'cyberpress' ),
                'youtube'                   => esc_html__( 'Youtube', 'cyberpress' ),
                'zhihu'                     => esc_html__( 'Zhihu', 'cyberpress' ),
            );

            $result    = array();
            $base_path = __DIR__ . '/svg/';

            // Prepare SVG paths.
            foreach ( $brands as $k => $data ) {
                $svg_path = $base_path . $k . '.svg';

                if ( file_exists( $svg_path ) ) {
                    $result[ $k ] = array_merge(
                        is_array( $data ) ? $data : array(
                            'name' => $data,
                        ),
                        $get_svg ? array(
                            'svg' => self::get_svg_by_path( $svg_path, $svg_data ),
                        ) : array(),
                        array(
                            'svg_path' => $base_path . $k . '.svg',
                        )
                    );
                }
            }

            return $result;
        }
    }
endif;
