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

Version Description

  • Options are organized more logical
  • Added some more icons
Download this release

Release Info

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

Code changes from version 0.11 to 0.12

images/external-12.png ADDED
Binary file
images/external-12_1.png ADDED
Binary file
images/external-13.png ADDED
Binary file
images/external-13_1.png ADDED
Binary file
images/external-14.png ADDED
Binary file
images/external-14_1.png ADDED
Binary file
images/external-15.png ADDED
Binary file
images/external-15_1.png ADDED
Binary file
images/external-16.png ADDED
Binary file
images/external-17.png ADDED
Binary file
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === WP External Links ===
2
  Contributors: freelancephp
3
  Tags: links, external, new window, icon, target, _blank, _new, rel, nofollow, javascript, xhtml strict
4
  Requires at least: 2.7.0
5
  Tested up to: 3.1.0
6
- Stable tag: 0.11
7
 
8
- Manage the external links on your site: opening in a new window, set link icon, set "external", set "nofollow", set css-class.
9
 
10
  == Description ==
11
 
@@ -17,7 +17,9 @@ Manage the external links on your site.
17
  * Choose an icon for external links
18
  * Add a css Class-name
19
  * Unobtrusive JavaScript method wich is XHTML Strict compliant
20
- * Supports PHP4.3+ and up to latest WP versionMore info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-plugin)
 
 
21
 
22
  == Installation ==
23
 
@@ -35,6 +37,10 @@ Manage the external links on your site.
35
 
36
  == Changelog ==
37
 
 
 
 
 
38
  = 0.11 =
39
  * JavaScript uses window.open() (tested in FireFox Opera, Safari, Chrome and IE6+)
40
  * Also possible to open all external links in the same new window
1
+ === WP External Links (new window, icon, "nofollow") ===
2
  Contributors: freelancephp
3
  Tags: links, external, new window, icon, target, _blank, _new, rel, nofollow, javascript, xhtml strict
4
  Requires at least: 2.7.0
5
  Tested up to: 3.1.0
6
+ Stable tag: 0.12
7
 
8
+ Manage the external links on your site: opening in a new window, set link icon, set "external" and/or "nofollow", set css-class.
9
 
10
  == Description ==
11
 
17
  * Choose an icon for external links
18
  * Add a css Class-name
19
  * Unobtrusive JavaScript method wich is XHTML Strict compliant
20
+ * Supports PHP4.3+ and up to latest WP version
21
+
22
+ More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-plugin)
23
 
24
  == Installation ==
25
 
37
 
38
  == Changelog ==
39
 
40
+ = 0.12 =
41
+ * Options are organized more logical
42
+ * Added some more icons
43
+
44
  = 0.11 =
45
  * JavaScript uses window.open() (tested in FireFox Opera, Safari, Chrome and IE6+)
46
  * Also possible to open all external links in the same new window
screenshot-1.png CHANGED
Binary file
wp-external-links.php CHANGED
@@ -4,7 +4,7 @@ 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", set "nofollow", set css-class.
6
  Author: Victor Villaverde Laan
7
- Version: 0.11
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
@@ -30,7 +30,9 @@ class WP_External_Links {
30
  * @var array
31
  */
32
  var $options = array(
33
- 'new_window' => 1,
 
 
34
  'external' => TRUE,
35
  'nofollow' => TRUE,
36
  'icon' => 1,
@@ -96,7 +98,7 @@ class WP_External_Links {
96
  add_action( 'wp_head', array( $this, 'wp_head' ) );
97
 
98
  // set js file
99
- if ( $this->options[ 'new_window' ] >= 4 ) {
100
  wp_enqueue_script( 'external-links', plugins_url( 'js/external-links.js', __FILE__ ), array( 'jquery' ), '0.11' );
101
  }
102
  }
@@ -107,13 +109,13 @@ class WP_External_Links {
107
  */
108
  function wp_head() {
109
  ?>
110
- <?php if ( $this->options[ 'new_window' ] >= 4 ): ?>
111
  <!-- JS External Links Plugin -->
112
  <script language="javascript">
113
  /* <![CDATA[ */
114
  var gExtLinks = {
115
  baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',
116
- target: '<?php echo ( $this->options[ 'new_window' ] == 5 ) ? '_new' : '_blank' ?>'
117
  };
118
  /* ]]> */
119
  </script>
@@ -173,9 +175,9 @@ var gExtLinks = {
173
  : $attrs[ 'class' ] .' '. $this->options[ 'class_name' ];
174
  }
175
 
176
- // set target="_blank"
177
- if ( $this->options[ 'new_window' ] == 1 )
178
- $attrs[ 'target' ] = '_blank';
179
  }
180
 
181
 
@@ -210,6 +212,14 @@ var gExtLinks = {
210
  */
211
  function options_page() {
212
  ?>
 
 
 
 
 
 
 
 
213
  <div class="wrap">
214
  <div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
215
  <h2><?php _e( 'External Links Settings' ) ?></h2>
@@ -231,21 +241,19 @@ var gExtLinks = {
231
  <table class="form-table">
232
  <tr>
233
  <th><?php _e( 'Open in new window', $this->domain ) ?></th>
234
- <td><label><input type="radio" name="<?php echo $this->options_name ?>[new_window]" value="1" <?php checked('1', (int) $options['new_window']); ?> />
235
- <span><?php _e( '1) No, open external links in active window', $this->domain ) ?></span></label>
236
- <br/>
237
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[new_window]" value="2" <?php checked('2', (int) $options['new_window']); ?> />
238
- <span><?php _e( '2) Yes, add <code>target="_blank"</code> to external links (every external link is loaded in a new window)', $this->domain ) ?></span></label>
239
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[new_window]" value="3" <?php checked('3', (int) $options['new_window']); ?> />
240
- <span><?php _e( '3) Yes, add <code>target="_new"</code> to external links (all external links will be loaded in the same new window)', $this->domain ) ?></span></label>
241
- <br/>
242
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[new_window]" value="4" <?php checked('4', (int) $options['new_window']); ?> />
243
- <span><?php _e( '4) Yes, using JavaScript for opening every external link in a new window', $this->domain ) ?></span></label>
244
- <br/><label><input type="radio" name="<?php echo $this->options_name ?>[new_window]" value="5" <?php checked('5', (int) $options['new_window']); ?> />
245
- <span><?php _e( '5) Yes, using JavaScript for opening all external links in the same new window', $this->domain ) ?></span></label>
246
- <br />
247
- <br />
248
- <p><span class="description"><?php _e( 'Note: method 2 and 3 are compliant with XHTML Transitional. The other methods are also XHTML Strict compliant.' ) ?></span></p>
249
  </td>
250
  </tr>
251
  <tr>
@@ -293,7 +301,7 @@ var gExtLinks = {
293
  <div style="width:25%;float:left">
294
  <label><input type="radio" name="<?php echo $this->options_name ?>[icon]" value="0" <?php checked('0', (int) $options['icon']); ?> />
295
  <span><?php _e( 'No icon', $this->domain ) ?></span></label>
296
- <?php for ( $x = 1; $x <= 11; $x++ ): ?>
297
  <br/><label><input type="radio" name="<?php echo $this->options_name ?>[icon]" value="<?php echo $x ?>" <?php checked( $x, (int) $options['icon'] ); ?> />
298
  <img src="<?php echo plugins_url( 'images/external-'. $x .'.png', __FILE__ ) ?>" /></label>
299
  <?php endfor; ?>
@@ -318,8 +326,8 @@ var gExtLinks = {
318
  <div class="inside">
319
  <ul>
320
  <li><a href="<?php echo plugins_url( 'readme.txt', __FILE__ ) ?>" target="_blank">readme.txt</a></li>
321
- <li><a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank"><?php _e( 'Plugin page on ', $this->domain ) ?> FreelancePHP.net</a></li>
322
- <li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank"><?php _e( 'Plugin page on ', $this->domain ) ?> WordPress.org</a></li>
323
  <li><a href="http://www.freelancephp.net/contact/" target="_blank"><?php _e( 'Contact the author', $this->domain ) ?></a></li>
324
  </ul>
325
  </div>
@@ -359,7 +367,17 @@ var gExtLinks = {
359
 
360
  if ( ! empty( $saved_options ) ) {
361
  // set saved option values
362
- $this->options['new_window'] = $saved_options['new_window'];
 
 
 
 
 
 
 
 
 
 
363
  $this->options['external'] = ! empty( $saved_options['external'] );
364
  $this->options['nofollow'] = ! empty( $saved_options['nofollow'] );
365
  $this->options['icon'] = $saved_options['icon'];
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", set "nofollow", set css-class.
6
  Author: Victor Villaverde Laan
7
+ Version: 0.12
8
  Author URI: http://www.freelancephp.net
9
  License: Dual licensed under the MIT and GPL licenses
10
  */
30
  * @var array
31
  */
32
  var $options = array(
33
+ 'new_window' => TRUE,
34
+ 'use_js' => TRUE,
35
+ 'target' => '_blank',
36
  'external' => TRUE,
37
  'nofollow' => TRUE,
38
  'icon' => 1,
98
  add_action( 'wp_head', array( $this, 'wp_head' ) );
99
 
100
  // set js file
101
+ if ( $this->options[ 'use_js' ] ) {
102
  wp_enqueue_script( 'external-links', plugins_url( 'js/external-links.js', __FILE__ ), array( 'jquery' ), '0.11' );
103
  }
104
  }
109
  */
110
  function wp_head() {
111
  ?>
112
+ <?php if ( $this->options[ 'use_js' ] ): ?>
113
  <!-- JS External Links Plugin -->
114
  <script language="javascript">
115
  /* <![CDATA[ */
116
  var gExtLinks = {
117
  baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',
118
+ target: '<?php echo $this->options[ 'target' ] ?>'
119
  };
120
  /* ]]> */
121
  </script>
175
  : $attrs[ 'class' ] .' '. $this->options[ 'class_name' ];
176
  }
177
 
178
+ // set target
179
+ if ( $this->options[ 'new_window' ] AND ! $this->options[ 'use_js' ] )
180
+ $attrs[ 'target' ] = $this->options[ 'target' ];
181
  }
182
 
183
 
212
  */
213
  function options_page() {
214
  ?>
215
+ <script language="javascript">
216
+ jQuery(function( $ ){
217
+ $( 'input#new_window' ).change(function(){
218
+ var anim = $( this ).attr( 'checked' ) ? 'slideDown' : 'slideUp';
219
+ $( 'div.new_window_options' )[ anim ]();
220
+ })
221
+ })
222
+ </script>
223
  <div class="wrap">
224
  <div class="icon32" id="icon-options-custom" style="background:url( <?php echo plugins_url( 'images/icon.png', __FILE__ ) ?> ) no-repeat 50% 50%"><br></div>
225
  <h2><?php _e( 'External Links Settings' ) ?></h2>
241
  <table class="form-table">
242
  <tr>
243
  <th><?php _e( 'Open in new window', $this->domain ) ?></th>
244
+ <td>
245
+ <label><input type="checkbox" name="<?php echo $this->options_name ?>[new_window]" id="new_window" value="1" <?php checked( '1', (int) $options['new_window'] ); ?> />
246
+ <span><?php _e( 'Open external links in a new window (or tab)', $this->domain ) ?></span></label>
247
+ <div class="new_window_options">
248
+ <p><label><input type="checkbox" name="<?php echo $this->options_name ?>[use_js]" value="1" <?php checked( '1', (int) $options['use_js'] ); ?> />
249
+ <span><?php _e( 'Use JavaScript method (for XHTML Strict compliance)', $this->domain ) ?></span></label>
250
+ </p><p><span><?php _e( 'Target:', $this->domain ) ?></span>
251
+ <br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" value="_blank" <?php checked( '_blank', $options['target'] ); ?> />
252
+ <span><?php _e( '_blank, opens every external link in a new window (or tab)', $this->domain ) ?></span></label>
253
+ <br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" value="_new" <?php checked( '_new', $options['target'] ); ?> />
254
+ <span><?php _e( '_new, opens all external link in the same new window (or tab)', $this->domain ) ?></span></label>
255
+ </p>
256
+ </div>
 
 
257
  </td>
258
  </tr>
259
  <tr>
301
  <div style="width:25%;float:left">
302
  <label><input type="radio" name="<?php echo $this->options_name ?>[icon]" value="0" <?php checked('0', (int) $options['icon']); ?> />
303
  <span><?php _e( 'No icon', $this->domain ) ?></span></label>
304
+ <?php for ( $x = 1; $x <= 17; $x++ ): ?>
305
  <br/><label><input type="radio" name="<?php echo $this->options_name ?>[icon]" value="<?php echo $x ?>" <?php checked( $x, (int) $options['icon'] ); ?> />
306
  <img src="<?php echo plugins_url( 'images/external-'. $x .'.png', __FILE__ ) ?>" /></label>
307
  <?php endfor; ?>
326
  <div class="inside">
327
  <ul>
328
  <li><a href="<?php echo plugins_url( 'readme.txt', __FILE__ ) ?>" target="_blank">readme.txt</a></li>
329
+ <li><a href="http://www.freelancephp.net/wp-external-links-plugin/" target="_blank"><?php _e( 'Plugin on ', $this->domain ) ?> FreelancePHP.net</a></li>
330
+ <li><a href="http://wordpress.org/extend/plugins/wp-external-links/" target="_blank"><?php _e( 'Plugin on ', $this->domain ) ?> WordPress.org</a></li>
331
  <li><a href="http://www.freelancephp.net/contact/" target="_blank"><?php _e( 'Contact the author', $this->domain ) ?></a></li>
332
  </ul>
333
  </div>
367
 
368
  if ( ! empty( $saved_options ) ) {
369
  // set saved option values
370
+ if ( isset( $saved_options['new_window'] ) AND ! isset( $saved_options['target'] ) ) {
371
+ // convert values from version <= 0.11
372
+ $new_window = ( empty( $saved_options['new_window'] ) ) ? $this->options['new_window'] : $saved_options['new_window'];
373
+ $this->options['new_window'] = ( $new_window != 1 );
374
+ $this->options['use_js'] = ( $new_window == 4 OR $new_window == 5 );
375
+ $this->options['target'] = ( $new_window == 2 OR $new_window == 4 ) ? '_blank' : '_new';
376
+ } else {
377
+ $this->options['new_window'] = ! empty( $saved_options['new_window'] );
378
+ $this->options['use_js'] = ! empty( $saved_options['use_js'] );
379
+ $this->options['target'] = $saved_options['target'];
380
+ }
381
  $this->options['external'] = ! empty( $saved_options['external'] );
382
  $this->options['nofollow'] = ! empty( $saved_options['nofollow'] );
383
  $this->options['icon'] = $saved_options['icon'];