Plugin Directory

Changeset 2624040


Ignore:
Timestamp:
11/03/2021 01:31:18 PM (4 years ago)
Author:
shortdark
Message:

Tested up to PHP8 and WP5.8.1, updated URLs.

Location:
add-target-fixer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • add-target-fixer/trunk/add-target-fixer.php

    r1501653 r2624040  
    22/**
    33 * @package add-target-fixer
    4  * @version 0.0.03
     4 * @version 0.0.04
    55 */
    66/*
    77 * Plugin Name: Add Target Fixer
    8  * Plugin URI: http://www.shortdark.net/wordpress-plugin/add-target-fixer/
     8 * Plugin URI: https://shortdark.co.uk/projects/add-target-fixer/
    99 * Description: Fixes the security issue with target="_blank"
    1010 * Author: Neil Ludlow
    1111 * Text Domain: add-target-fixer
    12  * Version: 0.0.03
    13  * Author URI: http://www.shortdark.net/
     12 * Version: 0.0.04
     13 * Author URI: https://www.shortdark.co.uk/
    1414 */
    1515
     
    4242
    4343// This assembles the plugin page.
    44 function sdatf_add_target_fixer($content) {
    45    
     44function sdatf_add_target_fixer($content)
     45{
    4646    $pattern = '/< *a *([\w\s\d\/.?#,;@()&+%=:"~\[\]\-\']*) *target *= *["\']+([\w]*)["\']+ *([\w\s\d\/.?#,;@()&+%=:"~\[\]\-\']*)>/i';
    4747    $replace_with = '<a $1 target=\'$2\' rel=\'noopener noreferrer\' $3>';
    48     $content = preg_replace($pattern, $replace_with, $content);
    49 
    50     return $content;
     48    return preg_replace($pattern, $replace_with, $content);
    5149}
    5250
     
    5856 ****************************/
    5957
    60 function sdatf_load_textdomain() {
     58function sdatf_load_textdomain()
     59{
    6160    load_plugin_textdomain('add-target-fixer', false, dirname(plugin_basename(__FILE__)) . '/languages');
    6261}
    6362
    6463add_action('init', 'sdatf_load_textdomain');
    65 ?>
  • add-target-fixer/trunk/readme.txt

    r1501653 r2624040  
    22=== Add Target Fixer ===
    33Contributors: shortdark
    4 Donate link: http://www.shortdark.net/
     4Donate link: https://www.shortdark.co.uk/
    55Tags: posts, security
    66Requires at least: 3.5
    7 Tested up to: 4.6.1
     7Tested up to: 5.8.1
    88Stable tag: trunk
    99License: GPLv2 or later
    10 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     10License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    1111
    1212Fixes the target="_blank" vulnerability by adding rel="noopener noreferrer" to the 'a' tag.
     
    1414== Description ==
    1515
    16 This plugin looks at the phishing issue with target="_blank" vulnerability when the opened page can control the referring page. 
     16This plugin looks at the phishing issue with target="_blank" vulnerability when the opened page can control the referring page.
    1717The plugin fixes it by adding a rel="noopener noreferrer" in the "A" tags where a target="_blank" is found. It does not
    18 change the content, it only modifies the "A" tags while the plugin is active.
     18change the content, it only modifies the "A" tags while the plugin is active. Tested on PHP 5 to PHP 8.
    1919
    2020Please let me know if you like this plugin by leaving a review or [contacting me](http://www.shortdark.net/contact-me/).
     
    2626This section describes how to install the plugin and get it working.
    2727
    28 1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress 
     281. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress
    2929plugins screen directly.
    30302. Activate the plugin through the 'Plugins' screen in WordPress.
     
    3232
    3333== Changelog ==
     34
     35= 0.0.04 =
     36
     37* Checked WordPress version and also works on PHP 8.
    3438
    3539= 0.0.03 =
     
    4751
    4852
    49 
Note: See TracChangeset for help on using the changeset viewer.