Version Description
- Improved Admin Options, f.e. target option looks more like the Blogroll target option
- Added option for choosing which content should be filtered
Download this release
Release Info
Developer | freelancephp |
Plugin | WP External Links (nofollow new tab seo) |
Version | 0.30 |
Comparing to | |
See all releases |
Code changes from version 0.21 to 0.30
- js/external-links.js +10 -8
- readme.txt +21 -11
- wp-external-links.php +118 -62
js/external-links.js
CHANGED
@@ -14,10 +14,11 @@
|
|
14 |
}
|
15 |
},
|
16 |
init = function () {
|
17 |
-
|
|
|
18 |
};
|
19 |
|
20 |
-
function setExtLinks() {
|
21 |
var links = w.document.getElementsByTagName( 'a' );
|
22 |
|
23 |
// check each <a> element
|
@@ -26,17 +27,18 @@
|
|
26 |
href = a.href ? a.href.toLowerCase() : '',
|
27 |
rel = a.rel ? a.rel.toLowerCase() : '';
|
28 |
|
29 |
-
if ( a.href
|
30 |
-
|
|
|
31 |
( href.substr( 0, 7 ) == 'http://'
|
32 |
|| href.substr( 0, 8 ) == 'https://'
|
33 |
|| href.substr( 0, 6 ) == 'ftp://' ) ) ) ) {
|
34 |
|
35 |
-
// click event
|
36 |
addEvt( a, 'click', function( a ){
|
37 |
return function( e ){
|
38 |
// open link in a new window
|
39 |
-
var n = w.open( a.href,
|
40 |
n.focus();
|
41 |
|
42 |
// prevent default
|
@@ -50,10 +52,10 @@
|
|
50 |
}
|
51 |
|
52 |
if ( $ ) {
|
53 |
-
// jQuery method
|
54 |
$( init );
|
55 |
} else {
|
56 |
-
// when jQuery
|
57 |
addEvt( w, 'load', init );
|
58 |
}
|
59 |
|
14 |
}
|
15 |
},
|
16 |
init = function () {
|
17 |
+
if ( typeof wpExtLinks != 'undefined' )
|
18 |
+
setExtLinks( wpExtLinks );
|
19 |
};
|
20 |
|
21 |
+
function setExtLinks( options ) {
|
22 |
var links = w.document.getElementsByTagName( 'a' );
|
23 |
|
24 |
// check each <a> element
|
27 |
href = a.href ? a.href.toLowerCase() : '',
|
28 |
rel = a.rel ? a.rel.toLowerCase() : '';
|
29 |
|
30 |
+
if ( a.href && ( options.excludeClass.length == 0 || a.className.indexOf( options.excludeClass ) )
|
31 |
+
&& ( rel.indexOf( 'external' ) > -1
|
32 |
+
|| ( ( href.indexOf( options.baseUrl ) === -1 ) &&
|
33 |
( href.substr( 0, 7 ) == 'http://'
|
34 |
|| href.substr( 0, 8 ) == 'https://'
|
35 |
|| href.substr( 0, 6 ) == 'ftp://' ) ) ) ) {
|
36 |
|
37 |
+
// click event for opening in a new window
|
38 |
addEvt( a, 'click', function( a ){
|
39 |
return function( e ){
|
40 |
// open link in a new window
|
41 |
+
var n = w.open( a.href, options.target );
|
42 |
n.focus();
|
43 |
|
44 |
// prevent default
|
52 |
}
|
53 |
|
54 |
if ( $ ) {
|
55 |
+
// jQuery DOMready method
|
56 |
$( init );
|
57 |
} else {
|
58 |
+
// use onload when jQuery not available
|
59 |
addEvt( w, 'load', init );
|
60 |
}
|
61 |
|
readme.txt
CHANGED
@@ -1,31 +1,32 @@
|
|
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.
|
7 |
|
8 |
-
Manage
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
Manage the external links on your site.
|
13 |
|
14 |
= Features =
|
15 |
-
*
|
16 |
-
*
|
17 |
* Choose an icon for external links
|
18 |
* Set a No-Icon class and/or an additional class (for your own styling)
|
19 |
-
*
|
20 |
-
*
|
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 |
-
|
27 |
-
1.
|
28 |
-
1.
|
|
|
29 |
|
30 |
== Frequently Asked Questions ==
|
31 |
|
@@ -38,6 +39,10 @@ More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-pl
|
|
38 |
|
39 |
== Changelog ==
|
40 |
|
|
|
|
|
|
|
|
|
41 |
= 0.21 =
|
42 |
* Solved bug removing icon stylesheet
|
43 |
|
@@ -62,5 +67,10 @@ More info at [FreelancePHP.net](http://www.freelancephp.net/wp-external-links-pl
|
|
62 |
* Replaces external links by clean XHTML <a> tags
|
63 |
* Internalization implemented (no language files yet)
|
64 |
|
|
|
|
|
|
|
|
|
|
|
65 |
== Other notes ==
|
66 |
* 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)
|
1 |
+
=== WP External Links ===
|
2 |
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 |
|
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
|
45 |
+
|
46 |
= 0.21 =
|
47 |
* Solved bug removing icon stylesheet
|
48 |
|
67 |
* Replaces external links by clean XHTML <a> tags
|
68 |
* Internalization implemented (no language files yet)
|
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)
|
wp-external-links.php
CHANGED
@@ -2,9 +2,9 @@
|
|
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"
|
6 |
Author: Victor Villaverde Laan
|
7 |
-
Version: 0.
|
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.
|
23 |
|
24 |
/**
|
25 |
* Used as prefix for options entry and could be used as text domain (for translations)
|
@@ -38,13 +38,17 @@ class WP_External_Links {
|
|
38 |
* @var array
|
39 |
*/
|
40 |
var $options = array(
|
41 |
-
'
|
42 |
-
'use_js' =>
|
43 |
-
'
|
44 |
-
'
|
45 |
-
'
|
46 |
-
'
|
|
|
|
|
|
|
47 |
'no_icon_class' => 'no-ext-icon',
|
|
|
48 |
'class_name' => 'ext-link',
|
49 |
);
|
50 |
|
@@ -61,17 +65,49 @@ class WP_External_Links {
|
|
61 |
function __construct() {
|
62 |
// set option values
|
63 |
$this->_set_options();
|
64 |
-
|
65 |
// load text domain for translations
|
66 |
load_plugin_textdomain( $this->domain, dirname( __FILE__ ) . '/lang/', basename( dirname(__FILE__) ) . '/lang/' );
|
67 |
|
68 |
// add actions
|
69 |
-
add_action( 'init', array( $this, 'init' )
|
70 |
-
add_action( 'admin_init', array( $this, 'admin_init' )
|
71 |
-
add_action( 'admin_menu', array( $this, 'admin_menu' )
|
72 |
|
73 |
// add filters
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
// set uninstall hook
|
77 |
if ( function_exists( 'register_deactivation_hook' ) )
|
@@ -120,14 +156,14 @@ class WP_External_Links {
|
|
120 |
* Callback wp_head
|
121 |
*/
|
122 |
function wp_head() {
|
123 |
-
if ( $this->options[ 'use_js' ] ):
|
|
|
|
|
|
|
124 |
?>
|
125 |
<script language="javascript">/* <![CDATA[ */
|
126 |
/* WP External Links Plugin */
|
127 |
-
var
|
128 |
-
baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',
|
129 |
-
target: '<?php echo $this->options[ 'target' ] ?>'
|
130 |
-
};
|
131 |
/* ]]> */</script>
|
132 |
<?php
|
133 |
endif;
|
@@ -152,6 +188,8 @@ var gExtLinks = {
|
|
152 |
return $content;
|
153 |
}
|
154 |
|
|
|
|
|
155 |
/**
|
156 |
* Make a clean <a> code
|
157 |
* @param array $match Result of a preg call in filter_content()
|
@@ -200,7 +238,7 @@ var gExtLinks = {
|
|
200 |
}
|
201 |
|
202 |
// set target
|
203 |
-
if ( $this->options[ '
|
204 |
$attrs[ 'target' ] = $this->options[ 'target' ];
|
205 |
}
|
206 |
|
@@ -245,11 +283,26 @@ jQuery(function( $ ){
|
|
245 |
.delay( 3000 )
|
246 |
.slideUp( 600 );
|
247 |
|
248 |
-
// option slide effect
|
249 |
-
$( 'input
|
250 |
.change(function(){
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
})
|
254 |
.change();
|
255 |
})
|
@@ -274,38 +327,50 @@ jQuery(function( $ ){
|
|
274 |
<fieldset class="options">
|
275 |
<table class="form-table">
|
276 |
<tr>
|
277 |
-
<th><?php _e( '
|
278 |
-
<td>
|
279 |
-
<label><input type="
|
280 |
-
<span><?php _e( '
|
281 |
-
<
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
</td>
|
293 |
</tr>
|
294 |
<tr>
|
295 |
<th><?php _e( 'Add "external"', $this->domain ) ?></th>
|
296 |
<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']); ?> />
|
297 |
-
<span><?php _e( '
|
298 |
</td>
|
299 |
</tr>
|
300 |
<tr>
|
301 |
<th><?php _e( 'Add "nofollow"', $this->domain ) ?></th>
|
302 |
<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']); ?> />
|
303 |
-
<span><?php _e( '
|
304 |
</td>
|
305 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
</table>
|
307 |
</fieldset>
|
308 |
-
<p class="description"><?php _e( 'This plugin automatically cleans up the code of <code><a></code> tags and makes them XHTML valid' ) ?></p>
|
309 |
<p class="submit">
|
310 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
311 |
</p>
|
@@ -328,7 +393,7 @@ jQuery(function( $ ){
|
|
328 |
<span><?php _e( 'No icon', $this->domain ) ?></span></label>
|
329 |
<?php for ( $x = 1; $x <= 20; $x++ ): ?>
|
330 |
<br/>
|
331 |
-
<label title="<?php
|
332 |
<img src="<?php echo plugins_url( 'images/external-'. $x .'.png', __FILE__ ) ?>" /></label>
|
333 |
<?php if ( $x % 5 == 0 ): ?>
|
334 |
</div>
|
@@ -346,7 +411,10 @@ jQuery(function( $ ){
|
|
346 |
<tr>
|
347 |
<th><?php _e( 'No-Icon Class', $this->domain ) ?></th>
|
348 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[no_icon_class]" name="<?php echo $this->options_name ?>[no_icon_class]" value="<?php echo $options['no_icon_class']; ?>" />
|
349 |
-
<span><?php _e( 'Use this class when a link should not show any icon', $this->domain ) ?></span></label
|
|
|
|
|
|
|
350 |
</tr>
|
351 |
<tr>
|
352 |
<th><?php _e( 'Additional Class (optional)', $this->domain ) ?></th>
|
@@ -410,26 +478,14 @@ jQuery(function( $ ){
|
|
410 |
// set options
|
411 |
$saved_options = get_option( $this->options_name );
|
412 |
|
|
|
413 |
if ( ! empty( $saved_options ) ) {
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
$this->options[
|
419 |
-
$this->options['use_js'] = ( $new_window == 4 OR $new_window == 5 );
|
420 |
-
$this->options['target'] = ( $new_window == 2 OR $new_window == 4 ) ? '_blank' : '_new';
|
421 |
-
} else {
|
422 |
-
$this->options['new_window'] = ! empty( $saved_options['new_window'] );
|
423 |
-
$this->options['use_js'] = ! empty( $saved_options['use_js'] );
|
424 |
-
$this->options['target'] = $saved_options['target'];
|
425 |
}
|
426 |
-
$this->options['external'] = ! empty( $saved_options['external'] );
|
427 |
-
$this->options['nofollow'] = ! empty( $saved_options['nofollow'] );
|
428 |
-
$this->options['icon'] = $saved_options['icon'];
|
429 |
-
$this->options['no_icon_class'] = ( ! isset( $saved_options['no_icon_class'] ) )
|
430 |
-
? $this->options['no_icon_class']
|
431 |
-
: $saved_options['no_icon_class'];
|
432 |
-
$this->options['class_name'] = $saved_options['class_name'];
|
433 |
}
|
434 |
}
|
435 |
|
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 |
* 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)
|
38 |
* @var array
|
39 |
*/
|
40 |
var $options = array(
|
41 |
+
'target' => '_none',
|
42 |
+
'use_js' => 1,
|
43 |
+
'external' => 1,
|
44 |
+
'nofollow' => 1,
|
45 |
+
'filter_whole_page' => 1,
|
46 |
+
'filter_posts' => 1,
|
47 |
+
'filter_comments' => 1,
|
48 |
+
'filter_widgets' => 1,
|
49 |
+
'icon' => 0,
|
50 |
'no_icon_class' => 'no-ext-icon',
|
51 |
+
'no_icon_same_window' => 0,
|
52 |
'class_name' => 'ext-link',
|
53 |
);
|
54 |
|
65 |
function __construct() {
|
66 |
// set option values
|
67 |
$this->_set_options();
|
68 |
+
|
69 |
// load text domain for translations
|
70 |
load_plugin_textdomain( $this->domain, dirname( __FILE__ ) . '/lang/', basename( dirname(__FILE__) ) . '/lang/' );
|
71 |
|
72 |
// add actions
|
73 |
+
add_action( 'init', array( $this, 'init' ) );
|
74 |
+
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
75 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
76 |
|
77 |
// add filters
|
78 |
+
if ( $this->options[ 'filter_whole_page' ] ) {
|
79 |
+
add_action( 'wp', array( $this, 'wp' ), 1 );
|
80 |
+
} else {
|
81 |
+
// set filter priority
|
82 |
+
$priority = 1000000000;
|
83 |
+
|
84 |
+
// content
|
85 |
+
if ( $this->options[ 'filter_posts' ] ) {
|
86 |
+
add_filter( 'the_title', array( $this, 'filter_content' ), $priority );
|
87 |
+
add_filter( 'the_content', array( $this, 'filter_content' ), $priority );
|
88 |
+
add_filter( 'the_excerpt', array( $this, 'filter_content' ), $priority );
|
89 |
+
add_filter( 'get_the_excerpt', array( $this, 'filter_content' ), $priority );
|
90 |
+
}
|
91 |
+
|
92 |
+
// comments
|
93 |
+
if ( $this->options[ 'filter_comments' ] ) {
|
94 |
+
add_filter( 'comment_text', array( $this, 'filter_content' ), $priority );
|
95 |
+
add_filter( 'comment_excerpt', array( $this, 'filter_content' ), $priority );
|
96 |
+
add_filter( 'comment_url', array( $this, 'filter_content' ), $priority );
|
97 |
+
add_filter( 'get_comment_author_url', array( $this, 'filter_content' ), $priority );
|
98 |
+
add_filter( 'get_comment_author_link', array( $this, 'filter_content' ), $priority );
|
99 |
+
add_filter( 'get_comment_author_url_link', array( $this, 'filter_content' ), $priority );
|
100 |
+
}
|
101 |
+
|
102 |
+
// widgets ( only text widgets )
|
103 |
+
if ( $this->options[ 'filter_widgets' ] ) {
|
104 |
+
add_filter( 'widget_title', array( $this, 'filter_content' ), $priority );
|
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 |
|
112 |
// set uninstall hook
|
113 |
if ( function_exists( 'register_deactivation_hook' ) )
|
156 |
* Callback wp_head
|
157 |
*/
|
158 |
function wp_head() {
|
159 |
+
if ( $this->options[ 'use_js' ] AND $this->options[ 'target' ] != '_none' ):
|
160 |
+
$excludeClass = ( $this->options[ 'no_icon_same_window' ] AND ! empty( $this->options[ 'no_icon_class' ] ) )
|
161 |
+
? $this->options[ 'no_icon_class' ]
|
162 |
+
: '';
|
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;
|
188 |
return $content;
|
189 |
}
|
190 |
|
191 |
+
|
192 |
+
|
193 |
/**
|
194 |
* Make a clean <a> code
|
195 |
* @param array $match Result of a preg call in filter_content()
|
238 |
}
|
239 |
|
240 |
// set target
|
241 |
+
if ( $this->options[ 'target' ] != '_none' AND ! $this->options[ 'use_js' ] AND ( ! $this->options[ 'no_icon_same_window' ] OR empty( $this->options[ 'no_icon_class' ] ) OR strpos( $attrs[ 'class' ], $this->options[ 'no_icon_class' ] ) === FALSE ) )
|
242 |
$attrs[ 'target' ] = $this->options[ 'target' ];
|
243 |
}
|
244 |
|
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(){
|
298 |
+
var $i = $( 'input#filter_posts, input#filter_comments, input#filter_widgets' );
|
299 |
+
|
300 |
+
if ( $( this ).attr( 'checked' ) ) {
|
301 |
+
$i.attr( 'disabled', true )
|
302 |
+
.attr( 'checked', true );
|
303 |
+
} else {
|
304 |
+
$i.attr( 'disabled', false )
|
305 |
+
}
|
306 |
})
|
307 |
.change();
|
308 |
})
|
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>
|
334 |
+
<br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_top" <?php checked( '_top', $options['target'] ); ?> />
|
335 |
+
<span><?php _e( '<code>_top</code>, open in current window or tab, with no frames', $this->domain ) ?></span></label>
|
336 |
+
<br/><label><input type="radio" name="<?php echo $this->options_name ?>[target]" class="field_target" value="_new" <?php checked( '_new', $options['target'] ); ?> />
|
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><body></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><a></code> tags in the selected contents will be converted to XHTML valid code' ) ?></span>
|
371 |
+
</td>
|
372 |
</table>
|
373 |
</fieldset>
|
|
|
374 |
<p class="submit">
|
375 |
<input class="button-primary" type="submit" value="<?php _e( 'Save Changes' ) ?>" />
|
376 |
</p>
|
393 |
<span><?php _e( 'No icon', $this->domain ) ?></span></label>
|
394 |
<?php for ( $x = 1; $x <= 20; $x++ ): ?>
|
395 |
<br/>
|
396 |
+
<label title="<?php echo sprintf( __( 'Icon %1$s: choose this icon to show for all external links or add the class \'ext-icon-%1$s\' to a specific link.' ), $x ) ?>"><input type="radio" name="<?php echo $this->options_name ?>[icon]" value="<?php echo $x ?>" <?php checked( $x, (int) $options['icon'] ); ?> />
|
397 |
<img src="<?php echo plugins_url( 'images/external-'. $x .'.png', __FILE__ ) ?>" /></label>
|
398 |
<?php if ( $x % 5 == 0 ): ?>
|
399 |
</div>
|
411 |
<tr>
|
412 |
<th><?php _e( 'No-Icon Class', $this->domain ) ?></th>
|
413 |
<td><label><input type="text" id="<?php echo $this->options_name ?>[no_icon_class]" name="<?php echo $this->options_name ?>[no_icon_class]" value="<?php echo $options['no_icon_class']; ?>" />
|
414 |
+
<span><?php _e( 'Use this class when a link should not show any icon', $this->domain ) ?></span></label>
|
415 |
+
<br/><label><input type="checkbox" name="<?php echo $this->options_name ?>[no_icon_same_window]" id="no_icon_same_window" value="1" <?php checked( '1', (int) $options['no_icon_same_window'] ); ?> />
|
416 |
+
<span><?php _e( 'Always open no-icon links in current window', $this->domain ) ?></span></label>
|
417 |
+
</td>
|
418 |
</tr>
|
419 |
<tr>
|
420 |
<th><?php _e( 'Additional Class (optional)', $this->domain ) ?></th>
|
478 |
// set options
|
479 |
$saved_options = get_option( $this->options_name );
|
480 |
|
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 ];
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
490 |
}
|
491 |
|