Changeset 3628440
- Timestamp:
- 07/30/2026 11:02:41 AM (3 months ago)
- Location:
- gf-social-icons/trunk
- Files:
-
- 48 added
- 24 edited
-
README.md (added)
-
README.txt (modified) (5 diffs)
-
composer.json (modified) (1 diff)
-
gf-social-icons.php (modified) (3 diffs)
-
includes/BaseCustomizer.php (modified) (1 diff)
-
includes/Controls/BorderControl.php (modified) (1 diff)
-
includes/Controls/Checkbox.php (modified) (1 diff)
-
includes/Controls/Color.php (modified) (1 diff)
-
includes/Controls/ConditionalDisplay.php (modified) (1 diff)
-
includes/Controls/SelectDropdownControl.php (modified) (1 diff)
-
includes/Controls/SocialRepeater.php (modified) (1 diff)
-
includes/Controls/Tabs.php (modified) (1 diff)
-
includes/Controls/Toggle.php (modified) (1 diff)
-
includes/Controls/UnitInput.php (modified) (1 diff)
-
includes/Core.php (modified) (21 diffs)
-
includes/Global/Activate.php (modified) (1 diff)
-
includes/Global/EnqueueScripts.php (modified) (1 diff)
-
includes/Global/Settings.php (modified) (1 diff)
-
includes/Sanitize.php (modified) (2 diffs)
-
includes/TemplateLoader.php (modified) (5 diffs)
-
includes/Types/Control.php (modified) (1 diff)
-
includes/Types/Panel.php (modified) (1 diff)
-
includes/Types/Partial.php (modified) (1 diff)
-
includes/Types/Section.php (modified) (1 diff)
-
includes/Validation.php (modified) (1 diff)
-
package.json (added)
-
src (added)
-
src/components (added)
-
src/components/borderControl (added)
-
src/components/borderControl/border.jsx (added)
-
src/components/borderControl/index.js (added)
-
src/components/checkboxControl (added)
-
src/components/checkboxControl/checkbox.jsx (added)
-
src/components/checkboxControl/index.js (added)
-
src/components/colorControl (added)
-
src/components/colorControl/color.jsx (added)
-
src/components/colorControl/colorStyle.scss (added)
-
src/components/colorControl/index.js (added)
-
src/components/colorControl/transparent.png (added)
-
src/components/conditionalDisplayControl (added)
-
src/components/conditionalDisplayControl/conditionalDisplay.jsx (added)
-
src/components/conditionalDisplayControl/index.js (added)
-
src/components/selectDropDownControl (added)
-
src/components/selectDropDownControl/index.js (added)
-
src/components/selectDropDownControl/selectDropDown.jsx (added)
-
src/components/socialRepeaterControl (added)
-
src/components/socialRepeaterControl/iconPopup.jsx (added)
-
src/components/socialRepeaterControl/index.js (added)
-
src/components/socialRepeaterControl/socialRepeatedField.jsx (added)
-
src/components/socialRepeaterControl/socialRepeater.jsx (added)
-
src/components/socialRepeaterControl/socialRepeaterStyle.scss (added)
-
src/components/styleGenerator.jsx (added)
-
src/components/subControl.jsx (added)
-
src/components/tabs (added)
-
src/components/tabs/index.js (added)
-
src/components/tabs/tabs.jsx (added)
-
src/components/tabs/tabsStyle.scss (added)
-
src/components/toggleControl (added)
-
src/components/toggleControl/index.js (added)
-
src/components/toggleControl/toggle.jsx (added)
-
src/components/tooltip (added)
-
src/components/tooltip/tooltip.jsx (added)
-
src/components/tooltip/tooltipStyle.scss (added)
-
src/components/unitInputControl (added)
-
src/components/unitInputControl/index.js (added)
-
src/components/unitInputControl/unitInput.jsx (added)
-
src/customizer.js (added)
-
src/customizer.scss (added)
-
src/iconStore.json (added)
-
src/view.js (added)
-
src/view.scss (added)
-
webpack.config.js (added)
Legend:
- Unmodified
- Added
- Removed
-
gf-social-icons/trunk/README.txt
r3546939 r3628440 1 === Sticky Social Icons - Floating Social Media, WhatsApp Chat, Click-to-Call & Email Icons===1 === Sticky Social Icons === 2 2 Contributors: gutefy 3 Tags: social icons, floating social icons, whatsapp button, click to call, share buttons3 Tags: social icons, floating social icons, sticky icons, contact buttons, click to call 4 4 Requires at least: 6.3 5 5 Requires PHP: 7.2 6 Tested up to: 7.0 7 Stable tag: 1.2. 06 Tested up to: 7.0.2 7 Stable tag: 1.2.1 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Floating or inline social icons for any WordPress site: WhatsApp click-to-chat, click-to-call, email, Facebook, Instagram, X, YouTube, TikTok and more.11 Floating or inline social and contact icons for any WordPress site — no code, live Customizer preview. 12 12 13 13 == Description == … … 15 15 **Sticky Social Icons** is a lightweight, mobile-friendly social media plugin that lets you add floating sticky social icons to any WordPress site — without writing a single line of code. Visitors get instant access to your WhatsApp, phone, email, and every social channel right from the side of the screen. 16 16 17 Designed for businesses, creators, agencies, and stores, the plugin works out of the box with **Block Themes**, **Classic Themes**, **WooCommerce**, **Elementor**, **Bricks**, **Divi**, **Astra**, **Kadence**, **GeneratePress**, **Hello Theme**, **Hello Elementor**, and every popular page builder.17 Designed for businesses, creators, agencies, and stores, the plugin works out of the box with both block and classic themes, and with the common page builders. 18 18 19 19 Configure everything live in the **WordPress Customizer** — change colors, sizes, borders, radius, position, and per-device visibility and see the result update in real time. … … 46 46 47 47 Facebook, Facebook Messenger, Facebook (f), WhatsApp, Instagram, X (Twitter), YouTube, LinkedIn, TikTok, Telegram, Pinterest, Snapchat, Reddit, Skype, Tumblr, Discord, GitHub, Vimeo, Twitch, Behance, Dribbble, Email (envelope), Phone, and more — with new icons added in every release. 48 49 = 🛠 Source Code and Build Process = 50 51 Nothing in this plugin is obfuscated or minified by hand. The uncompiled source (JavaScript/JSX and SCSS) ships inside the plugin in `/src`, together with `package.json` and `webpack.config.js`, and is also published at https://github.com/syed-sajib/gutefy-social-icons 52 53 The files in `/build` are generated from `/src` with @wordpress/scripts (webpack) by running `npm install` and then `npm run build`. See the "Source Code" section below for details. 48 54 49 55 = 💼 Perfect For = … … 103 109 No. The plugin makes no external requests, sets no cookies, and does not track anything. 104 110 105 == Screenshots == 106 1. Floating social icons rail on a typical homepage. 107 2. Customizer panel — General section with Accounts List, drag-to-reorder, and Open in New Tab. 108 3. Customizer panel — Design section with Normal/Hover tabs, colors, sizes, border, radius. 109 4. Customizer panel — Advanced section with Device Visibility and Display Rules. 110 5. Per-row WhatsApp pre-fill / mailto subject+body / SMS toggle. 111 6. Per-row WhatsApp pre-fill, mailto subject+body, SMS toggle. 111 == Source Code == 112 113 The complete, human-readable source of this plugin — uncompiled JavaScript/JSX and SCSS — is available at: 114 115 https://github.com/syed-sajib/gutefy-social-icons 116 117 The files in `/build` are generated from `/src` with @wordpress/scripts (webpack). To build them yourself: 118 119 1. `npm install` 120 2. `npm run build` 121 122 Build configuration lives in `webpack.config.js`; the entry points are `src/customizer.js` and `src/view.js`. Development watch mode is `npm run start`. The `/src` directory is also shipped inside this plugin package, so no download is required to read the original source. 112 123 113 124 == Changelog == 125 126 = 1.2.1 = 127 * **Changed:** Plugin display name simplified to **Sticky Social Icons** — removed the third-party trademarked term and the extra keywords from the name and the plugin tags. 128 * **Added:** Full uncompiled source (`/src`), `package.json`, and `webpack.config.js` are now included in the plugin package. 129 * **Added:** Readme now documents the public source repository and the exact build process for the files in `/build`. 130 * **Updated:** Repository URLs point to the new location, https://github.com/syed-sajib/gutefy-social-icons. 131 * No functional or feature changes. 114 132 115 133 = 1.2.0 = … … 149 167 == Upgrade Notice == 150 168 169 = 1.2.1 = 170 Maintenance release. Plugin name simplified, full source code and build instructions now included. No functional changes — safe update for everyone. 171 151 172 = 1.2.0 = 152 173 Major feature release. Adds click-to-chat WhatsApp/Email/Phone, page-level visibility rules, role-based hiding, border-radius, per-device visibility, and accessibility (aria-label, noopener). Recommended for everyone. -
gf-social-icons/trunk/composer.json
r3157280 r3628440 4 4 "license": "GPL-2.0+", 5 5 "require": { 6 "php": ">=7. 0"6 "php": ">=7.2" 7 7 }, 8 8 "autoload": { -
gf-social-icons/trunk/gf-social-icons.php
r3546939 r3628440 2 2 /** 3 3 * 4 * @link https://github.com/ dev-sajib/gutefy-social-icons5 * @since 1.2. 04 * @link https://github.com/syed-sajib/gutefy-social-icons 5 * @since 1.2.1 6 6 * @package Gutefy_Social_Icons 7 7 * 8 8 * @wordpress-plugin 9 9 * Plugin Name: Sticky Social Icons 10 * Plugin URI: https://github.com/ dev-sajib/gutefy-social-icons11 * Description: Add floating, sticky , or inline social media icons (Facebook, WhatsApp, Instagram, X/Twitter, YouTube, LinkedIn, TikTok, Email, Phone, more) with a no-code WordPress Customizer interface, shortcode, and Gutenberg block.12 * Version: 1.2. 010 * Plugin URI: https://github.com/syed-sajib/gutefy-social-icons 11 * Description: Add floating, sticky social and contact icons (Facebook, Instagram, X/Twitter, YouTube, LinkedIn, TikTok, WhatsApp, Email, Phone and more) to any site, configured live in the WordPress Customizer. 12 * Version: 1.2.1 13 13 * Author: Gutefy 14 14 * Author URI: https://profiles.wordpress.org/gutefy/ … … 16 16 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 17 17 * Text Domain: gf-social-icons 18 * Domain Path: /languages19 18 * Requires at least: 6.3 20 * Tested up to: 7.0 19 * Tested up to: 7.0.2 21 20 * Requires PHP: 7.2 22 21 */ … … 51 50 use GF_SOCIAL_ICONS\TemplateLoader; 52 51 53 // Initialize the classes 54 new Core(); 52 // Activation hook and admin links must be registered while the plugin file loads. 55 53 new Activate(); 56 EnqueueScripts::init(); 57 TemplateLoader::init(); 54 55 /** 56 * Initialize the rest of the plugin on `init`. 57 * 58 * The Customizer panels, sections and controls carry translated labels, so they 59 * must not be built before `init` — doing so triggers WordPress' "translation 60 * loading was triggered too early" notice (see _load_textdomain_just_in_time()). 61 */ 62 add_action('init', function () { 63 new Core(); 64 EnqueueScripts::init(); 65 TemplateLoader::init(); 66 }); 58 67 59 68 ?> -
gf-social-icons/trunk/includes/BaseCustomizer.php
r3546939 r3628440 2 2 namespace GF_SOCIAL_ICONS; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 use GF_SOCIAL_ICONS\Types\Panel; 5 9 use GF_SOCIAL_ICONS\Types\Partial; -
gf-social-icons/trunk/includes/Controls/BorderControl.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class BorderControl extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/Checkbox.php
r3546939 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Checkbox extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/Color.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Color extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/ConditionalDisplay.php
r3546939 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class ConditionalDisplay extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/SelectDropdownControl.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class SelectDropdownControl extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/SocialRepeater.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class SocialRepeater extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/Tabs.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Tabs extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/Toggle.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Toggle extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Controls/UnitInput.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Controls; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class UnitInput extends \WP_Customize_Control 5 9 { -
gf-social-icons/trunk/includes/Core.php
r3546939 r3628440 3 3 namespace GF_SOCIAL_ICONS; 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 use GF_SOCIAL_ICONS\Global\Settings; 6 10 use GF_SOCIAL_ICONS\BaseCustomizer; … … 30 34 $panels = array( 31 35 Settings::PANEL_CORE => [ 32 'title' => __('Sticky Social Icons', TEXT_DOMAIN),33 'description' => __(' <p>Gutefy Extensions for floating social icons</p>', TEXT_DOMAIN),36 'title' => __('Sticky Social Icons', 'gf-social-icons'), 37 'description' => __('Floating social and contact icons for your site.', 'gf-social-icons'), 34 38 'priority' => 31, 35 39 ] … … 50 54 $section = array( 51 55 Settings::SECTION_GENERAL_SETTINGS => [ 52 'title' => __('General', TEXT_DOMAIN),56 'title' => __('General', 'gf-social-icons'), 53 57 'panel' => Settings::PANEL_CORE, 54 58 'priority' => 1, 55 59 ], 56 60 Settings::SECTION_STYLE_SETTINGS => [ 57 'title' => __('Design', TEXT_DOMAIN),61 'title' => __('Design', 'gf-social-icons'), 58 62 'panel' => Settings::PANEL_CORE, 59 63 'priority' => 2, 60 64 ], 61 65 Settings::SECTION_ADVANCED_SETTINGS => [ 62 'title' => __('Advanced', TEXT_DOMAIN),66 'title' => __('Advanced', 'gf-social-icons'), 63 67 'panel' => Settings::PANEL_CORE, 64 68 'priority' => 3, … … 102 106 ], 103 107 'control_args' => [ 104 'label' => __('Accounts List', TEXT_DOMAIN),108 'label' => __('Accounts List', 'gf-social-icons'), 105 109 'section' => Settings::SECTION_GENERAL_SETTINGS, 106 110 'input_attrs' => array( … … 120 124 ], 121 125 'control_args' => [ 122 'label' => __('Open in new Tab', TEXT_DOMAIN),126 'label' => __('Open in new Tab', 'gf-social-icons'), 123 127 'section' => Settings::SECTION_GENERAL_SETTINGS, 124 128 'input_attrs' => array( … … 156 160 ], 157 161 'control_args' => [ 158 'label' => __('Device Visibility', TEXT_DOMAIN),162 'label' => __('Device Visibility', 'gf-social-icons'), 159 163 'section' => Settings::SECTION_ADVANCED_SETTINGS, 160 164 'priority' => 1, … … 185 189 ], 186 190 'control_args' => [ 187 'label' => __('Icon Color', TEXT_DOMAIN),191 'label' => __('Icon Color', 'gf-social-icons'), 188 192 'section' => Settings::SECTION_STYLE_SETTINGS, 189 193 'input_attrs' => array( … … 215 219 ], 216 220 'control_args' => [ 217 'label' => __('Icon background color', TEXT_DOMAIN),221 'label' => __('Icon background color', 'gf-social-icons'), 218 222 'section' => Settings::SECTION_STYLE_SETTINGS, 219 223 'input_attrs' => array( … … 245 249 ], 246 250 'control_args' => [ 247 'label' => __('Icon color', TEXT_DOMAIN),251 'label' => __('Icon color', 'gf-social-icons'), 248 252 'section' => Settings::SECTION_STYLE_SETTINGS, 249 253 'input_attrs' => array( … … 275 279 ], 276 280 'control_args' => [ 277 'label' => __('Icon background color', TEXT_DOMAIN),281 'label' => __('Icon background color', 'gf-social-icons'), 278 282 'section' => Settings::SECTION_STYLE_SETTINGS, 279 283 'input_attrs' => array( … … 305 309 ], 306 310 'control_args' => [ 307 'label' => __('Icon Size', TEXT_DOMAIN),311 'label' => __('Icon Size', 'gf-social-icons'), 308 312 'section' => Settings::SECTION_STYLE_SETTINGS, 309 313 'input_attrs' => array( … … 335 339 ], 336 340 'control_args' => [ 337 'label' => __('Icon Size', TEXT_DOMAIN),341 'label' => __('Icon Size', 'gf-social-icons'), 338 342 'section' => Settings::SECTION_STYLE_SETTINGS, 339 343 'input_attrs' => array( … … 373 377 ], 374 378 'control_args' => [ 375 'label' => __('Icon Wrapper', TEXT_DOMAIN),379 'label' => __('Icon Wrapper', 'gf-social-icons'), 376 380 'section' => Settings::SECTION_STYLE_SETTINGS, 377 381 'input_attrs' => array( … … 403 407 ], 404 408 'control_args' => [ 405 'label' => __('Icon Wrapper size', TEXT_DOMAIN),409 'label' => __('Icon Wrapper size', 'gf-social-icons'), 406 410 'section' => Settings::SECTION_STYLE_SETTINGS, 407 411 'input_attrs' => array( … … 434 438 ], 435 439 'control_args' => [ 436 'label' => __('Vertical Gap', TEXT_DOMAIN),440 'label' => __('Vertical Gap', 'gf-social-icons'), 437 441 'section' => Settings::SECTION_STYLE_SETTINGS, 438 442 'input_attrs' => array( … … 463 467 ], 464 468 'control_args' => [ 465 'label' => __('Adjust Vertical Position', TEXT_DOMAIN),469 'label' => __('Adjust Vertical Position', 'gf-social-icons'), 466 470 'section' => Settings::SECTION_STYLE_SETTINGS, 467 471 'input_attrs' => array( … … 484 488 ], 485 489 'control_args' => [ 486 'label' => __('Horizontal Position', TEXT_DOMAIN),490 'label' => __('Horizontal Position', 'gf-social-icons'), 487 491 'section' => Settings::SECTION_STYLE_SETTINGS, 488 492 'input_attrs' => array( … … 514 518 ], 515 519 'control_args' => [ 516 'label' => __('Border', TEXT_DOMAIN),520 'label' => __('Border', 'gf-social-icons'), 517 521 'section' => Settings::SECTION_STYLE_SETTINGS, 518 522 'input_attrs' => array( … … 543 547 ], 544 548 'control_args' => [ 545 'label' => __('Border Radius', TEXT_DOMAIN),549 'label' => __('Border Radius', 'gf-social-icons'), 546 550 'section' => Settings::SECTION_STYLE_SETTINGS, 547 551 'input_attrs' => array( … … 571 575 ], 572 576 'control_args' => [ 573 'label' => __('Border Radius', TEXT_DOMAIN),577 'label' => __('Border Radius', 'gf-social-icons'), 574 578 'section' => Settings::SECTION_STYLE_SETTINGS, 575 579 'input_attrs' => array( … … 594 598 ], 595 599 'control_args' => [ 596 'label' => __('Display Rules', TEXT_DOMAIN),600 'label' => __('Display Rules', 'gf-social-icons'), 597 601 'section' => Settings::SECTION_ADVANCED_SETTINGS, 598 602 'priority' => 2, -
gf-social-icons/trunk/includes/Global/Activate.php
r3157280 r3628440 3 3 namespace GF_SOCIAL_ICONS\Global; 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 class Activate 6 10 { -
gf-social-icons/trunk/includes/Global/EnqueueScripts.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Global; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class EnqueueScripts 5 9 { -
gf-social-icons/trunk/includes/Global/Settings.php
r3546939 r3628440 2 2 namespace GF_SOCIAL_ICONS\Global; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Settings 5 9 { -
gf-social-icons/trunk/includes/Sanitize.php
r3546939 r3628440 2 2 3 3 namespace GF_SOCIAL_ICONS; 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Sanitize { 5 9 … … 42 46 // Ensure $value is an array 43 47 if (!is_array($value)) { 44 error_log('Unexpected type encountered in gf_social_icons_custom_sanitize: ' . gettype($value));45 return [['facebook', 'http://facebook.com']]; // Return a default array or handle the unexpected type48 // Unexpected type — fall back to a safe default. 49 return [['facebook', 'http://facebook.com']]; 46 50 } 47 51 -
gf-social-icons/trunk/includes/TemplateLoader.php
r3546939 r3628440 3 3 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 class TemplateLoader 6 10 { … … 27 31 $gf_social_icons_position_horizontally = get_option('gf_social_icons_position_horizontally', 'position--right'); 28 32 29 $html = "<div id='gf_social_icons__wrapper' class='gutefy-section-parent-wrapper " . esc_attr($gf_social_icons_position_horizontally) . "'>" . self::load_template() . "</div>";30 33 self::generateStyle(); 31 34 32 echo $html; 35 echo '<div id="gf_social_icons__wrapper" class="gutefy-section-parent-wrapper ' . esc_attr($gf_social_icons_position_horizontally) . '">'; 36 self::render_template(); 37 echo '</div>'; 38 } 39 40 /** 41 * Tags and attributes allowed inside the bundled icon SVGs. 42 * 43 * The icon markup ships with the plugin (build/iconStore.json), but it is still 44 * filtered through wp_kses() so nothing unexpected can ever reach the page. 45 * 46 * @return array 47 */ 48 public static function svg_allowed_html() 49 { 50 $shared_attributes = array( 51 'fill' => true, 52 'fill-rule' => true, 53 'fill-opacity' => true, 54 'stroke' => true, 55 'stroke-width' => true, 56 'stroke-linecap' => true, 57 'stroke-linejoin' => true, 58 'stroke-dasharray' => true, 59 'opacity' => true, 60 'transform' => true, 61 'class' => true, 62 'style' => true, 63 'id' => true, 64 ); 65 66 return array( 67 'svg' => $shared_attributes + array( 68 'xmlns' => true, 69 'xmlns:xlink' => true, 70 'viewbox' => true, 71 'width' => true, 72 'height' => true, 73 'preserveaspectratio' => true, 74 'role' => true, 75 'aria-hidden' => true, 76 'focusable' => true, 77 'version' => true, 78 ), 79 'g' => $shared_attributes, 80 'title' => array(), 81 'defs' => array(), 82 'path' => $shared_attributes + array('d' => true), 83 'circle' => $shared_attributes + array('cx' => true, 'cy' => true, 'r' => true), 84 'ellipse' => $shared_attributes + array('cx' => true, 'cy' => true, 'rx' => true, 'ry' => true), 85 'rect' => $shared_attributes + array('x' => true, 'y' => true, 'width' => true, 'height' => true, 'rx' => true, 'ry' => true), 86 'line' => $shared_attributes + array('x1' => true, 'y1' => true, 'x2' => true, 'y2' => true), 87 'polygon' => $shared_attributes + array('points' => true), 88 'polyline' => $shared_attributes + array('points' => true), 89 'use' => $shared_attributes + array('href' => true, 'xlink:href' => true, 'x' => true, 'y' => true), 90 ); 33 91 } 34 92 … … 82 140 return true; 83 141 } 142 /** 143 * Returns the icon markup as a string. 144 * 145 * Kept for backward compatibility — render_template() is the printing version. 146 * 147 * @return string 148 */ 84 149 public static function load_template() 150 { 151 ob_start(); 152 self::render_template(); 153 return ob_get_clean(); 154 } 155 156 /** 157 * Prints the icon list. 158 */ 159 public static function render_template() 85 160 { 86 161 $social_icons_settings = get_option('gf_social_icons_general_settings', []); … … 93 168 //check availablity 94 169 if (!file_exists($json_file_path)) { 95 return 'Icon Json File Not Found';170 return; 96 171 } 97 172 … … 101 176 102 177 // Check if the JSON data was properly decoded 103 if (json_last_error() !== JSON_ERROR_NONE) { 104 return '<p>Error: Invalid JSON data.</p>'; 105 } 106 ob_start(); 178 if (json_last_error() !== JSON_ERROR_NONE || !is_array($social_icons_data)) { 179 return; 180 } 181 182 $open_in_new_tab = (is_array($open_in_new_tab) && !empty($open_in_new_tab['value'])); 183 $allowed_svg = self::svg_allowed_html(); 107 184 108 185 echo '<div class="gf_social_icons_social_float">'; 109 if (!empty($social_icons_settings)): 186 187 if (!empty($social_icons_settings)) { 110 188 foreach ($social_icons_settings as $icon) { 111 if ($icon[1]) { 112 $aria_label = ucwords(str_replace(['_', '-'], ' ', $icon[0])); 113 $options = (isset($icon[3]) && is_array($icon[3])) ? $icon[3] : []; 114 $href = self::build_href($icon[0], $icon[1], $options); 115 $is_protocol_href = (bool) preg_match('/^(mailto:|tel:|sms:)/i', $href); 116 ?> 117 118 <a class="gf_social_icons_social_icon" href="<?php echo $is_protocol_href ? esc_attr($href) : esc_url($href); ?>" aria-label="<?php echo esc_attr($aria_label); ?>" rel="noopener noreferrer" <?php 119 if ($open_in_new_tab['value'] && !$is_protocol_href) { 120 echo 'target="_blank"'; 121 } ?>> 122 <span> 123 <?php echo ($social_icons_data[$icon[0]]['icon']) ?> 124 </span> 125 </a> 126 <?php 127 } 128 } 129 ; 130 else: ?> 131 <p class="empty-sms">Minimum One Url Required.</p> 132 <?php endif; 189 if (empty($icon[1]) || !isset($social_icons_data[$icon[0]]['icon'])) { 190 continue; 191 } 192 193 $aria_label = ucwords(str_replace(['_', '-'], ' ', $icon[0])); 194 $options = (isset($icon[3]) && is_array($icon[3])) ? $icon[3] : []; 195 $href = self::build_href($icon[0], $icon[1], $options); 196 $is_protocol_href = (bool) preg_match('/^(mailto:|tel:|sms:)/i', $href); 197 198 echo '<a class="gf_social_icons_social_icon" href="' 199 . ($is_protocol_href ? esc_attr($href) : esc_url($href)) 200 . '" aria-label="' . esc_attr($aria_label) . '" rel="noopener noreferrer"' 201 . (($open_in_new_tab && !$is_protocol_href) ? ' target="_blank"' : '') 202 . '><span>' 203 . wp_kses($social_icons_data[$icon[0]]['icon'], $allowed_svg) 204 . '</span></a>'; 205 } 206 } else { 207 echo '<p class="empty-sms">' . esc_html__('Minimum One Url Required.', 'gf-social-icons') . '</p>'; 208 } 209 133 210 echo '</div>'; 134 // Get the contents of the buffer and clean it135 return ob_get_clean();136 211 } 137 212 -
gf-social-icons/trunk/includes/Types/Control.php
r3157280 r3628440 3 3 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 class Control{ 6 10 -
gf-social-icons/trunk/includes/Types/Panel.php
r3157280 r3628440 3 3 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 class Panel{ 6 10 -
gf-social-icons/trunk/includes/Types/Partial.php
r3157280 r3628440 3 3 4 4 5 6 if ( ! defined( 'ABSPATH' ) ) { 7 exit; // Exit if accessed directly. 8 } 5 9 class Partial{ 6 10 -
gf-social-icons/trunk/includes/Types/Section.php
r3157280 r3628440 2 2 namespace GF_SOCIAL_ICONS\Types; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Section { 5 9 /** -
gf-social-icons/trunk/includes/Validation.php
r3546939 r3628440 2 2 namespace GF_SOCIAL_ICONS; 3 3 4 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; // Exit if accessed directly. 7 } 4 8 class Validation{ 5 9 public static function gf_social_icons_custom_url_validation($error_object, $value, $setting_object) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)