wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php:22This class is in charge of displaying SVG icons across the site.
$ui_iconsarraypublic static$social_icons_maparraypublic static$social_iconsarraypublic static<?phpclass TwentyNineteen_SVG_Icons { /** * Gets the SVG code for a given icon. * * @param string $group The group of icons ('ui' or 'social'). * @param string $icon The specific icon to retrieve. * @param int $size The desired width and height for the SVG icon. */ public static function get_svg( $group, $icon, $size ) { if ( 'ui' === $group ) { $arr = self::$ui_icons; } elseif ( 'social' === $group ) { $arr = self::$social_icons; } else { $arr = array(); } if ( array_key_exists( $icon, $arr ) ) { $repl = sprintf( '<svg class="svg-icon" width="%d" height="%d" aria-hidden="true" role="img" focusable="false" ', $size, $size ); $svg = preg_replace( '/^<svg /', $repl, trim( $arr[ $icon ] ) ); // Add extra attributes to SVG code. $svg = preg_replace( "/([\n\t]+)/", ' ', $svg ); // Remove newlines & tabs. $svg = preg_replace( '/>\s*</', '><', $svg ); // Remove whitespace between SVG tags. return $svg; } return null; } /** * Detects the social network from a URL and returns the SVG code for its icon. * * @param string $uri The URL of the social network link. * @param int $size The desired width and height for the SVG icon. */ public static function get_social_link_svg( $uri, $size ) { static $regex_map; // Only compute regex map once, for performance. if ( ! isset( $regex_map ) ) { $regex_map = array(); $map = &self::$social_icons_map; // Use reference instead of copy, to save memory. foreach ( array_keys( self::$social_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, $uri ) ) { return self::get_svg( 'social', $icon, $size ); } } return null; } /** * User Interface icons – svg sources. * * @var array */ public static $ui_icons = array( 'link' => /* material-design – link */ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M0 0h24v24H0z" fill="none"></path> <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></svg>', 'watch' => /* material-design – watch-later */ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <defs> <path id="a" d="M0 0h24v24H0V0z"></path> </defs> <clipPath id="b"> <use xlink:href="#a" overflow="visible"></use> </clipPath> <path clip-path="url(#b)" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm4.2 14.2L11 13V7h1.5v5.2l4.5 2.7-.8 1.3z"></path></svg>', 'archive' => /* material-design – folder */ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"></path> <path d="M0 0h24v24H0z" fill="none"></path>Introduced in Twenty Nineteen 1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-content/themes/twentynineteen/classes/class-twentynineteen-svg-icons.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.