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

Version Description

  • Added option to ignore certain links or domains
  • Solved tweet button problem by adding link to new ignore option
  • Made JavaScript method consistent to not using JS
  • Solved PHP warnings
  • Solved bug adding own class
  • Changed bloginfo "url" to "wpurl"
Download this release

Release Info

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

Code changes from version 1.10 to 1.20

includes/class-admin-external-links.php CHANGED
@@ -12,6 +12,9 @@ final class Admin_External_Links {
12
  * @var array
13
  */
14
  protected $save_options = array(
 
 
 
15
  'general' => array(
16
  'target' => '_none',
17
  'use_js' => 1,
@@ -23,6 +26,7 @@ final class Admin_External_Links {
23
  'filter_comments' => 1,
24
  'filter_widgets' => 1,
25
  'class_name' => 'ext-link',
 
26
  'fix_js' => 0,
27
  'filter_excl_sel' => '.excl-ext-link',
28
  'phpquery' => 0,
@@ -61,48 +65,43 @@ final class Admin_External_Links {
61
  $this->form = new WP_Option_Forms_01( WP_EXTERNAL_LINKS_KEY, $this->save_options );
62
 
63
  // init admin
64
- if ( is_admin() )
65
- $this->init();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
68
  /**
69
  * Initialize Admin
70
  */
71
- public function init() {
 
 
 
 
 
72
  // load text domain for translations
73
  load_plugin_textdomain( WP_EXTERNAL_LINKS_KEY, FALSE, dirname( plugin_basename( WP_EXTERNAL_LINKS_FILE ) ) . '/lang/' );
74
-
75
- // set activation hook
76
- // Does not work properly
77
- //register_activation_hook( WP_EXTERNAL_LINKS_FILE, array( $this, 'call_activation' ) );
78
- // workaround: call activation, when new format not found
79
- $options = get_option( 'wp_external_links-general' );
80
- if ( empty( $options ) )
81
- $this->call_activation();
82
-
83
- // set deactivation hook
84
- register_deactivation_hook( WP_EXTERNAL_LINKS_FILE, array( $this, 'call_deactivation' ) );
85
-
86
- // set options for add_page_method
87
- $menu_pos = $this->form->set_current_option( 'screen' )->value( 'menu_position' );
88
-
89
- // init meta box page
90
- $this->meta_box_page->init(
91
- // settings
92
- array(
93
- 'menu_title' => $this->__( 'External Links' ),
94
- 'page_slug' => strtolower( WP_EXTERNAL_LINKS_KEY ),
95
- 'add_page_method' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? 'add_submenu_page' : 'add_menu_page',
96
- 'parent_slug' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? $menu_pos : NULL,
97
- 'column_widths' => array(
98
- 1 => array( 99 ),
99
- 2 => array( 69, 29 ),
100
- ),
101
- 'icon_url' => plugins_url( 'images/icon-wp-external-links-16.png', WP_EXTERNAL_LINKS_FILE ),
102
- ),
103
- // load callback
104
- array( $this, 'call_load_meta_box' )
105
- );
106
  }
107
 
108
  /**
@@ -288,7 +287,7 @@ final class Admin_External_Links {
288
  <br/>&nbsp;&nbsp;<label><?php echo $this->form->checkbox( 'filter_comments', 1 ); ?>
289
  <span><?php $this->_e( 'Comments' ) ?></span></label>
290
  <br/>&nbsp;&nbsp;<label><?php echo $this->form->checkbox( 'filter_widgets', 1 ); ?>
291
- <span><?php
292
  if ( self::check_widget_content_filter() ):
293
  $this->_e( 'All widgets' );
294
  echo $this->tooltip_help( 'Applied to all widgets by using the "widget_content" filter of the Widget Logic plugin' );
@@ -299,8 +298,17 @@ final class Admin_External_Links {
299
  ?></span></label>
300
  </td>
301
  </tr>
 
 
 
 
 
 
 
302
  </table>
303
 
 
 
304
  <table class="form-table">
305
  <tr>
306
  <th style="width:300px;"><?php $this->_e( 'Try solving problems' ) ?>
@@ -310,8 +318,8 @@ final class Admin_External_Links {
310
  <?php echo $this->tooltip_help( 'By replacing </a> with <\/a> in JavaScript code these tags will not be processed by the plugin.' ) ?>
311
  <br/>
312
  <label><?php echo $this->form->checkbox( 'phpquery', 1 ); ?>
313
- <span><?php $this->_e( 'Use phpQuery for parsing document.' ) ?></span></label>
314
- <?php echo $this->tooltip_help( 'Using phpQuery library for manipulating links. This option is experimental.' ) ?>
315
  </td>
316
  </tr>
317
  <tr class="filter_excl_sel" <?php echo ( $this->form->value( 'phpquery' ) ) ? '' : 'style="display:none;"'; ?>>
@@ -434,9 +442,18 @@ final class Admin_External_Links {
434
  }
435
 
436
  /**
437
- * Activation plugin callback
438
  */
439
- public function call_activation() {
 
 
 
 
 
 
 
 
 
440
  // check for upgrading saved options to v1.00
441
  $old_options = get_option( 'WP_External_Links_options' );
442
 
@@ -465,12 +482,20 @@ final class Admin_External_Links {
465
  // delete old format option values
466
  delete_option( 'WP_External_Links_options' );
467
  }
 
 
 
 
 
 
 
 
468
  }
469
 
470
  /**
471
- * Deactivation plugin callback
472
  */
473
- public function call_deactivation() {
474
  $this->form->delete_options();
475
  }
476
 
12
  * @var array
13
  */
14
  protected $save_options = array(
15
+ 'meta' => array(
16
+ 'version' => NULL,
17
+ ),
18
  'general' => array(
19
  'target' => '_none',
20
  'use_js' => 1,
26
  'filter_comments' => 1,
27
  'filter_widgets' => 1,
28
  'class_name' => 'ext-link',
29
+ 'ignore' => 'http://twitter.com/share',
30
  'fix_js' => 0,
31
  'filter_excl_sel' => '.excl-ext-link',
32
  'phpquery' => 0,
65
  $this->form = new WP_Option_Forms_01( WP_EXTERNAL_LINKS_KEY, $this->save_options );
66
 
67
  // init admin
68
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
69
+
70
+ if ( is_admin() ) {
71
+ // set options for add_page_method
72
+ $menu_pos = $this->form->set_current_option( 'screen' )->value( 'menu_position' );
73
+
74
+ // init meta box page
75
+ $this->meta_box_page->init(
76
+ // settings
77
+ array(
78
+ 'menu_title' => $this->__( 'External Links' ),
79
+ 'page_slug' => strtolower( WP_EXTERNAL_LINKS_KEY ),
80
+ 'add_page_method' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? 'add_submenu_page' : 'add_menu_page',
81
+ 'parent_slug' => ( ! empty( $menu_pos ) AND $menu_pos != 'admin.php' ) ? $menu_pos : NULL,
82
+ 'column_widths' => array(
83
+ 1 => array( 99 ),
84
+ 2 => array( 69, 29 ),
85
+ ),
86
+ 'icon_url' => plugins_url( 'images/icon-wp-external-links-16.png', WP_EXTERNAL_LINKS_FILE ),
87
+ ),
88
+ // load callback
89
+ array( $this, 'call_load_meta_box' )
90
+ );
91
+ }
92
  }
93
 
94
  /**
95
  * Initialize Admin
96
  */
97
+ public function admin_init() {
98
+ $this->check_version_update();
99
+
100
+ // set uninstall hook
101
+ register_uninstall_hook( WP_EXTERNAL_LINKS_FILE, array( $this, 'call_uninstall' ) );
102
+
103
  // load text domain for translations
104
  load_plugin_textdomain( WP_EXTERNAL_LINKS_KEY, FALSE, dirname( plugin_basename( WP_EXTERNAL_LINKS_FILE ) ) . '/lang/' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
287
  <br/>&nbsp;&nbsp;<label><?php echo $this->form->checkbox( 'filter_comments', 1 ); ?>
288
  <span><?php $this->_e( 'Comments' ) ?></span></label>
289
  <br/>&nbsp;&nbsp;<label><?php echo $this->form->checkbox( 'filter_widgets', 1 ); ?>
290
+ <span><?php
291
  if ( self::check_widget_content_filter() ):
292
  $this->_e( 'All widgets' );
293
  echo $this->tooltip_help( 'Applied to all widgets by using the "widget_content" filter of the Widget Logic plugin' );
298
  ?></span></label>
299
  </td>
300
  </tr>
301
+ <tr>
302
+ <th><?php $this->_e( 'Ignore links containing...' ) ?>
303
+ <?php echo $this->tooltip_help( 'This plugin will completely ignore links that contain one of the given texts (seperated each text by enter). This check is not case sensitive.' ) ?></th>
304
+ <td><label><?php echo $this->form->textarea( 'ignore' ); ?>
305
+ <span class="description"><?php _e( 'Be as specific as you want, f.e.: <code>twitter.com</code> or <code>https://twitter.com</code>. Seperate each by an enter.' ) ?></span></label>
306
+ </td>
307
+ </tr>
308
  </table>
309
 
310
+ <?php echo $this->hr(); ?>
311
+
312
  <table class="form-table">
313
  <tr>
314
  <th style="width:300px;"><?php $this->_e( 'Try solving problems' ) ?>
318
  <?php echo $this->tooltip_help( 'By replacing </a> with <\/a> in JavaScript code these tags will not be processed by the plugin.' ) ?>
319
  <br/>
320
  <label><?php echo $this->form->checkbox( 'phpquery', 1 ); ?>
321
+ <span><?php $this->_e( 'Use phpQuery for parsing document (NOT RECOMMENDED).' ) ?></span></label>
322
+ <?php echo $this->tooltip_help( 'Using phpQuery library for manipulating links. This option was experimental and now deprecated.' ) ?>
323
  </td>
324
  </tr>
325
  <tr class="filter_excl_sel" <?php echo ( $this->form->value( 'phpquery' ) ) ? '' : 'style="display:none;"'; ?>>
442
  }
443
 
444
  /**
445
+ * Activation callback
446
  */
447
+ public function check_version_update() {
448
+ // check for version
449
+ $meta = get_option( 'wp_external_links-meta' );
450
+ if ( $meta[ 'version' ] == WP_EXTERNAL_LINKS_VERSION )
451
+ return;
452
+
453
+ // set new version
454
+ $meta[ 'version' ] = WP_EXTERNAL_LINKS_VERSION;
455
+ update_option( 'wp_external_links-meta', $meta );
456
+
457
  // check for upgrading saved options to v1.00
458
  $old_options = get_option( 'WP_External_Links_options' );
459
 
482
  // delete old format option values
483
  delete_option( 'WP_External_Links_options' );
484
  }
485
+
486
+ // upgrade to v1.20
487
+ $upgrade_general = get_option( 'wp_external_links-general' );
488
+
489
+ if ( ! isset( $upgrade_general[ 'ignore' ] ) ) {
490
+ $upgrade_general[ 'ignore' ] = $this->save_options[ 'general' ][ 'ignore' ];
491
+ update_option( 'wp_external_links-general', $upgrade_general );
492
+ }
493
  }
494
 
495
  /**
496
+ * Uninstall callback
497
  */
498
+ public function call_uninstall() {
499
  $this->form->delete_options();
500
  }
501
 
includes/class-wp-external-links.php CHANGED
@@ -13,6 +13,12 @@ final class WP_External_Links {
13
  */
14
  private $admin = NULL;
15
 
 
 
 
 
 
 
16
 
17
  /**
18
  * Constructor
@@ -66,7 +72,6 @@ final class WP_External_Links {
66
  if ( $this->get_opt( 'filter_posts' ) ) {
67
  add_filter( 'the_title', array( $this, 'call_filter_content' ), $priority );
68
  add_filter( 'the_content', array( $this, 'call_filter_content' ), $priority );
69
-
70
  add_filter( 'get_the_excerpt', array( $this, 'call_filter_content' ), $priority );
71
  // redundant:
72
  //add_filter( 'the_excerpt', array( $this, 'call_filter_content' ), $priority );
@@ -107,6 +112,14 @@ final class WP_External_Links {
107
  * wp_head callback
108
  */
109
  public function call_wp_head() {
 
 
 
 
 
 
 
 
110
  if ( $this->get_opt( 'use_js' ) AND $this->get_opt( 'target' ) != '_none' ):
111
  // set exclude class
112
  $excludeClass = ( $this->get_opt( 'no_icon_same_window', 'style' ) AND $this->get_opt( 'no_icon_class', 'style' ) )
@@ -115,7 +128,7 @@ final class WP_External_Links {
115
  ?>
116
  <script type="text/javascript">/* <![CDATA[ */
117
  /* WP External Links Plugin */
118
- var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php echo $this->get_opt( 'target' ) ?>',excludeClass: '<?php echo $excludeClass ?>' };
119
  /* ]]> */</script>
120
  <?php
121
  endif;
@@ -155,8 +168,14 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
155
  * @return boolean
156
  */
157
  private function is_external( $href, $rel ) {
 
 
 
 
 
 
158
  return ( isset( $href ) AND ( strpos( $rel, 'external' ) !== FALSE
159
- OR ( strpos( $href, strtolower( get_bloginfo( 'url' ) ) ) === FALSE )
160
  AND ( substr( $href, 0, 7 ) == 'http://'
161
  OR substr( $href, 0, 8 ) == 'https://'
162
  OR substr( $href, 0, 6 ) == 'ftp://' ) ) );
@@ -174,7 +193,7 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
174
  // remove style when no icon classes are found
175
  if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
176
  // remove style with id wp-external-links-css
177
- $content = preg_replace( '/<link(.*?)wp-external-links-css(.*?)\/>[\s+]*/i', '', $content );
178
  }
179
 
180
  return $content;
@@ -209,16 +228,17 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
209
  $title = $this->get_opt( 'title' );
210
  $attrs[ 'title' ] = str_replace( '%title%', $attrs[ 'title' ], $title );
211
 
 
 
 
 
 
212
  // set icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found
213
  if ( $this->get_opt( 'icon', 'style' ) > 0 AND ( ! $this->get_opt( 'no_icon_class', 'style' ) OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class', 'style' ) ) === FALSE ) AND strpos( $attrs[ 'class' ], 'ext-icon-' ) === FALSE ){
214
  $icon_class = 'ext-icon-'. $this->get_opt( 'icon', 'style' );
215
  $this->add_attr_value( &$attrs, 'class', $icon_class );
216
  }
217
 
218
- // set user-defined class
219
- if ( $this->get_opt( 'class_name', 'style' ) )
220
- $this->add_attr_value( &$attrs, 'class', $this->options[ 'class_name' ] );
221
-
222
  // set target
223
  if ( ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window', 'style' ) OR ! $this->get_opt( 'no_icon_class', 'style' ) OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class', 'style' ) ) === FALSE ) ) {
224
  if ( $this->get_opt( 'target' ) == '_none' ) {
@@ -287,7 +307,7 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
287
  */
288
  private function filter_phpquery( $content ) {
289
  // Workaround: remove <head>-attributes before using phpQuery
290
- $regexp_head = '/<head(.*?)>/is';
291
  $clean_head = '<head>';
292
 
293
  // set simple <head> without attributes
@@ -337,7 +357,7 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
337
 
338
  for( $x = 0; $x < $count; $x++ ) {
339
  $a = $links->eq( $x );
340
-
341
  if ( ! $a->attr( 'excluded' ) )
342
  $this->set_link_phpquery( $links->eq( $x ) );
343
  }
13
  */
14
  private $admin = NULL;
15
 
16
+ /**
17
+ * Array of ignored links
18
+ * @var type
19
+ */
20
+ private $ignored = array();
21
+
22
 
23
  /**
24
  * Constructor
72
  if ( $this->get_opt( 'filter_posts' ) ) {
73
  add_filter( 'the_title', array( $this, 'call_filter_content' ), $priority );
74
  add_filter( 'the_content', array( $this, 'call_filter_content' ), $priority );
 
75
  add_filter( 'get_the_excerpt', array( $this, 'call_filter_content' ), $priority );
76
  // redundant:
77
  //add_filter( 'the_excerpt', array( $this, 'call_filter_content' ), $priority );
112
  * wp_head callback
113
  */
114
  public function call_wp_head() {
115
+ // set ignored
116
+ $ignored = $this->get_opt( 'ignore' );
117
+ $ignored = trim( $ignored );
118
+ $ignored = explode( "\n", $ignored );
119
+ $ignored = array_map( 'trim', $ignored );
120
+ $ignored = array_map( 'strtolower', $ignored );
121
+ $this->ignored = $ignored;
122
+
123
  if ( $this->get_opt( 'use_js' ) AND $this->get_opt( 'target' ) != '_none' ):
124
  // set exclude class
125
  $excludeClass = ( $this->get_opt( 'no_icon_same_window', 'style' ) AND $this->get_opt( 'no_icon_class', 'style' ) )
128
  ?>
129
  <script type="text/javascript">/* <![CDATA[ */
130
  /* WP External Links Plugin */
131
+ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>',target: '<?php echo $this->get_opt( 'target' ) ?>',excludeClass: '<?php echo $excludeClass ?>' };
132
  /* ]]> */</script>
133
  <?php
134
  endif;
168
  * @return boolean
169
  */
170
  private function is_external( $href, $rel ) {
171
+ // check if this links should be ignored
172
+ for ( $x = 0, $count = count($this->ignored); $x < $count; $x++ ) {
173
+ if ( strrpos( $href, $this->ignored[ $x ] ) !== FALSE )
174
+ return FALSE;
175
+ }
176
+
177
  return ( isset( $href ) AND ( strpos( $rel, 'external' ) !== FALSE
178
+ OR ( strpos( $href, strtolower( get_bloginfo( 'wpurl' ) ) ) === FALSE )
179
  AND ( substr( $href, 0, 7 ) == 'http://'
180
  OR substr( $href, 0, 8 ) == 'https://'
181
  OR substr( $href, 0, 6 ) == 'ftp://' ) ) );
193
  // remove style when no icon classes are found
194
  if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
195
  // remove style with id wp-external-links-css
196
+ $content = preg_replace( '/<link ([^>]*)wp-external-links-css([^>]*)\/>[\s+]*/i', '', $content );
197
  }
198
 
199
  return $content;
228
  $title = $this->get_opt( 'title' );
229
  $attrs[ 'title' ] = str_replace( '%title%', $attrs[ 'title' ], $title );
230
 
231
+ // set user-defined class
232
+ $class = $this->get_opt( 'class_name', 'general' );
233
+ if ( $class )
234
+ $this->add_attr_value( &$attrs, 'class', $class );
235
+
236
  // set icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found
237
  if ( $this->get_opt( 'icon', 'style' ) > 0 AND ( ! $this->get_opt( 'no_icon_class', 'style' ) OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class', 'style' ) ) === FALSE ) AND strpos( $attrs[ 'class' ], 'ext-icon-' ) === FALSE ){
238
  $icon_class = 'ext-icon-'. $this->get_opt( 'icon', 'style' );
239
  $this->add_attr_value( &$attrs, 'class', $icon_class );
240
  }
241
 
 
 
 
 
242
  // set target
243
  if ( ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window', 'style' ) OR ! $this->get_opt( 'no_icon_class', 'style' ) OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class', 'style' ) ) === FALSE ) ) {
244
  if ( $this->get_opt( 'target' ) == '_none' ) {
307
  */
308
  private function filter_phpquery( $content ) {
309
  // Workaround: remove <head>-attributes before using phpQuery
310
+ $regexp_head = '/<head(>|\s(.*?)>)>/is';
311
  $clean_head = '<head>';
312
 
313
  // set simple <head> without attributes
357
 
358
  for( $x = 0; $x < $count; $x++ ) {
359
  $a = $links->eq( $x );
360
+
361
  if ( ! $a->attr( 'excluded' ) )
362
  $this->set_link_phpquery( $links->eq( $x ) );
363
  }
includes/wp-plugin-dev-classes/class-wp-meta-box-page.php CHANGED
@@ -407,7 +407,7 @@ class WP_Meta_Box_Page_01 {
407
  foreach ( $this->meta_boxes AS $box ) {
408
  $title = $box[ 'title' ];
409
  $id = ( isset( $box[ 'id' ] ) ) ? $box[ 'id' ] : sanitize_title_with_dashes( $title .'-'. ++$nr, 'meta-box-' . $nr );
410
- $callback = ( method_exists( $this, $box[ 'callback' ] ) ) ? array( $this, $box[ 'callback' ] ) : $box[ 'callback' ];
411
  $context = $box[ 'context' ];
412
  $priority = $box[ 'priority' ];
413
 
407
  foreach ( $this->meta_boxes AS $box ) {
408
  $title = $box[ 'title' ];
409
  $id = ( isset( $box[ 'id' ] ) ) ? $box[ 'id' ] : sanitize_title_with_dashes( $title .'-'. ++$nr, 'meta-box-' . $nr );
410
+ $callback = ( is_string( $box[ 'callback' ] ) && method_exists( $this, $box[ 'callback' ] ) ) ? array( $this, $box[ 'callback' ] ) : $box[ 'callback' ];
411
  $context = $box[ 'context' ];
412
  $priority = $box[ 'priority' ];
413
 
includes/wp-plugin-dev-classes/class-wp-option-forms.php CHANGED
@@ -7,7 +7,7 @@ if ( ! class_exists( 'WP_Option_Forms_01' ) ):
7
  * Also with Ajax save support.
8
  *
9
  * Requires WordPress 3.0+ and PHP 5.2+
10
- *
11
  * @version 0.1
12
  * @author Victor Villaverde Laan
13
  * @link http://www.freelancephp.net/
7
  * Also with Ajax save support.
8
  *
9
  * Requires WordPress 3.0+ and PHP 5.2+
10
+ *
11
  * @version 0.1
12
  * @author Victor Villaverde Laan
13
  * @link http://www.freelancephp.net/
js/external-links.js CHANGED
@@ -17,16 +17,10 @@
17
  // open external link
18
  function openExtLink( a, opts, e ) {
19
  var options = opts ? opts : wpExtLinks,
20
- href = a.href ? a.href.toLowerCase() : '',
21
  rel = a.rel ? a.rel.toLowerCase() : '',
22
  n;
23
 
24
- if ( a.href && ( options.excludeClass.length == 0 || a.className.indexOf( options.excludeClass ) )
25
- && ( rel.indexOf( 'external' ) > -1
26
- || ( ( href.indexOf( options.baseUrl ) === -1 ) &&
27
- ( href.substr( 0, 7 ) == 'http://'
28
- || href.substr( 0, 8 ) == 'https://'
29
- || href.substr( 0, 6 ) == 'ftp://' ) ) ) ) {
30
  // open link in a new window
31
  n = window.open( a.href, options.target );
32
  n.focus();
17
  // open external link
18
  function openExtLink( a, opts, e ) {
19
  var options = opts ? opts : wpExtLinks,
 
20
  rel = a.rel ? a.rel.toLowerCase() : '',
21
  n;
22
 
23
+ if ( a.href && rel.indexOf( 'external' ) > -1 && ( options.excludeClass.length == 0 || a.className.indexOf( options.excludeClass ) ) ) {
 
 
 
 
 
24
  // open link in a new window
25
  n = window.open( a.href, options.target );
26
  n.focus();
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.0.0
5
- Tested up to: 3.2.1
6
- Stable tag: 1.10
7
 
8
  Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
9
 
@@ -46,6 +46,14 @@ This latest version requires PHP 5.2+ and WP 3.0+.
46
 
47
  == Changelog ==
48
 
 
 
 
 
 
 
 
 
49
  = 1.10 =
50
  * Resolved old parsing method (same as version 0.35)
51
  * Option to use phpQuery for parsing (for those who didn't experience problems with version 1.03)
@@ -121,6 +129,12 @@ This latest version requires PHP 5.2+ and WP 3.0+.
121
 
122
  == Upgrade Notice ==
123
 
 
 
 
 
 
 
124
  = 1.10 =
125
  * Resolved old parsing method (same as version 0.35)
126
  * Option to use phpQuery for parsing (same as version 1.03)
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.0.0
5
+ Tested up to: 3.3.1
6
+ Stable tag: 1.20
7
 
8
  Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
9
 
46
 
47
  == Changelog ==
48
 
49
+ = 1.20 =
50
+ * Added option to ignore certain links or domains
51
+ * Solved tweet button problem by adding link to new ignore option
52
+ * Made JavaScript method consistent to not using JS
53
+ * Solved PHP warnings
54
+ * Solved bug adding own class
55
+ * Changed bloginfo "url" to "wpurl"
56
+
57
  = 1.10 =
58
  * Resolved old parsing method (same as version 0.35)
59
  * Option to use phpQuery for parsing (for those who didn't experience problems with version 1.03)
129
 
130
  == Upgrade Notice ==
131
 
132
+ = 1.20 =
133
+ Main updates:
134
+ * Added option to ignore certain links or domains
135
+ * Solved tweet button problem
136
+ * Solved PHP warnings and other fixes
137
+
138
  = 1.10 =
139
  * Resolved old parsing method (same as version 0.35)
140
  * Option to use phpQuery for parsing (same as version 1.03)
wp-external-links.php CHANGED
@@ -4,13 +4,13 @@ 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.10
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
 
12
  // plugin version
13
- define( 'WP_EXTERNAL_LINKS_VERSION', '1.10' );
14
 
15
  // plugin key (used as translation domain, option_group, page_slug etc)
16
  define( 'WP_EXTERNAL_LINKS_KEY', '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.20
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
11
 
12
  // plugin version
13
+ define( 'WP_EXTERNAL_LINKS_VERSION', '1.20' );
14
 
15
  // plugin key (used as translation domain, option_group, page_slug etc)
16
  define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );