SVG inner markup. */ public static function paths() { static $p = null; if ( null !== $p ) { return $p; } $p = array( /* Fields */ 'text' => '', 'editor-textcolor' => '', 'email' => '', 'admin-links' => '', 'lock' => '', 'calculator' => '', 'hidden' => '', 'phone' => '', 'admin-users' => '', 'calendar-alt' => '', 'upload' => '', 'format-image' => '', 'edit' => '', 'shield' => '', 'shield-alt' => '', 'performance' => '', 'location' => '', 'location-alt' => '', 'list-view' => '', 'arrow-down-alt2' => '', 'marker' => '', 'yes-alt' => '', 'admin-site-alt3' => '', 'star-filled' => '', 'chart-bar' => '', 'leftright' => '', 'grid-view' => '', 'sort' => '', 'art' => '', 'controls-volumeon' => '', 'thumbs-up' => '', 'align-pull-left' => '', 'backup' => '', 'bank' => '', 'button' => '', 'cart' => '', 'columns' => '', 'controls-forward' => '', 'editor-code' => '', 'editor-paste-word' => '', 'heading' => '', 'id-alt' => '', 'money-alt' => '', 'plus-alt' => '', 'shortcode' => '', 'tickets-alt' => '', 'update' => '', 'admin-plugins' => '', 'hook' => '', /* Interface */ 'desktop' => '', 'tablet' => '', 'mobile' => '', 'warning' => '', 'external' => '', 'visibility' => '', 'close' => '', 'home' => '', 'gear' => '', 'mail' => '', 'chart' => '', 'plug' => '', 'card' => '', 'palette' => '', 'layout' => '', 'form' => '', 'eye' => '', 'inbox' => '', 'target' => '', 'bell' => '', 'plus' => '', 'check' => '', 'arrow' => '', 'book' => '', 'download' => '', 'list' => '', 'chevron-down' => '', 'chevron-right' => '', 'trash' => '', 'save' => '', 'shuffle' => '', 'share' => '', 'spacer' => '', 'minus' => '', 'info' => '', 'tag' => '', 'chevron-left' => '', 'copy' => '', 'box' => '', 'award' => '', 'user-plus' => '', 'user-check' => '', 'file-plus' => '', 'mail-check' => '', ); $p = apply_filters( 'fwren/icons', $p ); return $p; } /** * One icon. * * @param string $name Icon name (a leading "dashicons-" is ignored). * @param int $size Pixel size. * @param string $class Extra class. * @return string SVG markup ('' when unknown). */ public static function svg( $name, $size = 24, $class = '' ) { $name = preg_replace( '/^dashicons-/', '', (string) $name ); $map = array( 'wordpress' => 'hook', 'admin-generic' => 'gear', 'smartphone' => 'mobile', 'email-alt' => 'mail', 'no-alt' => 'close', 'saved' => 'save', 'randomize' => 'shuffle', 'text-page' => 'editor-paste-word', 'html' => 'editor-code', 'store' => 'home', 'editor-ol' => 'list-view', 'image-flip-vertical' => 'spacer', 'editor-paragraph' => 'text', 'upload' => 'upload', 'arrow-right-alt2' => 'chevron-right' ); $name = $map[ $name ] ?? $name; $p = self::paths(); if ( ! isset( $p[ $name ] ) ) { $name = 'form'; } return ''; } /** @return string data: URI for add_menu_page() (WordPress recolours the fill to match the admin scheme). */ public static function menu_icon() { $svg = ''; return 'data:image/svg+xml;base64,' . base64_encode( $svg ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions } /** @return array name => SVG markup for JS (admin, editor, integrations). */ public static function for_js( array $names, $size = 18 ) { $out = array(); foreach ( $names as $n ) { $out[ $n ] = self::svg( $n, $size ); } return $out; } }