From 5bf66662a9bdd62c5bccab15e607cd95cfb8fcab Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Mon, 27 Jul 2020 10:05:23 +0200 Subject: Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my familly --- .../classes/class-twentytwenty-customize.php | 526 --------------------- .../class-twentytwenty-non-latin-languages.php | 122 ----- .../classes/class-twentytwenty-script-loader.php | 47 -- .../class-twentytwenty-separator-control.php | 26 - .../classes/class-twentytwenty-svg-icons.php | 259 ---------- .../classes/class-twentytwenty-walker-comment.php | 142 ------ .../classes/class-twentytwenty-walker-page.php | 173 ------- 7 files changed, 1295 deletions(-) delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-non-latin-languages.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-script-loader.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-separator-control.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-comment.php delete mode 100644 srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-walker-page.php (limited to 'srcs/wordpress/wp-content/themes/twentytwenty/classes') diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php b/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php deleted file mode 100644 index cec2496..0000000 --- a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-customize.php +++ /dev/null @@ -1,526 +0,0 @@ -get_setting( 'blogname' )->transport = 'postMessage'; - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; - - $wp_customize->selective_refresh->add_partial( - 'blogname', - array( - 'selector' => '.site-title a', - 'render_callback' => 'twentytwenty_customize_partial_blogname', - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'blogdescription', - array( - 'selector' => '.site-description', - 'render_callback' => 'twentytwenty_customize_partial_blogdescription', - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'custom_logo', - array( - 'selector' => '.header-titles [class*=site-]:not(.site-description)', - 'render_callback' => 'twentytwenty_customize_partial_site_logo', - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'retina_logo', - array( - 'selector' => '.header-titles [class*=site-]:not(.site-description)', - 'render_callback' => 'twentytwenty_customize_partial_site_logo', - ) - ); - - /** - * Site Identity - */ - - /* 2X Header Logo ---------------- */ - $wp_customize->add_setting( - 'retina_logo', - array( - 'capability' => 'edit_theme_options', - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), - 'transport' => 'postMessage', - ) - ); - - $wp_customize->add_control( - 'retina_logo', - array( - 'type' => 'checkbox', - 'section' => 'title_tagline', - 'priority' => 10, - 'label' => __( 'Retina logo', 'twentytwenty' ), - 'description' => __( 'Scales the logo to half its uploaded size, making it sharp on high-res screens.', 'twentytwenty' ), - ) - ); - - // Header & Footer Background Color. - $wp_customize->add_setting( - 'header_footer_background_color', - array( - 'default' => '#ffffff', - 'sanitize_callback' => 'sanitize_hex_color', - 'transport' => 'postMessage', - ) - ); - - $wp_customize->add_control( - new WP_Customize_Color_Control( - $wp_customize, - 'header_footer_background_color', - array( - 'label' => __( 'Header & Footer Background Color', 'twentytwenty' ), - 'section' => 'colors', - ) - ) - ); - - // Enable picking an accent color. - $wp_customize->add_setting( - 'accent_hue_active', - array( - 'capability' => 'edit_theme_options', - 'sanitize_callback' => array( __CLASS__, 'sanitize_select' ), - 'transport' => 'postMessage', - 'default' => 'default', - ) - ); - - $wp_customize->add_control( - 'accent_hue_active', - array( - 'type' => 'radio', - 'section' => 'colors', - 'label' => __( 'Primary Color', 'twentytwenty' ), - 'choices' => array( - 'default' => __( 'Default', 'twentytwenty' ), - 'custom' => __( 'Custom', 'twentytwenty' ), - ), - ) - ); - - /** - * Implementation for the accent color. - * This is different to all other color options because of the accessibility enhancements. - * The control is a hue-only colorpicker, and there is a separate setting that holds values - * for other colors calculated based on the selected hue and various background-colors on the page. - * - * @since 1.0.0 - */ - - // Add the setting for the hue colorpicker. - $wp_customize->add_setting( - 'accent_hue', - array( - 'default' => 344, - 'type' => 'theme_mod', - 'sanitize_callback' => 'absint', - 'transport' => 'postMessage', - ) - ); - - // Add setting to hold colors derived from the accent hue. - $wp_customize->add_setting( - 'accent_accessible_colors', - array( - 'default' => array( - 'content' => array( - 'text' => '#000000', - 'accent' => '#cd2653', - 'secondary' => '#6d6d6d', - 'borders' => '#dcd7ca', - ), - 'header-footer' => array( - 'text' => '#000000', - 'accent' => '#cd2653', - 'secondary' => '#6d6d6d', - 'borders' => '#dcd7ca', - ), - ), - 'type' => 'theme_mod', - 'transport' => 'postMessage', - 'sanitize_callback' => array( __CLASS__, 'sanitize_accent_accessible_colors' ), - ) - ); - - // Add the hue-only colorpicker for the accent color. - $wp_customize->add_control( - new WP_Customize_Color_Control( - $wp_customize, - 'accent_hue', - array( - 'section' => 'colors', - 'settings' => 'accent_hue', - 'description' => __( 'Apply a custom color for links, buttons, featured images.', 'twentytwenty' ), - 'mode' => 'hue', - 'active_callback' => function() use ( $wp_customize ) { - return ( 'custom' === $wp_customize->get_setting( 'accent_hue_active' )->value() ); - }, - ) - ) - ); - - // Update background color with postMessage, so inline CSS output is updated as well. - $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; - - /** - * Theme Options - */ - - $wp_customize->add_section( - 'options', - array( - 'title' => __( 'Theme Options', 'twentytwenty' ), - 'priority' => 40, - 'capability' => 'edit_theme_options', - ) - ); - - /* Enable Header Search ----------------------------------------------- */ - - $wp_customize->add_setting( - 'enable_header_search', - array( - 'capability' => 'edit_theme_options', - 'default' => true, - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), - ) - ); - - $wp_customize->add_control( - 'enable_header_search', - array( - 'type' => 'checkbox', - 'section' => 'options', - 'priority' => 10, - 'label' => __( 'Show search in header', 'twentytwenty' ), - ) - ); - - /* Show author bio ---------------------------------------------------- */ - - $wp_customize->add_setting( - 'show_author_bio', - array( - 'capability' => 'edit_theme_options', - 'default' => true, - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), - ) - ); - - $wp_customize->add_control( - 'show_author_bio', - array( - 'type' => 'checkbox', - 'section' => 'options', - 'priority' => 10, - 'label' => __( 'Show author bio', 'twentytwenty' ), - ) - ); - - /* Display full content or excerpts on the blog and archives --------- */ - - $wp_customize->add_setting( - 'blog_content', - array( - 'capability' => 'edit_theme_options', - 'default' => 'full', - 'sanitize_callback' => array( __CLASS__, 'sanitize_select' ), - ) - ); - - $wp_customize->add_control( - 'blog_content', - array( - 'type' => 'radio', - 'section' => 'options', - 'priority' => 10, - 'label' => __( 'On archive pages, posts show:', 'twentytwenty' ), - 'choices' => array( - 'full' => __( 'Full text', 'twentytwenty' ), - 'summary' => __( 'Summary', 'twentytwenty' ), - ), - ) - ); - - /** - * Template: Cover Template. - */ - $wp_customize->add_section( - 'cover_template_options', - array( - 'title' => __( 'Cover Template', 'twentytwenty' ), - 'capability' => 'edit_theme_options', - 'description' => __( 'Settings for the "Cover Template" page template. Add a featured image to use as background.', 'twentytwenty' ), - 'priority' => 42, - ) - ); - - /* Overlay Fixed Background ------ */ - - $wp_customize->add_setting( - 'cover_template_fixed_background', - array( - 'capability' => 'edit_theme_options', - 'default' => true, - 'sanitize_callback' => array( __CLASS__, 'sanitize_checkbox' ), - 'transport' => 'postMessage', - ) - ); - - $wp_customize->add_control( - 'cover_template_fixed_background', - array( - 'type' => 'checkbox', - 'section' => 'cover_template_options', - 'label' => __( 'Fixed Background Image', 'twentytwenty' ), - 'description' => __( 'Creates a parallax effect when the visitor scrolls.', 'twentytwenty' ), - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'cover_template_fixed_background', - array( - 'selector' => '.cover-header', - 'type' => 'cover_fixed', - ) - ); - - /* Separator --------------------- */ - - $wp_customize->add_setting( - 'cover_template_separator_1', - array( - 'sanitize_callback' => 'wp_filter_nohtml_kses', - ) - ); - - $wp_customize->add_control( - new TwentyTwenty_Separator_Control( - $wp_customize, - 'cover_template_separator_1', - array( - 'section' => 'cover_template_options', - ) - ) - ); - - /* Overlay Background Color ------ */ - - $wp_customize->add_setting( - 'cover_template_overlay_background_color', - array( - 'default' => twentytwenty_get_color_for_area( 'content', 'accent' ), - 'sanitize_callback' => 'sanitize_hex_color', - ) - ); - - $wp_customize->add_control( - new WP_Customize_Color_Control( - $wp_customize, - 'cover_template_overlay_background_color', - array( - 'label' => __( 'Overlay Background Color', 'twentytwenty' ), - 'description' => __( 'The color used for the overlay. Defaults to the accent color.', 'twentytwenty' ), - 'section' => 'cover_template_options', - ) - ) - ); - - /* Overlay Text Color ------------ */ - - $wp_customize->add_setting( - 'cover_template_overlay_text_color', - array( - 'default' => '#ffffff', - 'sanitize_callback' => 'sanitize_hex_color', - ) - ); - - $wp_customize->add_control( - new WP_Customize_Color_Control( - $wp_customize, - 'cover_template_overlay_text_color', - array( - 'label' => __( 'Overlay Text Color', 'twentytwenty' ), - 'description' => __( 'The color used for the text in the overlay.', 'twentytwenty' ), - 'section' => 'cover_template_options', - ) - ) - ); - - /* Overlay Color Opacity --------- */ - - $wp_customize->add_setting( - 'cover_template_overlay_opacity', - array( - 'default' => 80, - 'sanitize_callback' => 'absint', - 'transport' => 'postMessage', - ) - ); - - $wp_customize->add_control( - 'cover_template_overlay_opacity', - array( - 'label' => __( 'Overlay Opacity', 'twentytwenty' ), - 'description' => __( 'Make sure that the contrast is high enough so that the text is readable.', 'twentytwenty' ), - 'section' => 'cover_template_options', - 'type' => 'range', - 'input_attrs' => twentytwenty_customize_opacity_range(), - ) - ); - - $wp_customize->selective_refresh->add_partial( - 'cover_template_overlay_opacity', - array( - 'selector' => '.cover-color-overlay', - 'type' => 'cover_opacity', - ) - ); - } - - /** - * Sanitization callback for the "accent_accessible_colors" setting. - * - * @static - * @access public - * @since 1.0.0 - * @param array $value The value we want to sanitize. - * @return array Returns sanitized value. Each item in the array gets sanitized separately. - */ - public static function sanitize_accent_accessible_colors( $value ) { - - // Make sure the value is an array. Do not typecast, use empty array as fallback. - $value = is_array( $value ) ? $value : array(); - - // Loop values. - foreach ( $value as $area => $values ) { - foreach ( $values as $context => $color_val ) { - $value[ $area ][ $context ] = sanitize_hex_color( $color_val ); - } - } - - return $value; - } - - /** - * Sanitize select. - * - * @param string $input The input from the setting. - * @param object $setting The selected setting. - * - * @return string $input|$setting->default The input from the setting or the default setting. - */ - public static function sanitize_select( $input, $setting ) { - $input = sanitize_key( $input ); - $choices = $setting->manager->get_control( $setting->id )->choices; - return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); - } - - /** - * Sanitize boolean for checkbox. - * - * @param bool $checked Whether or not a box is checked. - * - * @return bool - */ - public static function sanitize_checkbox( $checked ) { - return ( ( isset( $checked ) && true === $checked ) ? true : false ); - } - - } - - // Setup the Theme Customizer settings and controls. - add_action( 'customize_register', array( 'TwentyTwenty_Customize', 'register' ) ); - -} - -/** - * PARTIAL REFRESH FUNCTIONS - * */ -if ( ! function_exists( 'twentytwenty_customize_partial_blogname' ) ) { - /** - * Render the site title for the selective refresh partial. - */ - function twentytwenty_customize_partial_blogname() { - bloginfo( 'name' ); - } -} - -if ( ! function_exists( 'twentytwenty_customize_partial_blogdescription' ) ) { - /** - * Render the site description for the selective refresh partial. - */ - function twentytwenty_customize_partial_blogdescription() { - bloginfo( 'description' ); - } -} - -if ( ! function_exists( 'twentytwenty_customize_partial_site_logo' ) ) { - /** - * Render the site logo for the selective refresh partial. - * - * Doing it this way so we don't have issues with `render_callback`'s arguments. - */ - function twentytwenty_customize_partial_site_logo() { - twentytwenty_site_logo(); - } -} - - -/** - * Input attributes for cover overlay opacity option. - * - * @return array Array containing attribute names and their values. - */ -function twentytwenty_customize_opacity_range() { - /** - * Filter the input attributes for opacity - * - * @param array $attrs { - * The attributes - * - * @type int $min Minimum value - * @type int $max Maximum value - * @type int $step Interval between numbers - * } - */ - return apply_filters( - 'twentytwenty_customize_opacity_range', - array( - 'min' => 0, - 'max' => 90, - 'step' => 5, - ) - ); -} diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-non-latin-languages.php b/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-non-latin-languages.php deleted file mode 100644 index a3a1336..0000000 --- a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-non-latin-languages.php +++ /dev/null @@ -1,122 +0,0 @@ - array( 'Tahoma', 'Arial', 'sans-serif' ), - 'ary' => array( 'Tahoma', 'Arial', 'sans-serif' ), - 'azb' => array( 'Tahoma', 'Arial', 'sans-serif' ), - 'ckb' => array( 'Tahoma', 'Arial', 'sans-serif' ), - 'fa-IR' => array( 'Tahoma', 'Arial', 'sans-serif' ), - 'haz' => array( 'Tahoma', 'Arial', 'sans-serif' ), - 'ps' => array( 'Tahoma', 'Arial', 'sans-serif' ), - - // Chinese Simplified (China) - Noto Sans SC. - 'zh-CN' => array( '\'PingFang SC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), - - // Chinese Traditional (Taiwan) - Noto Sans TC. - 'zh-TW' => array( '\'PingFang TC\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), - - // Chinese (Hong Kong) - Noto Sans HK. - 'zh-HK' => array( '\'PingFang HK\'', '\'Helvetica Neue\'', '\'Microsoft YaHei New\'', '\'STHeiti Light\'', 'sans-serif' ), - - // Cyrillic. - 'bel' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'bg-BG' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'kk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'mk-MK' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'mn' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'ru-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'sah' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'sr-RS' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'tt-RU' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - 'uk' => array( '\'Helvetica Neue\'', 'Helvetica', '\'Segoe UI\'', 'Arial', 'sans-serif' ), - - // Devanagari. - 'bn-BD' => array( 'Arial', 'sans-serif' ), - 'hi-IN' => array( 'Arial', 'sans-serif' ), - 'mr' => array( 'Arial', 'sans-serif' ), - 'ne-NP' => array( 'Arial', 'sans-serif' ), - - // Greek. - 'el' => array( '\'Helvetica Neue\', Helvetica, Arial, sans-serif' ), - - // Gujarati. - 'gu' => array( 'Arial', 'sans-serif' ), - - // Hebrew. - 'he-IL' => array( '\'Arial Hebrew\'', 'Arial', 'sans-serif' ), - - // Japanese. - 'ja' => array( 'sans-serif' ), - - // Korean. - 'ko-KR' => array( '\'Apple SD Gothic Neo\'', '\'Malgun Gothic\'', '\'Nanum Gothic\'', 'Dotum', 'sans-serif' ), - - // Thai. - 'th' => array( '\'Sukhumvit Set\'', '\'Helvetica Neue\'', 'Helvetica', 'Arial', 'sans-serif' ), - - // Vietnamese. - 'vi' => array( '\'Libre Franklin\'', 'sans-serif' ), - - ) - ); - - // Return if the selected language has no fallback fonts. - if ( empty( $font_family[ $locale ] ) ) { - return; - } - - // Define elements to apply fallback fonts to. - $elements = apply_filters( - 'twentytwenty_get_localized_font_family_elements', - array( - 'front-end' => array( 'body', 'input', 'textarea', 'button', '.button', '.faux-button', '.wp-block-button__link', '.wp-block-file__button', '.has-drop-cap:not(:focus)::first-letter', '.has-drop-cap:not(:focus)::first-letter', '.entry-content .wp-block-archives', '.entry-content .wp-block-categories', '.entry-content .wp-block-cover-image', '.entry-content .wp-block-latest-comments', '.entry-content .wp-block-latest-posts', '.entry-content .wp-block-pullquote', '.entry-content .wp-block-quote.is-large', '.entry-content .wp-block-quote.is-style-large', '.entry-content .wp-block-archives *', '.entry-content .wp-block-categories *', '.entry-content .wp-block-latest-posts *', '.entry-content .wp-block-latest-comments *', '.entry-content p', '.entry-content ol', '.entry-content ul', '.entry-content dl', '.entry-content dt', '.entry-content cite', '.entry-content figcaption', '.entry-content .wp-caption-text', '.comment-content p', '.comment-content ol', '.comment-content ul', '.comment-content dl', '.comment-content dt', '.comment-content cite', '.comment-content figcaption', '.comment-content .wp-caption-text', '.widget_text p', '.widget_text ol', '.widget_text ul', '.widget_text dl', '.widget_text dt', '.widget-content .rssSummary', '.widget-content cite', '.widget-content figcaption', '.widget-content .wp-caption-text' ), - 'block-editor' => array( '.editor-styles-wrapper > *', '.editor-styles-wrapper p', '.editor-styles-wrapper ol', '.editor-styles-wrapper ul', '.editor-styles-wrapper dl', '.editor-styles-wrapper dt', '.editor-post-title__block .editor-post-title__input', '.editor-styles-wrapper .wp-block h1', '.editor-styles-wrapper .wp-block h2', '.editor-styles-wrapper .wp-block h3', '.editor-styles-wrapper .wp-block h4', '.editor-styles-wrapper .wp-block h5', '.editor-styles-wrapper .wp-block h6', '.editor-styles-wrapper .has-drop-cap:not(:focus)::first-letter', '.editor-styles-wrapper cite', '.editor-styles-wrapper figcaption', '.editor-styles-wrapper .wp-caption-text' ), - 'classic-editor' => array( 'body#tinymce.wp-editor', 'body#tinymce.wp-editor p', 'body#tinymce.wp-editor ol', 'body#tinymce.wp-editor ul', 'body#tinymce.wp-editor dl', 'body#tinymce.wp-editor dt', 'body#tinymce.wp-editor figcaption', 'body#tinymce.wp-editor .wp-caption-text', 'body#tinymce.wp-editor .wp-caption-dd', 'body#tinymce.wp-editor cite', 'body#tinymce.wp-editor table' ), - ) - ); - - // Return if the specified type doesn't exist. - if ( empty( $elements[ $type ] ) ) { - return; - } - - // Return the specified styles. - return twentytwenty_generate_css( implode( ',', $elements[ $type ] ), 'font-family', implode( ',', $font_family[ $locale ] ), null, null, false ); - - } - } -} diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-script-loader.php b/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-script-loader.php deleted file mode 100644 index a8af12f..0000000 --- a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-script-loader.php +++ /dev/null @@ -1,47 +0,0 @@ -get_data( $handle, $attr ) ) { - continue; - } - // Prevent adding attribute when already added in #12009. - if ( ! preg_match( ":\s$attr(=|>|\s):", $tag ) ) { - $tag = preg_replace( ':(?=>):', " $attr", $tag, 1 ); - } - // Only allow async or defer, not both. - break; - } - return $tag; - } - - } -} diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-separator-control.php b/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-separator-control.php deleted file mode 100644 index 8072257..0000000 --- a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-separator-control.php +++ /dev/null @@ -1,26 +0,0 @@ -'; - } - - } - } -} diff --git a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php b/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php deleted file mode 100644 index a4b2e7a..0000000 --- a/srcs/wordpress/wp-content/themes/twentytwenty/classes/class-twentytwenty-svg-icons.php +++ /dev/null @@ -1,259 +0,0 @@ -\s*<', $svg ); // Remove white space between SVG tags. - return $svg; - } - return null; - } - - /** - * GET SOCIAL LINK SVG - * Detects the social network from a URL and returns the SVG code for its icon. - * - * @param string $uri The URL to retrieve SVG for. - */ - public static function get_social_link_svg( $uri ) { - 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 twentytwenty_get_theme_svg( $icon, 'social' ); - } - } - return null; - } - - /** - * ICON STORAGE - * Store the code for all SVGs in an array. - * - * @var array - */ - public static $ui_icons = array( - 'arrow-down' => ' - - ', - 'arrow-down-circled ' => ' - - ', - 'bookmark' => ' - - ', - 'calendar' => ' - - ', - 'chevron-down' => ' - - ', - 'comment' => ' - - ', - 'cross' => ' - - ', - 'ellipsis' => ' - - ', - 'edit' => ' - - ', - 'folder' => ' - - ', - 'link' => ' - - ', - 'search' => ' - - ', - 'tag' => ' - - ', - 'user' => ' - - ', - ); - - /** - * 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', - ), - 'behance' => array( - 'behance.net', - ), - 'codepen' => array( - 'codepen.io', - ), - 'facebook' => array( - 'facebook.com', - 'fb.me', - ), - 'feed' => array( - 'feed', - ), - 'lastfm' => array( - 'last.fm', - ), - 'mail' => array( - 'mailto:', - ), - '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' => '', - - 'bandcamp' => '', - - 'behance' => '', - - 'codepen' => '', - - 'deviantart' => '', - - 'dribbble' => '', - - 'dropbox' => '', - - 'etsy' => '', - - 'facebook' => '', - - 'feed' => '', - - 'flickr' => '', - - 'foursquare' => '', - - 'goodreads' => '', - - 'google' => '', - - 'github' => '', - - 'instagram' => '', - - 'lastfm' => '', - - 'linkedin' => '', - - 'mail' => '