Open external links in a new window - Version 1.3.2

Version Description

Download this release

Release Info

Developer kezze
Plugin Icon 128x128 Open external links in a new window
Version 1.3.2
Comparing to
See all releases

Code changes from version 1.3.1 to 1.3.2

readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: kezze
3
  Donate link: https://www.paypal.com/xclick/business=paypal%40kezze.dk&item_name=Donation&no_note=1&tax=0&currency_code=EUR
4
  Tags: links, external links, target blank, target new, window.open, new window, blank window, new tab, blank tab, tabs, SEO, xhtml strict, javascript
5
  Requires at least: 2.0
6
- Tested up to: 4.0
7
- Stable tag: 1.3.1
8
 
9
  Opens all (or specific) external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
10
 
@@ -88,4 +88,4 @@ Minor bugfix.
88
  Ready for production.
89
 
90
  = 0.9 =
91
- Initial release
3
  Donate link: https://www.paypal.com/xclick/business=paypal%40kezze.dk&item_name=Donation&no_note=1&tax=0&currency_code=EUR
4
  Tags: links, external links, target blank, target new, window.open, new window, blank window, new tab, blank tab, tabs, SEO, xhtml strict, javascript
5
  Requires at least: 2.0
6
+ Tested up to: 4.9
7
+ Stable tag: trunk
8
 
9
  Opens all (or specific) external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
10
 
88
  Ready for production.
89
 
90
  = 0.9 =
91
+ Initial release
trunk/open-external-links-in-a-new-window-da_DK.mo ADDED
Binary file
trunk/open-external-links-in-a-new-window-da_DK.po ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Plugins - Open external links in a new window - "
4
+ "Development (trunk)\n"
5
+ "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2017-11-02 10:42+0000\n"
7
+ "PO-Revision-Date: 2017-11-02 10:43+0000\n"
8
+ "Last-Translator: \n"
9
+ "Language-Team: Danish (Denmark)\n"
10
+ "Language: da-DK\n"
11
+ "Plural-Forms: nplurals=2; plural=n != 1\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Loco-Source-Locale: da_NL\n"
16
+ "X-Generator: Loco - https://localise.biz/\n"
17
+ "X-Loco-Parser: loco_parse_po"
18
+
19
+ #. Author URI of the plugin/theme
20
+ msgid "http://kezze.dk"
21
+ msgstr "https://kristianrisagerlarsen.dk"
22
+
23
+ #. Author of the plugin/theme
24
+ msgid "Kristian Risager Larsen"
25
+ msgstr "Kristian Risager Larsen"
26
+
27
+ #. Description of the plugin/theme
28
+ msgid ""
29
+ "Opens all external links in a new window. XHTML Strict compliant and search "
30
+ "engine optimized (SEO)."
31
+ msgstr ""
32
+ "Åbner alle eksterne links i et nyt vindue/faneblad. Er i overensstemmelse "
33
+ "med XHTML strict og tager højde for søgemaskineoptimering (SEO)."
34
+
35
+ #. Plugin URI of the plugin/theme
36
+ msgid ""
37
+ "http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/"
38
+ msgstr ""
39
+ "http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/"
40
+
41
+ #: open-external-links-in-a-new-window.php:152
42
+ msgid "Settings"
43
+ msgstr "Indstillinger"
44
+
45
+ #: open-external-links-in-a-new-window.php:140
46
+ msgid "http:// or https://"
47
+ msgstr "http:// eller https://"
48
+
49
+ #: open-external-links-in-a-new-window.php:139
50
+ msgid "Forced, matching URLs"
51
+ msgstr "Gennemtvungne, matchende URL'er"
52
+
53
+ #: open-external-links-in-a-new-window.php:138
54
+ msgid "Ignored, matching URLs"
55
+ msgstr "Ignorerede, matchende URL'er"
56
+
57
+ #: open-external-links-in-a-new-window.php:136
58
+ msgid "The matches are prioritized in the following order:"
59
+ msgstr "De matchende URL'er bliver prioriteret i den følgende rækkefølge:"
60
+
61
+ #: open-external-links-in-a-new-window.php:132
62
+ msgid "Save changes"
63
+ msgstr "Gem ændringer"
64
+
65
+ #: open-external-links-in-a-new-window.php:127
66
+ msgid ""
67
+ "Ignore links, and do not open them in a new window, if they match: (Even if "
68
+ "they start with http:// or https://)"
69
+ msgstr ""
70
+ "Ignorer links, og åbn dem ikke i et nyt vindue, hvis de matcher: (Også "
71
+ "selvom de starter med http:// eller https://)"
72
+
73
+ #: open-external-links-in-a-new-window.php:124
74
+ msgid "Force links to open in a new window if they match:"
75
+ msgstr "Tving links til at åbne i et nyt vindue, hvis de matcher:"
76
+
77
+ #: open-external-links-in-a-new-window.php:120
78
+ msgid ""
79
+ "You can change this behavior by providing regular expressions that either "
80
+ "forces or ignores whether the link should open in a new window."
81
+ msgstr ""
82
+ "Du kan ændre dette ved at skrive regular expressions, som enten "
83
+ "gennemtvinger at et matchende link skal åbne i et nyt vindue, eller "
84
+ "ignorerer det matchende link."
85
+
86
+ #: open-external-links-in-a-new-window.php:118
87
+ msgid ""
88
+ "By default, this plugins makes all external links (i.e. links that point "
89
+ "outside the current host name) open in a new window/tab."
90
+ msgstr ""
91
+ "Som udgangspunkt sørger dette plugin for at åbne alle eksterne links (dvs. "
92
+ "links, der peger væk fra det nuværende værtsnavn) i et nyt vindue/tab."
93
+
94
+ #: open-external-links-in-a-new-window.php:106
95
+ msgid "External links"
96
+ msgstr "Eksterne links"
97
+
98
+ #. #-#-#-#-# tmp-open-external-links-in-a-new-window.pot (Open external links
99
+ #. in a new window 1.3.1) #-#-#-#-#
100
+ #. Plugin Name of the plugin/theme
101
+ #: open-external-links-in-a-new-window.php:106
102
+ #: open-external-links-in-a-new-window.php:113
103
+ msgid "Open external links in a new window"
104
+ msgstr "Åbn eksterne links i et nyt vindue."
105
+
106
+ #: open-external-links-in-a-new-window.php:18
107
+ msgid "Download it at"
108
+ msgstr "Hent det fra"
109
+
110
+ #: open-external-links-in-a-new-window.php:18
111
+ msgid "Plugin by"
112
+ msgstr "Plugin af"
113
+
114
+ #: open-external-links-in-a-new-window.php:18
115
+ msgid "Plugin: Open external links a new window."
116
+ msgstr "Plugin: Åbn eksterne links i et nyt vindue."
trunk/open-external-links-in-a-new-window-lt_LT.mo ADDED
Binary file
trunk/open-external-links-in-a-new-window-lt_LT.po ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012 Open external links in a new window
2
+ # This file is distributed under the same license as the Open external links in a new window package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Open external links in a new window 1.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/open-external-links-in-a-new-window\n"
7
+ "POT-Creation-Date: 2012-05-23 18:24:41+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-05-25 14:05+0200\n"
12
+ "Last-Translator: \n"
13
+ "Language-Team: Host1Free\n"
14
+ "X-Poedit-Language: Lithuanian\n"
15
+ "X-Poedit-Country: Lithuania\n"
16
+
17
+ #: open-external-links-in-a-new-window.php:18
18
+ msgid "Plugin: Open external links a new window."
19
+ msgstr "Papildinys: Atidaryti išorines nuorodas naujame lange."
20
+
21
+ #: open-external-links-in-a-new-window.php:18
22
+ msgid "Plugin by"
23
+ msgstr "Papildinys sukurtas"
24
+
25
+ #: open-external-links-in-a-new-window.php:18
26
+ msgid "Download it at"
27
+ msgstr "Parsisiųskite tai iš"
28
+
29
+ #. #-#-#-#-# plugin.pot (Open external links in a new window 1.3) #-#-#-#-#
30
+ #. Plugin Name of the plugin/theme
31
+ #: open-external-links-in-a-new-window.php:106
32
+ #: open-external-links-in-a-new-window.php:113
33
+ msgid "Open external links in a new window"
34
+ msgstr "Atidaryti išorines nuorodas naujame lange"
35
+
36
+ #: open-external-links-in-a-new-window.php:106
37
+ msgid "External links"
38
+ msgstr "Išorinės nuorodos"
39
+
40
+ #: open-external-links-in-a-new-window.php:118
41
+ msgid "By default, this plugins makes all external links (i.e. links that point outside the current host name) open in a new window/tab."
42
+ msgstr "Pagal numatytasias parinktis, šis papildinys padaro taip, kad visos išorinės nuorodos (pvz. nuorodos, kurios nurodo į kitus, negu dabartinis puslapis) atsidarytų naujame lange/kortelėje."
43
+
44
+ #: open-external-links-in-a-new-window.php:120
45
+ msgid "You can change this behavior by providing regular expressions that either forces or ignores whether the link should open in a new window."
46
+ msgstr "Jūs galite pakeisti šią elgseną, įprastų išsireiškimų pagalbą, kurie priverčia langą atsidaryti naujame lange, arba šią parinktį ignoruoja."
47
+
48
+ #: open-external-links-in-a-new-window.php:124
49
+ msgid "Force links to open in a new window if they match:"
50
+ msgstr "Priversti nuorodas atidaryti naujame lange, jeigu jos atitinka:"
51
+
52
+ #: open-external-links-in-a-new-window.php:127
53
+ msgid "Ignore links, and do not open them in a new window, if they match: (Even if they start with http:// or https://)"
54
+ msgstr "Ignoruoti nuorodas ir neatidarinėti jų naujame lange, jeigu jos atitinka: (Net jeigu jos praisdeda http:// arba https://)"
55
+
56
+ #: open-external-links-in-a-new-window.php:132
57
+ msgid "Save changes"
58
+ msgstr "Įrašyti pakeitimus"
59
+
60
+ #: open-external-links-in-a-new-window.php:136
61
+ msgid "The matches are prioritized in the following order:"
62
+ msgstr "Atitinkams pirmenybė teikiama šia tvarka:"
63
+
64
+ #: open-external-links-in-a-new-window.php:138
65
+ msgid "Ignored, matching URLs"
66
+ msgstr "Ignoruojamos, atitinkančios universaliosios nuorodos"
67
+
68
+ #: open-external-links-in-a-new-window.php:139
69
+ msgid "Forced, matching URLs"
70
+ msgstr "Priverstinai atitinkančioms universaliosioms nuorodoms"
71
+
72
+ #: open-external-links-in-a-new-window.php:140
73
+ msgid "http:// or https://"
74
+ msgstr "http:// arba https://"
75
+
76
+ #: open-external-links-in-a-new-window.php:152
77
+ msgid "Settings"
78
+ msgstr "Nuostatos"
79
+
80
+ #. Plugin URI of the plugin/theme
81
+ msgid "http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/"
82
+ msgstr "http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/"
83
+
84
+ #. Description of the plugin/theme
85
+ msgid "Opens all external links in a new window. XHTML Strict compliant and search engine optimized (SEO)."
86
+ msgstr "Atidaro visas išorines nuorodas naujame naršyklės lange. Griežtai atitinkantis XHTML and paieškos sistemos optimizavimą (SEO)"
87
+
88
+ #. Author of the plugin/theme
89
+ msgid "Kristian Risager Larsen"
90
+ msgstr "Kristian Risager Larsen"
91
+
92
+ #. Author URI of the plugin/theme
93
+ msgid "http://kezze.dk"
94
+ msgstr "http://kezze.dk"
95
+
trunk/open-external-links-in-a-new-window-nl_NL.mo ADDED
Binary file
trunk/open-external-links-in-a-new-window-nl_NL.po ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Open external links in a new window\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-05-23 12:30+0100\n"
6
+ "PO-Revision-Date: 2012-05-26 15:38+0100\n"
7
+ "Last-Translator: Paul Staring <info@collectief-it.nl>\n"
8
+ "Language-Team: Kristian Risager Larsen\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: Dutch\n"
14
+ "X-Poedit-Country: NETHERLANDS\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
+ "X-Poedit-Basepath: .\n"
18
+ "X-Textdomain-Support: yes\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+
21
+ #@ open-external-links-in-a-new-window
22
+ #: open-external-links-in-a-new-window.php:18
23
+ msgid "Plugin: Open external links a new window."
24
+ msgstr "Plugin: Open externe links in een nieuw venster."
25
+
26
+ #@ open-external-links-in-a-new-window
27
+ #: open-external-links-in-a-new-window.php:18
28
+ msgid "Plugin by"
29
+ msgstr "Plugin door"
30
+
31
+ #@ open-external-links-in-a-new-window
32
+ #: open-external-links-in-a-new-window.php:18
33
+ msgid "Download it at"
34
+ msgstr "Download het van"
35
+
36
+ #@ open-external-links-in-a-new-window
37
+ #: open-external-links-in-a-new-window.php:106
38
+ #: open-external-links-in-a-new-window.php:113
39
+ msgid "Open external links in a new window"
40
+ msgstr "Open externe links in een nieuw venster"
41
+
42
+ #@ open-external-links-in-a-new-window
43
+ #: open-external-links-in-a-new-window.php:106
44
+ msgid "External links"
45
+ msgstr "Externe links"
46
+
47
+ #@ open-external-links-in-a-new-window
48
+ #: open-external-links-in-a-new-window.php:124
49
+ msgid "Force links to open in a new window if they match:"
50
+ msgstr "Dwing links in een nieuw venster te openen, indien ze overeenkomen met:"
51
+
52
+ #@ open-external-links-in-a-new-window
53
+ #: open-external-links-in-a-new-window.php:127
54
+ msgid "Ignore links, and do not open them in a new window, if they match: (Even if they start with http:// or https://)"
55
+ msgstr "Negeer links en open ze niet in een nieuw venster, indien ze overeenkomen met: (Zelfs als ze beginnen met http:// of https://)"
56
+
57
+ #@ open-external-links-in-a-new-window
58
+ #: open-external-links-in-a-new-window.php:132
59
+ msgid "Save changes"
60
+ msgstr "Wijzigingen opslaan"
61
+
62
+ #@ open-external-links-in-a-new-window
63
+ #: open-external-links-in-a-new-window.php:118
64
+ msgid "By default, this plugins makes all external links (i.e. links that point outside the current host name) open in a new window/tab."
65
+ msgstr "Standaard zorgt deze plugin ervoor dat alle externe links (d.w.z. links die buiten de huidige host-naam wijzen) openen in een nieuw venster/tabblad."
66
+
67
+ #@ open-external-links-in-a-new-window
68
+ #: open-external-links-in-a-new-window.php:120
69
+ msgid "You can change this behavior by providing regular expressions that either forces or ignores whether the link should open in a new window."
70
+ msgstr "Je kunt dit gedrag veranderen door middel van regular expressions die de vraag of de link moet openen in een nieuw venster ofwel dwingen of negeren."
71
+
72
+ #@ open-external-links-in-a-new-window
73
+ #: open-external-links-in-a-new-window.php:140
74
+ msgid "http:// or https://"
75
+ msgstr "http:// of https://"
76
+
77
+ #@ default
78
+ #: open-external-links-in-a-new-window.php:152
79
+ msgid "Settings"
80
+ msgstr ""
81
+
82
+ #@ open-external-links-in-a-new-window
83
+ #: open-external-links-in-a-new-window.php:136
84
+ msgid "The matches are prioritized in the following order:"
85
+ msgstr "De overeenkomsten worden gesorteerd op volgorde als volgt:"
86
+
87
+ #@ open-external-links-in-a-new-window
88
+ #: open-external-links-in-a-new-window.php:138
89
+ msgid "Ignored, matching URLs"
90
+ msgstr "Genegeerde, overeenkomende URL's"
91
+
92
+ #@ open-external-links-in-a-new-window
93
+ #: open-external-links-in-a-new-window.php:139
94
+ msgid "Forced, matching URLs"
95
+ msgstr "Gedwongen, overeenkomende URL's"
96
+
trunk/open-external-links-in-a-new-window.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Open external links in a new window
4
+ Plugin URI: https://wordpress.org/extend/plugins/open-external-links-in-a-new-window/
5
+ Description: Opens all external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
6
+ Author: Kristian Risager Larsen
7
+ Version: 1.3.2
8
+ Author URI: https://kristianrisagerlarsen.dk
9
+ Text Domain: open-external-links-in-a-new-window
10
+ License: GPL2
11
+
12
+ This plugin is free software: you can redistribute it and/or modify
13
+ it under the terms of the GNU General Public License as published by
14
+ the Free Software Foundation, either version 2 of the License, or
15
+ any later version.
16
+
17
+ This plugin is distributed in the hope that it will be useful,
18
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ GNU General Public License for more details.
21
+
22
+ You should have received a copy of the GNU General Public License
23
+ along with this plugin. If not, see https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html .
24
+ */
25
+
26
+ load_plugin_textdomain('open-external-links-in-a-new-window', false, basename( dirname( __FILE__ ) ) );
27
+ add_action('wp_head', 'external_links_in_new_windows_client');
28
+
29
+ // Loads the code for the website
30
+ function external_links_in_new_windows_client()
31
+ {
32
+ echo "\n\n<!-- ".__("Plugin: Open external links a new window.","open-external-links-in-a-new-window"). " ". __("Plugin by","open-external-links-in-a-new-window"). " Kristian Risager Larsen, http://kristianrisagerlarsen.dk . ".__("Download it at","open-external-links-in-a-new-window")." http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/ -->\n";
33
+
34
+ $blogdomain = parse_url(get_option('home'));
35
+ echo "<script type=\"text/javascript\">//<![CDATA[";
36
+ echo "
37
+ function external_links_in_new_windows_loop() {
38
+ if (!document.links) {
39
+ document.links = document.getElementsByTagName('a');
40
+ }
41
+ var change_link = false;
42
+ var force = '".get_option("external_links_in_new_windows_force")."';
43
+ var ignore = '".get_option("external_links_in_new_windows_ignore")."';
44
+
45
+ for (var t=0; t<document.links.length; t++) {
46
+ var all_links = document.links[t];
47
+ change_link = false;
48
+
49
+ if(document.links[t].hasAttribute('onClick') == false) {
50
+ // forced if the address starts with http (or also https), but does not link to the current domain
51
+ if(all_links.href.search(/^http/) != -1 && all_links.href.search('".$blogdomain['host']."') == -1) {
52
+ // alert('Changeda '+all_links.href);
53
+ change_link = true;
54
+ }
55
+
56
+ if(force != '' && all_links.href.search(force) != -1) {
57
+ // forced
58
+ // alert('force '+all_links.href);
59
+ change_link = true;
60
+ }
61
+
62
+ if(ignore != '' && all_links.href.search(ignore) != -1) {
63
+ // alert('ignore '+all_links.href);
64
+ // ignored
65
+ change_link = false;
66
+ }
67
+
68
+ if(change_link == true) {
69
+ // alert('Changed '+all_links.href);
70
+ document.links[t].setAttribute('onClick', 'javascript:window.open(\\''+all_links.href+'\\'); return false;');
71
+ document.links[t].removeAttribute('target');
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ // Load
78
+ function external_links_in_new_windows_load(func)
79
+ {
80
+ var oldonload = window.onload;
81
+ if (typeof window.onload != 'function'){
82
+ window.onload = func;
83
+ } else {
84
+ window.onload = function(){
85
+ oldonload();
86
+ func();
87
+ }
88
+ }
89
+ }
90
+
91
+ external_links_in_new_windows_load(external_links_in_new_windows_loop);
92
+ ";
93
+
94
+ echo "//]]></script>\n\n";
95
+ }
96
+
97
+ // Administration interface
98
+ // Based on http://www.themepremium.com/how-to-create-wordpress-plugin-admin-panel/
99
+
100
+ /* What to do when the plugin is activated? */
101
+ register_activation_hook(__FILE__,'external_links_in_new_windows_activate');
102
+
103
+ /* What to do when the plugin is deactivated? */
104
+ register_deactivation_hook( __FILE__, 'external_links_in_new_windows_deactivate' );
105
+
106
+ function external_links_in_new_windows_activate() {
107
+ /* Create a new database field */
108
+ update_option("external_links_in_new_windows_force",'');
109
+ update_option("external_links_in_new_windows_ignore",'');
110
+ }
111
+
112
+ function external_links_in_new_windows_deactivate() {
113
+ /* Delete the database field */
114
+ delete_option('external_links_in_new_windows_force');
115
+ delete_option('external_links_in_new_windows_ignore');
116
+ }
117
+
118
+ add_action('admin_menu', 'external_links_in_new_windows_admin_menu');
119
+ function external_links_in_new_windows_admin_menu() {
120
+ add_options_page(__('Open external links in a new window',"open-external-links-in-a-new-window"), __('External links',"open-external-links-in-a-new-window"), 'manage_options','external_links_in_new_windows', 'external_links_in_new_windows_admin_options_page');
121
+ }
122
+
123
+ function external_links_in_new_windows_admin_options_page() {
124
+ ?>
125
+ <div class="wrap">
126
+ <?php screen_icon(); ?>
127
+ <h2><?php _e("Open external links in a new window","open-external-links-in-a-new-window"); ?></h2>
128
+ <p>
129
+ <form method="post" action="options.php">
130
+ <?php wp_nonce_field('update-options'); ?>
131
+
132
+ <?php _e("By default, this plugins makes all external links (i.e. links that point outside the current host name) open in a new window/tab.","open-external-links-in-a-new-window"); ?><br />
133
+
134
+ <?php _e("You can change this behavior by providing regular expressions that either forces or ignores whether the link should open in a new window.","open-external-links-in-a-new-window"); ?><br />
135
+ <br />
136
+
137
+
138
+ <?php _e("Force links to open in a new window if they match:","open-external-links-in-a-new-window"); ?><br />
139
+ <input name="external_links_in_new_windows_force" type="text" id="external_links_in_new_windows_force" value="<?php echo get_option('external_links_in_new_windows_force'); ?>" style="width: 80%" /><br /><br />
140
+
141
+ <?php _e("Ignore links, and do not open them in a new window, if they match: (Even if they start with http:// or https://)","open-external-links-in-a-new-window"); ?><br />
142
+ <input name="external_links_in_new_windows_ignore" type="text" id="external_links_in_new_windows_ignore" value="<?php echo get_option('external_links_in_new_windows_ignore'); ?>" style="width: 80%" /><br /><br />
143
+
144
+ <input type="hidden" name="action" value="update" />
145
+ <input type="hidden" name="page_options" value="external_links_in_new_windows_force,external_links_in_new_windows_ignore" />
146
+ <input type="submit" value="<?php _e("Save changes","open-external-links-in-a-new-window");?>" />
147
+
148
+ <br /><br />
149
+
150
+ <?php _e("The matches are prioritized in the following order:","open-external-links-in-a-new-window"); ?>
151
+ <ol>
152
+ <li><?php _e("Ignored, matching URLs","open-external-links-in-a-new-window"); ?></li>
153
+ <li><?php _e("Forced, matching URLs","open-external-links-in-a-new-window"); ?></li>
154
+ <li><?php _e("http:// or https://","open-external-links-in-a-new-window"); ?></li>
155
+ </ol>
156
+
157
+
158
+ </form>
159
+ </p>
160
+ </div>
161
+ <?php
162
+ }
163
+
164
+ function external_links_in_new_windows_plugin_action_links( $links, $file ) {
165
+ if ( $file == plugin_basename( dirname(__FILE__).'/open-external-links-in-a-new-window.php' ) ) {
166
+ $links[] = '<a href="options-general.php?page=external_links_in_new_windows">'.__('Settings',"open-external-links-in-a-new-window").'</a>';
167
+ }
168
+ return $links;
169
+ }
170
+
171
+ add_filter( 'plugin_action_links', 'external_links_in_new_windows_plugin_action_links', 10, 2 );
172
+ ?>
trunk/open-external-links-in-a-new-window.pot ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012 Open external links in a new window
2
+ # This file is distributed under the same license as the Open external links in a new window package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Open external links in a new window 1.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/open-external-links-in-a-new-"
7
+ "window\n"
8
+ "POT-Creation-Date: 2012-05-23 18:24:41+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: open-external-links-in-a-new-window.php:18
17
+ msgid "Plugin: Open external links a new window."
18
+ msgstr ""
19
+
20
+ #: open-external-links-in-a-new-window.php:18
21
+ msgid "Plugin by"
22
+ msgstr ""
23
+
24
+ #: open-external-links-in-a-new-window.php:18
25
+ msgid "Download it at"
26
+ msgstr ""
27
+
28
+ #. #-#-#-#-# plugin.pot (Open external links in a new window 1.3) #-#-#-#-#
29
+ #. Plugin Name of the plugin/theme
30
+ #: open-external-links-in-a-new-window.php:106
31
+ #: open-external-links-in-a-new-window.php:113
32
+ msgid "Open external links in a new window"
33
+ msgstr ""
34
+
35
+ #: open-external-links-in-a-new-window.php:106
36
+ msgid "External links"
37
+ msgstr ""
38
+
39
+ #: open-external-links-in-a-new-window.php:118
40
+ msgid ""
41
+ "By default, this plugins makes all external links (i.e. links that point "
42
+ "outside the current host name) open in a new window/tab."
43
+ msgstr ""
44
+
45
+ #: open-external-links-in-a-new-window.php:120
46
+ msgid ""
47
+ "You can change this behavior by providing regular expressions that either "
48
+ "forces or ignores whether the link should open in a new window."
49
+ msgstr ""
50
+
51
+ #: open-external-links-in-a-new-window.php:124
52
+ msgid "Force links to open in a new window if they match:"
53
+ msgstr ""
54
+
55
+ #: open-external-links-in-a-new-window.php:127
56
+ msgid ""
57
+ "Ignore links, and do not open them in a new window, if they match: (Even if "
58
+ "they start with http:// or https://)"
59
+ msgstr ""
60
+
61
+ #: open-external-links-in-a-new-window.php:132
62
+ msgid "Save changes"
63
+ msgstr ""
64
+
65
+ #: open-external-links-in-a-new-window.php:136
66
+ msgid "The matches are prioritized in the following order:"
67
+ msgstr ""
68
+
69
+ #: open-external-links-in-a-new-window.php:138
70
+ msgid "Ignored, matching URLs"
71
+ msgstr ""
72
+
73
+ #: open-external-links-in-a-new-window.php:139
74
+ msgid "Forced, matching URLs"
75
+ msgstr ""
76
+
77
+ #: open-external-links-in-a-new-window.php:140
78
+ msgid "http:// or https://"
79
+ msgstr ""
80
+
81
+ #: open-external-links-in-a-new-window.php:152
82
+ msgid "Settings"
83
+ msgstr ""
84
+
85
+ #. Plugin URI of the plugin/theme
86
+ msgid ""
87
+ "http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/"
88
+ msgstr ""
89
+
90
+ #. Description of the plugin/theme
91
+ msgid ""
92
+ "Opens all external links in a new window. XHTML Strict compliant and search "
93
+ "engine optimized (SEO)."
94
+ msgstr ""
95
+
96
+ #. Author of the plugin/theme
97
+ msgid "Kristian Risager Larsen"
98
+ msgstr ""
99
+
100
+ #. Author URI of the plugin/theme
101
+ msgid "http://kezze.dk"
102
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Open external links in a new window ===
2
+ Contributors: kezze
3
+ Donate link: https://www.paypal.com/xclick/business=paypal%40kezze.dk&item_name=Donation&no_note=1&tax=0&currency_code=EUR
4
+ Tags: links, external links, target blank, target new, window.open, new window, blank window, new tab, blank tab, tabs, SEO, xhtml strict, javascript
5
+ Requires at least: 2.0
6
+ Tested up to: 4.9
7
+ Stable tag: trunk
8
+
9
+ Opens all (or specific) external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
10
+
11
+ == Description ==
12
+ Opens external links (starting with `http://` or `https://`) in a separate browser tab (or window). You can also specify certain URLs that should either be forced to open in a new window or ignored.
13
+ The plugin produces XHTML Strict compliant code and is also search engine optimized (SEO).
14
+ This is done using JavaScript's `window.open()`-function.
15
+
16
+ Most other plugins perform a hack by altering the `target` parameter (i.e. `<a href="http://somewhere.example" target="_blank">`). That method is not XHTML Strict compliant.
17
+ This plugin handles the links client-side, which lets search engines follow the links properly. Also, if a browser does not support JavaScript, the plugin is simply inactive, and does not result in any errors.
18
+
19
+ **Credits**
20
+ Inspired by the [Zap_NewWindow](http://www.zappelfillip.de/2005-12-05/zap_newwindow/ "Another Wordpress plugin")-plugin by [Tom K&ouml;hler](http://www.zappelfillip.de/ "His website is mostly in German").
21
+ The banner is a [photo](http://www.flickr.com/photos/monja/1367946568/in/photostream/) by [Monja Da Riva](http://www.monja.it/).
22
+
23
+ **Translations**
24
+ Danish by [Kristian Risager Larsen](https://kristianrisagerlarsen.dk).
25
+ Dutch by [Paul Staring](http://www.collectief-it.nl/)
26
+ Lithuanian by [Vincent G](http://Host1Free.com).
27
+ Other translations will be appreciated!
28
+
29
+ **Known bugs**
30
+ The plugin conflicts with other plugins that change the links' `onClick´-attribute.
31
+
32
+ == Installation ==
33
+ 1. Copy the plugin to /wp-content/plugins/
34
+ 1. Activate the plugin.
35
+ 1. Eventually, change the settings in Settings->External links.
36
+
37
+ == Changelog ==
38
+
39
+ = 1.3.2 =
40
+ Updated: Danish translation
41
+
42
+ = 1.3.1 =
43
+ Verified compatibility with Wordpress 4.0
44
+ Added: Plugin logo for Wordpress 4.0
45
+ Added: Dutch translation.
46
+
47
+ = 1.3 =
48
+ Added: Possibility to force and ignore user-defined strings in URLs. This feature has been requested.
49
+ Added: Lithuanian and Danish translation.
50
+
51
+ = 1.2 =
52
+ Added: Translation-ready.
53
+
54
+ = 1.1.1 =
55
+ Fixed: Deprecation warning (Thanks to [boo1865](http://wordpress.org/support/topic/plugin-open-external-links-in-a-new-window-doesnt-work?replies=2#post-2152292))
56
+
57
+ = 1.1.0 =
58
+ Changed: Better practice for opening links. The plugin now uses the onClick-attribute instead of writing JavaScript directly into the href-attribute. This enables users to right-click the link and open in a new window/tab, save the target etc.
59
+
60
+ = 1.0.1 =
61
+ Fixed: Removes target attribute from links instead of setting the attribute to null. (Thanks to [crashnet](http://wordpress.org/support/topic/plugin-open-external-links-in-a-new-window-target-attribute-left-empty?replies=2#post-1813522))
62
+
63
+ = 1.0 =
64
+ Fixed: Credits to Tom K&ouml;hler (Charset).
65
+ Fixed: Links.
66
+
67
+ = 0.9 =
68
+ Initial release.
69
+
70
+ == Upgrade Notice ==
71
+
72
+ = 1.3.1 =
73
+ Wordpress 4.0-compatibility, and Dutch translation.
74
+
75
+ = 1.3 =
76
+ In Settings->External links, you can now specify URL's that should be either forced to open in a new window, or ignored.
77
+
78
+ = 1.2 =
79
+ Added: Translation-ready.
80
+
81
+ = 1.1.1 =
82
+ Fixed: Deprecation warning.
83
+
84
+ = 1.1.0 =
85
+ Better practice for opening links. Please upgrade.
86
+
87
+ = 1.0.1 =
88
+ Minor bugfix.
89
+
90
+ = 1.0 =
91
+ Ready for production.
92
+
93
+ = 0.9 =
94
+ Initial release