External Links - Version 6.4.1

Version Description

  • External Links with querystring not being excluded by Domains to Exclude
  • Ensure http/https are stripped off exclude domains in External Links admin
  • Fix wrong parameter count in strstr warning for sites using PHP 5.2 or earlier
  • Fix subdomain logic when the subdomain is also used in the tld - co.city.co.us
Download this release

Release Info

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

Code changes from version 6.4 to 6.4.1

readme.txt CHANGED
@@ -60,6 +60,13 @@ The plugin supports a non-started rel="follow" attribute on links to override th
60
 
61
  == Change Log ==
62
 
 
 
 
 
 
 
 
63
  = 6.4 =
64
 
65
  - New setting to specify domain(s) to be excluded from any processing. props Brian Wilson
60
 
61
  == Change Log ==
62
 
63
+ = 6.4.1 =
64
+
65
+ - External Links with querystring not being excluded by Domains to Exclude
66
+ - Ensure http/https are stripped off exclude domains in External Links admin
67
+ - Fix wrong parameter count in strstr warning for sites using PHP 5.2 or earlier
68
+ - Fix subdomain logic when the subdomain is also used in the tld - co.city.co.us
69
+
70
  = 6.4 =
71
 
72
  - New setting to specify domain(s) to be excluded from any processing. props Brian Wilson
sem-external-links-admin.php CHANGED
@@ -90,6 +90,8 @@ class external_links_admin {
90
  global $sem_external_links;
91
  foreach( $domains as $num => $domain ) {
92
  $domain = trim($domain);
 
 
93
  if ( $sem_external_links->is_valid_domain_name($domain)) {
94
  $domain = $sem_external_links->extract_domain( $domain );
95
  if ( !in_array( $domain, $exclude_domains) )
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)) {
96
  $domain = $sem_external_links->extract_domain( $domain );
97
  if ( !in_array( $domain, $exclude_domains) )
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.4
7
  Author: Denis de Bernardy & Mike Koepke
8
  Author URI: https://www.semiologic.com
9
  Text Domain: external-links
@@ -19,7 +19,7 @@ This software is copyright Denis de Bernardy & Mike Koepke, and is distributed u
19
 
20
  **/
21
 
22
- define('sem_external_links_version', '6.4');
23
 
24
  /**
25
  * external_links
@@ -640,8 +640,10 @@ class sem_external_links {
640
  if ($link_domain === false)
641
  return true;
642
  elseif (is_array($link_domain)) {
643
- if (isset($link_domain['host']))
644
  $link_domain = $link_domain['host'];
 
 
645
  else
646
  return false;
647
  }
@@ -659,7 +661,7 @@ class sem_external_links {
659
  if ( $this->opts['subdomains_local'] ) {
660
  $subdomains = $this->extract_subdomains($link_domain);
661
  if ( $subdomains != '')
662
- $link_domain = str_replace($subdomains . '.', '', $link_domain);
663
  }
664
 
665
  if ( $site_domain == $link_domain ) {
@@ -712,7 +714,7 @@ class sem_external_links {
712
  $subdomains = $domain;
713
  $domain = $this->extract_domain($subdomains);
714
 
715
- $subdomains = rtrim(strstr($subdomains, $domain, true), '.');
716
 
717
  return $subdomains;
718
  } # extract_subdomains()
@@ -730,6 +732,27 @@ class sem_external_links {
730
  && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name) ); //length of each label
731
  }
732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  /**
734
  * get_options
735
  *
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.4.1
7
  Author: Denis de Bernardy & Mike Koepke
8
  Author URI: https://www.semiologic.com
9
  Text Domain: external-links
19
 
20
  **/
21
 
22
+ define('sem_external_links_version', '6.4.1');
23
 
24
  /**
25
  * external_links
640
  if ($link_domain === false)
641
  return true;
642
  elseif (is_array($link_domain)) {
643
+ if (isset($link_domain['host'])) {
644
  $link_domain = $link_domain['host'];
645
+ $link_domain = $this->remove_querystring( $link_domain );
646
+ }
647
  else
648
  return false;
649
  }
661
  if ( $this->opts['subdomains_local'] ) {
662
  $subdomains = $this->extract_subdomains($link_domain);
663
  if ( $subdomains != '')
664
+ $link_domain = $this->str_replace_first($subdomains, '', $link_domain);
665
  }
666
 
667
  if ( $site_domain == $link_domain ) {
714
  $subdomains = $domain;
715
  $domain = $this->extract_domain($subdomains);
716
 
717
+ $subdomains = rtrim( substr($subdomains, 0, strpos($subdomains, $domain)) );
718
 
719
  return $subdomains;
720
  } # extract_subdomains()
732
  && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name) ); //length of each label
733
  }
734
 
735
+ /**
736
+ * remove_querystring_var()
737
+ *
738
+ * @param string $url
739
+ * @return string
740
+ **/
741
+ function remove_querystring($url) {
742
+ $arr = explode("?", $url, 2);
743
+ $domain = $arr[0];
744
+
745
+ return $domain;
746
+ }
747
+
748
+ function str_replace_first($search, $replace, $subject) {
749
+ $pos = strpos($subject, $search);
750
+ if ($pos !== false) {
751
+ $subject = substr_replace($subject, $replace, $pos, strlen($search));
752
+ }
753
+ return $subject;
754
+ }
755
+
756
  /**
757
  * get_options
758
  *