PluginProbe
Remove Meta Generators / trunk
Remove Meta Generators vtrunk
remove-meta-generators / remove-meta-generators.php

remove-meta-generators.php in Remove Meta Generators trunk, at remove-meta-generators.php

40 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Plugin Name: Remove Meta Generators
4 Description: Remove all meta generator tags for all plugins. No settings necessary! Install and activate.
5 Author: Webbernaut
6 Author URI: https://www.webbernaut.com
7 License: GPLv2 or later
8 Text Domain: remove-meta-generators
9 Version: 1.1.1
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13
14 // Set the version of this plugin
15 if ( ! defined( 'removeMetaGenerators' ) ) {
16 define( 'removeMetaGenerators', '1.1.1' );
17 }
18
19 class removeMetaGenerators {
20 function __construct() {
21 add_action( 'init', array( &$this, 'init_removeMetaGenerators' ) ); // Hook up to the init action
22 }
23
24 function init_removeMetaGenerators() {
25 ini_set( 'output_buffering', 'on' ); // turns on output_buffering
26 function remove_meta_generators( $html ) {
27 $pattern = '/<meta\s+name\s*=\s*["\']generator["\'][^>]*>/i';
28 $html = preg_replace( $pattern, '', $html );
29 return $html;
30 }
31 function clean_meta_generators() {
32 ob_start( 'remove_meta_generators' );
33 }
34 add_action( 'template_redirect', 'clean_meta_generators', 100 );
35 add_action( 'wp_footer', function () { ob_end_flush(); }, 100 );
36 }
37 }
38
39 new removeMetaGenerators();
40