Version Description
- Fixed Bug: wpmel_external_link filter hook was not working correctly
Download this release
Release Info
| Developer | freelancephp |
| Plugin | |
| Version | 1.41 |
| Comparing to | |
| See all releases | |
Code changes from version 1.40 to 1.41
- includes/class-admin-external-links.php +0 -31
- includes/class-wp-external-links.php +10 -5
- readme.txt +12 -4
- screenshot-2.png +0 -0
- wp-external-links.php +2 -2
includes/class-admin-external-links.php
CHANGED
|
@@ -136,7 +136,6 @@ final class Admin_External_Links {
|
|
| 136 |
public function call_load_meta_box( $meta_box ) {
|
| 137 |
// add filters
|
| 138 |
$meta_box->add_title_filter( array( $this, 'call_page_title' ) )
|
| 139 |
-
// ->add_screen_settings_filter( array( $this, 'call_screen_settings' ) )
|
| 140 |
->add_contextual_help_filter( array( $this, 'call_contextual_help' ) );
|
| 141 |
|
| 142 |
// add meta boxes
|
|
@@ -157,35 +156,6 @@ final class Admin_External_Links {
|
|
| 157 |
wp_enqueue_script( 'admin-wp-external-links', plugins_url( '/js/admin-wp-external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'postbox', 'option-forms' ), WP_EXTERNAL_LINKS_VERSION );
|
| 158 |
}
|
| 159 |
|
| 160 |
-
/**
|
| 161 |
-
* Screen settings
|
| 162 |
-
* @param string $content
|
| 163 |
-
* @return string
|
| 164 |
-
public function call_screen_settings( $content ) {
|
| 165 |
-
$content .= '<h5>'. $this->__( 'Menu Setting' ) .'</h5>' . "\n";
|
| 166 |
-
$content .= '<div class="extra-prfs">' . "\n";
|
| 167 |
-
$content .= $this->__( 'Admin menu position' ) . ': ' . "\n";
|
| 168 |
-
$content .= $this->form->open_screen_option( 'screen', 'menu_position' );
|
| 169 |
-
$content .= $this->form->select( 'menu_position', array(
|
| 170 |
-
'admin.php' => 'Main menu',
|
| 171 |
-
'index.php' => $this->__( 'Subitem of Dashboard' ),
|
| 172 |
-
'edit.php' => $this->__( 'Subitem of Posts' ),
|
| 173 |
-
'upload.php' => $this->__( 'Subitem of Media' ),
|
| 174 |
-
'link-manager.php' => $this->__( 'Subitem of Links' ),
|
| 175 |
-
'edit.php?post_type=page' => $this->__( 'Subitem of Pages' ),
|
| 176 |
-
'edit-comments.php' => $this->__( 'Subitem of Comments' ),
|
| 177 |
-
'themes.php' => $this->__( 'Subitem of Appearance' ),
|
| 178 |
-
'plugins.php' => $this->__( 'Subitem of Plugins' ),
|
| 179 |
-
'users.php' => $this->__( 'Subitem of Users' ),
|
| 180 |
-
'tools.php' => $this->__( 'Subitem of Tools' ),
|
| 181 |
-
'options-general.php' => $this->__( 'Subitem of Settings' ),
|
| 182 |
-
)) . "\n";
|
| 183 |
-
$content .= '</div>' . "\n";
|
| 184 |
-
|
| 185 |
-
return $content;
|
| 186 |
-
}
|
| 187 |
-
*/
|
| 188 |
-
|
| 189 |
/**
|
| 190 |
* Contextual_help (callback)
|
| 191 |
* @param string $content
|
|
@@ -637,7 +607,6 @@ final class Admin_External_Links {
|
|
| 637 |
$text = htmlentities( $text );
|
| 638 |
|
| 639 |
$html = '<a href="#" class="tooltip-help" title="'. $text .'">[?]</a>';
|
| 640 |
-
//$html = '<img alt="" title="" src="'. plugins_url( '/images/help-icon.png', WP_EXTERNAL_LINKS_FILE ) .'" />';
|
| 641 |
return $html;
|
| 642 |
}
|
| 643 |
|
| 136 |
public function call_load_meta_box( $meta_box ) {
|
| 137 |
// add filters
|
| 138 |
$meta_box->add_title_filter( array( $this, 'call_page_title' ) )
|
|
|
|
| 139 |
->add_contextual_help_filter( array( $this, 'call_contextual_help' ) );
|
| 140 |
|
| 141 |
// add meta boxes
|
| 156 |
wp_enqueue_script( 'admin-wp-external-links', plugins_url( '/js/admin-wp-external-links.js', WP_EXTERNAL_LINKS_FILE ), array( 'postbox', 'option-forms' ), WP_EXTERNAL_LINKS_VERSION );
|
| 157 |
}
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
/**
|
| 160 |
* Contextual_help (callback)
|
| 161 |
* @param string $content
|
| 607 |
$text = htmlentities( $text );
|
| 608 |
|
| 609 |
$html = '<a href="#" class="tooltip-help" title="'. $text .'">[?]</a>';
|
|
|
|
| 610 |
return $html;
|
| 611 |
}
|
| 612 |
|
includes/class-wp-external-links.php
CHANGED
|
@@ -293,7 +293,7 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 293 |
$link .= '>'. $matches[ 2 ] .'</a>';
|
| 294 |
|
| 295 |
// filter
|
| 296 |
-
$link = apply_filters('wpel_external_link', $link, $matches[
|
| 297 |
|
| 298 |
return $link;
|
| 299 |
}
|
|
@@ -348,8 +348,11 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 348 |
|
| 349 |
// set simple <head> without attributes
|
| 350 |
preg_match( $regexp_head, $content, $matches );
|
| 351 |
-
|
| 352 |
-
|
|
|
|
|
|
|
|
|
|
| 353 |
|
| 354 |
//phpQuery::$debug = true;
|
| 355 |
|
|
@@ -408,8 +411,10 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'wpurl' ) ?>', target: '<?
|
|
| 408 |
// get document content
|
| 409 |
$content = (string) $doc;
|
| 410 |
|
| 411 |
-
|
| 412 |
-
|
|
|
|
|
|
|
| 413 |
|
| 414 |
return $content;
|
| 415 |
}
|
| 293 |
$link .= '>'. $matches[ 2 ] .'</a>';
|
| 294 |
|
| 295 |
// filter
|
| 296 |
+
$link = apply_filters('wpel_external_link', $link, $matches[ 0 ], $matches[ 2 ], $attrs);
|
| 297 |
|
| 298 |
return $link;
|
| 299 |
}
|
| 348 |
|
| 349 |
// set simple <head> without attributes
|
| 350 |
preg_match( $regexp_head, $content, $matches );
|
| 351 |
+
|
| 352 |
+
if( count( $matches ) > 0 ) {
|
| 353 |
+
$original_head = $matches[ 0 ];
|
| 354 |
+
$content = str_replace( $original_head, $clean_head, $content );
|
| 355 |
+
}
|
| 356 |
|
| 357 |
//phpQuery::$debug = true;
|
| 358 |
|
| 411 |
// get document content
|
| 412 |
$content = (string) $doc;
|
| 413 |
|
| 414 |
+
if( isset( $original_head ) ) {
|
| 415 |
+
// recover original <head> with attributes
|
| 416 |
+
$content = str_replace( $clean_head, $original_head, $content );
|
| 417 |
+
}
|
| 418 |
|
| 419 |
return $content;
|
| 420 |
}
|
readme.txt
CHANGED
|
@@ -3,7 +3,7 @@ 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.2.0
|
| 5 |
Tested up to: 3.5.1
|
| 6 |
-
Stable tag: 1.
|
| 7 |
|
| 8 |
Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.
|
| 9 |
|
|
@@ -61,13 +61,18 @@ The plugin also has a hook when ready, f.e. to add extra filters:
|
|
| 61 |
add_action('wpel_ready', 'extra_filters');`
|
| 62 |
|
| 63 |
= Filter hook =
|
| 64 |
-
The wpel_external_link filter gives you the possibility to manipulate output of the mailto created by the plugin
|
| 65 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
return '<b>'. $created_link .'</b>';
|
| 67 |
}
|
| 68 |
add_filter('wpel_external_link', 'special_external_link', 10, 4);`
|
| 69 |
|
| 70 |
-
Now all external links will be processed and wrapped around a `<b>`-tag.
|
| 71 |
|
| 72 |
= Credits =
|
| 73 |
* [jQuery Tipsy Plugin](http://plugins.jquery.com/project/tipsy) made by [Jason Frame](http://onehackoranother.com/)
|
|
@@ -76,6 +81,9 @@ Now all external links will be processed and wrapped around a `<b>`-tag.
|
|
| 76 |
|
| 77 |
== Changelog ==
|
| 78 |
|
|
|
|
|
|
|
|
|
|
| 79 |
= 1.40 =
|
| 80 |
* Added action hook wpel_ready
|
| 81 |
* Added filter hook wpel_external_link
|
| 3 |
Tags: links, external, icon, target, _blank, _new, _none, rel, nofollow, new window, new tab, javascript, xhtml, seo
|
| 4 |
Requires at least: 3.2.0
|
| 5 |
Tested up to: 3.5.1
|
| 6 |
+
Stable tag: 1.41
|
| 7 |
|
| 8 |
Open external links in a new window or tab, adding "nofollow", set link icon, styling, SEO friendly options and more. Easy install and go.
|
| 9 |
|
| 61 |
add_action('wpel_ready', 'extra_filters');`
|
| 62 |
|
| 63 |
= Filter hook =
|
| 64 |
+
The wpel_external_link filter gives you the possibility to manipulate output of the mailto created by the plugin, like:
|
| 65 |
+
`function special_external_link($created_link, $original_link, $label, $attrs = array()) {
|
| 66 |
+
// skip links that contain the class "not-external"
|
| 67 |
+
if (isset($attrs['class']) && strpos($attrs['class'], 'not-external') !== false) {
|
| 68 |
+
return $original_link;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
return '<b>'. $created_link .'</b>';
|
| 72 |
}
|
| 73 |
add_filter('wpel_external_link', 'special_external_link', 10, 4);`
|
| 74 |
|
| 75 |
+
Now all external links will be processed and wrapped around a `<b>`-tag. And links containing the class "not-external" will not be processed by the plugin at all (and stay the way they are).
|
| 76 |
|
| 77 |
= Credits =
|
| 78 |
* [jQuery Tipsy Plugin](http://plugins.jquery.com/project/tipsy) made by [Jason Frame](http://onehackoranother.com/)
|
| 81 |
|
| 82 |
== Changelog ==
|
| 83 |
|
| 84 |
+
= 1.41 =
|
| 85 |
+
* Fixed Bug: wpmel_external_link filter hook was not working correctly
|
| 86 |
+
|
| 87 |
= 1.40 =
|
| 88 |
* Added action hook wpel_ready
|
| 89 |
* Added filter hook wpel_external_link
|
screenshot-2.png
CHANGED
|
Binary file
|
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.41
|
| 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.41' );
|
| 14 |
|
| 15 |
// plugin key (used as translation domain, option_group, page_slug etc)
|
| 16 |
define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );
|
