WP External Links (nofollow new tab seo) - Version 1.55

Version Description

  • Fixed bug JS error: Uncaught TypeError: undefined is not a function
  • Fixed bug PHP error for links without href attribute ("undefined index href")
  • Replaced deprecated jQuery .live() to .on() (contribution by Alonbilu)
Download this release

Release Info

Developer freelancephp
Plugin Icon 128x128 WP External Links (nofollow new tab seo)
Version 1.55
Comparing to
See all releases

Code changes from version 1.54 to 1.55

includes/class-wp-external-links.php CHANGED
@@ -332,9 +332,13 @@ final class WP_External_Links {
332
  $rel = ( isset( $attrs[ 'rel' ] ) ) ? strtolower( $attrs[ 'rel' ] ) : '';
333
 
334
  // href preperation
335
- $href = $attrs[ 'href' ];
336
- $href = strtolower( $href );
337
- $href = trim( $href );
 
 
 
 
338
 
339
  // checks
340
  $is_external = $this->is_external( $href, $rel );
@@ -396,7 +400,7 @@ final class WP_External_Links {
396
  $attrs['data-wpel-target'] = $target;
397
  } else {
398
  // set target value
399
- $attrs[ 'target' ] = $this->get_opt( 'target' );
400
  }
401
  }
402
 
332
  $rel = ( isset( $attrs[ 'rel' ] ) ) ? strtolower( $attrs[ 'rel' ] ) : '';
333
 
334
  // href preperation
335
+ if (isset( $attrs[ 'href' ])) {
336
+ $href = $attrs[ 'href' ];
337
+ $href = strtolower( $href );
338
+ $href = trim( $href );
339
+ } else {
340
+ $href = '';
341
+ }
342
 
343
  // checks
344
  $is_external = $this->is_external( $href, $rel );
400
  $attrs['data-wpel-target'] = $target;
401
  } else {
402
  // set target value
403
+ $attrs[ 'target' ] = $target;
404
  }
405
  }
406
 
js/src/admin-wp-external-links.js CHANGED
@@ -1,4 +1,4 @@
1
- /* WP External Links Plugin - Admin */
2
  /*global jQuery, window*/
3
  jQuery(function ($) {
4
  'use strict';
1
+ /* WP External Links - Admin */
2
  /*global jQuery, window*/
3
  jQuery(function ($) {
4
  'use strict';
js/src/wp-external-links.js CHANGED
@@ -1,6 +1,6 @@
1
- /* WP External Links Plugin */
2
  /*global jQuery, window*/
3
- (function () {
4
  'use strict';
5
 
6
  var $ = jQuery === undefined ? null : jQuery;
@@ -29,9 +29,9 @@
29
 
30
  // prevent default event action
31
  if (evt) {
32
- if (evt.preventDefault) {
33
  evt.preventDefault();
34
- } else if (typeof evt.returnValue !== 'undefined') {
35
  evt.returnValue = false;
36
  }
37
  }
1
+ /* WP External Links */
2
  /*global jQuery, window*/
3
+ (function (undefined) {
4
  'use strict';
5
 
6
  var $ = jQuery === undefined ? null : jQuery;
29
 
30
  // prevent default event action
31
  if (evt) {
32
+ if (evt.preventDefault !== undefined) {
33
  evt.preventDefault();
34
+ } else if (evt.returnValue !== undefined) {
35
  evt.returnValue = false;
36
  }
37
  }
js/wp-external-links.js CHANGED
@@ -1,2 +1,2 @@
1
  /* WP External Links */
2
- (function(){"use strict";function t(e,t,n){if(e.attachEvent){e.attachEvent("on"+t,n)}else if(e.addEventListener){e.addEventListener(t,n,false)}}function n(e,t){var n=e.getAttribute("data-wpel-target");var r=e.getAttribute("href");var i;if(r&&n){i=window.open(r,n);i.focus();if(t){if(t.preventDefault){t.preventDefault()}else if(typeof t.returnValue!=="undefined"){t.returnValue=false}}}}var e=jQuery===undefined?null:jQuery;if(e){e(function(){e("a").live("click",function(e){n(this,e)})})}else{t(window,"load",function(){var e=window.document.getElementsByTagName("a");var r=function(e){var t=this instanceof window.Element?this:e.target;n(t,e)};var i;var s;for(s=0;s<e.length;s+=1){i=e[s];t(i,"click",r)}})}})()
1
  /* WP External Links */
2
+ (function(e){"use strict";function n(e,t,n){if(e.attachEvent){e.attachEvent("on"+t,n)}else if(e.addEventListener){e.addEventListener(t,n,false)}}function r(t,n){var r=t.getAttribute("data-wpel-target");var i=t.getAttribute("href");var s;if(i&&r){s=window.open(i,r);s.focus();if(n){if(n.preventDefault!==e){n.preventDefault()}else if(n.returnValue!==e){n.returnValue=false}}}}var t=jQuery===e?null:jQuery;if(t){t(function(){t("body").on("click","a",function(e){r(this,e)})})}else{n(window,"load",function(){var e=window.document.getElementsByTagName("a");var t=function(e){var t=this instanceof Element?this:e.target;r(t,e)};var i;var s;for(s=0;s<e.length;s+=1){i=e[s];n(i,"click",t)}})}})()
js/wp-option-forms.js ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* WP Options Form */
2
+ /*global jQuery, ajaxurl*/
3
+ jQuery(function ($) {
4
+ 'use strict';
5
+
6
+ // save function
7
+ var saveAjaxForm = function (target) {
8
+ var $this = $(target),
9
+ $form = $this.parents('form'),
10
+ // get ajax post values
11
+ vals = $form.serializeArray();
12
+
13
+ // disable button
14
+ $this.attr('disabled', true);
15
+
16
+ // show ajax loader
17
+ $form.find('.ajax-feedback').css('visibility', 'visible');
18
+
19
+ // save option values
20
+ $.post(ajaxurl, vals, function (result) {
21
+ var $msg = $('<strong>').insertBefore($this);
22
+
23
+ if (result === '1') {
24
+ $msg.html('Saved');
25
+ } else {
26
+ // save options, non-ajax fallback
27
+ $form.find('[name="action"]').val('update');
28
+ // normal submit
29
+ $form.submit();
30
+ }
31
+
32
+ $msg.css({ margin: '0 5px' })
33
+ .delay(1000)
34
+ .fadeOut(function(){
35
+ $(this).remove();
36
+ });
37
+
38
+ // enable button
39
+ $this.attr('disabled', false);
40
+
41
+ // hide ajax loader
42
+ $form.find('.ajax-feedback').css('visibility', 'hidden');
43
+
44
+ // trigger ajax_saved_options
45
+ $form.trigger('ajax_saved_options', [result]);
46
+ });
47
+ };
48
+
49
+ // add ajax post
50
+ $('form.ajax-form input[type="submit"]').click(function(e) {
51
+ saveAjaxForm(this);
52
+ e.preventDefault();
53
+ });
54
+
55
+ });
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: freelancephp
3
  Tags: links, external, icon, target, _blank, _new, _none, rel, nofollow, new window, new tab, javascript, xhtml, seo
4
  Requires at least: 3.4.0
5
- Tested up to: 3.9.1
6
- Stable tag: 1.54
7
 
8
  Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.
9
 
@@ -106,6 +106,11 @@ In this case all internal links will be made bold.
106
 
107
  == Changelog ==
108
 
 
 
 
 
 
109
  = 1.54 =
110
  * Fixed bug opening links containing html tags (like <b>)
111
 
2
  Contributors: freelancephp
3
  Tags: links, external, icon, target, _blank, _new, _none, rel, nofollow, new window, new tab, javascript, xhtml, seo
4
  Requires at least: 3.4.0
5
+ Tested up to: 4.0.0
6
+ Stable tag: 1.55
7
 
8
  Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.
9
 
106
 
107
  == Changelog ==
108
 
109
+ = 1.55 =
110
+ * Fixed bug JS error: Uncaught TypeError: undefined is not a function
111
+ * Fixed bug PHP error for links without href attribute ("undefined index href")
112
+ * Replaced deprecated jQuery .live() to .on() (contribution by Alonbilu)
113
+
114
  = 1.54 =
115
  * Fixed bug opening links containing html tags (like <b>)
116
 
wp-external-links.php CHANGED
@@ -4,14 +4,14 @@ Plugin Name: WP External Links
4
  Plugin URI: http://www.freelancephp.net/wp-external-links-plugin
5
  Description: Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
6
  Author: Victor Villaverde Laan
7
- Version: 1.54
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
 
12
  // constants
13
  if (!defined('WP_EXTERNAL_LINKS_FILE')) { define('WP_EXTERNAL_LINKS_FILE', __FILE__); }
14
- if (!defined('WP_EXTERNAL_LINKS_VERSION')) { define('WP_EXTERNAL_LINKS_VERSION', '1.54'); }
15
  if (!defined('WP_EXTERNAL_LINKS_KEY')) { define('WP_EXTERNAL_LINKS_KEY', 'wp_external_links'); }
16
  if (!defined('WP_EXTERNAL_LINKS_DOMAIN')) { define('WP_EXTERNAL_LINKS_DOMAIN', 'wp-external-links'); }
17
  if (!defined('WP_EXTERNAL_LINKS_OPTIONS_NAME')) { define('WP_EXTERNAL_LINKS_OPTIONS_NAME', 'WP_External_Links_options'); }
4
  Plugin URI: http://www.freelancephp.net/wp-external-links-plugin
5
  Description: Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
6
  Author: Victor Villaverde Laan
7
+ Version: 1.55
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
 
12
  // constants
13
  if (!defined('WP_EXTERNAL_LINKS_FILE')) { define('WP_EXTERNAL_LINKS_FILE', __FILE__); }
14
+ if (!defined('WP_EXTERNAL_LINKS_VERSION')) { define('WP_EXTERNAL_LINKS_VERSION', '1.55'); }
15
  if (!defined('WP_EXTERNAL_LINKS_KEY')) { define('WP_EXTERNAL_LINKS_KEY', 'wp_external_links'); }
16
  if (!defined('WP_EXTERNAL_LINKS_DOMAIN')) { define('WP_EXTERNAL_LINKS_DOMAIN', 'wp-external-links'); }
17
  if (!defined('WP_EXTERNAL_LINKS_OPTIONS_NAME')) { define('WP_EXTERNAL_LINKS_OPTIONS_NAME', 'WP_External_Links_options'); }