External Links - Version 6.7

Version Description

  • Fix: Some links with affiliate code may not be correctly detected as an external link.
  • Fix: Auto Convert Text Urls were being applied to Text Widgets regardless of Settings
  • Fix: A lengthy page or long embedded form could cause Auto Convert Text URLS to fail and result in some blanking of the text.
  • Change: Site domain entered in the 'Domains To Exclude' with a trailing slash is handled better and trailing slash is simply removed.
Download this release

Release Info

Developer Mike_Koepke
Plugin Icon wp plugin External Links
Version 6.7
Comparing to
See all releases

Code changes from version 6.6 to 6.7

readme.txt CHANGED
@@ -59,19 +59,24 @@ The plugin supports a non-started rel="follow" attribute on links to override th
59
 
60
  == Change Log ==
61
 
 
 
 
 
 
 
 
62
  = 6.6 =
63
 
64
  - New option to exclude html code blocks (pre and code) from link processing
65
  - Updated the text-domain to sem-external-links to match plugin's slug to support internationalization efforts
66
 
67
-
68
  = 6.5.1 =
69
 
70
  - No functionality changes in this release.
71
  - WP 4.3 compat
72
  - Tested against PHP 5.6
73
 
74
-
75
  = 6.5 =
76
 
77
  - Domains to Exclude no longer assumes subdomains meaning subdomains need to be specifically excluded now.
59
 
60
  == Change Log ==
61
 
62
+ = 6.7 =
63
+
64
+ - Fix: Some links with affiliate code may not be correctly detected as an external link.
65
+ - Fix: Auto Convert Text Urls were being applied to Text Widgets regardless of Settings
66
+ - Fix: A lengthy page or long embedded form could cause Auto Convert Text URLS to fail and result in some blanking of the text.
67
+ - Change: Site domain entered in the 'Domains To Exclude' with a trailing slash is handled better and trailing slash is simply removed.
68
+
69
  = 6.6 =
70
 
71
  - New option to exclude html code blocks (pre and code) from link processing
72
  - Updated the text-domain to sem-external-links to match plugin's slug to support internationalization efforts
73
 
 
74
  = 6.5.1 =
75
 
76
  - No functionality changes in this release.
77
  - WP 4.3 compat
78
  - Tested against PHP 5.6
79
 
 
80
  = 6.5 =
81
 
82
  - Domains to Exclude no longer assumes subdomains meaning subdomains need to be specifically excluded now.
sem-autolink-uri.php CHANGED
@@ -79,11 +79,16 @@ class sem_autolink_uri {
79
  **/
80
 
81
  function init() {
 
 
 
82
  // more stuff: register actions and filters
83
  // after shortcodes
 
84
  add_filter('the_content', array($this, 'filter'), 12);
85
  add_filter('the_excerpt', array($this, 'filter'), 12);
86
- add_filter('widget_text', array($this, 'filter'), 12);
 
87
  }
88
 
89
  /**
@@ -94,6 +99,10 @@ class sem_autolink_uri {
94
  **/
95
 
96
  function filter($text) {
 
 
 
 
97
  global $escape_autolink_uri;
98
 
99
  $escape_autolink_uri = array();
@@ -168,7 +177,7 @@ class sem_autolink_uri {
168
  <\s*\/\s*head\s*>
169
  /isx",
170
  'blocks' => "/
171
- <\s*(script|style|object|textarea|code|pre)(?:\s.*?)?>
172
  .*?
173
  <\s*\/\s*\\1\s*>
174
  /isx",
@@ -176,19 +185,21 @@ class sem_autolink_uri {
176
  \[.+?\]
177
  /x",
178
  'anchors' => "/
179
- <\s*a\s.+?>.+?<\s*\/\s*a\s*>
180
  /isx",
181
  'tags' => "/
182
- <[^<>]+?(?:src|href|codebase|archive|usemap|data|value|action|background|placeholder)=[^<>]+?>
183
  /ix",
184
  ) as $regex ) {
185
- $text = preg_replace_callback($regex, array($this, 'escape_callback'), $text);
 
 
186
  }
187
-
188
  return $text;
189
  } # escape()
190
-
191
-
192
  /**
193
  * escape_callback()
194
  *
79
  **/
80
 
81
  function init() {
82
+
83
+ $opts = sem_external_links::get_options();
84
+
85
  // more stuff: register actions and filters
86
  // after shortcodes
87
+
88
  add_filter('the_content', array($this, 'filter'), 12);
89
  add_filter('the_excerpt', array($this, 'filter'), 12);
90
+ if ( isset( $opts['text_widgets'] ) && $opts['text_widgets'] )
91
+ add_filter('widget_text', array($this, 'filter'), 12);
92
  }
93
 
94
  /**
99
  **/
100
 
101
  function filter($text) {
102
+
103
+ if ( empty( $text ) )
104
+ return $text;
105
+
106
  global $escape_autolink_uri;
107
 
108
  $escape_autolink_uri = array();
177
  <\s*\/\s*head\s*>
178
  /isx",
179
  'blocks' => "/
180
+ <\s*(script|style|object|code|pre|textarea)(?:\s.*?)?>
181
  .*?
182
  <\s*\/\s*\\1\s*>
183
  /isx",
185
  \[.+?\]
186
  /x",
187
  'anchors' => "/
188
+ <a .*?>.*?<\/a>
189
  /isx",
190
  'tags' => "/
191
+ <[^<>]+?(?:src|href|codebase|archive|usemap|data|value|action|background|placeholder|onclick)=[^<>]+?>
192
  /ix",
193
  ) as $regex ) {
194
+ $t = preg_replace_callback($regex, array($this, 'escape_callback'), $text);
195
+ if ( $t !== NULL )
196
+ $text = $t;
197
  }
198
+
199
  return $text;
200
  } # escape()
201
+
202
+
203
  /**
204
  * escape_callback()
205
  *
sem-external-links-admin.php CHANGED
@@ -90,6 +90,7 @@ class external_links_admin {
90
  global $sem_external_links;
91
  foreach( $domains as $num => $domain ) {
92
  $domain = trim($domain);
 
93
  $domain = str_replace('http://', '', $domain);
94
  $domain = str_replace('https://', '', $domain);
95
  if ( $sem_external_links->is_valid_domain_name($domain)) {
90
  global $sem_external_links;
91
  foreach( $domains as $num => $domain ) {
92
  $domain = trim($domain);
93
+ $domain = untrailingslashit($domain);
94
  $domain = str_replace('http://', '', $domain);
95
  $domain = str_replace('https://', '', $domain);
96
  if ( $sem_external_links->is_valid_domain_name($domain)) {
sem-external-links.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: External Links
4
  Plugin URI: http://www.semiologic.com/software/external-links/
5
  Description: Marks outbound links as such, with various effects that are configurable under <a href="options-general.php?page=external-links">Settings / External Links</a>.
6
- Version: 6.6
7
  Author: Denis de Bernardy & Mike Koepke
8
  Author URI: https://www.semiologic.com
9
  Text Domain: sem-external-links
@@ -383,7 +383,7 @@ class sem_external_links {
383
  $anchor['attr'] = $this->parseAttributes( $match[1] );
384
 
385
  if ( !is_array($anchor['attr']) || empty($anchor['attr']['href']) # parser error or no link
386
- || trim($anchor['attr']['href']) != esc_url($anchor['attr']['href'], null, 'db') ) # likely a script
387
  return false;
388
 
389
  foreach ( array('class', 'rel') as $attr ) {
3
  Plugin Name: External Links
4
  Plugin URI: http://www.semiologic.com/software/external-links/
5
  Description: Marks outbound links as such, with various effects that are configurable under <a href="options-general.php?page=external-links">Settings / External Links</a>.
6
+ Version: 6.7
7
  Author: Denis de Bernardy & Mike Koepke
8
  Author URI: https://www.semiologic.com
9
  Text Domain: sem-external-links
383
  $anchor['attr'] = $this->parseAttributes( $match[1] );
384
 
385
  if ( !is_array($anchor['attr']) || empty($anchor['attr']['href']) # parser error or no link
386
+ || trim($anchor['attr']['href']) != esc_attr($anchor['attr']['href'], null, 'db') ) # likely a script
387
  return false;
388
 
389
  foreach ( array('class', 'rel') as $attr ) {