Open external links in a new window - Version 1.2

Version Description

Added: Translation-ready.

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.2

open-external-links-in-a-new-window-da_DK.mo ADDED
Binary file
open-external-links-in-a-new-window-da_DK.po ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-23 12:53+0100\n"
7
+ "Last-Translator: Kristian Risager Larsen <translation@kezze.dk>\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: Danish\n"
14
+ "X-Poedit-Country: DENMARK\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:17
23
+ msgid "Plugin: Open external links a new window."
24
+ msgstr "Plugin: Åbn eksterne links i et nyt vindue."
25
+
26
+ #@ open-external-links-in-a-new-window
27
+ #: open-external-links-in-a-new-window.php:17
28
+ msgid "Plugin by"
29
+ msgstr "Plugin af"
30
+
31
+ #@ open-external-links-in-a-new-window
32
+ #: open-external-links-in-a-new-window.php:17
33
+ msgid "Download it at"
34
+ msgstr "Hent det fra"
35
+
open-external-links-in-a-new-window-default.mo ADDED
Binary file
open-external-links-in-a-new-window-default.po ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-23 12:53+0100\n"
7
+ "Last-Translator: Kristian Risager Larsen <translation@kezze.dk>\n"
8
+ "Language-Team: KRL\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: UNITED STATES\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: open-external-links-in-a-new-window.php:17
19
+ msgid "Plugin: Open external links a new window."
20
+ msgstr "Plugin: Open external links a new window."
21
+
22
+ #: open-external-links-in-a-new-window.php:17
23
+ msgid "Plugin by"
24
+ msgstr "Plugin by"
25
+
26
+ #: open-external-links-in-a-new-window.php:17
27
+ msgid "Download it at"
28
+ msgstr "Download it at"
29
+
open-external-links-in-a-new-window.php CHANGED
@@ -4,18 +4,21 @@ Plugin Name: Open external links in a new window
4
  Plugin URI: http://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.0.1
8
  Author URI: http://kezze.dk
 
9
  */
10
 
 
 
11
  add_action('wp_head', 'external_links_in_new_windows');
12
 
13
  function external_links_in_new_windows()
14
  {
15
- echo "\n\n<!-- External links open in a new window. Plugin by Kristian Risager Larsen, http://kezze.dk . Download it at http://wordpress.org/extend/plugins/open-external-links-in-a-new-window/ -->\n";
16
-
 
17
  echo "<script type=\"text/javascript\">//<![CDATA[";
18
- $blogdomain = parse_url(get_settings('home'));
19
  echo "
20
  function makeNewWindows() {
21
  if (!document.links) {
@@ -25,9 +28,8 @@ function external_links_in_new_windows()
25
  for (var t=0; t<document.links.length; t++) {
26
  var all_links = document.links[t];
27
  if (all_links.href.search(/^http/) != -1) { // Catches both http and https
28
- if (all_links.href.search('/".$blogdomain['host']."/') == -1) {
29
- // all_links.setAttribute('target', '_blank');
30
- document.links[t].setAttribute('href', 'javascript:window.open(\\''+all_links.href+'\\'); void(0);');
31
  document.links[t].removeAttribute('target');
32
  }
33
  }
@@ -52,4 +54,4 @@ function external_links_in_new_windows()
52
 
53
  echo "//]]></script>\n\n";
54
  }
55
- ?>
4
  Plugin URI: http://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.2
8
  Author URI: http://kezze.dk
9
+ Text Domain: open-external-links-in-a-new-window
10
  */
11
 
12
+ load_plugin_textdomain('open-external-links-in-a-new-window', false, basename( dirname( __FILE__ ) ) );
13
+
14
  add_action('wp_head', 'external_links_in_new_windows');
15
 
16
  function external_links_in_new_windows()
17
  {
18
+ 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";
19
+
20
+ $blogdomain = parse_url(get_option('home'));
21
  echo "<script type=\"text/javascript\">//<![CDATA[";
 
22
  echo "
23
  function makeNewWindows() {
24
  if (!document.links) {
28
  for (var t=0; t<document.links.length; t++) {
29
  var all_links = document.links[t];
30
  if (all_links.href.search(/^http/) != -1) { // Catches both http and https
31
+ if (all_links.href.search('/".$blogdomain['host']."/') == -1 && document.links[t].hasAttribute('onClick') == false) {
32
+ document.links[t].setAttribute('onClick', 'javascript:window.open(\\''+all_links.href+'\\'); return false;');
 
33
  document.links[t].removeAttribute('target');
34
  }
35
  }
54
 
55
  echo "//]]></script>\n\n";
56
  }
57
+ ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: kezze, Zap
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: 3.0
7
- Stable tag: 1.0.1
8
 
9
  Opens all external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
10
 
@@ -12,12 +12,17 @@ Opens all external links in a new window. XHTML Strict compliant and search engi
12
  Opens all external links (starting with `http://` or `https://`) in a separate browser window.
13
  The plugin produces XHTML Strict compliant code and is also search engine optimized (SEO).
14
 
15
- This is done using the `javascript:window.open()`-function.
16
 
17
  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.
18
  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.
19
 
20
- Based on the source of [Zap_NewWindow](http://www.zappelfillip.de/2005-12-05/zap_newwindow/ "Another Wordpress plugin") by [Tom K&ouml;hler](http://www.zappelfillip.de/ "His website is mostly in German"). Thanks a lot!
 
 
 
 
 
21
 
22
  == Installation ==
23
  1. Copy the plugin to /wp-content/plugins/
@@ -25,18 +30,36 @@ Based on the source of [Zap_NewWindow](http://www.zappelfillip.de/2005-12-05/zap
25
 
26
  == Changelog ==
27
 
 
 
 
 
 
 
 
 
 
28
  = 1.0.1 =
29
- 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))
30
 
31
  = 1.0 =
32
- Fixed: Credits to Tom K&ouml;hler (Charset)
33
- Fixed: Links
34
 
35
  = 0.9 =
36
- Initial release
37
 
38
  == Upgrade Notice ==
39
 
 
 
 
 
 
 
 
 
 
40
  = 1.0.1 =
41
  Minor bugfix.
42
 
@@ -44,4 +67,4 @@ Minor bugfix.
44
  Ready for production.
45
 
46
  = 0.9 =
47
- 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: 3.3
7
+ Stable tag: 1.2
8
 
9
  Opens all external links in a new window. XHTML Strict compliant and search engine optimized (SEO).
10
 
12
  Opens all external links (starting with `http://` or `https://`) in a separate browser window.
13
  The plugin produces XHTML Strict compliant code and is also search engine optimized (SEO).
14
 
15
+ This is done using JavaScript's `window.open()`-function.
16
 
17
  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.
18
  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.
19
 
20
+ **Credits**
21
+ 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").
22
+ The banner is a [photo](http://www.flickr.com/photos/monja/1367946568/in/photostream/) by [Monja Da Riva](http://www.monja.it/).
23
+
24
+ **Known bugs**
25
+ * The plugin conflicts with other plugins that change the links' `onClick´-attribute.
26
 
27
  == Installation ==
28
  1. Copy the plugin to /wp-content/plugins/
30
 
31
  == Changelog ==
32
 
33
+ = 1.2 =
34
+ Added: Translation-ready.
35
+
36
+ = 1.1.1 =
37
+ 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))
38
+
39
+ = 1.1.0 =
40
+ 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.
41
+
42
  = 1.0.1 =
43
+ 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))
44
 
45
  = 1.0 =
46
+ Fixed: Credits to Tom K&ouml;hler (Charset).
47
+ Fixed: Links.
48
 
49
  = 0.9 =
50
+ Initial release.
51
 
52
  == Upgrade Notice ==
53
 
54
+ = 1.2 =
55
+ Added: Translation-ready.
56
+
57
+ = 1.1.1 =
58
+ Fixed: Deprecation warning.
59
+
60
+ = 1.1.0 =
61
+ Better practice for opening links. Please upgrade.
62
+
63
  = 1.0.1 =
64
  Minor bugfix.
65
 
67
  Ready for production.
68
 
69
  = 0.9 =
70
+ Initial release