and the password goes too...
This commit is contained in:
parent
ad62097fc4
commit
2569cf45c7
|
@ -1,10 +1,63 @@
|
|||
<?php
|
||||
|
||||
//* Remove Menu Links
|
||||
function plugin_controls_remove_menus() {
|
||||
/*
|
||||
Plugin Name: Plugin Control
|
||||
Plugin URI: https://cooini.com/services/dev/wordpress
|
||||
Description: This plugin will disable access to the plugins and other pages
|
||||
Version: 1.0
|
||||
Author: sbyrd
|
||||
Author URI: https://cooini.com/
|
||||
License: MINE-all-mine
|
||||
*/
|
||||
|
||||
function plugin_controls_remove_menus()
|
||||
{
|
||||
$allow_plugin_file = plugin_dir_path(__FILE__)."/.allow_plugin_list";
|
||||
|
||||
if (isset($_GET['allow_plugin_list']) and $_GET['allow_plugin_list'] === "123letmesee")
|
||||
{
|
||||
touch( $allow_plugin_file );
|
||||
}
|
||||
//
|
||||
|
||||
if (!file_exists($allow_plugin_file)) {
|
||||
remove_menu_page('plugins.php');
|
||||
remove_menu_page('update-core.php');
|
||||
}
|
||||
add_action( 'admin_menu', 'plugin_controls_remove_menus' );
|
||||
|
||||
//TODO make plugins only accessible with token
|
||||
}
|
||||
function plugin_page_control()
|
||||
{
|
||||
$allow_plugin_file = plugin_dir_path(__FILE__)."/.allow_updates";
|
||||
|
||||
if (isset($_GET['allow_updates']) and $_GET['allow_updates'] === "123letmeupdate")
|
||||
{
|
||||
touch( $allow_plugin_file );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file_exists($allow_plugin_file) and (time() - filectime($allow_plugin_file) >= 60 * 60 * 12 ))
|
||||
{
|
||||
// File is older than threshold, delete
|
||||
unlink($allow_plugin_file);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
if (file_exists($allow_plugin_file))
|
||||
{
|
||||
define( 'DISALLOW_FILE_EDIT', false ); // allow
|
||||
define( 'DISALLOW_FILE_MODS', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
define( 'DISALLOW_FILE_EDIT', true ); // disable
|
||||
define( 'DISALLOW_FILE_MODS', true);
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', 'plugin_controls_remove_menus' );
|
||||
add_action( 'admin_menu', 'plugin_page_control' );
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue