Remove Yoast SEO Comments - Version 1.0.2

Version Description

  • Minor changes to all files
  • Removed a unnecessary file
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

Files changed (3) hide show
  1. functions.php +0 -45
  2. readme.txt +29 -5
  3. remove-yoast-seo-comments.php +54 -9
functions.php DELETED
@@ -1,45 +0,0 @@
1
- <?php
2
- //**//
3
- //**// Remove Yoast SEO Comments (RYSC)
4
- //**// This file holds all the functions.
5
- //**//
6
-
7
- // Check if a plugin is active, in this case Yoast SEO
8
- function rysc_active( $plugin ) {
9
- $network_active = false;
10
- if ( is_multisite() ) {
11
- $plugins = get_site_option( 'active_sitewide_plugins' );
12
- if ( isset( $plugins[$plugin] ) ) {
13
- $network_active = true;
14
- }
15
- }
16
- return in_array( $plugin, get_option( 'active_plugins' ) ) || $network_active;
17
- }
18
-
19
- // If Yoast SEO is not active, this is the message that will be shown.
20
- function rysc_notice() {
21
- echo '<div class="notice notice-error is-dismissible"><p>Cannot activate <strong>Remove Yoast SEO comments</strong>: Please activate <a href="http://wordpress.org/plugins/wordpress-seo/" target="_blank">Yoast SEO</a> plugin first before activating this plugin.</p></div>';
22
- }
23
-
24
- // Function to deactivate RYSC.
25
- function rysc_deactivate() {
26
- deactivate_plugins( plugin_basename( RYSC_FILE ) );
27
- }
28
-
29
- // And here we have the actual script which removes the Yoast SEO comments.
30
- function rysc_do() {
31
- add_action('get_header',function (){
32
- ob_start(function ($o) {
33
- return preg_replace('/\n?<.*?yoast.*?>/mi','',$o);
34
- });
35
- });
36
- add_action('wp_head',function (){
37
- ob_end_flush();
38
- }, 999);
39
- }
40
-
41
- // Bundle the functions and execute if Yoast SEO is not active.
42
- function rysc_noyoast() {
43
- add_action( 'admin_notices', 'rysc_notice' );
44
- add_action( 'admin_init', 'rysc_deactivate' );
45
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,20 +1,22 @@
1
  === Remove Yoast SEO comments ===
2
  Contributors: lowest
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC
4
- Tags: yoast seo, yoast, seo, remove comments, remove html, remove ads, remove debug code
5
  Requires at least: 1.2.0
6
  Stable tag: 1.2.0
7
  Tested up to: 4.6
8
 
9
- Removes all the Yoast SEO HTML comments from your front-end source code.
10
 
11
  == Description ==
12
 
13
- This plugin will remove all HTML comments coming from the Yoast SEO plugin.
14
 
15
- No more advertisements in your front-end source code!
16
 
17
- *Note: This plugin requires [Yoast SEO](http://wordpress.org/plugins/wordpress-seo/) or Yoast SEO Premium. If you do not have Yoast SEO nor Yoast SEO Premium act,mnivated, this plugin will not work.*
 
 
18
 
19
  == Installation ==
20
 
@@ -22,8 +24,30 @@ No more advertisements in your front-end source code!
22
  2. Activate the plugin through the 'Plugins' menu in WordPress
23
  3. All done! The HTML comments are now removed from your front-end source code.
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  == Changelog ==
26
 
 
 
 
 
27
  = 1.0.1 =
28
  * Added support for Yoast SEO Premium
29
 
1
  === Remove Yoast SEO comments ===
2
  Contributors: lowest
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC
4
+ Tags: yoast seo, yoast, seo, remove comments, remove html, remove ads, remove debug code, lightweight
5
  Requires at least: 1.2.0
6
  Stable tag: 1.2.0
7
  Tested up to: 4.6
8
 
9
+ Removes the Yoast SEO advertisement HTML comments from your front-end source code.
10
 
11
  == Description ==
12
 
13
+ A light-weight plugin which will remove the advertisement HTML comments coming from the Yoast SEO plugin, such as:
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: This plugin requires [Yoast SEO](http://wordpress.org/plugins/wordpress-seo/) or Yoast SEO Premium. If you do not have Yoast SEO or Yoast SEO Premium activated, this plugin will not work.*
20
 
21
  == Installation ==
22
 
24
  2. Activate the plugin through the 'Plugins' menu in WordPress
25
  3. All done! The HTML comments are now removed from your front-end source code.
26
 
27
+ == Frequently Asked Questions ==
28
+
29
+ = When Yoast SEO updates their plugin, will the HTML comments stay removed? =
30
+
31
+ Yes, they will stay removed.
32
+
33
+ = Does this plugin add any configuration options? =
34
+
35
+ No, activate the plugin and you are done! This plugin will not add any extra tables or such to your database.
36
+
37
+ = Why does this plugin exist? =
38
+
39
+ The HTML comments coming from the Yoast SEO plugin give out information such as plugin version and type. When there is a exploit in the Yoast SEO plugin, hackers may take advantage of that exploit to hack your website. A good reason to remove them.
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
+ = 1.0.2 =
48
+ * Minor changes to all files
49
+ * Removed a unnecessary file
50
+
51
  = 1.0.1 =
52
  * Added support for Yoast SEO Premium
53
 
remove-yoast-seo-comments.php CHANGED
@@ -2,31 +2,76 @@
2
  /*
3
  * Plugin Name: Remove Yoast SEO comments
4
  * Plugin URI: https://wordpress.org/plugins/remove-yoast-seo-comments/
5
- * Description: Removes all the Yoast SEO comments from your front-end source code.
6
- * Version: 1.0.1
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  */
11
 
12
- // Exit if accessed directly.
13
  if ( ! defined( 'ABSPATH' ) ) { exit; }
14
 
15
- // Define current path to RYSC.
16
  if ( ! defined( 'RYSC_FILE' ) ) { define( 'RYSC_FILE', __FILE__ ); }
17
 
18
- // Request all functions.
19
- require_once( dirname( RYSC_FILE ) . '/functions.php' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- // Check if Yoast SEO is active. If so, then proceed.
22
- // If not, show a error and deactivate RYSC.
23
  if ( rysc_active( 'wordpress-seo/wp-seo.php' ) || rysc_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
24
  rysc_do();
25
  } else {
26
  rysc_noyoast();
27
  }
28
 
29
- // Add the donate button.
30
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), function($link) {
31
  return array_merge( $link, array('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC" target="_blank">Donate</a>') );
32
  } );
2
  /*
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: 1.0.2
7
  * Author: Mitch
8
  * Author URI: https://profiles.wordpress.org/lowest
9
  * License: GPL-2.0+
10
+ * Text Domain: rysc
11
+ * Domain Path:
12
+ * Network:
13
+ * License: GPL-2.0+
14
+ *
15
+ * This program is free software; you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation; either version 2 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program; if not, write to the Free Software
27
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
  */
29
 
 
30
  if ( ! defined( 'ABSPATH' ) ) { exit; }
31
 
 
32
  if ( ! defined( 'RYSC_FILE' ) ) { define( 'RYSC_FILE', __FILE__ ); }
33
 
34
+ function rysc_active( $plugin ) {
35
+ $network_active = false;
36
+ if ( is_multisite() ) {
37
+ $plugins = get_site_option( 'active_sitewide_plugins' );
38
+ if ( isset( $plugins[$plugin] ) ) {
39
+ $network_active = true;
40
+ }
41
+ }
42
+ return in_array( $plugin, get_option( 'active_plugins' ) ) || $network_active;
43
+ }
44
+
45
+ function rysc_notice() {
46
+ echo '<div class="notice notice-error is-dismissible"><p>Cannot activate <strong>Remove Yoast SEO comments</strong>: Please activate <a href="http://wordpress.org/plugins/wordpress-seo/" target="_blank">Yoast SEO</a> or Yoast SEO Premium plugin first before activating this plugin.</p></div>';
47
+ }
48
+
49
+ function rysc_deactivate() {
50
+ deactivate_plugins( plugin_basename( RYSC_FILE ) );
51
+ }
52
+
53
+ function rysc_do() {
54
+ add_action('get_header',function (){
55
+ ob_start(function ($o) {
56
+ return preg_replace('/\n?<.*?yoast.*?>/mi','',$o);
57
+ });
58
+ });
59
+ add_action('wp_head',function (){
60
+ ob_end_flush();
61
+ }, 999);
62
+ }
63
+
64
+ function rysc_noyoast() {
65
+ add_action( 'admin_notices', 'rysc_notice' );
66
+ add_action( 'admin_init', 'rysc_deactivate' );
67
+ }
68
 
 
 
69
  if ( rysc_active( 'wordpress-seo/wp-seo.php' ) || rysc_active( 'wordpress-seo-premium/wp-seo-premium.php' ) ) {
70
  rysc_do();
71
  } else {
72
  rysc_noyoast();
73
  }
74
 
 
75
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), function($link) {
76
  return array_merge( $link, array('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2VYPRGME8QELC" target="_blank">Donate</a>') );
77
  } );