Changeset 2624040
- Timestamp:
- 11/03/2021 01:31:18 PM (4 years ago)
- Location:
- add-target-fixer/trunk
- Files:
-
- 2 edited
-
add-target-fixer.php (modified) (3 diffs)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
add-target-fixer/trunk/add-target-fixer.php
r1501653 r2624040 2 2 /** 3 3 * @package add-target-fixer 4 * @version 0.0.0 34 * @version 0.0.04 5 5 */ 6 6 /* 7 7 * 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/ 9 9 * Description: Fixes the security issue with target="_blank" 10 10 * Author: Neil Ludlow 11 11 * Text Domain: add-target-fixer 12 * Version: 0.0.0 313 * Author URI: http ://www.shortdark.net/12 * Version: 0.0.04 13 * Author URI: https://www.shortdark.co.uk/ 14 14 */ 15 15 … … 42 42 43 43 // This assembles the plugin page. 44 function sdatf_add_target_fixer($content) {45 44 function sdatf_add_target_fixer($content) 45 { 46 46 $pattern = '/< *a *([\w\s\d\/.?#,;@()&+%=:"~\[\]\-\']*) *target *= *["\']+([\w]*)["\']+ *([\w\s\d\/.?#,;@()&+%=:"~\[\]\-\']*)>/i'; 47 47 $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); 51 49 } 52 50 … … 58 56 ****************************/ 59 57 60 function sdatf_load_textdomain() { 58 function sdatf_load_textdomain() 59 { 61 60 load_plugin_textdomain('add-target-fixer', false, dirname(plugin_basename(__FILE__)) . '/languages'); 62 61 } 63 62 64 63 add_action('init', 'sdatf_load_textdomain'); 65 ?> -
add-target-fixer/trunk/readme.txt
r1501653 r2624040 2 2 === Add Target Fixer === 3 3 Contributors: shortdark 4 Donate link: http ://www.shortdark.net/4 Donate link: https://www.shortdark.co.uk/ 5 5 Tags: posts, security 6 6 Requires at least: 3.5 7 Tested up to: 4.6.17 Tested up to: 5.8.1 8 8 Stable tag: trunk 9 9 License: GPLv2 or later 10 License URI: http ://www.gnu.org/licenses/gpl-2.0.html10 License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 11 11 12 12 Fixes the target="_blank" vulnerability by adding rel="noopener noreferrer" to the 'a' tag. … … 14 14 == Description == 15 15 16 This plugin looks at the phishing issue with target="_blank" vulnerability when the opened page can control the referring page. 16 This plugin looks at the phishing issue with target="_blank" vulnerability when the opened page can control the referring page. 17 17 The 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. 18 change the content, it only modifies the "A" tags while the plugin is active. Tested on PHP 5 to PHP 8. 19 19 20 20 Please let me know if you like this plugin by leaving a review or [contacting me](http://www.shortdark.net/contact-me/). … … 26 26 This section describes how to install the plugin and get it working. 27 27 28 1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress 28 1. Upload the plugin folder to the `/wp-content/plugins/` directory, or install the plugin through the WordPress 29 29 plugins screen directly. 30 30 2. Activate the plugin through the 'Plugins' screen in WordPress. … … 32 32 33 33 == Changelog == 34 35 = 0.0.04 = 36 37 * Checked WordPress version and also works on PHP 8. 34 38 35 39 = 0.0.03 = … … 47 51 48 52 49
Note: See TracChangeset
for help on using the changeset viewer.