Plugin Directory

Changeset 3462759


Ignore:
Timestamp:
02/16/2026 05:36:52 PM (7 days ago)
Author:
a1tools
Message:

v1.4.11: Fix X (Twitter) icon - use inline SVG instead of FA6-only fa-x-twitter

Location:
a1-tools/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • a1-tools/trunk/a1-tools.php

    r3458218 r3462759  
    44 * Plugin URI:        https://tools.a-1chimney.com
    55 * Description:       Connects your WordPress site to the A1 Tools platform for centralized management of contact information, social media links, and business details.
    6  * Version:           1.4.10
     6 * Version:           1.4.11
    77 * Requires at least: 5.0
    88 * Requires PHP:      7.4
     
    2121
    2222// Plugin constants.
    23 define( 'A1TOOLS_VERSION', '1.4.10' );
     23define( 'A1TOOLS_VERSION', '1.4.11' );
    2424define( 'A1TOOLS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2525define( 'A1TOOLS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
     
    365365}
    366366add_shortcode( 'a1tools_hours', 'a1tools_shortcode_hours' );
     367
     368/**
     369 * Get SVG markup for icons not available in Font Awesome 5.
     370 *
     371 * @since 1.4.11
     372 * @param string $icon_key The SVG icon key (e.g. 'svg-x').
     373 * @return string SVG markup or empty string.
     374 */
     375function a1tools_get_svg_icon( $icon_key ) {
     376    $svgs = array(
     377        'svg-x' => '<svg viewBox="0 0 24 24" aria-hidden="true" fill="currentColor" class="a1tools-svg-icon"><path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/></svg>',
     378    );
     379    return isset( $svgs[ $icon_key ] ) ? $svgs[ $icon_key ] : '';
     380}
     381
     382/**
     383 * Get icon HTML (SVG or Font Awesome <i> tag).
     384 *
     385 * @since 1.4.11
     386 * @param string $icon Icon class or SVG key.
     387 * @return string HTML markup for the icon.
     388 */
     389function a1tools_get_icon_html( $icon ) {
     390    $svg = a1tools_get_svg_icon( $icon );
     391    if ( $svg ) {
     392        return $svg;
     393    }
     394    return '<i class="' . esc_attr( $icon ) . '" aria-hidden="true"></i>';
     395}
    367396
    368397/**
     
    402431        'instagram_url'       => array( 'label' => 'Instagram', 'icon' => 'fab fa-instagram', 'color' => '#E4405F' ),
    403432        'youtube_url'         => array( 'label' => 'YouTube', 'icon' => 'fab fa-youtube', 'color' => '#FF0000' ),
    404         'twitter_url'         => array( 'label' => 'Twitter', 'icon' => 'fab fa-x-twitter', 'color' => '#000000' ),
     433        'twitter_url'         => array( 'label' => 'X (Twitter)', 'icon' => 'svg-x', 'color' => '#000000' ),
    405434        'linkedin_url'        => array( 'label' => 'LinkedIn', 'icon' => 'fab fa-linkedin-in', 'color' => '#0A66C2' ),
    406435        'tiktok_url'          => array( 'label' => 'TikTok', 'icon' => 'fab fa-tiktok', 'color' => '#000000' ),
     
    422451        foreach ( $platforms as $key => $data ) {
    423452            if ( ! empty( $vars[ $key ] ) ) {
    424                 $icon_class = ! empty( $atts['icon_class'] ) ? $atts['icon_class'] : $data['icon'];
     453                $icon = ! empty( $atts['icon_class'] ) ? $atts['icon_class'] : $data['icon'];
    425454                $output    .= '<a href="' . esc_url( $vars[ $key ] ) . '" target="_blank" rel="noopener noreferrer" title="' . esc_attr( $data['label'] ) . '">';
    426                 $output    .= '<i class="' . esc_attr( $icon_class ) . '" aria-hidden="true"></i>';
     455                $output    .= a1tools_get_icon_html( $icon );
    427456                $output    .= '<span class="screen-reader-text">' . esc_html( $data['label'] ) . '</span>';
    428457                $output    .= '</a>';
     
    517546            }
    518547
    519             $icon_class = ! empty( $atts['icon_class'] ) ? $atts['icon_class'] : $data['icon'];
     548            $icon = ! empty( $atts['icon_class'] ) ? $atts['icon_class'] : $data['icon'];
    520549            $output    .= '<a href="' . esc_url( $vars[ $key ] ) . '" class="a1tools-social-icon" target="_blank" rel="noopener noreferrer" title="' . esc_attr( $data['label'] ) . '" style="' . esc_attr( $inline_style ) . '">';
    521             $output    .= '<i class="' . esc_attr( $icon_class ) . '" aria-hidden="true"></i>';
     550            $output    .= a1tools_get_icon_html( $icon );
    522551            $output    .= '<span class="screen-reader-text">' . esc_html( $data['label'] ) . '</span>';
    523552            $output    .= '</a>';
     
    10401069    color: inherit;
    10411070    line-height: 1;
     1071}
     1072.a1tools-social-icons-styled .a1tools-social-icon .a1tools-svg-icon {
     1073    width: 1em;
     1074    height: 1em;
     1075    fill: currentColor;
    10421076}
    10431077/* Style presets for non-custom styles */
     
    15041538            'instagram_url'       => array( 'label' => 'Instagram', 'icon' => 'fab fa-instagram', 'color' => '#E4405F' ),
    15051539            'youtube_url'         => array( 'label' => 'YouTube', 'icon' => 'fab fa-youtube', 'color' => '#FF0000' ),
    1506             'twitter_url'         => array( 'label' => 'Twitter', 'icon' => 'fab fa-x-twitter', 'color' => '#000000' ),
     1540            'twitter_url'         => array( 'label' => 'X (Twitter)', 'icon' => 'svg-x', 'color' => '#000000' ),
    15071541            'linkedin_url'        => array( 'label' => 'LinkedIn', 'icon' => 'fab fa-linkedin-in', 'color' => '#0A66C2' ),
    15081542            'tiktok_url'          => array( 'label' => 'TikTok', 'icon' => 'fab fa-tiktok', 'color' => '#000000' ),
     
    16401674
    16411675                echo '<a href="' . esc_url( $vars[ $key ] ) . '" class="a1tools-social-icon" target="_blank" rel="noopener noreferrer" title="' . esc_attr( $data['label'] ) . '" style="' . esc_attr( $inline_style ) . '">';
    1642                 echo '<i class="' . esc_attr( $data['icon'] ) . '" aria-hidden="true"></i>';
     1676                echo a1tools_get_icon_html( $data['icon'] );
    16431677                echo '<span class="screen-reader-text">' . esc_html( $data['label'] ) . '</span>';
    16441678                echo '</a>';
  • a1-tools/trunk/includes/class-a1-tools-elementor-widget.php

    r3458218 r3462759  
    6363            'instagram_url'       => array( 'label' => 'Instagram', 'icon' => 'fab fa-instagram', 'color' => '#E4405F' ),
    6464            'youtube_url'         => array( 'label' => 'YouTube', 'icon' => 'fab fa-youtube', 'color' => '#FF0000' ),
    65             'twitter_url'         => array( 'label' => 'Twitter', 'icon' => 'fab fa-x-twitter', 'color' => '#000000' ),
     65            'twitter_url'         => array( 'label' => 'X (Twitter)', 'icon' => 'svg-x', 'color' => '#000000' ),
    6666            'linkedin_url'        => array( 'label' => 'LinkedIn', 'icon' => 'fab fa-linkedin-in', 'color' => '#0A66C2' ),
    6767            'tiktok_url'          => array( 'label' => 'TikTok', 'icon' => 'fab fa-tiktok', 'color' => '#000000' ),
     
    503503            }
    504504            echo '>';
    505             echo '<i class="' . esc_attr( $data['icon'] ) . '" aria-hidden="true"></i>';
     505
     506            echo a1tools_get_icon_html( $data['icon'] );
     507
    506508            echo '<span class="screen-reader-text">' . esc_html( $data['label'] ) . '</span>';
    507509            echo '</a>';
     
    525527        $js_platforms = array();
    526528        foreach ( $platforms as $key => $data ) {
    527             $icon_parts  = explode( ' ', $data['icon'] );
    528             $icon_class  = end( $icon_parts );
    529             $icon_prefix = count( $icon_parts ) > 1 ? $icon_parts[0] : 'fab';
    530 
    531             $js_platforms[] = array(
    532                 'icon'   => $icon_class,
    533                 'prefix' => $icon_prefix,
    534                 'color'  => $data['color'],
    535                 'name'   => $data['label'],
    536             );
     529            $svg = a1tools_get_svg_icon( $data['icon'] );
     530            if ( $svg ) {
     531                $js_platforms[] = array(
     532                    'svg'    => $svg,
     533                    'color'  => $data['color'],
     534                    'name'   => $data['label'],
     535                );
     536            } else {
     537                $icon_parts  = explode( ' ', $data['icon'] );
     538                $icon_class  = end( $icon_parts );
     539                $icon_prefix = count( $icon_parts ) > 1 ? $icon_parts[0] : 'fab';
     540
     541                $js_platforms[] = array(
     542                    'icon'   => $icon_class,
     543                    'prefix' => $icon_prefix,
     544                    'color'  => $data['color'],
     545                    'name'   => $data['label'],
     546                );
     547            }
    537548        }
    538549
     
    578589            #>
    579590            <a href="#" class="a1tools-social-icon" style="{{ inlineStyle }}">
     591                <# if (platform.svg) { #>
     592                {{{ platform.svg }}}
     593                <# } else { #>
    580594                <i class="{{ platform.prefix }} {{ platform.icon }}"></i>
     595                <# } #>
    581596            </a>
    582597            <# }); #>
  • a1-tools/trunk/readme.txt

    r3458218 r3462759  
    44Requires at least: 5.0
    55Tested up to: 6.9
    6 Stable tag: 1.4.10
     6Stable tag: 1.4.11
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    151151
    152152== Changelog ==
     153
     154= 1.4.11 =
     155* Fixed X (Twitter) icon not displaying (fa-x-twitter is Font Awesome 6 only)
     156* Added inline SVG support for icons not available in Font Awesome 5
     157* X icon now renders as proper SVG that scales with icon size settings
    153158
    154159= 1.4.10 =
Note: See TracChangeset for help on using the changeset viewer.