qsdklsqkdmqskdmlqskd
azoepqikdomlqskdjmlqs
qpfklqjsfmklqsjdmqlsjdsqd
class-twentynineteen-svg-icons.php 0000666 00000170713 15233141647 0013371 0 ustar 00 source on its own array key, without adding the
* both `width` and `height` attributes, since these are added dynamically,
* before rendering the SVG code.
*
* All icons are assumed to have equal width and height, hence the option
* to only specify a `$size` parameter in the svg methods.
*
* @since Twenty Nineteen 1.0
*/
class 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.
* @return string|null SVG code for the icon, or null if not found.
*/
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( ' \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.
* @return string|null SVG code for the social link icon, or null if not found.
*/
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 */ '
',
'watch' => /* material-design – watch-later */ '
',
'archive' => /* material-design – folder */ '
',
'tag' => /* material-design – local_offer */ '
',
'comment' => /* material-design – comment */ '
',
'person' => /* material-design – person */ '
',
'edit' => /* material-design – edit */ '
',
'chevron_left' => /* material-design – chevron_left */ '
',
'chevron_right' => /* material-design – chevron_right */ '
',
'check' => /* material-design – check */ '
',
'arrow_drop_down_circle' => /* material-design – arrow_drop_down_circle */ '
',
'keyboard_arrow_down' => /* material-design – keyboard_arrow_down */ '
',
'keyboard_arrow_right' => /* material-design – keyboard_arrow_right */ '
',
'keyboard_arrow_left' => /* material-design – keyboard_arrow_left */ '
',
'arrow_drop_down_ellipsis' => /* custom – arrow_drop_down_ellipsis */ '
',
);
/**
* 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).
*
* @var array
*/
public 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',
),
'google-plus' => array(
'plus.google.com',
),
'lastfm' => array(
'last.fm',
),
'mail' => array(
'mailto:',
),
'slideshare' => array(
'slideshare.net',
),
'pocket' => array(
'getpocket.com',
),
'twitch' => array(
'twitch.tv',
),
'wordpress' => array(
'wordpress.com',
'wordpress.org',
),
);
/**
* Social Icons – svg sources.
*
* @var array
*/
public static $social_icons = array(
'500px' => '
',
'amazon' => '
',
'apple' => '
',
'bandcamp' => '
',
'behance' => '
',
'chain' => '
',
'codepen' => '
',
'deviantart' => '
',
'digg' => '
',
'dribbble' => '
',
'dropbox' => '
',
'etsy' => '
',
'facebook' => '
',
'feed' => '
',
'flickr' => '
',
'foursquare' => '
',
'goodreads' => '
',
'google-plus' => '
',
'google' => '
',
'github' => '
',
'instagram' => '
',
'lastfm' => '
',
'linkedin' => '
',
'mail' => '
',
'meetup' => '
',
'medium' => '
',
'pinterest' => '
',
'pocket' => '
',
'reddit' => '
',
'skype' => '
',
'slideshare' => '
',
'snapchat' => '
',
'soundcloud' => '
',
'spotify' => '
',
'stumbleupon' => '
',
'tumblr' => '
',
'twitch' => '
',
'twitter' => '
',
'vimeo' => '
',
'vk' => '
',
'wordpress' => '
',
'yelp' => '
',
'youtube' => '
',
);
}
class-twentynineteen-walker-comment.php 0000666 00000007712 15233141647 0014404 0 ustar 00
< id="comment-" has_children ? 'parent' : '', $comment ); ?>>
'div-comment',
'depth' => $depth,
'max_depth' => $args['max_depth'],
'before' => '
',
)
)
);
?>
custom_get_readable_color( $background_color ) . ';';
$theme_css .= '--global--color-secondary: ' . $this->custom_get_readable_color( $background_color ) . ';';
$theme_css .= '--button--color-background: ' . $this->custom_get_readable_color( $background_color ) . ';';
$theme_css .= '--button--color-text-hover: ' . $this->custom_get_readable_color( $background_color ) . ';';
if ( '#fff' === $this->custom_get_readable_color( $background_color ) ) {
$theme_css .= '--table--stripes-border-color: rgba(240, 240, 240, 0.15);';
$theme_css .= '--table--stripes-background-color: rgba(240, 240, 240, 0.15);';
}
}
$theme_css .= '}';
return $theme_css;
}
/**
* Customizer & frontend custom color variables.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function custom_color_variables() {
if ( 'd1e4dd' !== strtolower( get_theme_mod( 'background_color', 'D1E4DD' ) ) ) {
wp_add_inline_style( 'twenty-twenty-one-style', $this->generate_custom_color_variables() );
}
}
/**
* Editor custom color variables.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function editor_custom_color_variables() {
wp_enqueue_style(
'twenty-twenty-one-custom-color-overrides',
get_theme_file_uri( 'assets/css/custom-color-overrides.css' ),
array(),
wp_get_theme()->get( 'Version' )
);
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
if ( 'd1e4dd' !== strtolower( $background_color ) ) {
wp_add_inline_style( 'twenty-twenty-one-custom-color-overrides', $this->generate_custom_color_variables( 'editor' ) );
}
}
/**
* Gets luminance from a HEX color.
*
* @static
*
* @since Twenty Twenty-One 1.0
*
* @param string $hex The HEX color.
* @return int Returns a number (0-255).
*/
public static function get_relative_luminance_from_hex( $hex ) {
// Remove the "#" symbol from the beginning of the color.
$hex = ltrim( $hex, '#' );
// Make sure there are 6 digits for the below calculations.
if ( 3 === strlen( $hex ) ) {
$hex = substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) . substr( $hex, 2, 1 ) . substr( $hex, 2, 1 );
}
// Get red, green, blue.
$red = hexdec( substr( $hex, 0, 2 ) );
$green = hexdec( substr( $hex, 2, 2 ) );
$blue = hexdec( substr( $hex, 4, 2 ) );
// Calculate the luminance.
$lum = ( 0.2126 * $red ) + ( 0.7152 * $green ) + ( 0.0722 * $blue );
return (int) round( $lum );
}
/**
* Adds a class to if the background-color is dark.
*
* @since Twenty Twenty-One 1.0
*
* @param array $classes The existing body classes.
* @return array
*/
public function body_class( $classes ) {
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
$luminance = self::get_relative_luminance_from_hex( $background_color );
if ( 127 > $luminance ) {
$classes[] = 'is-dark-theme';
} else {
$classes[] = 'is-light-theme';
}
if ( 225 <= $luminance ) {
$classes[] = 'has-background-white';
}
return $classes;
}
}
class-twenty-twenty-one-customize-notice-control.php 0000666 00000002143 15233165145 0017007 0 ustar 00
in the dashboard.
add_filter( 'admin_body_class', array( $this, 'admin_body_classes' ) );
// Add the switch on the frontend & customizer.
add_action( 'wp_footer', array( $this, 'the_switch' ) );
// Add the privacy policy content.
add_action( 'admin_init', array( $this, 'add_privacy_policy_content' ) );
}
/**
* Enqueues editor custom color variables & scripts.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function editor_custom_color_variables() {
if ( ! $this->switch_should_render() ) {
return;
}
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) > 127 ) {
// Add Dark Mode variable overrides.
wp_add_inline_style(
'twenty-twenty-one-custom-color-overrides',
'.is-dark-theme.is-dark-theme .editor-styles-wrapper { --global--color-background: var(--global--color-dark-gray); --global--color-primary: var(--global--color-light-gray); --global--color-secondary: var(--global--color-light-gray); --button--color-text: var(--global--color-background); --button--color-text-hover: var(--global--color-secondary); --button--color-text-active: var(--global--color-secondary); --button--color-background: var(--global--color-secondary); --button--color-background-active: var(--global--color-background); --global--color-border: #9ea1a7; --table--stripes-border-color: rgba(240, 240, 240, 0.15); --table--stripes-background-color: rgba(240, 240, 240, 0.15); }'
);
}
wp_enqueue_script(
'twentytwentyone-dark-mode-support-toggle',
get_template_directory_uri() . '/assets/js/dark-mode-toggler.js',
array(),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
wp_enqueue_script(
'twentytwentyone-editor-dark-mode-support',
get_template_directory_uri() . '/assets/js/editor-dark-mode-support.js',
array( 'twentytwentyone-dark-mode-support-toggle' ),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
}
/**
* Enqueues scripts and styles.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function enqueue_scripts() {
if ( ! $this->switch_should_render() ) {
return;
}
$url = get_template_directory_uri() . '/assets/css/style-dark-mode.css';
if ( is_rtl() ) {
$url = get_template_directory_uri() . '/assets/css/style-dark-mode-rtl.css';
}
wp_enqueue_style( 'tt1-dark-mode', $url, array( 'twenty-twenty-one-style' ), wp_get_theme()->get( 'Version' ) );
}
/**
* Enqueues scripts for the customizer.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function customize_controls_enqueue_scripts() {
if ( ! $this->switch_should_render() ) {
return;
}
wp_enqueue_script(
'twentytwentyone-customize-controls',
get_template_directory_uri() . '/assets/js/customize.js',
array( 'customize-base', 'customize-controls', 'underscore', 'jquery', 'twentytwentyone-customize-helpers' ),
wp_get_theme()->get( 'Version' ),
array( 'in_footer' => true )
);
}
/**
* Registers customizer options.
*
* @since Twenty Twenty-One 1.0
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
* @return void
*/
public function customizer_controls( $wp_customize ) {
$colors_section = $wp_customize->get_section( 'colors' );
if ( is_object( $colors_section ) ) {
$colors_section->title = __( 'Colors & Dark Mode', 'twentytwentyone' );
}
// Custom notice control.
require_once get_theme_file_path( 'classes/class-twenty-twenty-one-customize-notice-control.php' );
$wp_customize->add_setting(
'respect_user_color_preference_notice',
array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => '__return_empty_string',
)
);
$wp_customize->add_control(
new Twenty_Twenty_One_Customize_Notice_Control(
$wp_customize,
'respect_user_color_preference_notice',
array(
'section' => 'colors',
'priority' => 100,
'active_callback' => static function () {
return 127 >= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
},
)
)
);
$wp_customize->add_setting(
'respect_user_color_preference',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => static function ( $value ) {
return (bool) $value;
},
)
);
$description = '';
$description .= sprintf(
/* translators: %s: Twenty Twenty-One support article URL. */
__( 'Dark Mode is a device setting. If a visitor to your site requests it, your site will be shown with a dark background and light text. Learn more about Dark Mode. ', 'twentytwentyone' ),
esc_url( __( 'https://wordpress.org/documentation/article/twenty-twenty-one/#dark-mode-support', 'twentytwentyone' ) )
);
$description .= '
';
$description .= '' . __( 'Dark Mode can also be turned on and off with a button that you can find in the bottom corner of the page.', 'twentytwentyone' ) . '
';
$wp_customize->add_control(
'respect_user_color_preference',
array(
'type' => 'checkbox',
'section' => 'colors',
'label' => esc_html__( 'Dark Mode support', 'twentytwentyone' ),
'priority' => 110,
'description' => $description,
'active_callback' => static function ( $value ) {
return 127 < Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) );
},
)
);
// Add partial for background_color.
$wp_customize->selective_refresh->add_partial(
'background_color',
array(
'selector' => '#dark-mode-toggler',
'container_inclusive' => true,
'render_callback' => function () {
$attrs = ( $this->switch_should_render() ) ? array() : array( 'style' => 'display:none;' );
$this->the_html( $attrs );
},
)
);
}
/**
* Calculates classes for the main element.
*
* @since Twenty Twenty-One 1.0
*
* @param string $classes The classes for element.
* @return string
*/
public function html_classes( $classes ) {
if ( ! $this->switch_should_render() ) {
return $classes;
}
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
if ( $should_respect_color_scheme && 127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) ) {
return ( $classes ) ? ' respect-color-scheme-preference' : 'respect-color-scheme-preference';
}
return $classes;
}
/**
* Adds a class to the element in the editor to accommodate dark-mode.
*
* @since Twenty Twenty-One 1.0
*
* @global WP_Screen $current_screen WordPress current screen object.
*
* @param string $classes The admin body-classes.
* @return string
*/
public function admin_body_classes( $classes ) {
if ( ! $this->switch_should_render() ) {
return $classes;
}
global $current_screen;
if ( empty( $current_screen ) ) {
set_current_screen();
}
if ( $current_screen->is_block_editor() ) {
$should_respect_color_scheme = get_theme_mod( 'respect_user_color_preference', false );
$background_color = get_theme_mod( 'background_color', 'D1E4DD' );
if ( $should_respect_color_scheme && Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( $background_color ) > 127 ) {
$classes .= ' twentytwentyone-supports-dark-theme';
}
}
return $classes;
}
/**
* Determines if we want to print the dark-mode switch or not.
*
* @since Twenty Twenty-One 1.0
*
* @global bool $is_IE
*
* @return bool
*/
public function switch_should_render() {
global $is_IE;
return (
get_theme_mod( 'respect_user_color_preference', false ) &&
! $is_IE &&
127 <= Twenty_Twenty_One_Custom_Colors::get_relative_luminance_from_hex( get_theme_mod( 'background_color', 'D1E4DD' ) )
);
}
/**
* Adds night/day switch.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function the_switch() {
if ( ! $this->switch_should_render() ) {
return;
}
$this->the_html();
$this->the_script();
}
/**
* Prints the dark-mode switch HTML.
*
* Inspired from https://codepen.io/aaroniker/pen/KGpXZo (MIT-licensed)
*
* @since Twenty Twenty-One 1.0
*
* @param array $attrs The attributes to add to our element.
* @return void
*/
public function the_html( $attrs = array() ) {
$attrs = wp_parse_args(
$attrs,
array(
'id' => 'dark-mode-toggler',
'class' => 'fixed-bottom',
'aria-pressed' => 'false',
'onClick' => 'toggleDarkMode()',
)
);
echo ' $val ) {
echo ' ' . esc_attr( $key ) . '="' . esc_attr( $val ) . '"';
}
echo '>';
printf(
/* translators: %s: On/Off */
esc_html__( 'Dark Mode: %s', 'twentytwentyone' ),
' '
);
echo ' ';
?>
%s\n", $js );
}
}
/**
* Adds information to the privacy policy.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function add_privacy_policy_content() {
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
return;
}
$content = '' . __( 'Twenty Twenty-One uses LocalStorage when Dark Mode support is enabled.', 'twentytwentyone' ) . '
'
. '' . __( 'Suggested text:', 'twentytwentyone' ) . ' '
. __( 'This website uses LocalStorage to save the setting when Dark Mode support is turned on or off. LocalStorage is necessary for the setting to work and is only used when a user clicks on the Dark Mode button. No data is saved in the database or transferred.', 'twentytwentyone' );
wp_add_privacy_policy_content( __( 'Twenty Twenty-One', 'twentytwentyone' ), wp_kses_post( wpautop( $content, false ) ) );
}
}
class-twenty-twenty-one-customize.php 0000666 00000011306 15233165145 0014053 0 ustar 00 get_setting( $setting_id );
if ( $setting ) {
$setting->transport = 'postMessage';
}
}
// Add partial for blogname.
$wp_customize->selective_refresh->add_partial(
'blogname',
array(
'selector' => '.site-title',
'render_callback' => array( $this, 'partial_blogname' ),
)
);
// Add partial for blogdescription.
$wp_customize->selective_refresh->add_partial(
'blogdescription',
array(
'selector' => '.site-description',
'render_callback' => array( $this, 'partial_blogdescription' ),
)
);
// Add "display_title_and_tagline" setting for displaying the site-title & tagline.
$wp_customize->add_setting(
'display_title_and_tagline',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ),
)
);
// Add control for the "display_title_and_tagline" setting.
$wp_customize->add_control(
'display_title_and_tagline',
array(
'type' => 'checkbox',
'section' => 'title_tagline',
'label' => esc_html__( 'Display Site Title & Tagline', 'twentytwentyone' ),
)
);
/**
* Add excerpt or full text selector to customizer
*/
$wp_customize->add_section(
'excerpt_settings',
array(
'title' => esc_html__( 'Excerpt Settings', 'twentytwentyone' ),
'priority' => 120,
)
);
$wp_customize->add_setting(
'display_excerpt_or_full_post',
array(
'capability' => 'edit_theme_options',
'default' => 'excerpt',
'sanitize_callback' => static function ( $value ) {
return 'excerpt' === $value || 'full' === $value ? $value : 'excerpt';
},
)
);
$wp_customize->add_control(
'display_excerpt_or_full_post',
array(
'type' => 'radio',
'section' => 'excerpt_settings',
'label' => esc_html__( 'On Archive Pages, posts show:', 'twentytwentyone' ),
'choices' => array(
'excerpt' => esc_html__( 'Summary', 'twentytwentyone' ),
'full' => esc_html__( 'Full text', 'twentytwentyone' ),
),
)
);
// Background color.
// Include the custom control class.
require_once get_theme_file_path( 'classes/class-twenty-twenty-one-customize-color-control.php' );
// Register the custom control.
$wp_customize->register_control_type( 'Twenty_Twenty_One_Customize_Color_Control' );
// Get the palette from theme-supports.
$palette = get_theme_support( 'editor-color-palette' );
// Build the colors array from theme-support.
$colors = array();
if ( isset( $palette[0] ) && is_array( $palette[0] ) ) {
foreach ( $palette[0] as $palette_color ) {
$colors[] = $palette_color['color'];
}
}
// Add the control. Overrides the default background-color control.
$wp_customize->add_control(
new Twenty_Twenty_One_Customize_Color_Control(
$wp_customize,
'background_color',
array(
'label' => esc_html_x( 'Background color', 'Customizer control', 'twentytwentyone' ),
'section' => 'colors',
'palette' => $colors,
)
)
);
}
/**
* Sanitizes a boolean for checkbox.
*
* @since Twenty Twenty-One 1.0
*
* @param bool $checked Whether or not a box is checked.
* @return bool
*/
public static function sanitize_checkbox( $checked = null ) {
return (bool) isset( $checked ) && true === $checked;
}
/**
* Renders the site title for the selective refresh partial.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function partial_blogname() {
bloginfo( 'name' );
}
/**
* Renders the site tagline for the selective refresh partial.
*
* @since Twenty Twenty-One 1.0
*
* @return void
*/
public function partial_blogdescription() {
bloginfo( 'description' );
}
}
}
class-twenty-twenty-one-svg-icons.php 0000666 00000146122 15233165145 0013746 0 ustar 00 source on its own array key, without adding either
* the `width` or `height` attributes, since these are added dynamically,
* before rendering the SVG code.
*
* All icons are assumed to have equal width and height, hence the option
* to only specify a `$size` parameter in the svg methods.
*
* @since Twenty Twenty-One 1.0
*/
class Twenty_Twenty_One_SVG_Icons {
/**
* User Interface icons – svg sources.
*
* @since Twenty Twenty-One 1.0
*
* @var array
*/
protected static $icons = array(
'arrow_right' => ' ',
'arrow_left' => ' ',
'close' => ' ',
'menu' => ' ',
'plus' => ' ',
'minus' => ' ',
);
/**
* Social Icons – svg sources.
*
* @since Twenty Twenty-One 1.0
*
* @var array
*/
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).
*
* @since Twenty Twenty-One 1.0
*
* @var array
*/
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:',
),
'mastodon' => array(
'mastodon.social',
'pawoo.net',
'mstdn.jp',
'mastodon.cloud',
'mastodon.online',
'counter.social',
'mstdn.social',
'mas.to',
'mastodon.world',
'gc2.jp',
),
'pocket' => array(
'getpocket.com',
),
'twitch' => array(
'twitch.tv',
),
'wordpress' => array(
'wordpress.com',
'wordpress.org',
),
);
/**
* Gets the SVG code for a given icon.
*
* @static
*
* @since Twenty Twenty-One 1.0
*
* @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, $size ) {
if ( 'ui' === $group ) {
$arr = self::$icons;
} elseif ( 'social' === $group ) {
$arr = self::$social_icons;
} else {
$arr = array();
}
/**
* Filters Twenty Twenty-Ones's array of icons.
*
* The dynamic portion of the hook name, `$group`, refers to
* the name of the group of icons, either "ui" or "social".
*
* @since Twenty Twenty-One 1.0
*
* @param array $arr Array of icons.
*/
$arr = apply_filters( "twenty_twenty_one_svg_icons_{$group}", $arr );
$svg = '';
if ( isset( $arr[ $icon ] ) && is_string( $arr[ $icon ] ) ) {
$repl = sprintf( ' $regex ) {
if ( preg_match( $regex, $uri ) ) {
return self::get_svg( 'social', $icon, $size ) . '';
}
}
return null;
}
}
class-twenty-twenty-one-customize-color-control.php 0000666 00000002440 15233165145 0016644 0 ustar 00 get( 'Version' ),
false
);
}
/**
* Refreshes the parameters passed to the JavaScript via JSON.
*
* @since Twenty Twenty-One 1.0
*
* @uses WP_Customize_Control::to_json()
*
* @return void
*/
public function to_json() {
parent::to_json();
$this->json['palette'] = $this->palette;
}
}