Remove Yoast SEO Comments - Version 2.0.3

Version Description

  • Removes Yoast SEO comments from XML pages generated by Yoast SEO.
Download this release

Release Info

Developer lowest
Plugin Icon wp plugin Remove Yoast SEO Comments
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

Files changed (2) hide show
  1. readme.txt +19 -12
  2. remove-yoast-seo-comments.php +25 -5
readme.txt CHANGED
@@ -14,7 +14,7 @@ A light-weight plugin which will remove the advertisement HTML comments coming f
14
 
15
  `<!-- This site is optimized with the Yoast SEO plugin -->`
16
 
17
- This is a must-have plugin if you have Yoast SEO installed.
18
 
19
  = Note: =
20
  This plugin requires [Yoast SEO](http://wordpress.org/plugins/wordpress-seo/).
@@ -36,14 +36,21 @@ Yes, they will stay removed as long as Yoast SEO doesn't change its coding layou
36
 
37
  = Does this plugin add any configuration options? =
38
 
39
- No, activate the plugin and you are ready to go!
40
 
41
  = Will this plugin modify any of my Yoast SEO plugin files? =
42
 
43
  No, this plugin will not modify any of your Yoast SEO plugin files.
44
 
 
 
 
 
45
  == Changelog ==
46
 
 
 
 
47
  = 2.0.2 =
48
  * Added support for Yoast SEO 4.3 and earlier (this includes custom Yoast SEO versions which cannot be updated).
49
  * Plan B functions added for when Yoast SEO decides to change their coding layout.
@@ -52,25 +59,25 @@ No, this plugin will not modify any of your Yoast SEO plugin files.
52
  * Yoast SEO update caused a bug in this plugin, this update fixes it.
53
 
54
  = 2.0 =
55
- * Introducing more modern, better and faster functions.
56
- * RYSC can now be activated without Yoast SEO being activated.
57
 
58
  = 1.0.5 =
59
- * Fixed an security vulnerability regarding `target="_blank"` ([read more](https://core.trac.wordpress.org/ticket/36809)).
60
- * Added support for WordPress 4.7.
61
 
62
  = 1.0.4 =
63
- * Removed debugging code.
64
 
65
  = 1.0.3 =
66
- * Removed anonymous functions.
67
 
68
  = 1.0.2 =
69
- * Minor changes to all files.
70
- * Removed a unnecessary file.
71
 
72
  = 1.0.1 =
73
- * Added support for Yoast SEO Premium.
74
 
75
  = 1.0 =
76
- * Initial release.
14
 
15
  `<!-- This site is optimized with the Yoast SEO plugin -->`
16
 
17
+ This is a must-have plugin if you have Yoast SEO or Yoast SEO Premium installed.
18
 
19
  = Note: =
20
  This plugin requires [Yoast SEO](http://wordpress.org/plugins/wordpress-seo/).
36
 
37
  = Does this plugin add any configuration options? =
38
 
39
+ No, activate the plugin and you are done! This plugin will not add any extra tables or such to your database.
40
 
41
  = Will this plugin modify any of my Yoast SEO plugin files? =
42
 
43
  No, this plugin will not modify any of your Yoast SEO plugin files.
44
 
45
+ = My RYSC version is incompatible with Yoast SEO. What happened? =
46
+
47
+ In most cases happens when Yoast SEO changes their coding layout. Please be patient while we make RYSC compatible again.
48
+
49
  == Changelog ==
50
 
51
+ = 2.0.3 =
52
+ * Removes Yoast SEO comments from XML pages generated by Yoast SEO.
53
+
54
  = 2.0.2 =
55
  * Added support for Yoast SEO 4.3 and earlier (this includes custom Yoast SEO versions which cannot be updated).
56
  * Plan B functions added for when Yoast SEO decides to change their coding layout.
59
  * Yoast SEO update caused a bug in this plugin, this update fixes it.
60
 
61
  = 2.0 =
62
+ * Introducing more modern, better and faster functions
63
+ * RYSC can now be activated without Yoast SEO being activated
64
 
65
  = 1.0.5 =
66
+ * Fixed an security vulnerability regarding `target="_blank"` ([read more](https://core.trac.wordpress.org/ticket/36809))
67
+ * Added support for WordPress 4.7
68
 
69
  = 1.0.4 =
70
+ * Removed debugging code
71
 
72
  = 1.0.3 =
73
+ * Removed anonymous functions: RYSC is now more light-weight than ever
74
 
75
  = 1.0.2 =
76
+ * Minor changes to all files
77
+ * Removed a unnecessary file
78
 
79
  = 1.0.1 =
80
+ * Added support for Yoast SEO Premium
81
 
82
  = 1.0 =
83
+ * Initial release
remove-yoast-seo-comments.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Remove Yoast SEO comments
4
  * Plugin URI: https://wordpress.org/plugins/remove-yoast-seo-comments/
5
  * Description: Removes the Yoast SEO advertisement HTML comments from your front-end source code.
6
- * Version: 2.0.2
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
@@ -35,20 +35,28 @@ function rysc_bundle() {
35
  if(defined( 'WPSEO_VERSION' ) && class_exists( 'WPSEO_Frontend' )) {
36
  if(method_exists( 'WPSEO_Frontend', 'debug_mark' ) && version_compare( WPSEO_VERSION, '4.4', '>=' )) { // for Yoast SEO 4.4 or later
37
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'debug_mark' ) , 2);
 
38
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
39
- add_action( 'wp_head', 'rysc_rewrite' , 1);
 
 
40
  } elseif(method_exists( 'WPSEO_Frontend', 'debug_marker' ) && version_compare( WPSEO_VERSION, '4.3', '<=' )) { // for Yoast SEO 4.3 or earlier
41
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'debug_marker' ) , 2);
 
42
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
43
- add_action( 'wp_head', 'rysc_rewrite' , 1);
44
- } else { // looks like we have no compatible solutions for now, let's activate plan b
 
 
45
  add_action( 'wp_head', 'rysc_parser', 999 );
 
 
46
  }
47
  }
48
  }
49
  add_action( 'init', 'rysc_bundle');
50
 
51
- function rysc_rewrite() {
52
  $rewrite = new ReflectionMethod( 'WPSEO_Frontend', 'head' );
53
 
54
  $filename = $rewrite->getFileName();
@@ -63,6 +71,18 @@ function rysc_rewrite() {
63
  eval($body);
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  function rysc_parser() {
67
  $current_cont = ob_get_contents();
68
 
3
  * Plugin Name: Remove Yoast SEO comments
4
  * Plugin URI: https://wordpress.org/plugins/remove-yoast-seo-comments/
5
  * Description: Removes the Yoast SEO advertisement HTML comments from your front-end source code.
6
+ * Version: 2.0.3
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
35
  if(defined( 'WPSEO_VERSION' ) && class_exists( 'WPSEO_Frontend' )) {
36
  if(method_exists( 'WPSEO_Frontend', 'debug_mark' ) && version_compare( WPSEO_VERSION, '4.4', '>=' )) { // for Yoast SEO 4.4 or later
37
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'debug_mark' ) , 2);
38
+
39
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
40
+ add_action( 'wp_head', 'rysc_rewrite_head' , 1);
41
+
42
+ add_action( 'init', 'rysc_xml_parser', 999 );
43
  } elseif(method_exists( 'WPSEO_Frontend', 'debug_marker' ) && version_compare( WPSEO_VERSION, '4.3', '<=' )) { // for Yoast SEO 4.3 or earlier
44
  remove_action( 'wpseo_head', array( WPSEO_Frontend::get_instance(), 'debug_marker' ) , 2);
45
+
46
  remove_action( 'wp_head', array( WPSEO_Frontend::get_instance(), 'head' ) , 1);
47
+ add_action( 'wp_head', 'rysc_rewrite_head' , 1);
48
+
49
+ add_action( 'init', 'rysc_xml_parser', 999 );
50
+ } else { // looks like we have no compatible solutions for now
51
  add_action( 'wp_head', 'rysc_parser', 999 );
52
+
53
+ add_action( 'init', 'rysc_xml_parser', 999 );
54
  }
55
  }
56
  }
57
  add_action( 'init', 'rysc_bundle');
58
 
59
+ function rysc_rewrite_head() {
60
  $rewrite = new ReflectionMethod( 'WPSEO_Frontend', 'head' );
61
 
62
  $filename = $rewrite->getFileName();
71
  eval($body);
72
  }
73
 
74
+ function rysc_xml_parser() {
75
+ $ext = pathinfo($_SERVER['REQUEST_URI'], PATHINFO_EXTENSION);
76
+
77
+ if($ext == 'xml') {
78
+ $flush = ob_end_flush();
79
+
80
+ ob_start(function( $buffer ) {
81
+ return preg_replace( '/\n?<.*?yoast.*?>/mi', '', $buffer ) . $flush;
82
+ });
83
+ }
84
+ }
85
+
86
  function rysc_parser() {
87
  $current_cont = ob_get_contents();
88