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

Version Description

  • Workaround for echo DOCTYPE bug (caused by attributes in the head-tag)
Download this release

Release Info

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

Code changes from version 1.02 to 1.03

includes/class-wp-external-links.php CHANGED
@@ -127,9 +127,34 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
127
  * @return string
128
  */
129
  public function call_filter_content( $content ) {
 
 
 
 
 
 
 
 
 
130
  //phpQuery::$debug = true;
 
 
131
  $doc = phpQuery::newDocument( $content );
132
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  // remove style when no icon classes are found
134
  if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
135
  // remove icon css
@@ -166,7 +191,13 @@ var wpExtLinks = { baseUrl: '<?php echo get_bloginfo( 'url' ) ?>',target: '<?php
166
  $excludes->find( 'a' )->removeAttr( 'excluded' );
167
  }
168
 
169
- return $doc;
 
 
 
 
 
 
170
  }
171
 
172
  /**
127
  * @return string
128
  */
129
  public function call_filter_content( $content ) {
130
+ // Workaround: remove <head>-attributes before using phpQuery
131
+ $regexp_head = '/<head(.*?)>/is';
132
+ $clean_head = '<head>';
133
+
134
+ // set simple <head> without attributes
135
+ preg_match( $regexp_head, $content, $matches );
136
+ $original_head = $matches[ 0 ];
137
+ $content = str_replace( $original_head, $clean_head, $content );
138
+
139
  //phpQuery::$debug = true;
140
+
141
+ // set document
142
  $doc = phpQuery::newDocument( $content );
143
 
144
+ // @todo
145
+ /*
146
+ $regexp_xml = '/<\?xml(.*?)\?>/is';
147
+ $regexp_xhtml = '/<!DOCTYPE(.*?)xhtml(.*?)>/is';
148
+
149
+ if ( preg_match( $regexp_xml, $content ) > 0 ) {
150
+ $doc = phpQuery::newDocumentXML( $content, get_bloginfo( 'charset' ) );
151
+ } elseif ( preg_match( $regexp_xhtml, $content ) > 0 ) {
152
+ $doc = phpQuery::newDocumentXHTML( $content, get_bloginfo( 'charset' ) );
153
+ } else {
154
+ $doc = phpQuery::newDocumentHTML( $content, get_bloginfo( 'charset' ) );
155
+ }
156
+ */
157
+
158
  // remove style when no icon classes are found
159
  if ( strpos( $content, 'ext-icon-' ) === FALSE ) {
160
  // remove icon css
191
  $excludes->find( 'a' )->removeAttr( 'excluded' );
192
  }
193
 
194
+ // get document content
195
+ $content = (string) $doc;
196
+
197
+ // recover original <head> with attributes
198
+ $content = str_replace( $clean_head, $original_head, $content );
199
+
200
+ return $content;
201
  }
202
 
203
  /**
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.0.0
5
  Tested up to: 3.2.1
6
- Stable tag: 1.02
7
 
8
  Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
9
 
@@ -46,6 +46,9 @@ This latest version requires PHP 5.2+ and WP 3.0+.
46
 
47
  == Changelog ==
48
 
 
 
 
49
  = 1.02 =
50
  * Solved the not working activation hook
51
 
@@ -114,8 +117,6 @@ This latest version requires PHP 5.2+ and WP 3.0+.
114
 
115
  == Upgrade Notice ==
116
 
117
- = 1.02 =
 
118
  * This version requires PHP5.2+ and WP3.0+
119
- * Added option for setting title-attribute
120
- * Added option for excluding certain links
121
- * Improved Admin page
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.2.1
6
+ Stable tag: 1.03
7
 
8
  Open external links in a new window/tab, add "external" / "nofollow" to rel-attribute, set icon, XHTML strict, SEO friendly...
9
 
46
 
47
  == Changelog ==
48
 
49
+ = 1.03 =
50
+ * Workaround for echo DOCTYPE bug (caused by attributes in the head-tag)
51
+
52
  = 1.02 =
53
  * Solved the not working activation hook
54
 
117
 
118
  == Upgrade Notice ==
119
 
120
+ = 1.03 =
121
+ * Workaround for echo DOCTYPE bug
122
  * This version requires PHP5.2+ and WP3.0+
 
 
 
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.02
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.02' );
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.03
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.03' );
14
 
15
  // plugin key (used as translation domain, option_group, page_slug etc)
16
  define( 'WP_EXTERNAL_LINKS_KEY', 'wp_external_links' );