Version Description
- Added option to ignore all subdomains
Download this release
Release Info
| Developer | freelancephp |
| Plugin | |
| Version | 1.70 |
| Comparing to | |
| See all releases | |
Code changes from version 1.62 to 1.70
- includes/class-admin-external-links.php +9 -0
- includes/class-wp-external-links.php +33 -6
- readme.txt +6 -2
- wp-external-links.php +3 -3
includes/class-admin-external-links.php
CHANGED
|
@@ -22,6 +22,7 @@ final class Admin_External_Links {
|
|
| 22 |
'filter_comments' => 1,
|
| 23 |
'filter_widgets' => 1,
|
| 24 |
'ignore' => '//twitter.com/share',
|
|
|
|
| 25 |
),
|
| 26 |
'seo' => array(
|
| 27 |
'external' => 1,
|
|
@@ -265,6 +266,14 @@ style;
|
|
| 265 |
<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>
|
| 266 |
</td>
|
| 267 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
</table>
|
| 269 |
</fieldset>
|
| 270 |
|
| 22 |
'filter_comments' => 1,
|
| 23 |
'filter_widgets' => 1,
|
| 24 |
'ignore' => '//twitter.com/share',
|
| 25 |
+
'ignore_subdomains' => 0,
|
| 26 |
),
|
| 27 |
'seo' => array(
|
| 28 |
'external' => 1,
|
| 266 |
<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>
|
| 267 |
</td>
|
| 268 |
</tr>
|
| 269 |
+
<tr>
|
| 270 |
+
<th style="width:250px;"><?php $this->_e( 'Ignore subdomains' ) ?>
|
| 271 |
+
<?php echo $this->tooltip_help( 'Ignore all links to the site\'s domain and subdomains. These links will be threaded as internal links.' ) ?></th>
|
| 272 |
+
<td>
|
| 273 |
+
<label><?php echo $this->form->checkbox( 'ignore_subdomains', 1 ); ?>
|
| 274 |
+
<span><?php $this->_e( 'Ignore all links to the site\'s domain and subdomains' ) ?></span> <span class="description"><?php $this->_e('These links will be threaded as internal links.') ?></span></label>
|
| 275 |
+
</td>
|
| 276 |
+
</tr>
|
| 277 |
</table>
|
| 278 |
</fieldset>
|
| 279 |
|
includes/class-wp-external-links.php
CHANGED
|
@@ -29,10 +29,24 @@ final class WP_External_Links {
|
|
| 29 |
// set admin object
|
| 30 |
$this->admin = new Admin_External_Links();
|
| 31 |
|
| 32 |
-
|
| 33 |
add_action( 'wp', array( $this, 'call_wp' ) );
|
| 34 |
}
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
/**
|
| 37 |
* Quick helper method for getting saved option values
|
| 38 |
* @param string $key
|
|
@@ -188,11 +202,24 @@ final class WP_External_Links {
|
|
| 188 |
* @return boolean
|
| 189 |
*/
|
| 190 |
private function is_external( $href ) {
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
}
|
| 197 |
|
| 198 |
/**
|
| 29 |
// set admin object
|
| 30 |
$this->admin = new Admin_External_Links();
|
| 31 |
|
| 32 |
+
// add actions
|
| 33 |
add_action( 'wp', array( $this, 'call_wp' ) );
|
| 34 |
}
|
| 35 |
|
| 36 |
+
/**
|
| 37 |
+
* Get domain name
|
| 38 |
+
* @return string
|
| 39 |
+
*/
|
| 40 |
+
private function get_domain() {
|
| 41 |
+
if ( empty($this->_domain_name) ) {
|
| 42 |
+
$url = get_bloginfo('wpurl');
|
| 43 |
+
preg_match("/[a-z0-9\-]{1,63}\.[a-z\.]{2,6}$/", parse_url($url, PHP_URL_HOST), $domain_tld);
|
| 44 |
+
$this->_domain_name = count($domain_tld) > 0 ? $domain_tld[0] : $_SERVER['SERVER_NAME'];
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
return $this->_domain_name;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
/**
|
| 51 |
* Quick helper method for getting saved option values
|
| 52 |
* @param string $key
|
| 202 |
* @return boolean
|
| 203 |
*/
|
| 204 |
private function is_external( $href ) {
|
| 205 |
+
$wpurl = strtolower( get_bloginfo( 'wpurl' ) );
|
| 206 |
+
|
| 207 |
+
// relative url's are internal
|
| 208 |
+
// so just check absolute url's starting with these protocols
|
| 209 |
+
if ( substr( $href, 0, 7 ) !== 'http://'
|
| 210 |
+
&& substr( $href, 0, 8 ) !== 'https://'
|
| 211 |
+
&& substr( $href, 0, 6 ) !== 'ftp://'
|
| 212 |
+
&& substr( $href, 0, 2 ) !== '//' ) {
|
| 213 |
+
return false;
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
if ( $this->get_opt( 'ignore_subdomains' ) ) {
|
| 217 |
+
$is_external = ( strpos( $href, $this->get_domain() ) === FALSE );
|
| 218 |
+
} else {
|
| 219 |
+
$is_external = ( strpos( $href, $wpurl ) === FALSE );
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
return $is_external;
|
| 223 |
}
|
| 224 |
|
| 225 |
/**
|
readme.txt
CHANGED
|
@@ -2,8 +2,8 @@
|
|
| 2 |
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.6.0
|
| 5 |
-
Tested up to: 4.
|
| 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 |
|
|
@@ -17,6 +17,7 @@ Configure settings for all external links on your site.
|
|
| 17 |
* Choose from 20 icons
|
| 18 |
* Set other link options (like classes, title etc)
|
| 19 |
* Make it SEO friendly
|
|
|
|
| 20 |
|
| 21 |
= Easy to use =
|
| 22 |
After activating the plugin all options are already set to make your external links SEO friendly. Optionally you can also set the target for opening in a new window or tab or styling options, like adding an icon.
|
|
@@ -192,6 +193,9 @@ See [FAQ](https://wordpress.org/plugins/wp-external-links/faq/) for more possibi
|
|
| 192 |
|
| 193 |
== Changelog ==
|
| 194 |
|
|
|
|
|
|
|
|
|
|
| 195 |
= 1.62 =
|
| 196 |
* Fixed php error when using phpQuery option
|
| 197 |
|
| 2 |
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.6.0
|
| 5 |
+
Tested up to: 4.2.2
|
| 6 |
+
Stable tag: 1.70
|
| 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 |
|
| 17 |
* Choose from 20 icons
|
| 18 |
* Set other link options (like classes, title etc)
|
| 19 |
* Make it SEO friendly
|
| 20 |
+
* Compatible with WPMU (Multisite)
|
| 21 |
|
| 22 |
= Easy to use =
|
| 23 |
After activating the plugin all options are already set to make your external links SEO friendly. Optionally you can also set the target for opening in a new window or tab or styling options, like adding an icon.
|
| 193 |
|
| 194 |
== Changelog ==
|
| 195 |
|
| 196 |
+
= 1.70 =
|
| 197 |
+
* Added option to ignore all subdomains
|
| 198 |
+
|
| 199 |
= 1.62 =
|
| 200 |
* Fixed php error when using phpQuery option
|
| 201 |
|
wp-external-links.php
CHANGED
|
@@ -4,14 +4,14 @@ 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 |
// constants
|
| 13 |
if (!defined('WP_EXTERNAL_LINKS_FILE')) { define('WP_EXTERNAL_LINKS_FILE', __FILE__); }
|
| 14 |
-
if (!defined('WP_EXTERNAL_LINKS_VERSION')) { define('WP_EXTERNAL_LINKS_VERSION', '1.
|
| 15 |
if (!defined('WP_EXTERNAL_LINKS_KEY')) { define('WP_EXTERNAL_LINKS_KEY', 'wp_external_links'); }
|
| 16 |
if (!defined('WP_EXTERNAL_LINKS_DOMAIN')) { define('WP_EXTERNAL_LINKS_DOMAIN', 'wp-external-links'); }
|
| 17 |
if (!defined('WP_EXTERNAL_LINKS_OPTIONS_NAME')) { define('WP_EXTERNAL_LINKS_OPTIONS_NAME', 'WP_External_Links_options'); }
|
|
@@ -47,7 +47,7 @@ if (version_compare($wp_version, '3.6', '>=') && version_compare(phpversion(), '
|
|
| 47 |
$plugin_title = get_admin_page_title();
|
| 48 |
|
| 49 |
echo '<div class="error">'
|
| 50 |
-
. sprintf(__('<p>Warning - The plugin <strong>%s</strong> requires PHP 5.2.4+ and WP 3.
|
| 51 |
. '<br/>Disable the plugin to remove this message.</p>'
|
| 52 |
, WP_EXTERNAL_LINKS_KEY), $plugin_title)
|
| 53 |
. '</div>';
|
| 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.70
|
| 8 |
Author URI: http://www.freelancephp.net
|
| 9 |
License: Dual licensed under the MIT and GPL licenses
|
| 10 |
*/
|
| 11 |
|
| 12 |
// constants
|
| 13 |
if (!defined('WP_EXTERNAL_LINKS_FILE')) { define('WP_EXTERNAL_LINKS_FILE', __FILE__); }
|
| 14 |
+
if (!defined('WP_EXTERNAL_LINKS_VERSION')) { define('WP_EXTERNAL_LINKS_VERSION', '1.70'); }
|
| 15 |
if (!defined('WP_EXTERNAL_LINKS_KEY')) { define('WP_EXTERNAL_LINKS_KEY', 'wp_external_links'); }
|
| 16 |
if (!defined('WP_EXTERNAL_LINKS_DOMAIN')) { define('WP_EXTERNAL_LINKS_DOMAIN', 'wp-external-links'); }
|
| 17 |
if (!defined('WP_EXTERNAL_LINKS_OPTIONS_NAME')) { define('WP_EXTERNAL_LINKS_OPTIONS_NAME', 'WP_External_Links_options'); }
|
| 47 |
$plugin_title = get_admin_page_title();
|
| 48 |
|
| 49 |
echo '<div class="error">'
|
| 50 |
+
. sprintf(__('<p>Warning - The plugin <strong>%s</strong> requires PHP 5.2.4+ and WP 3.6+. Please upgrade your PHP and/or WordPress.'
|
| 51 |
. '<br/>Disable the plugin to remove this message.</p>'
|
| 52 |
, WP_EXTERNAL_LINKS_KEY), $plugin_title)
|
| 53 |
. '</div>';
|
