External Links - Version 6.4

Version Description

  • New setting to specify domain(s) to be excluded from any processing. props Brian Wilson
  • Remove multi-site check that was causing all links to be deemed internal.
  • WP 4.1 Compat
Download this release

Release Info

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

Code changes from version 6.3.1 to 6.4

readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Denis-de-Bernardy, Mike_Koepke
3
  Donate link: http://www.semiologic.com/partners/
4
  Tags: external-links, nofollow, link-target, link-icon, semiologic
5
  Requires at least: 2.8
6
- Tested up to: 3.9
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -60,6 +60,12 @@ The plugin supports a non-started rel="follow" attribute on links to override th
60
 
61
  == Change Log ==
62
 
 
 
 
 
 
 
63
  = 6.3.1 =
64
 
65
  - Fix bug that crept back in with embedded image with a class while the link itself had no class attribute
3
  Donate link: http://www.semiologic.com/partners/
4
  Tags: external-links, nofollow, link-target, link-icon, semiologic
5
  Requires at least: 2.8
6
+ Tested up to: 4.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
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
66
+ - Remove multi-site check that was causing all links to be deemed internal.
67
+ - WP 4.1 Compat
68
+
69
  = 6.3.1 =
70
 
71
  - Fix bug that crept back in with embedded image with a class while the link itself had no class attribute
sem-external-links-admin.php CHANGED
@@ -83,9 +83,25 @@ class external_links_admin {
83
  'subdomains_local') as $var )
84
  $$var = isset($_POST[$var]);
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  $version = sem_external_links_version;
87
  update_option('external_links', compact('global', 'icon', 'target', 'nofollow', 'text_widgets',
88
- 'autolinks', 'subdomains_local', 'version'));
89
 
90
  echo "<div class=\"updated fade\">\n"
91
  . "<p>"
@@ -240,6 +256,23 @@ class external_links_admin {
240
  . '</td>' . "\n"
241
  . '</tr>' . "\n";
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
  echo '</table>' . "\n";
244
 
245
  echo '<p class="submit">'
83
  'subdomains_local') as $var )
84
  $$var = isset($_POST[$var]);
85
 
86
+ $exclude_domains = stripslashes($_POST['exclude_domains']);
87
+ $domains = explode( ',', $exclude_domains );
88
+ $exclude_domains = array();
89
+
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) )
96
+ $exclude_domains[] = $domain;
97
+ }
98
+ }
99
+
100
+ $exclude_domains = implode( ',', $exclude_domains );
101
+
102
  $version = sem_external_links_version;
103
  update_option('external_links', compact('global', 'icon', 'target', 'nofollow', 'text_widgets',
104
+ 'autolinks', 'subdomains_local', 'version', 'exclude_domains'));
105
 
106
  echo "<div class=\"updated fade\">\n"
107
  . "<p>"
256
  . '</td>' . "\n"
257
  . '</tr>' . "\n";
258
 
259
+ echo '<tr>' . "\n"
260
+ . '<th scope="row">'
261
+ . __('Domains to Exclude', 'external-links')
262
+ . '</th>' . "\n"
263
+ . '<td>'
264
+ . '<label>'
265
+ . __('External site domains that should be excluded from processing:', 'external-links')
266
+ . '<textarea name="exclude_domains" cols="58" rows="4" class="widefat">'
267
+ . esc_html($options['exclude_domains'])
268
+ . '</textarea>' . "\n"
269
+ . __('Domains should be separated by a comma and entered as the base domain only. &nbsp;http://, https://, www. should not be included and will be stripped off.', 'external-links')
270
+ . '</label>&nbsp;&nbsp;'
271
+ . '<i>' .__('Example: domain.com, domain.net, somesite.com, external.org.', 'external-links') . '</i>'
272
+ . '<br />' . "\n"
273
+ . '</td>'
274
+ . '</tr>' . "\n";
275
+
276
  echo '</table>' . "\n";
277
 
278
  echo '<p class="submit">'
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.3.1
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.3');
23
 
24
  /**
25
  * external_links
@@ -648,6 +648,14 @@ class sem_external_links {
648
 
649
  $link_domain = strtolower($link_domain);
650
  $link_domain = str_replace('www.', '', $link_domain);
 
 
 
 
 
 
 
 
651
  if ( $this->opts['subdomains_local'] ) {
652
  $subdomains = $this->extract_subdomains($link_domain);
653
  if ( $subdomains != '')
@@ -656,10 +664,12 @@ class sem_external_links {
656
 
657
  if ( $site_domain == $link_domain ) {
658
  return false;
659
- } elseif ( function_exists('is_multisite') && is_multisite() ) {
 
 
660
  return false;
661
  }
662
- /* else {
663
  $site_elts = explode('.', $site_domain);
664
  $link_elts = explode('.', $link_domain);
665
 
@@ -707,6 +717,18 @@ class sem_external_links {
707
  return $subdomains;
708
  } # extract_subdomains()
709
 
 
 
 
 
 
 
 
 
 
 
 
 
710
 
711
  /**
712
  * get_options
@@ -725,6 +747,9 @@ class sem_external_links {
725
  if ( $o === false || !isset($o['text_widgets']) || !isset($o['autolinks']) || !isset($o['version']) )
726
  $o = sem_external_links::init_options();
727
 
 
 
 
728
  return $o;
729
  } # get_options()
730
 
@@ -747,6 +772,7 @@ class sem_external_links {
747
  'autolinks' => false,
748
  'subdomains_local' => true,
749
  'version' => sem_external_links_version,
 
750
  );
751
 
752
  if ( !$o )
@@ -760,6 +786,8 @@ class sem_external_links {
760
  $updated_opts['autolinks'] = true;
761
  }
762
 
 
 
763
  update_option('external_links', $updated_opts);
764
 
765
  return $updated_opts;
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
 
20
  **/
21
 
22
+ define('sem_external_links_version', '6.4');
23
 
24
  /**
25
  * external_links
648
 
649
  $link_domain = strtolower($link_domain);
650
  $link_domain = str_replace('www.', '', $link_domain);
651
+
652
+ if ( isset($this->opts['exclude_domains']) ) {
653
+ $exclude_domains = explode( ',', $this->opts['exclude_domains'] );
654
+ $dom = $this->extract_domain($link_domain);
655
+ if ( in_array( $dom, $exclude_domains) )
656
+ return false;
657
+ }
658
+
659
  if ( $this->opts['subdomains_local'] ) {
660
  $subdomains = $this->extract_subdomains($link_domain);
661
  if ( $subdomains != '')
664
 
665
  if ( $site_domain == $link_domain ) {
666
  return false;
667
+ }
668
+
669
+ /* elseif ( function_exists('is_multisite') && is_multisite() ) {
670
  return false;
671
  }
672
+ else {
673
  $site_elts = explode('.', $site_domain);
674
  $link_elts = explode('.', $link_domain);
675
 
717
  return $subdomains;
718
  } # extract_subdomains()
719
 
720
+ /**
721
+ * is_valid_domain_name()
722
+ *
723
+ * @param string $domain_name
724
+ * @return bool
725
+ **/
726
+ function is_valid_domain_name($domain_name)
727
+ {
728
+ return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) //valid chars check
729
+ && preg_match("/^.{1,253}$/", $domain_name) //overall length check
730
+ && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name) ); //length of each label
731
+ }
732
 
733
  /**
734
  * get_options
747
  if ( $o === false || !isset($o['text_widgets']) || !isset($o['autolinks']) || !isset($o['version']) )
748
  $o = sem_external_links::init_options();
749
 
750
+ if ( version_compare( sem_external_links_version, $o['version'], '>' ) )
751
+ $o = sem_external_links::init_options();
752
+
753
  return $o;
754
  } # get_options()
755
 
772
  'autolinks' => false,
773
  'subdomains_local' => true,
774
  'version' => sem_external_links_version,
775
+ 'exclude_domains' => '',
776
  );
777
 
778
  if ( !$o )
786
  $updated_opts['autolinks'] = true;
787
  }
788
 
789
+ $o['version'] = sem_external_links_version;
790
+
791
  update_option('external_links', $updated_opts);
792
 
793
  return $updated_opts;
sem-external-links.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the External Links package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: External Links 6.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/sem-external-"
7
  "links\n"
8
- "POT-Creation-Date: 2014-11-06 02:35:09+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,111 +13,111 @@ msgstr ""
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
- #: sem-external-links-admin.php:93
17
  msgid "Settings saved."
18
  msgstr ""
19
 
20
- #: sem-external-links-admin.php:117
21
  msgid ""
22
  "Note: Your rel=nofollow preferences is being ignored because the dofollow "
23
  "plugin is enabled on your site."
24
  msgstr ""
25
 
26
- #: sem-external-links-admin.php:122
27
  msgid "External Links Settings"
28
  msgstr ""
29
 
30
- #: sem-external-links-admin.php:128
31
  msgid "Apply Globally"
32
  msgstr ""
33
 
34
- #: sem-external-links-admin.php:136
35
  msgid ""
36
  "Apply these settings to all outbound links on the site except those in "
37
  "scripts, styles and the html head section."
38
  msgstr ""
39
 
40
- #: sem-external-links-admin.php:143
41
  msgid "Apply to Text Widgets"
42
  msgstr ""
43
 
44
- #: sem-external-links-admin.php:151
45
  msgid ""
46
  "Apply these settings to any text widgets in addition to post, page and "
47
  "comments content."
48
  msgstr ""
49
 
50
- #: sem-external-links-admin.php:158
51
  msgid "Treat Subdomains as Local"
52
  msgstr ""
53
 
54
- #: sem-external-links-admin.php:166
55
  msgid "Treat any subdomains for this site as a local link."
56
  msgstr ""
57
 
58
- #: sem-external-links-admin.php:169
59
  msgid ""
60
  "Example: If your site is at domain.com and you also have store.domain.com, "
61
  "any link to store.domain.com will be treated as local."
62
  msgstr ""
63
 
64
- #: sem-external-links-admin.php:175
65
  msgid "Auto Convert Text Urls"
66
  msgstr ""
67
 
68
- #: sem-external-links-admin.php:183
69
  msgid "Automatically converts text urls into clickable urls."
70
  msgstr ""
71
 
72
- #: sem-external-links-admin.php:186
73
  msgid ""
74
  "Note: If this option is enabled then if www.example.com is found in your "
75
  "text, it will be converted to an html &lt;a&gt; link.\""
76
  msgstr ""
77
 
78
- #: sem-external-links-admin.php:188
79
  msgid ""
80
  "This conversion will occur first so external link treatment for nofollow, "
81
  "icon and target will be applied to this auto links."
82
  msgstr ""
83
 
84
- #: sem-external-links-admin.php:194
85
  msgid "Add No Follow"
86
  msgstr ""
87
 
88
- #: sem-external-links-admin.php:202
89
  msgid "Add a rel=\"nofollow\" attribute to outbound links."
90
  msgstr ""
91
 
92
- #: sem-external-links-admin.php:205
93
  msgid ""
94
  "Note: You can override this behavior by adding the attribute rel=\"follow\" "
95
  "to individual links."
96
  msgstr ""
97
 
98
- #: sem-external-links-admin.php:211
99
  msgid "Add Icons"
100
  msgstr ""
101
 
102
- #: sem-external-links-admin.php:219
103
  msgid "Mark outbound links with an icon."
104
  msgstr ""
105
 
106
- #: sem-external-links-admin.php:222
107
  msgid ""
108
  "Note: You can override this behavior by adding a class=\"no_icon\" or "
109
  "\"noicon\" to individual links."
110
  msgstr ""
111
 
112
- #: sem-external-links-admin.php:228
113
  msgid "Open in New Windows"
114
  msgstr ""
115
 
116
- #: sem-external-links-admin.php:236
117
  msgid "Open outbound links in new windows."
118
  msgstr ""
119
 
120
- #: sem-external-links-admin.php:239
121
  msgid ""
122
  "Note: Some usability experts discourage this, claiming that <a href=\"http://"
123
  "www.useit.com/alertbox/9605.html\">this can damage your visitors' trust</a> "
@@ -126,18 +126,37 @@ msgid ""
126
  "reason."
127
  msgstr ""
128
 
129
- #: sem-external-links-admin.php:247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  msgid "Save Changes"
131
  msgstr ""
132
 
133
- #. #-#-#-#-# sem-external-links.pot (External Links 6.1) #-#-#-#-#
134
  #. Plugin Name of the plugin/theme
135
- #: sem-external-links-info.php:2 sem-external-links.php:785
136
- #: sem-external-links.php:786
137
  msgid "External Links"
138
  msgstr ""
139
 
140
- #. #-#-#-#-# sem-external-links.pot (External Links 6.1) #-#-#-#-#
141
  #. Description of the plugin/theme
142
  #: sem-external-links-info.php:3
143
  msgid ""
@@ -155,5 +174,5 @@ msgid "Denis de Bernardy & Mike Koepke"
155
  msgstr ""
156
 
157
  #. Author URI of the plugin/theme
158
- msgid "http://www.getsemiologic.com"
159
  msgstr ""
2
  # This file is distributed under the same license as the External Links package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: External Links 6.4\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/sem-external-"
7
  "links\n"
8
+ "POT-Creation-Date: 2014-12-13 15:59:51+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
+ #: sem-external-links-admin.php:109
17
  msgid "Settings saved."
18
  msgstr ""
19
 
20
+ #: sem-external-links-admin.php:133
21
  msgid ""
22
  "Note: Your rel=nofollow preferences is being ignored because the dofollow "
23
  "plugin is enabled on your site."
24
  msgstr ""
25
 
26
+ #: sem-external-links-admin.php:138
27
  msgid "External Links Settings"
28
  msgstr ""
29
 
30
+ #: sem-external-links-admin.php:144
31
  msgid "Apply Globally"
32
  msgstr ""
33
 
34
+ #: sem-external-links-admin.php:152
35
  msgid ""
36
  "Apply these settings to all outbound links on the site except those in "
37
  "scripts, styles and the html head section."
38
  msgstr ""
39
 
40
+ #: sem-external-links-admin.php:159
41
  msgid "Apply to Text Widgets"
42
  msgstr ""
43
 
44
+ #: sem-external-links-admin.php:167
45
  msgid ""
46
  "Apply these settings to any text widgets in addition to post, page and "
47
  "comments content."
48
  msgstr ""
49
 
50
+ #: sem-external-links-admin.php:174
51
  msgid "Treat Subdomains as Local"
52
  msgstr ""
53
 
54
+ #: sem-external-links-admin.php:182
55
  msgid "Treat any subdomains for this site as a local link."
56
  msgstr ""
57
 
58
+ #: sem-external-links-admin.php:185
59
  msgid ""
60
  "Example: If your site is at domain.com and you also have store.domain.com, "
61
  "any link to store.domain.com will be treated as local."
62
  msgstr ""
63
 
64
+ #: sem-external-links-admin.php:191
65
  msgid "Auto Convert Text Urls"
66
  msgstr ""
67
 
68
+ #: sem-external-links-admin.php:199
69
  msgid "Automatically converts text urls into clickable urls."
70
  msgstr ""
71
 
72
+ #: sem-external-links-admin.php:202
73
  msgid ""
74
  "Note: If this option is enabled then if www.example.com is found in your "
75
  "text, it will be converted to an html &lt;a&gt; link.\""
76
  msgstr ""
77
 
78
+ #: sem-external-links-admin.php:204
79
  msgid ""
80
  "This conversion will occur first so external link treatment for nofollow, "
81
  "icon and target will be applied to this auto links."
82
  msgstr ""
83
 
84
+ #: sem-external-links-admin.php:210
85
  msgid "Add No Follow"
86
  msgstr ""
87
 
88
+ #: sem-external-links-admin.php:218
89
  msgid "Add a rel=\"nofollow\" attribute to outbound links."
90
  msgstr ""
91
 
92
+ #: sem-external-links-admin.php:221
93
  msgid ""
94
  "Note: You can override this behavior by adding the attribute rel=\"follow\" "
95
  "to individual links."
96
  msgstr ""
97
 
98
+ #: sem-external-links-admin.php:227
99
  msgid "Add Icons"
100
  msgstr ""
101
 
102
+ #: sem-external-links-admin.php:235
103
  msgid "Mark outbound links with an icon."
104
  msgstr ""
105
 
106
+ #: sem-external-links-admin.php:238
107
  msgid ""
108
  "Note: You can override this behavior by adding a class=\"no_icon\" or "
109
  "\"noicon\" to individual links."
110
  msgstr ""
111
 
112
+ #: sem-external-links-admin.php:244
113
  msgid "Open in New Windows"
114
  msgstr ""
115
 
116
+ #: sem-external-links-admin.php:252
117
  msgid "Open outbound links in new windows."
118
  msgstr ""
119
 
120
+ #: sem-external-links-admin.php:255
121
  msgid ""
122
  "Note: Some usability experts discourage this, claiming that <a href=\"http://"
123
  "www.useit.com/alertbox/9605.html\">this can damage your visitors' trust</a> "
126
  "reason."
127
  msgstr ""
128
 
129
+ #: sem-external-links-admin.php:261
130
+ msgid "Domains to Exclude"
131
+ msgstr ""
132
+
133
+ #: sem-external-links-admin.php:265
134
+ msgid "External site domains that should be excluded from processing:"
135
+ msgstr ""
136
+
137
+ #: sem-external-links-admin.php:269
138
+ msgid ""
139
+ "Domains should be separated by a comma and entered as the base domain only. "
140
+ "&nbsp;http://, https://, www. should not be included and will be stripped "
141
+ "off."
142
+ msgstr ""
143
+
144
+ #: sem-external-links-admin.php:271
145
+ msgid "Example: domain.com, domain.net, somesite.com, external.org."
146
+ msgstr ""
147
+
148
+ #: sem-external-links-admin.php:280
149
  msgid "Save Changes"
150
  msgstr ""
151
 
152
+ #. #-#-#-#-# sem-external-links.pot (External Links 6.4) #-#-#-#-#
153
  #. Plugin Name of the plugin/theme
154
+ #: sem-external-links-info.php:2 sem-external-links.php:835
155
+ #: sem-external-links.php:836
156
  msgid "External Links"
157
  msgstr ""
158
 
159
+ #. #-#-#-#-# sem-external-links.pot (External Links 6.4) #-#-#-#-#
160
  #. Description of the plugin/theme
161
  #: sem-external-links-info.php:3
162
  msgid ""
174
  msgstr ""
175
 
176
  #. Author URI of the plugin/theme
177
+ msgid "https://www.semiologic.com"
178
  msgstr ""