Version Description
- Re-arranged options in metaboxes
- Added option for no icons on images
Download this release
Release Info
Developer | freelancephp |
Plugin | WP External Links (nofollow new tab seo) |
Version | 1.30 |
Comparing to | |
See all releases |
Code changes from version 1.21 to 1.30
- includes/class-admin-external-links.php +180 -95
- includes/class-wp-external-links.php +30 -15
- includes/wp-plugin-dev-classes/class-wp-option-forms.php +10 -3
- js/admin-external-links.js +2 -2
- js/external-links.js +7 -1
- readme.txt +18 -8
- wp-external-links.php +2 -2
includes/class-admin-external-links.php
CHANGED
@@ -11,31 +11,36 @@ final class Admin_External_Links {
|
|
11 |
* Options to be saved and their default values
|
12 |
* @var array
|
13 |
*/
|
14 |
-
|
15 |
'meta' => array(
|
16 |
'version' => NULL,
|
17 |
),
|
18 |
-
'
|
19 |
'target' => '_none',
|
20 |
'use_js' => 1,
|
21 |
-
'external' => 1,
|
22 |
-
'nofollow' => 1,
|
23 |
-
'title' => '%title%',
|
24 |
'filter_page' => 1,
|
25 |
'filter_posts' => 1,
|
26 |
'filter_comments' => 1,
|
27 |
'filter_widgets' => 1,
|
28 |
-
'class_name' => 'ext-link',
|
29 |
'ignore' => 'http://twitter.com/share',
|
30 |
-
|
31 |
-
|
32 |
-
'
|
|
|
|
|
33 |
),
|
34 |
'style' => array(
|
|
|
35 |
'icon' => 0,
|
|
|
36 |
'no_icon_class' => 'no-ext-icon',
|
37 |
'no_icon_same_window' => 0,
|
38 |
),
|
|
|
|
|
|
|
|
|
|
|
39 |
'screen' => array(
|
40 |
'menu_position' => NULL,
|
41 |
),
|
@@ -52,17 +57,21 @@ final class Admin_External_Links {
|
|
52 |
* @var WP_Ajax_Option_Form
|
53 |
*/
|
54 |
public $form = NULL;
|
|
|
55 |
|
56 |
|
57 |
/**
|
58 |
* Constructor
|
59 |
*/
|
60 |
public function __construct() {
|
|
|
|
|
61 |
// set meta box page
|
62 |
$this->meta_box_page = new WP_Meta_Box_Page_01();
|
63 |
|
64 |
// set ajax forms (also used by front-end)
|
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' ) );
|
@@ -95,10 +104,8 @@ final class Admin_External_Links {
|
|
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(
|
102 |
|
103 |
// load text domain for translations
|
104 |
load_plugin_textdomain( WP_EXTERNAL_LINKS_KEY, FALSE, dirname( plugin_basename( WP_EXTERNAL_LINKS_FILE ) ) . '/lang/' );
|
@@ -134,7 +141,9 @@ final class Admin_External_Links {
|
|
134 |
// add meta boxes
|
135 |
// add_meta_box( $title, $callback, $context = 'normal', $id = NULL, $priority = 'default', $callback_args = NULL )
|
136 |
$meta_box->add_meta_box( $this->__( 'General Settings' ), array( $this, 'call_box_general_settings' ), 1 )
|
|
|
137 |
->add_meta_box( $this->__( 'Style Settings' ), array( $this, 'call_box_style_settings' ), 1 )
|
|
|
138 |
->add_meta_box( $this->__( 'About this Plugin' ), array( $this, 'call_box_about' ), 2 )
|
139 |
->add_meta_box( $this->__( 'Other Plugins' ), array( $this, 'call_box_other_plugins' ), 2 );
|
140 |
|
@@ -211,73 +220,48 @@ final class Admin_External_Links {
|
|
211 |
* Meta Box: General Settings
|
212 |
*/
|
213 |
public function call_box_general_settings() {
|
214 |
-
echo $this->form->set_current_option( '
|
215 |
?>
|
216 |
<fieldset class="options">
|
217 |
<table class="form-table">
|
218 |
<tr>
|
219 |
-
<th style="width:
|
220 |
<?php echo $this->tooltip_help( 'Specify the target (window or tab) for opening external links.' ) ?></th>
|
221 |
<td class="target_external_links">
|
|
|
|
|
|
|
|
|
222 |
<label><?php echo $this->form->radio( 'target', '_blank', array( 'class' => 'field_target' ) ); ?>
|
223 |
-
<span><?php $this->_e( '<code>_blank</code
|
224 |
<?php echo $this->tooltip_help( 'Open every external link in a new window or tab.' ) ?>
|
225 |
-
<br/>
|
226 |
<label><?php echo $this->form->radio( 'target', '_top', array( 'class' => 'field_target' ) ); ?>
|
227 |
-
<span><?php $this->_e( '<code>_top</code
|
228 |
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the topmost frame.' ) ?>
|
229 |
<br/>
|
230 |
<label><?php echo $this->form->radio( 'target', '_new', array( 'class' => 'field_target' ) ); ?>
|
231 |
-
<span><?php $this->_e( '<code>_new</code
|
232 |
<?php echo $this->tooltip_help( 'Open new window the first time and use this window for each external link.' ) ?>
|
233 |
-
<br/>
|
234 |
-
<label><?php echo $this->form->radio( 'target', '_none', array( 'class' => 'field_target' ) ); ?>
|
235 |
-
<span><?php $this->_e( '<code>_none</code>, current window' ) ?></span></label>
|
236 |
-
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the same frame.' ) ?>
|
237 |
</td>
|
238 |
</tr>
|
239 |
<tr>
|
240 |
-
<th><?php $this->_e( '
|
241 |
-
|
242 |
-
|
243 |
-
<span><?php $this->_e( 'Add <code>"external"</code>' ) ?></span></label>
|
244 |
-
<?php echo $this->tooltip_help( 'Add "external" to the "rel"-attribute of external links.' ) ?>
|
245 |
-
<br/><label><?php echo $this->form->checkbox( 'nofollow', 1 ); ?>
|
246 |
-
<span><?php $this->_e( 'Add <code>"nofollow"</code>' ) ?></span></label>
|
247 |
-
<?php echo $this->tooltip_help( 'Add "nofollow" to the "rel"-attribute of external links (unless link already has "follow").' ) ?>
|
248 |
-
</td>
|
249 |
-
</tr>
|
250 |
-
<tr>
|
251 |
-
<th><?php $this->_e( 'Add to <code>class</code>-attribute' ) ?>
|
252 |
-
<?php echo $this->tooltip_help( 'Add one or more extra classes to the external links, seperated by a space. It is optional, else just leave field blank.' ) ?></th>
|
253 |
-
<td><label><?php echo $this->form->text( 'class_name' ); ?></label></td>
|
254 |
-
</tr>
|
255 |
-
<tr>
|
256 |
-
<th><?php $this->_e( 'Set <code>title</code>-attribute' ) ?>
|
257 |
-
<?php echo $this->tooltip_help( 'Set title attribute for external links. Use %title% for the original title value.' ) ?></th>
|
258 |
-
<td><label><?php echo $this->form->text( 'title' ); ?>
|
259 |
-
<br/><span class="description"><?php _e( 'Use <code>%title%</code> for the original title value.' ) ?></span></label></td>
|
260 |
-
</tr>
|
261 |
-
</table>
|
262 |
-
|
263 |
-
<?php echo $this->hr(); ?>
|
264 |
-
|
265 |
-
<table class="form-table">
|
266 |
-
<tr>
|
267 |
-
<th style="width:300px;"><?php $this->_e( 'Valid XHTML Strict' ) ?>
|
268 |
-
<?php echo $this->tooltip_help( 'The "target"-attribute is not valid XHTML strict code. Enable this option to remove the target from external links and use the JavaScript method (built-in this plugin) for opening links.' ) ?></th>
|
269 |
<td>
|
270 |
<label><?php echo $this->form->checkbox( 'use_js', 1, array( 'class' => 'field_use_js' ) ); ?>
|
271 |
-
<span><?php $this->_e( 'Use JavaScript for opening links
|
272 |
</td>
|
273 |
</tr>
|
274 |
</table>
|
275 |
|
276 |
<?php echo $this->hr(); ?>
|
277 |
|
|
|
278 |
<table class="form-table">
|
279 |
<tr>
|
280 |
-
<th style="width:
|
281 |
<?php echo $this->tooltip_help( 'Choose contents for applying settings to external links.' ) ?></th>
|
282 |
<td>
|
283 |
<label><?php echo $this->form->checkbox( 'filter_page', 1 ); ?>
|
@@ -299,40 +283,48 @@ final class Admin_External_Links {
|
|
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
|
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 |
-
|
|
|
|
|
|
|
311 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
<table class="form-table">
|
313 |
<tr>
|
314 |
-
<th style="width:
|
315 |
-
<?php echo $this->tooltip_help( '
|
316 |
-
<td><label><?php echo $this->form->checkbox( '
|
317 |
-
<span><?php $this->_e( '
|
318 |
-
<?php echo $this->tooltip_help( '
|
319 |
<br/>
|
320 |
-
<label><?php echo $this->form->checkbox( '
|
321 |
-
<span><?php $this->_e( '
|
322 |
-
<?php echo $this->tooltip_help( '
|
323 |
</td>
|
324 |
</tr>
|
325 |
-
<tr
|
326 |
-
<th><?php $this->_e( '
|
327 |
-
|
328 |
-
<td><label><?php echo $this->form->
|
329 |
-
|
330 |
-
</td>
|
331 |
</tr>
|
332 |
</table>
|
333 |
</fieldset>
|
334 |
-
|
335 |
-
<p style="position:absolute;"><a id="admin_menu_position" href="#"><?php _e( 'Change menu position in "Screen Options"' ) ?></a></p>
|
336 |
<?php
|
337 |
echo $this->form->submit();
|
338 |
echo $this->form->close_form();
|
@@ -347,7 +339,7 @@ final class Admin_External_Links {
|
|
347 |
<fieldset class="options">
|
348 |
<table class="form-table">
|
349 |
<tr>
|
350 |
-
<th style="width:
|
351 |
<?php echo $this->tooltip_help( 'Set an icon that wll be shown for external links. See example on the right side.' ) ?></th>
|
352 |
<td>
|
353 |
<div>
|
@@ -373,7 +365,14 @@ final class Admin_External_Links {
|
|
373 |
</td>
|
374 |
</tr>
|
375 |
<tr>
|
376 |
-
<th
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
<?php echo $this->tooltip_help( 'Set this class for links, that should not have the external link icon.' ) ?></th>
|
378 |
<td><label><?php echo $this->form->text( 'no_icon_class', array( 'class' => '' ) ); ?></label>
|
379 |
<br/><label><?php echo $this->form->checkbox( 'no_icon_same_window', 1 ); ?>
|
@@ -381,6 +380,55 @@ final class Admin_External_Links {
|
|
381 |
<?php echo $this->tooltip_help( 'When enabled external links containing the no-icon class will always be opened in the current window or tab. No matter which target is set.' ) ?>
|
382 |
</td>
|
383 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
</table>
|
385 |
</fieldset>
|
386 |
<?php
|
@@ -460,23 +508,22 @@ final class Admin_External_Links {
|
|
460 |
if ( ! empty( $old_options ) ) {
|
461 |
$new_options = $this->save_options;
|
462 |
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
$new_options[ 'style' ][ 'no_icon_same_window' ] = $old_options[ 'no_icon_same_window' ];
|
476 |
-
}
|
477 |
|
478 |
// save new format option values
|
479 |
-
update_option( 'wp_external_links-
|
|
|
480 |
update_option( 'wp_external_links-style', $new_options[ 'style' ] );
|
481 |
|
482 |
// delete old format option values
|
@@ -484,19 +531,57 @@ final class Admin_External_Links {
|
|
484 |
}
|
485 |
|
486 |
// upgrade to v1.20
|
487 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
update_option( 'wp_external_links-general', $upgrade_general );
|
492 |
}
|
493 |
}
|
494 |
|
495 |
/**
|
496 |
* Uninstall callback
|
497 |
*/
|
498 |
-
public function call_uninstall() {
|
499 |
-
|
500 |
}
|
501 |
|
502 |
/**
|
11 |
* Options to be saved and their default values
|
12 |
* @var array
|
13 |
*/
|
14 |
+
public $save_options = array(
|
15 |
'meta' => array(
|
16 |
'version' => NULL,
|
17 |
),
|
18 |
+
'main' => array(
|
19 |
'target' => '_none',
|
20 |
'use_js' => 1,
|
|
|
|
|
|
|
21 |
'filter_page' => 1,
|
22 |
'filter_posts' => 1,
|
23 |
'filter_comments' => 1,
|
24 |
'filter_widgets' => 1,
|
|
|
25 |
'ignore' => 'http://twitter.com/share',
|
26 |
+
),
|
27 |
+
'seo' => array(
|
28 |
+
'external' => 1,
|
29 |
+
'nofollow' => 1,
|
30 |
+
'title' => '%title%',
|
31 |
),
|
32 |
'style' => array(
|
33 |
+
'class_name' => 'ext-link',
|
34 |
'icon' => 0,
|
35 |
+
'image_no_icon' => 1,
|
36 |
'no_icon_class' => 'no-ext-icon',
|
37 |
'no_icon_same_window' => 0,
|
38 |
),
|
39 |
+
'extra' => array(
|
40 |
+
'fix_js' => 0,
|
41 |
+
'phpquery' => 0,
|
42 |
+
'filter_excl_sel' => '.excl-ext-link',
|
43 |
+
),
|
44 |
'screen' => array(
|
45 |
'menu_position' => NULL,
|
46 |
),
|
57 |
* @var WP_Ajax_Option_Form
|
58 |
*/
|
59 |
public $form = NULL;
|
60 |
+
static public $staticForm = NULL;
|
61 |
|
62 |
|
63 |
/**
|
64 |
* Constructor
|
65 |
*/
|
66 |
public function __construct() {
|
67 |
+
$this->check_version_update();
|
68 |
+
|
69 |
// set meta box page
|
70 |
$this->meta_box_page = new WP_Meta_Box_Page_01();
|
71 |
|
72 |
// set ajax forms (also used by front-end)
|
73 |
$this->form = new WP_Option_Forms_01( WP_EXTERNAL_LINKS_KEY, $this->save_options );
|
74 |
+
self::$staticForm = $this->form;
|
75 |
|
76 |
// init admin
|
77 |
add_action( 'admin_init', array( $this, 'admin_init' ) );
|
104 |
* Initialize Admin
|
105 |
*/
|
106 |
public function admin_init() {
|
|
|
|
|
107 |
// set uninstall hook
|
108 |
+
register_uninstall_hook( WP_EXTERNAL_LINKS_FILE, array( 'Admin_External_Links', 'call_uninstall' ) );
|
109 |
|
110 |
// load text domain for translations
|
111 |
load_plugin_textdomain( WP_EXTERNAL_LINKS_KEY, FALSE, dirname( plugin_basename( WP_EXTERNAL_LINKS_FILE ) ) . '/lang/' );
|
141 |
// add meta boxes
|
142 |
// add_meta_box( $title, $callback, $context = 'normal', $id = NULL, $priority = 'default', $callback_args = NULL )
|
143 |
$meta_box->add_meta_box( $this->__( 'General Settings' ), array( $this, 'call_box_general_settings' ), 1 )
|
144 |
+
->add_meta_box( $this->__( 'SEO Settings' ), array( $this, 'call_box_seo_settings' ), 1 )
|
145 |
->add_meta_box( $this->__( 'Style Settings' ), array( $this, 'call_box_style_settings' ), 1 )
|
146 |
+
->add_meta_box( $this->__( 'Extra Settings' ), array( $this, 'call_box_extra_settings' ), 1 )
|
147 |
->add_meta_box( $this->__( 'About this Plugin' ), array( $this, 'call_box_about' ), 2 )
|
148 |
->add_meta_box( $this->__( 'Other Plugins' ), array( $this, 'call_box_other_plugins' ), 2 );
|
149 |
|
220 |
* Meta Box: General Settings
|
221 |
*/
|
222 |
public function call_box_general_settings() {
|
223 |
+
echo $this->form->set_current_option( 'main' )->open_form();
|
224 |
?>
|
225 |
<fieldset class="options">
|
226 |
<table class="form-table">
|
227 |
<tr>
|
228 |
+
<th style="width:250px;"><?php $this->_e( 'Open external links in...' ) ?>
|
229 |
<?php echo $this->tooltip_help( 'Specify the target (window or tab) for opening external links.' ) ?></th>
|
230 |
<td class="target_external_links">
|
231 |
+
<label><?php echo $this->form->radio( 'target', '_none', array( 'class' => 'field_target' ) ); ?>
|
232 |
+
<span><?php $this->_e( 'Same window or tab (<code>_none</code>)' ) ?></span></label>
|
233 |
+
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the same frame.' ) ?>
|
234 |
+
<br/>
|
235 |
<label><?php echo $this->form->radio( 'target', '_blank', array( 'class' => 'field_target' ) ); ?>
|
236 |
+
<span><?php $this->_e( 'New window or tab (<code>_blank</code>)' ) ?></span></label>
|
237 |
<?php echo $this->tooltip_help( 'Open every external link in a new window or tab.' ) ?>
|
238 |
+
<br style="margin-bottom:15px;" />
|
239 |
<label><?php echo $this->form->radio( 'target', '_top', array( 'class' => 'field_target' ) ); ?>
|
240 |
+
<span><?php $this->_e( 'Topmost frame (<code>_top</code>)' ) ?></span></label>
|
241 |
<?php echo $this->tooltip_help( 'Open in current window or tab, when framed in the topmost frame.' ) ?>
|
242 |
<br/>
|
243 |
<label><?php echo $this->form->radio( 'target', '_new', array( 'class' => 'field_target' ) ); ?>
|
244 |
+
<span><?php $this->_e( 'Seperate window or tab (<code>_new</code>)' ) ?></span></label>
|
245 |
<?php echo $this->tooltip_help( 'Open new window the first time and use this window for each external link.' ) ?>
|
|
|
|
|
|
|
|
|
246 |
</td>
|
247 |
</tr>
|
248 |
<tr>
|
249 |
+
<th><?php $this->_e( 'Use JavaScript method' ) ?>
|
250 |
+
<?php echo $this->tooltip_help( 'Enable this option to use the JavaScript method for opening links, which prevents adding target attribute in the HTML code.' ) ?></label>
|
251 |
+
</th>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
<td>
|
253 |
<label><?php echo $this->form->checkbox( 'use_js', 1, array( 'class' => 'field_use_js' ) ); ?>
|
254 |
+
<span><?php $this->_e( 'Use JavaScript for opening links (valid XHTML Strict).' ) ?></span>
|
255 |
</td>
|
256 |
</tr>
|
257 |
</table>
|
258 |
|
259 |
<?php echo $this->hr(); ?>
|
260 |
|
261 |
+
<h4><?php $this->_e( 'Apply on' ) ?></h4>
|
262 |
<table class="form-table">
|
263 |
<tr>
|
264 |
+
<th style="width:250px;"><?php $this->_e( 'Apply plugin settings on...' ) ?>
|
265 |
<?php echo $this->tooltip_help( 'Choose contents for applying settings to external links.' ) ?></th>
|
266 |
<td>
|
267 |
<label><?php echo $this->form->checkbox( 'filter_page', 1 ); ?>
|
283 |
</td>
|
284 |
</tr>
|
285 |
<tr>
|
286 |
+
<th><?php $this->_e( 'Ignore links (URL) containing...' ) ?>
|
287 |
+
<?php echo $this->tooltip_help( 'This plugin will completely ignore links that contain one of the given texts in the URL. Use enter to seperate each text. This check is not case sensitive.' ) ?></th>
|
288 |
<td><label><?php echo $this->form->textarea( 'ignore' ); ?>
|
289 |
<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>
|
290 |
</td>
|
291 |
</tr>
|
292 |
</table>
|
293 |
+
</fieldset>
|
294 |
|
295 |
+
<?php
|
296 |
+
echo $this->form->submit();
|
297 |
+
echo $this->form->close_form();
|
298 |
+
}
|
299 |
|
300 |
+
/**
|
301 |
+
* Meta Box: SEO Settings
|
302 |
+
*/
|
303 |
+
public function call_box_seo_settings() {
|
304 |
+
echo $this->form->set_current_option( 'seo' )->open_form();
|
305 |
+
?>
|
306 |
+
<fieldset class="options">
|
307 |
<table class="form-table">
|
308 |
<tr>
|
309 |
+
<th style="width:250px;"><?php $this->_e( 'Add to <code>rel</code>-attribute' ) ?>
|
310 |
+
<?php echo $this->tooltip_help( 'Set values for the "rel"-atribute of external links.' ) ?></th>
|
311 |
+
<td><label><?php echo $this->form->checkbox( 'nofollow', 1 ); ?>
|
312 |
+
<span><?php $this->_e( 'Add <code>"nofollow"</code>' ) ?></span></label>
|
313 |
+
<?php echo $this->tooltip_help( 'Add "nofollow" to the "rel"-attribute of external links (unless link already has "follow").' ) ?>
|
314 |
<br/>
|
315 |
+
<label><?php echo $this->form->checkbox( 'external', 1 ); ?>
|
316 |
+
<span><?php $this->_e( 'Add <code>"external"</code>' ) ?></span></label>
|
317 |
+
<?php echo $this->tooltip_help( 'Add "external" to the "rel"-attribute of external links.' ) ?>
|
318 |
</td>
|
319 |
</tr>
|
320 |
+
<tr>
|
321 |
+
<th><?php $this->_e( 'Set <code>title</code>-attribute' ) ?>
|
322 |
+
<?php echo $this->tooltip_help( 'Set title attribute for external links. Use %title% for the original title value.' ) ?></th>
|
323 |
+
<td><label><?php echo $this->form->text( 'title' ); ?>
|
324 |
+
<br/><span class="description"><?php _e( 'Use <code>%title%</code> for the original title value.' ) ?></span></label></td>
|
|
|
325 |
</tr>
|
326 |
</table>
|
327 |
</fieldset>
|
|
|
|
|
328 |
<?php
|
329 |
echo $this->form->submit();
|
330 |
echo $this->form->close_form();
|
339 |
<fieldset class="options">
|
340 |
<table class="form-table">
|
341 |
<tr>
|
342 |
+
<th style="width:250px;"><?php $this->_e( 'Set icon for external link' ) ?>
|
343 |
<?php echo $this->tooltip_help( 'Set an icon that wll be shown for external links. See example on the right side.' ) ?></th>
|
344 |
<td>
|
345 |
<div>
|
365 |
</td>
|
366 |
</tr>
|
367 |
<tr>
|
368 |
+
<th><?php $this->_e( 'Skip images' ) ?>
|
369 |
+
<?php echo $this->tooltip_help( 'Don\'t show icon for external links containing images.' ) ?></th>
|
370 |
+
<td><label><?php echo $this->form->checkbox( 'image_no_icon', 1 ); ?>
|
371 |
+
<span><?php $this->_e( 'No icon for extenal links with images' ) ?></span></label>
|
372 |
+
</td>
|
373 |
+
</tr>
|
374 |
+
<tr>
|
375 |
+
<th style="width:250px;"><?php $this->_e( 'Set no-icon class' ) ?>
|
376 |
<?php echo $this->tooltip_help( 'Set this class for links, that should not have the external link icon.' ) ?></th>
|
377 |
<td><label><?php echo $this->form->text( 'no_icon_class', array( 'class' => '' ) ); ?></label>
|
378 |
<br/><label><?php echo $this->form->checkbox( 'no_icon_same_window', 1 ); ?>
|
380 |
<?php echo $this->tooltip_help( 'When enabled external links containing the no-icon class will always be opened in the current window or tab. No matter which target is set.' ) ?>
|
381 |
</td>
|
382 |
</tr>
|
383 |
+
<tr>
|
384 |
+
<th><?php $this->_e( 'Add to <code>class</code>-attribute' ) ?>
|
385 |
+
<?php echo $this->tooltip_help( 'Add one or more extra classes to the external links, seperated by a space. It is optional, else just leave field blank.' ) ?></th>
|
386 |
+
<td><label><?php echo $this->form->text( 'class_name' ); ?></label></td>
|
387 |
+
</tr>
|
388 |
+
</table>
|
389 |
+
</fieldset>
|
390 |
+
<?php
|
391 |
+
echo $this->form->submit();
|
392 |
+
echo $this->form->close_form();
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Meta Box: Extra Settings
|
397 |
+
*/
|
398 |
+
public function call_box_extra_settings() {
|
399 |
+
echo $this->form->set_current_option( 'extra' )->open_form();
|
400 |
+
?>
|
401 |
+
<fieldset class="options">
|
402 |
+
<table class="form-table">
|
403 |
+
<tr>
|
404 |
+
<th style="width:250px;"><?php $this->_e( 'Solving problems' ) ?>
|
405 |
+
<?php echo $this->tooltip_help( 'Some options to try when a problem occurs. These options can also cause other problems, so be carefull.' ) ?></th>
|
406 |
+
<td><label><?php echo $this->form->checkbox( 'fix_js', 1 ); ?>
|
407 |
+
<span><?php $this->_e( 'Replacing <code></a></code> with <code><\/a></code> in JavaScript code.' ) ?></span></label>
|
408 |
+
<?php echo $this->tooltip_help( 'By replacing </a> with <\/a> in JavaScript code these tags will not be processed by the plugin.' ) ?>
|
409 |
+
</td>
|
410 |
+
</tr>
|
411 |
+
<tr>
|
412 |
+
<th style="width:250px;"><?php $this->_e( 'Use phpQuery library' ) ?>
|
413 |
+
<?php echo $this->tooltip_help( 'Using phpQuery library for manipulating links. This option is experimental.' ) ?></th>
|
414 |
+
<td><label><?php echo $this->form->checkbox( 'phpquery', 1 ); ?>
|
415 |
+
<span><?php $this->_e( 'Use phpQuery for parsing document.' ) ?></span>
|
416 |
+
<span class="description">(Test it first!)</span></label>
|
417 |
+
</td>
|
418 |
+
</tr>
|
419 |
+
<tr class="filter_excl_sel" <?php echo ( $this->form->value( 'phpquery' ) ) ? '' : 'style="display:none;"'; ?>>
|
420 |
+
<th><?php $this->_e( 'Do NOT apply settings on...' ) ?>
|
421 |
+
<?php echo $this->tooltip_help( 'The external links of these selection will be excluded for the settings of this plugin. Define the selection by using CSS selectors.' ) ?></th>
|
422 |
+
<td><label><?php echo $this->form->textarea( 'filter_excl_sel' ); ?>
|
423 |
+
<span class="description"><?php _e( 'Define selection by using CSS selectors, f.e.: <code>.excl-ext-link, .entry-title, #comments-title</code> (look <a href="http://code.google.com/p/phpquery/wiki/Selectors" target="_blank">here</a> for available selectors).' ) ?></span></label>
|
424 |
+
</td>
|
425 |
+
</tr>
|
426 |
+
<tr>
|
427 |
+
<th style="width:250px;"><?php $this->_e( 'Plugin menu position' ) ?>
|
428 |
+
<?php echo $this->tooltip_help( 'Change the menu position of this plugin in "Screen Options".' ) ?></th>
|
429 |
+
<td><label><a id="admin_menu_position" href="#"><?php _e( 'Change menu position' ) ?></a></label>
|
430 |
+
</td>
|
431 |
+
</tr>
|
432 |
</table>
|
433 |
</fieldset>
|
434 |
<?php
|
508 |
if ( ! empty( $old_options ) ) {
|
509 |
$new_options = $this->save_options;
|
510 |
|
511 |
+
$new_options[ 'main' ][ 'target' ] = $old_options[ 'target' ];
|
512 |
+
$new_options[ 'main' ][ 'use_js' ] = $old_options[ 'use_js' ];
|
513 |
+
$new_options[ 'main' ][ 'filter_page' ] = $old_options[ 'filter_whole_page' ];
|
514 |
+
$new_options[ 'main' ][ 'filter_posts' ] = $old_options[ 'filter_posts' ];
|
515 |
+
$new_options[ 'main' ][ 'filter_comments' ] = $old_options[ 'filter_comments' ];
|
516 |
+
$new_options[ 'main' ][ 'filter_widgets' ] = $old_options[ 'filter_widgets' ];
|
517 |
+
$new_options[ 'seo' ][ 'external' ] = $old_options[ 'external' ];
|
518 |
+
$new_options[ 'seo' ][ 'nofollow' ] = $old_options[ 'nofollow' ];
|
519 |
+
$new_options[ 'style' ][ 'class_name' ] = $old_options[ 'class_name' ];
|
520 |
+
$new_options[ 'style' ][ 'icon' ] = $old_options[ 'icon' ];
|
521 |
+
$new_options[ 'style' ][ 'no_icon_class' ] = $old_options[ 'no_icon_class' ];
|
522 |
+
$new_options[ 'style' ][ 'no_icon_same_window' ] = $old_options[ 'no_icon_same_window' ];
|
|
|
|
|
523 |
|
524 |
// save new format option values
|
525 |
+
update_option( 'wp_external_links-main', $new_options[ 'main' ] );
|
526 |
+
update_option( 'wp_external_links-seo', $new_options[ 'seo' ] );
|
527 |
update_option( 'wp_external_links-style', $new_options[ 'style' ] );
|
528 |
|
529 |
// delete old format option values
|
531 |
}
|
532 |
|
533 |
// upgrade to v1.20
|
534 |
+
$upgrade_main = get_option( 'wp_external_links-main' );
|
535 |
+
|
536 |
+
if ( ! isset( $upgrade_main[ 'ignore' ] ) ) {
|
537 |
+
$upgrade_main[ 'ignore' ] = $this->save_options[ 'main' ][ 'ignore' ];
|
538 |
+
update_option( 'wp_external_links-main', $upgrade_main );
|
539 |
+
}
|
540 |
+
|
541 |
+
// upgrade to v1.30
|
542 |
+
if ( WP_EXTERNAL_LINKS_VERSION == '1.30' ) {
|
543 |
+
$new_options = $this->save_options;
|
544 |
+
$general = get_option( 'wp_external_links-general' );
|
545 |
+
$style = get_option( 'wp_external_links-style' );
|
546 |
+
|
547 |
+
if ( isset( $general[ 'target' ] ) ) $new_options[ 'main' ][ 'target' ] = $general[ 'target' ];
|
548 |
+
$new_options[ 'main' ][ 'use_js' ] = ( isset( $general[ 'use_js' ] ) ) ? $general[ 'use_js' ] : 0;
|
549 |
+
$new_options[ 'main' ][ 'filter_page' ] = ( isset( $general[ 'filter_page' ] ) ) ? $general[ 'filter_page' ] : 0;
|
550 |
+
$new_options[ 'main' ][ 'filter_posts' ] = ( isset( $general[ 'filter_posts' ] ) ) ? $general[ 'filter_posts' ] : 0;
|
551 |
+
$new_options[ 'main' ][ 'filter_comments' ] = ( isset( $general[ 'filter_comments' ] ) ) ? $general[ 'filter_comments' ] : 0;
|
552 |
+
$new_options[ 'main' ][ 'filter_widgets' ] = ( isset( $general[ 'filter_widgets' ] ) ) ? $general[ 'filter_widgets' ] : 0;
|
553 |
+
if ( isset( $general[ 'ignore' ] ) ) $new_options[ 'main' ][ 'ignore' ] = $general[ 'ignore' ];
|
554 |
+
|
555 |
+
$new_options[ 'seo' ][ 'external' ] = ( isset( $general[ 'external' ] ) ) ? $general[ 'external' ] : 0;
|
556 |
+
$new_options[ 'seo' ][ 'nofollow' ] = ( isset( $general[ 'nofollow' ] ) ) ? $general[ 'nofollow' ] : 0;
|
557 |
+
if ( isset( $general[ 'title' ] ) ) $new_options[ 'seo' ][ 'title' ] = $general[ 'title' ];
|
558 |
+
|
559 |
+
if ( isset( $general[ 'class_name' ] ) ) $new_options[ 'style' ][ 'class_name' ] = $general[ 'class_name' ];
|
560 |
+
|
561 |
+
if ( isset( $style[ 'icon' ] ) ) $new_options[ 'style' ][ 'icon' ] = $style[ 'icon' ];
|
562 |
+
if ( isset( $style[ 'no_icon_class' ] ) ) $new_options[ 'style' ][ 'no_icon_class' ] = $style[ 'no_icon_class' ];
|
563 |
+
$new_options[ 'style' ][ 'no_icon_same_window' ] = ( isset( $style[ 'no_icon_same_window' ] ) ) ? $style[ 'no_icon_same_window' ] : 0;
|
564 |
+
|
565 |
+
$new_options[ 'extra' ][ 'fix_js' ] = ( isset( $general[ 'fix_js' ] ) ) ? $general[ 'fix_js' ] : 0;
|
566 |
+
$new_options[ 'extra' ][ 'phpquery' ] = ( isset( $general[ 'phpquery' ] ) ) ? $general[ 'phpquery' ] : 0;
|
567 |
+
if ( isset( $general[ 'filter_excl_sel' ] ) ) $new_options[ 'extra' ][ 'filter_excl_sel' ] = $general[ 'filter_excl_sel' ];
|
568 |
+
|
569 |
+
// save new format option values
|
570 |
+
update_option( 'wp_external_links-main', $new_options[ 'main' ] );
|
571 |
+
update_option( 'wp_external_links-seo', $new_options[ 'seo' ] );
|
572 |
+
update_option( 'wp_external_links-style', $new_options[ 'style' ] );
|
573 |
+
update_option( 'wp_external_links-extra', $new_options[ 'extra' ] );
|
574 |
|
575 |
+
// delete old format
|
576 |
+
delete_option( 'wp_external_links-general' );
|
|
|
577 |
}
|
578 |
}
|
579 |
|
580 |
/**
|
581 |
* Uninstall callback
|
582 |
*/
|
583 |
+
static public function call_uninstall() {
|
584 |
+
self::$staticForm->delete_options();
|
585 |
}
|
586 |
|
587 |
/**
|
includes/class-wp-external-links.php
CHANGED
@@ -3,6 +3,8 @@ if ( ! class_exists( 'WP_External_Links' ) ):
|
|
3 |
|
4 |
/**
|
5 |
* Class WP_External_Links
|
|
|
|
|
6 |
* @category WordPress Plugins
|
7 |
*/
|
8 |
final class WP_External_Links {
|
@@ -34,11 +36,19 @@ final class WP_External_Links {
|
|
34 |
/**
|
35 |
* Quick helper method for getting saved option values
|
36 |
* @param string $key
|
37 |
-
* @param string $option_name Optional, default looking in 'general' settings
|
38 |
* @return mixed
|
39 |
*/
|
40 |
-
public function get_opt( $key
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
43 |
|
44 |
/**
|
@@ -124,13 +134,13 @@ final class WP_External_Links {
|
|
124 |
|
125 |
if ( $this->get_opt( 'use_js' ) AND $this->get_opt( 'target' ) != '_none' ):
|
126 |
// set exclude class
|
127 |
-
$excludeClass = ( $this->get_opt( 'no_icon_same_window'
|
128 |
-
? $this->get_opt( 'no_icon_class'
|
129 |
: '';
|
130 |
?>
|
131 |
<script type="text/javascript">/* <![CDATA[ */
|
132 |
/* WP External Links Plugin */
|
133 |
-
var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>',target: '<?php echo $this->get_opt( 'target' ) ?>',excludeClass: '<?php echo $excludeClass ?>' };
|
134 |
/* ]]> */</script>
|
135 |
<?php
|
136 |
endif;
|
@@ -231,18 +241,23 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>',target: '<?p
|
|
231 |
$attrs[ 'title' ] = str_replace( '%title%', $attrs[ 'title' ], $title );
|
232 |
|
233 |
// set user-defined class
|
234 |
-
$class = $this->get_opt( 'class_name'
|
235 |
if ( $class )
|
236 |
$this->add_attr_value( &$attrs, 'class', $class );
|
237 |
|
238 |
-
// set icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found
|
239 |
-
if ( $this->get_opt( 'icon'
|
|
|
|
|
|
|
240 |
$icon_class = 'ext-icon-'. $this->get_opt( 'icon', 'style' );
|
241 |
$this->add_attr_value( &$attrs, 'class', $icon_class );
|
242 |
}
|
243 |
|
244 |
// set target
|
245 |
-
if ( ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window'
|
|
|
|
|
246 |
if ( $this->get_opt( 'target' ) == '_none' ) {
|
247 |
unset( $attrs[ 'target' ] );
|
248 |
} else {
|
@@ -408,18 +423,18 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>',target: '<?p
|
|
408 |
$a->attr( 'title', $title );
|
409 |
|
410 |
// add icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found
|
411 |
-
if ( $this->get_opt( 'icon'
|
412 |
-
$icon_class = 'ext-icon-'. $this->get_opt( 'icon'
|
413 |
$a->addClass( $icon_class );
|
414 |
}
|
415 |
|
416 |
// add user-defined class
|
417 |
-
if ( $this->get_opt( 'class_name'
|
418 |
-
$a->addClass( $this->get_opt( 'class_name'
|
419 |
}
|
420 |
|
421 |
// set target
|
422 |
-
if ( $this->get_opt( 'target' ) != '_none' AND ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window'
|
423 |
$a->attr( 'target', $this->get_opt( 'target' ) );
|
424 |
|
425 |
return $a;
|
3 |
|
4 |
/**
|
5 |
* Class WP_External_Links
|
6 |
+
* @package WordPress
|
7 |
+
* @since
|
8 |
* @category WordPress Plugins
|
9 |
*/
|
10 |
final class WP_External_Links {
|
36 |
/**
|
37 |
* Quick helper method for getting saved option values
|
38 |
* @param string $key
|
|
|
39 |
* @return mixed
|
40 |
*/
|
41 |
+
public function get_opt( $key ) {
|
42 |
+
$lookup = $this->admin->save_options;
|
43 |
+
|
44 |
+
foreach ( $lookup as $option_name => $values ) {
|
45 |
+
$value = $this->admin->form->value( $key, '___NONE___', $option_name );
|
46 |
+
|
47 |
+
if ($value !== '___NONE___')
|
48 |
+
return $value;
|
49 |
+
}
|
50 |
+
|
51 |
+
throw new Exception('Option with key "' . $key . '" does not exist.');
|
52 |
}
|
53 |
|
54 |
/**
|
134 |
|
135 |
if ( $this->get_opt( 'use_js' ) AND $this->get_opt( 'target' ) != '_none' ):
|
136 |
// set exclude class
|
137 |
+
$excludeClass = ( $this->get_opt( 'no_icon_same_window' ) AND $this->get_opt( 'no_icon_class' ) )
|
138 |
+
? $this->get_opt( 'no_icon_class' )
|
139 |
: '';
|
140 |
?>
|
141 |
<script type="text/javascript">/* <![CDATA[ */
|
142 |
/* WP External Links Plugin */
|
143 |
+
var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?php echo $this->get_opt( 'target' ) ?>', excludeClass: '<?php echo $excludeClass ?>' };
|
144 |
/* ]]> */</script>
|
145 |
<?php
|
146 |
endif;
|
241 |
$attrs[ 'title' ] = str_replace( '%title%', $attrs[ 'title' ], $title );
|
242 |
|
243 |
// set user-defined class
|
244 |
+
$class = $this->get_opt( 'class_name' );
|
245 |
if ( $class )
|
246 |
$this->add_attr_value( &$attrs, 'class', $class );
|
247 |
|
248 |
+
// set icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found or content contains image
|
249 |
+
if ( $this->get_opt( 'icon' ) > 0
|
250 |
+
AND ( ! $this->get_opt( 'no_icon_class' ) OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class' ) ) === FALSE )
|
251 |
+
AND strpos( $attrs[ 'class' ], 'ext-icon-' ) === FALSE
|
252 |
+
AND !( $this->get_opt( 'image_no_icon' ) AND (bool) preg_match( '/<img([^>]*)>/is', $matches[ 2 ] )) ){
|
253 |
$icon_class = 'ext-icon-'. $this->get_opt( 'icon', 'style' );
|
254 |
$this->add_attr_value( &$attrs, 'class', $icon_class );
|
255 |
}
|
256 |
|
257 |
// set target
|
258 |
+
if ( ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window' )
|
259 |
+
OR ! $this->get_opt( 'no_icon_class' )
|
260 |
+
OR strpos( $attrs[ 'class' ], $this->get_opt( 'no_icon_class' ) ) === FALSE ) ) {
|
261 |
if ( $this->get_opt( 'target' ) == '_none' ) {
|
262 |
unset( $attrs[ 'target' ] );
|
263 |
} else {
|
423 |
$a->attr( 'title', $title );
|
424 |
|
425 |
// add icon class, unless no-icon class isset or another icon class ('ext-icon-...') is found
|
426 |
+
if ( $this->get_opt( 'icon' ) > 0 AND ( ! $this->get_opt( 'no_icon_class' ) OR strpos( $a->attr( 'class' ), $this->get_opt( 'no_icon_class' ) ) === FALSE ) AND strpos( $a->attr( 'class' ), 'ext-icon-' ) === FALSE ){
|
427 |
+
$icon_class = 'ext-icon-'. $this->get_opt( 'icon' );
|
428 |
$a->addClass( $icon_class );
|
429 |
}
|
430 |
|
431 |
// add user-defined class
|
432 |
+
if ( $this->get_opt( 'class_name' ) ){
|
433 |
+
$a->addClass( $this->get_opt( 'class_name' ) );
|
434 |
}
|
435 |
|
436 |
// set target
|
437 |
+
if ( $this->get_opt( 'target' ) != '_none' AND ! $this->get_opt( 'use_js' ) AND ( ! $this->get_opt( 'no_icon_same_window' ) OR ! $this->get_opt( 'no_icon_class' ) OR strpos( $a->attr( 'class' ), $this->get_opt( 'no_icon_class' ) ) === FALSE ) )
|
438 |
$a->attr( 'target', $this->get_opt( 'target' ) );
|
439 |
|
440 |
return $a;
|
includes/wp-plugin-dev-classes/class-wp-option-forms.php
CHANGED
@@ -43,8 +43,9 @@ class WP_Option_Forms_01 {
|
|
43 |
$this->name = sanitize_title_with_dashes( $name );
|
44 |
|
45 |
// set option names
|
46 |
-
foreach ( $options AS $option_name => $values )
|
47 |
$this->add_option( $option_name, $values );
|
|
|
48 |
|
49 |
// actions
|
50 |
add_action( 'wp_ajax_wpof_update_options', array( $this, 'call_wp_ajax' ) );
|
@@ -56,8 +57,9 @@ class WP_Option_Forms_01 {
|
|
56 |
*/
|
57 |
public function call_admin_menu() {
|
58 |
// Register settings
|
59 |
-
foreach ( $this->options AS $option_name => $values )
|
60 |
register_setting( $option_name, $option_name );
|
|
|
61 |
|
62 |
// script
|
63 |
wp_enqueue_script( 'option-forms', plugins_url( 'wp-option-forms.js', __FILE__ ), array( 'jquery' ), '1.0' );
|
@@ -303,6 +305,10 @@ class WP_Option_Forms_01 {
|
|
303 |
$option = $this->name . '-' . $option_name;
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
306 |
$values = $this->options[ $option ];
|
307 |
|
308 |
return ( is_array( $values ) AND key_exists( $key, $values ) AND $values[ $key ] !== NULL ) ? $values[ $key ] : $default_value;
|
@@ -312,8 +318,9 @@ class WP_Option_Forms_01 {
|
|
312 |
* Delete and unregister option
|
313 |
*/
|
314 |
public function delete_options() {
|
315 |
-
foreach ( $this->options AS $option_name => $values )
|
316 |
delete_option( $option_name );
|
|
|
317 |
}
|
318 |
|
319 |
/**
|
43 |
$this->name = sanitize_title_with_dashes( $name );
|
44 |
|
45 |
// set option names
|
46 |
+
foreach ( $options AS $option_name => $values ) {
|
47 |
$this->add_option( $option_name, $values );
|
48 |
+
}
|
49 |
|
50 |
// actions
|
51 |
add_action( 'wp_ajax_wpof_update_options', array( $this, 'call_wp_ajax' ) );
|
57 |
*/
|
58 |
public function call_admin_menu() {
|
59 |
// Register settings
|
60 |
+
foreach ( $this->options AS $option_name => $values ) {
|
61 |
register_setting( $option_name, $option_name );
|
62 |
+
}
|
63 |
|
64 |
// script
|
65 |
wp_enqueue_script( 'option-forms', plugins_url( 'wp-option-forms.js', __FILE__ ), array( 'jquery' ), '1.0' );
|
305 |
$option = $this->name . '-' . $option_name;
|
306 |
}
|
307 |
|
308 |
+
if (!isset($this->options[ $option ])) {
|
309 |
+
return $default_value;
|
310 |
+
}
|
311 |
+
|
312 |
$values = $this->options[ $option ];
|
313 |
|
314 |
return ( is_array( $values ) AND key_exists( $key, $values ) AND $values[ $key ] !== NULL ) ? $values[ $key ] : $default_value;
|
318 |
* Delete and unregister option
|
319 |
*/
|
320 |
public function delete_options() {
|
321 |
+
foreach ( $this->options AS $option_name => $values ) {
|
322 |
delete_option( $option_name );
|
323 |
+
}
|
324 |
}
|
325 |
|
326 |
/**
|
js/admin-external-links.js
CHANGED
@@ -19,9 +19,9 @@ jQuery(function( $ ){
|
|
19 |
$( 'input#phpquery' )
|
20 |
.change(function(){
|
21 |
if ( $( this ).attr( 'checked' ) ) {
|
22 |
-
$( '.filter_excl_sel' ).fadeIn()
|
23 |
} else {
|
24 |
-
$( '.filter_excl_sel' ).fadeOut()
|
25 |
}
|
26 |
})
|
27 |
.change();
|
19 |
$( 'input#phpquery' )
|
20 |
.change(function(){
|
21 |
if ( $( this ).attr( 'checked' ) ) {
|
22 |
+
$( '.filter_excl_sel' ).fadeIn();
|
23 |
} else {
|
24 |
+
$( '.filter_excl_sel' ).fadeOut();
|
25 |
}
|
26 |
})
|
27 |
.change();
|
js/external-links.js
CHANGED
@@ -17,10 +17,16 @@
|
|
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
|
|
|
|
|
|
|
|
|
|
|
24 |
// open link in a new window
|
25 |
n = window.open( a.href, options.target );
|
26 |
n.focus();
|
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();
|
readme.txt
CHANGED
@@ -3,26 +3,28 @@ 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.2
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
-
Open external links in a new window
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
-
|
13 |
|
14 |
= Features =
|
15 |
-
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
* Add
|
20 |
* Set no-icon class
|
|
|
21 |
* XHTML strict and SEO friendly
|
22 |
|
23 |
This latest version requires PHP 5.2+ and WP 3.0+.
|
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`
|
@@ -46,6 +48,10 @@ This latest version requires PHP 5.2+ and WP 3.0+.
|
|
46 |
|
47 |
== Changelog ==
|
48 |
|
|
|
|
|
|
|
|
|
49 |
= 1.21 =
|
50 |
* Fixed phpQuery bugs (class already exists and loading stylesheet)
|
51 |
* Solved php notices
|
@@ -133,6 +139,10 @@ This latest version requires PHP 5.2+ and WP 3.0+.
|
|
133 |
|
134 |
== Upgrade Notice ==
|
135 |
|
|
|
|
|
|
|
|
|
136 |
= 1.21 =
|
137 |
* Fixed phpQuery bugs (class already exists and loading stylesheet)
|
138 |
* Solved php notices
|
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.2
|
6 |
+
Stable tag: 1.30
|
7 |
|
8 |
+
Open external links in a new window or tab, add "nofollow", choose icon, SEO friendly options...
|
9 |
|
10 |
== Description ==
|
11 |
|
12 |
+
Configure external links the way you want, with options like:
|
13 |
|
14 |
= Features =
|
15 |
+
|
16 |
+
* Open external links in new window or tab
|
17 |
+
* Add "nofollow" and "external" to rel-attribute
|
18 |
+
* Choose out of 20 icons
|
19 |
+
* Add additional classes for custom styling
|
20 |
* Set no-icon class
|
21 |
+
* Set title attribute
|
22 |
* XHTML strict and SEO friendly
|
23 |
|
24 |
This latest version requires PHP 5.2+ and WP 3.0+.
|
25 |
|
26 |
== Installation ==
|
27 |
+
|
28 |
1. Go to `Plugins` in the Admin menu
|
29 |
1. Click on the button `Add new`
|
30 |
1. Search for `WP External Links` and click 'Install Now' OR click on the `upload` link to upload `wp-external-links.zip`
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 1.30 =
|
52 |
+
* Re-arranged options in metaboxes
|
53 |
+
* Added option for no icons on images
|
54 |
+
|
55 |
= 1.21 =
|
56 |
* Fixed phpQuery bugs (class already exists and loading stylesheet)
|
57 |
* Solved php notices
|
139 |
|
140 |
== Upgrade Notice ==
|
141 |
|
142 |
+
= 1.30 =
|
143 |
+
* Re-arranged options in metaboxes
|
144 |
+
* Added option for no icons on images
|
145 |
+
|
146 |
= 1.21 =
|
147 |
* Fixed phpQuery bugs (class already exists and loading stylesheet)
|
148 |
* Solved php notices
|
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.
|
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.
|
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.30
|
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.30' );
|
14 |
|
15 |
// plugin key (used as translation domain, option_group, page_slug etc)
|
16 |
define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );
|