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

Version Description

  • Small cosmetical adjustments
Download this release

Release Info

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

Code changes from version 0.30 to 0.31

images/{icon.png → icon-wp-external-links.png} RENAMED
File without changes
images/icon-wp-mailto-links.png ADDED
Binary file
readme.txt CHANGED
@@ -3,30 +3,29 @@ Contributors: freelancephp
3
  Tags: links, external, new window, icon, target, _blank, _new, _top, _none, rel, nofollow, javascript, xhtml strict
4
  Requires at least: 2.7.0
5
  Tested up to: 3.1.0
6
- Stable tag: 0.30
7
 
8
- Manage external links on your site: open in a new window, set link icon, set "external" and/or "nofollow", set No-Icon class.
9
 
10
  == Description ==
11
 
12
  Manage the external links on your site.
13
 
14
  = Features =
15
- * Open external links in a new window
16
- * Add "external" and/or "nofollow" value to rel-attribute
17
- * Choose an icon for external links
18
- * Set a No-Icon class and/or an additional class (for your own styling)
19
- * Use JavaScript method (unobtrusive) which is XHTML Strict compliant
20
- * Scan whole page (posts, comments, widgets etc)
21
- * Supports PHP4.3+ and up to latest WP version
22
 
23
- More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-plugin)
24
 
25
  == Installation ==
26
  1. Go to `Plugins` in the Admin menu
27
  1. Click on the button `Add new`
28
  1. Search for `WP External Links` and click 'Install Now' or click on the `upload` link to upload `wp-external-links.zip`
29
- 1. Click on 'Activate plugin'
30
 
31
  == Frequently Asked Questions ==
32
 
@@ -35,10 +34,13 @@ More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-pl
35
  == Screenshots ==
36
 
37
  1. Admin Settings Page
38
- 1. Icon on the Site
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 0.30 =
43
  * Improved Admin Options, f.e. target option looks more like the Blogroll target option
44
  * Added option for choosing which content should be filtered
@@ -69,8 +71,8 @@ More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-pl
69
 
70
  == Upgrade Notice ==
71
 
72
- = 0.30 =
73
- Please after updating, check if the settings on `Setttings` > `External Links` are still correct.
74
 
75
  == Other notes ==
 
 
76
  * Title icon on Admin Options Page was made by [FatCow Web Hosting](http://www.fatcow.com/) taken form [iconfinder](http://findicons.com/icon/164579/link_go?id=427009)
3
  Tags: links, external, new window, icon, target, _blank, _new, _top, _none, rel, nofollow, javascript, xhtml strict
4
  Requires at least: 2.7.0
5
  Tested up to: 3.1.0
6
+ Stable tag: 0.31
7
 
8
+ Manage external links on your site: open in new window/tab, set link icon, add "external", add "nofollow" and more.
9
 
10
  == Description ==
11
 
12
  Manage the external links on your site.
13
 
14
  = Features =
15
+ * Open in a new window/tab
16
+ * Set link icon
17
+ * Add "external"
18
+ * Add "nofollow"
19
+ * Set no-icon class
20
+ * Set additional classes (for your own styling)
 
21
 
22
+ Supports PHP4.3+ and up to latest WP version.
23
 
24
  == Installation ==
25
  1. Go to `Plugins` in the Admin menu
26
  1. Click on the button `Add new`
27
  1. Search for `WP External Links` and click 'Install Now' or click on the `upload` link to upload `wp-external-links.zip`
28
+ 1. Click on `Activate plugin`
29
 
30
  == Frequently Asked Questions ==
31
 
34
  == Screenshots ==
35
 
36
  1. Admin Settings Page
37
+ 1. Link Icon on the Site
38
 
39
  == Changelog ==
40
 
41
+ = 0.31 =
42
+ * Small cosmetical adjustments
43
+
44
  = 0.30 =
45
  * Improved Admin Options, f.e. target option looks more like the Blogroll target option
46
  * Added option for choosing which content should be filtered
71
 
72
  == Upgrade Notice ==
73
 
 
 
74
 
75
  == Other notes ==
76
+
77
+ = Credits =
78
  * Title icon on Admin Options Page was made by [FatCow Web Hosting](http://www.fatcow.com/) taken form [iconfinder](http://findicons.com/icon/164579/link_go?id=427009)
screenshot-1.png CHANGED
Binary file
wp-external-links.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
  /*
3
  Plugin Name: WP External Links
4
- Plugin URI: http://www.freelancephp.net/
5
- Description: Manage the external links on your site: opening in a new window, set link icon, set "external" and/or "nofollow", set No-Icon class or additional css-class.
6
  Author: Victor Villaverde Laan
7
- Version: 0.30
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
@@ -19,7 +19,7 @@ class WP_External_Links {
19
  * Current version
20
  * @var string
21
  */
22
- var $version = '0.30';
23
 
24
  /**
25
  * Used as prefix for options entry and could be used as text domain (for translations)
@@ -105,7 +105,8 @@ class WP_External_Links {
105
  add_filter( 'widget_text', array( $this, 'filter_content' ), $priority );
106
 
107
  // Only if Widget Logic plugin is installed
108
- add_filter( 'widget_content', array( $this, 'filter_content' ), $priority );
 
109
  }
110
  }
111
 
@@ -129,7 +130,7 @@ class WP_External_Links {
129
  function admin_menu() {
130
  if ( function_exists( 'add_options_page' ) AND current_user_can( 'manage_options' ) ) {
131
  // add options page
132
- $page = add_options_page( 'External Links', 'External Links',
133
  'manage_options', __FILE__, array( $this, 'options_page' ) );
134
  }
135
  }
@@ -163,7 +164,7 @@ class WP_External_Links {
163
  ?>
164
  <script language="javascript">/* <![CDATA[ */
165
  /* WP External Links Plugin */
166
- var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>' ,target: '<?php echo $this->options[ 'target' ] ?>',excludeClass: '<?php echo $excludeClass ?>' };
167
  /* ]]> */</script>
168
  <?php
169
  endif;
@@ -283,15 +284,6 @@ jQuery(function( $ ){
283
  .delay( 3000 )
284
  .slideUp( 600 );
285
 
286
- // option new_window slide effect
287
- $( 'input.field_target' )
288
- .change(function(){
289
- if ( $( this ).attr( 'checked' ) ) {
290
- $( 'input.field_use_js' ).attr( 'disabled', $( this ).val() == '_none' );
291
- }
292
- })
293
- .change();
294
-
295
  // option filter whole page
296
  $( 'input#filter_whole_page' )
297
  .change(function(){
@@ -308,7 +300,7 @@ jQuery(function( $ ){
308
  })
309
  </script>
310
  <div class="wrap">
311
- <div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
312
  <h2><?php _e( 'External Links Settings' ) ?></h2>
313
 
314
  <form method="post" action="options.php">
@@ -327,7 +319,7 @@ jQuery(function( $ ){
327
  <fieldset class="options">
328
  <table class="form-table">
329
  <tr>
330
- <th><?php _e( 'Target external links', $this->domain ) ?></th>
331
  <td class="target_external_links">
332
  <label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_blank" <?php checked( '_blank', $options['target'] ); ?> />
333
  <span><?php _e( '<code>_blank</code>, open every external link in a new window or tab', $this->domain ) ?></span></label>
@@ -337,38 +329,38 @@ jQuery(function( $ ){
337
  <span><?php _e( '<code>_new</code>, open new window the first time and use this window for each external link', $this->domain ) ?></span></label>
338
  <br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_none" <?php checked( '_none', $options['target'] ); ?> />
339
  <span><?php _e( '<code>_none</code>, open in current window or tab', $this->domain ) ?></span></label>
340
- <br/>
341
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[use_js]" class="field_use_js" value="0" <?php checked( '0', (int) $options['use_js'] ); ?> />
342
- <span><?php _e( 'Set target attribute in HTML code (XHTML Transitional compliant)', $this->domain ) ?></span></label>
343
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[use_js]" class="field_use_js" value="1" <?php checked( '1', (int) $options['use_js'] ); ?> />
344
- <span><?php _e( 'Use JavaScript for opening links in target (recommended, XHTML Strict compliant)', $this->domain ) ?></span></label>
345
  </td>
346
  </tr>
347
  <tr>
348
- <th><?php _e( 'Add "external"', $this->domain ) ?></th>
349
- <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[external]" name="<?php echo $this->options_name ?>[external]" value="1" <?php checked('1', (int) $options['external']); ?> />
350
- <span><?php _e( 'Add <code>"external"</code> to the rel-attribute of external links', $this->domain ) ?></span></label>
 
351
  </td>
352
  </tr>
353
  <tr>
354
- <th><?php _e( 'Add "nofollow"', $this->domain ) ?></th>
355
- <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[nofollow]" name="<?php echo $this->options_name ?>[nofollow]" value="1" <?php checked('1', (int) $options['nofollow']); ?> />
 
 
356
  <span><?php _e( 'Add <code>"nofollow"</code> to the rel-attribute of external links (unless link has <code>"follow"</code>)', $this->domain ) ?></span></label>
357
  </td>
358
  </tr>
359
- <th><?php _e( 'Has effect on', $this->domain ) ?></th>
 
360
  <td>
361
  <label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_whole_page]" id="filter_whole_page" value="1" <?php checked( '1', (int) $options['filter_whole_page'] ); ?> />
362
  <span><?php _e( 'All contents (the whole <code>&lt;body&gt;</code>)', $this->domain ) ?></span></label>
363
- <br/><label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_posts]" id="filter_posts" value="1" <?php checked( '1', (int) $options['filter_posts'] ); ?> />
364
  <span><?php _e( 'Post contents', $this->domain ) ?></span></label>
365
- <br/><label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_comments]" id="filter_comments" value="1" <?php checked( '1', (int) $options['filter_comments'] ); ?> />
366
  <span><?php _e( 'Comments', $this->domain ) ?></span></label>
367
- <br/><label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_widgets]" id="filter_widgets" value="1" <?php checked( '1', (int) $options['filter_widgets'] ); ?> />
368
- <span><?php _e( 'Widgets (only text widgets)', $this->domain ) ?></span></label>
369
  <br/>
370
  <br/><span class="description"><?php _e( 'Note: all <code>&lt;a&gt;</code> tags in the selected contents will be converted to XHTML valid code' ) ?></span>
371
  </td>
 
372
  </table>
373
  </fieldset>
374
  <p class="submit">
@@ -401,7 +393,7 @@ jQuery(function( $ ){
401
  <?php endif; ?>
402
  <?php endfor; ?>
403
  </div>
404
- <div style="width:29%;float:left;"><?php _e( 'Example:', $this->domain ) ?>
405
  <br/><img src="<?php echo plugins_url( 'images/link-icon-example.png', __FILE__ ) ?>" />
406
  </div>
407
  <br style="clear:both" />
@@ -417,9 +409,9 @@ jQuery(function( $ ){
417
  </td>
418
  </tr>
419
  <tr>
420
- <th><?php _e( 'Additional Class (optional)', $this->domain ) ?></th>
421
  <td><label><input type="text" id="<?php echo $this->options_name ?>[class_name]" name="<?php echo $this->options_name ?>[class_name]" value="<?php echo $options['class_name']; ?>" />
422
- <span><?php _e( 'Add extra class to external links (or leave blank)', $this->domain ) ?></span></label></td>
423
  </tr>
424
  </table>
425
  </fieldset>
@@ -435,13 +427,14 @@ jQuery(function( $ ){
435
  <div style="margin:0 5px;">
436
  <div class="postbox">
437
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
438
- <h3 class="hndle"><?php _e( 'About' ) ?> WP External Links (v<?php echo $this->version ?>)</h3>
439
  <div class="inside">
 
 
440
  <ul>
441
- <li><a href="<?php echo plugins_url( 'readme.txt', __FILE__ ) ?>" target="_blank">readme.txt</a></li>
442
- <li><a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank"><?php _e( 'Plugin on ', $this->domain ) ?> FreelancePHP.net</a></li>
443
- <li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank"><?php _e( 'Plugin on ', $this->domain ) ?> WordPress.org</a></li>
444
- <li><a href="http://www.freelancephp.net/contact/" target="_blank"><?php _e( 'Contact the author', $this->domain ) ?></a></li>
445
  </ul>
446
  </div>
447
  </div>
@@ -450,8 +443,11 @@ jQuery(function( $ ){
450
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
451
  <h3 class="hndle"><?php _e( 'Other Plugins', $this->domain ) ?></h3>
452
  <div class="inside">
 
 
453
  <ul>
454
- <li><a href="http://www.freelancephp.net/email-encoder-php-class-wp-plugin/" target="_blank">WP Email Encoder Bundle</a></li>
 
455
  </ul>
456
  </div>
457
  </div>
@@ -481,7 +477,8 @@ jQuery(function( $ ){
481
  // set all options
482
  if ( ! empty( $saved_options ) ) {
483
  foreach ( $this->options AS $key => $option ) {
484
- if ( ! isset( $saved_options[ $key ] ) AND in_array( $key, array( 'target', 'use_js', 'icon' ) ) )
 
485
  continue;
486
 
487
  $this->options[ $key ] = $saved_options[ $key ];
1
  <?php
2
  /*
3
  Plugin Name: WP External Links
4
+ Plugin URI: http://www.freelancephp.net/wp-external-links-plugin
5
+ Description: Manage external links on your site: open in new window/tab, set link icon, add "external", add "nofollow" and more.
6
  Author: Victor Villaverde Laan
7
+ Version: 0.31
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
19
  * Current version
20
  * @var string
21
  */
22
+ var $version = '0.31';
23
 
24
  /**
25
  * Used as prefix for options entry and could be used as text domain (for translations)
105
  add_filter( 'widget_text', array( $this, 'filter_content' ), $priority );
106
 
107
  // Only if Widget Logic plugin is installed
108
+ // @todo Doesn't work and cannot find another way to filter all widget contents
109
+ //add_filter( 'widget_content', array( $this, 'filter_content' ), $priority );
110
  }
111
  }
112
 
130
  function admin_menu() {
131
  if ( function_exists( 'add_options_page' ) AND current_user_can( 'manage_options' ) ) {
132
  // add options page
133
+ $page = add_options_page( __( 'External Links', $this->domain ), __( 'External Links', $this->domain ),
134
  'manage_options', __FILE__, array( $this, 'options_page' ) );
135
  }
136
  }
164
  ?>
165
  <script language="javascript">/* <![CDATA[ */
166
  /* WP External Links Plugin */
167
+ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php echo $this->options[ 'target' ] ?>',excludeClass: '<?php echo $excludeClass ?>' };
168
  /* ]]> */</script>
169
  <?php
170
  endif;
284
  .delay( 3000 )
285
  .slideUp( 600 );
286
 
 
 
 
 
 
 
 
 
 
287
  // option filter whole page
288
  $( 'input#filter_whole_page' )
289
  .change(function(){
300
  })
301
  </script>
302
  <div class="wrap">
303
+ <div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon-wp-external-links.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
304
  <h2><?php _e( 'External Links Settings' ) ?></h2>
305
 
306
  <form method="post" action="options.php">
319
  <fieldset class="options">
320
  <table class="form-table">
321
  <tr>
322
+ <th><?php _e( 'Set target for external links', $this->domain ) ?></th>
323
  <td class="target_external_links">
324
  <label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_blank" <?php checked( '_blank', $options['target'] ); ?> />
325
  <span><?php _e( '<code>_blank</code>, open every external link in a new window or tab', $this->domain ) ?></span></label>
329
  <span><?php _e( '<code>_new</code>, open new window the first time and use this window for each external link', $this->domain ) ?></span></label>
330
  <br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_none" <?php checked( '_none', $options['target'] ); ?> />
331
  <span><?php _e( '<code>_none</code>, open in current window or tab', $this->domain ) ?></span></label>
 
 
 
 
 
332
  </td>
333
  </tr>
334
  <tr>
335
+ <th>&nbsp;</th>
336
+ <td>
337
+ <label><input type="checkbox" name="<?php echo $this->options_name ?>[use_js]" class="field_use_js" value="1" <?php checked( '1', (int) $options['use_js'] ); ?> />
338
+ <span><?php _e( 'Use JavaScript method (recommended, XHTML Strict compliant)', $this->domain ) ?></span></label>
339
  </td>
340
  </tr>
341
  <tr>
342
+ <th><?php _e( 'Add to "rel" attribute', $this->domain ) ?></th>
343
+ <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[external]" name="<?php echo $this->options_name ?>[external]" value="1" <?php checked('1', (int) $options['external']); ?> />
344
+ <span><?php _e( 'Add <code>"external"</code> to the rel-attribute of external links', $this->domain ) ?></span></label>
345
+ <br/><label><input type="checkbox" id="<?php echo $this->options_name ?>[nofollow]" name="<?php echo $this->options_name ?>[nofollow]" value="1" <?php checked('1', (int) $options['nofollow']); ?> />
346
  <span><?php _e( 'Add <code>"nofollow"</code> to the rel-attribute of external links (unless link has <code>"follow"</code>)', $this->domain ) ?></span></label>
347
  </td>
348
  </tr>
349
+ <tr>
350
+ <th><?php _e( 'Options have effect on', $this->domain ) ?></th>
351
  <td>
352
  <label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_whole_page]" id="filter_whole_page" value="1" <?php checked( '1', (int) $options['filter_whole_page'] ); ?> />
353
  <span><?php _e( 'All contents (the whole <code>&lt;body&gt;</code>)', $this->domain ) ?></span></label>
354
+ <br/>&nbsp;&nbsp;<label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_posts]" id="filter_posts" value="1" <?php checked( '1', (int) $options['filter_posts'] ); ?> />
355
  <span><?php _e( 'Post contents', $this->domain ) ?></span></label>
356
+ <br/>&nbsp;&nbsp;<label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_comments]" id="filter_comments" value="1" <?php checked( '1', (int) $options['filter_comments'] ); ?> />
357
  <span><?php _e( 'Comments', $this->domain ) ?></span></label>
358
+ <br/>&nbsp;&nbsp;<label><input type="checkbox" name="<?php echo $this->options_name ?>[filter_widgets]" id="filter_widgets" value="1" <?php checked( '1', (int) $options['filter_widgets'] ); ?> />
359
+ <span><?php _e( 'Text widgets', $this->domain ) ?></span></label>
360
  <br/>
361
  <br/><span class="description"><?php _e( 'Note: all <code>&lt;a&gt;</code> tags in the selected contents will be converted to XHTML valid code' ) ?></span>
362
  </td>
363
+ </tr>
364
  </table>
365
  </fieldset>
366
  <p class="submit">
393
  <?php endif; ?>
394
  <?php endfor; ?>
395
  </div>
396
+ <div style="width:29%;float:left;"><span class="description"><?php _e( 'Example:', $this->domain ) ?></span>
397
  <br/><img src="<?php echo plugins_url( 'images/link-icon-example.png', __FILE__ ) ?>" />
398
  </div>
399
  <br style="clear:both" />
409
  </td>
410
  </tr>
411
  <tr>
412
+ <th><?php _e( 'Additional Classes (optional)', $this->domain ) ?></th>
413
  <td><label><input type="text" id="<?php echo $this->options_name ?>[class_name]" name="<?php echo $this->options_name ?>[class_name]" value="<?php echo $options['class_name']; ?>" />
414
+ <span><?php _e( 'Add extra classes to external links (or leave blank)', $this->domain ) ?></span></label></td>
415
  </tr>
416
  </table>
417
  </fieldset>
427
  <div style="margin:0 5px;">
428
  <div class="postbox">
429
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
430
+ <h3 class="hndle"><?php _e( 'About' ) ?>...</h3>
431
  <div class="inside">
432
+ <h4><img src="<?php echo plugins_url( 'images/icon-wp-external-links.png', __FILE__ ) ?>" width="16" height="16" /> WP External Links (v<?php echo $this->version ?>)</h4>
433
+ <p><?php _e( 'Manage external links on your site: open in new window/tab, set link icon, add "external", add "nofollow" and more.', $this->domain ) ?></p>
434
  <ul>
435
+ <li><a href="http://www.freelancephp.net/contact/" target="_blank"><?php _e( 'Questions or suggestions?', $this->domain ) ?></a></li>
436
+ <li><?php _e( 'If you like this plugin please send your rating at WordPress.org.' ) ?></li>
437
+ <li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank">FreelancePHP.net</a></li>
 
438
  </ul>
439
  </div>
440
  </div>
443
  <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
444
  <h3 class="hndle"><?php _e( 'Other Plugins', $this->domain ) ?></h3>
445
  <div class="inside">
446
+ <h4><img src="<?php echo plugins_url( 'images/icon-wp-mailto-links.png', __FILE__ ) ?>" width="16" height="16" /> WP Mailto Links</h4>
447
+ <p><?php _e( 'Manage mailto links on your site and protect emails from spambots, set mail icon and more.', $this->domain ) ?></p>
448
  <ul>
449
+ <li><a href="<?php echo get_bloginfo( 'url' ) ?>/wp-admin/plugin-install.php?tab=search&type=term&s=WP+Mailto+Links+freelancephp&plugin-search-input=Search+Plugins" target="_blank"><?php _e( 'Get this plugin now' ) ?></a></li>
450
+ <li><a href="http://wordpress.org/extend/plugins/wp-mailto-links/" target="_blank">WordPress.org</a> | <a href="http://www.freelancephp.net/wp-mailto-links-plugin/" target="_blank">FreelancePHP.net</a></li>
451
  </ul>
452
  </div>
453
  </div>
477
  // set all options
478
  if ( ! empty( $saved_options ) ) {
479
  foreach ( $this->options AS $key => $option ) {
480
+ // skip when no saved value for radio 'target'
481
+ if ( ! isset( $saved_options[ $key ] ) AND $key == 'target' )
482
  continue;
483
 
484
  $this->options[ $key ] = $saved_options[ $key ];