Plugin Directory

Changeset 3208637


Ignore:
Timestamp:
12/16/2024 02:55:44 PM (16 months ago)
Author:
blapps
Message:

Bug fix and ready for WP 6.6

Location:
customize-external-links-and-add-icon/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • customize-external-links-and-add-icon/trunk/customize-external-links-form.php

    r3126790 r3208637  
    1 
    21<?php
    32
     
    6261}
    6362
    64 // CHECKBOX - Name: plugin_options[chkNoFollow]
    65 function cuexlinks_setting_plugin_chknoopener_fn()
    66 {
    67     $checked = "";
    68 
    69     $options = get_option('plugin_options');
    70     if (isset($options['chkNoOpener'])) {
    71         $checked = ' checked="checked" ';
    72     }
    73     ?>
    74 
    75 <input <?=$checked?>
    76         id='plugin_chknoopener'
    77         name='plugin_options[chkNoOpener]'
    78         type='checkbox' />
    79         <?php
    80 }
    81 
     63// CHECKBOX - Name: plugin_options[chkNoReferrer]
    8264function cuexlinks_setting_plugin_chknoreferrer_fn()
    8365{
  • customize-external-links-and-add-icon/trunk/customize-external-links.php

    r3126790 r3208637  
    55 * Description: Add nofollow and remove noreferrer attributes in external links. Choose between different icons to show users which link is an external one.
    66 * Author: blapps
    7  * Version: 2.2
     7 * Version: 2.3
    88 * Tested up to: 6.6
    99 * Text Domain: customize-external-links
     
    283283}
    284284
    285 function cuexlinks_get_icon()
    286 {
    287     //     $items = array("None", "fa-external-link-square-alt", "fa-external-link-alt", "ascii-8599", "ascii-8625", "ascii-8663");
    288     //     $item_tag = array("None", "<i class=\"fas fa-external-link-square-alt\"></i> Icon by Fontawesome", "<i class=\"fas fa-external-link-alt\"></i> Icon by Fontawesome", "&#8599; (recommened)", "&#8625;", "&#8663;");
     285function cuexlinks_get_icon() {
     286    // Get the plugin options
     287    $options = get_option('plugin_options');
     288
     289    // Check if $options is a valid array
     290    if (!is_array($options)) {
     291        // If not, return an empty string or handle the error
     292        return '';
     293    }
    289294
    290295    $icon = "";
    291     $options = get_option('plugin_options');
    292 
     296
     297    // Ensure the 'option_iconType' key exists in the options array
    293298    switch ($options['option_iconType']) {
    294299        case "fa-external-link-square-alt":
     
    308313            break;
    309314        case "manual":
    310             $icon = $options['text_manual'];
    311             break;
    312         case "None";
     315            // Check if 'text_manual' is set in options
     316            $icon = isset($options['text_manual']) ? $options['text_manual'] : '';
     317            break;
     318        case "None":
    313319            break;
    314320        default:
     
    316322            break;
    317323    }
     324
    318325    return $icon;
    319326}
     327
    320328
    321329function cuexlinks_closing_parse($content)
  • customize-external-links-and-add-icon/trunk/customizer-external-links-initiate.php

    r3126790 r3208637  
    5555function cuexlinks_fontawesome_admin()
    5656{
    57     wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v6.6.0/css/all.css');
     57    wp_enqueue_style('fontawesome', 'https://use.fontawesome.com/releases/v6.7.1/css/all.css');
    5858}
    5959
     
    9090
    9191$options = get_option('plugin_options');
    92 if (strpos($options['option_iconType'], 'external')) {
    93     add_action('wp_enqueue_scripts', 'cuexlinks_add_fawesome');
     92
     93// Check if $options is an array and if the 'option_iconType' key exists
     94if (is_array($options) && isset($options['option_iconType'])) {
     95    // Use strpos safely since we now know 'option_iconType' exists
     96    if (strpos($options['option_iconType'], 'external') !== false) {
     97        add_action('wp_enqueue_scripts', 'cuexlinks_add_fawesome');
     98    }
     99} else {
     100    // Handle the case where the option is missing, for example, by logging or setting default values.
     101    // You could set a default empty array to prevent further issues:
     102    $options = array();
    94103}
     104
    95105
    96106function cuexlinks_add_fawesome()
  • customize-external-links-and-add-icon/trunk/readme.txt

    r3126790 r3208637  
    22Contributors: blapps
    33Donate link:
    4 Tags: nofollow, noreferer, icon external link, nofollow links, external links, nofollow for external links, nofollow external link, nofollow external links, custom icons, remove noreferrer, no opener
     4Tags: nofollow, noreferer, icon external link, nofollow links, external links, nofollow for external links, nofollow external link, nofollow external links, custom icons, remove noreferrer
    55Requires at least: 4
    66Tested up to: 6.6
    7 Stable tag: 2.2
     7Stable tag: 2.3
    88License: GPL2
    99
     
    1212== Description ==
    1313
    14 This plugin adds and removes link relations such as nofollow and noreferrer to your external links. Furthermore, indication of external links by adding a custom icon to the link text. This plugin also adds automatically that external links will be opended in an new tab.
     14This plugin adds and removes link relations such as nofollow and noreferrer to your external links. Furthermore, indication of external links by adding a custom icon to the link text. This plugin also adds automatically that external links will be opened in a new tab.
    1515
    1616* Add rel=nofollow for all the external links of your posts / pages / menus
     
    5858
    5959= 2.2 =
    60 - ready for WP 6.6
    6160- minor bugfixes
    6261- Fontawesome resource updated
    63 - added noopener
     62
    6463
    6564= 2.1 =
Note: See TracChangeset for help on using the changeset viewer.