<?php
/**
 * Name: Disable File Editing
 * Description: Disable the theme and plugin file editor in WordPress admin to prevent unauthorized code changes and reduce security risks from compromised accounts
 * Category: Security
 * Icon: -
 * UseCases: [
 *   {
 *     "title": "Prevent Code Injection",
 *     "description": "Disable the theme and plugin file editors in WordPress admin to prevent hackers from injecting malicious code."
 *   },
 *   {
 *     "title": "Protect Production Sites",
 *     "description": "Ensure developers cannot accidentally edit code directly in production, forcing proper deployment workflows."
 *   }
 * ]
 * Added: 2025-07-22
 * Tags: security, editor, files, hardening, protection
 * WhereToFind: {
 *   "location": "Works automatically",
 *   "url": "",
 *   "instructions": "Theme and plugin editors disabled in admin",
 *   "newTab": false
 * }
 */

// Prevent direct access
if (!defined('ABSPATH')) exit;

class SwitchboardDisableFileEditing {

    public function __construct() {
        if (!defined('DISALLOW_FILE_EDIT')) {
            define('DISALLOW_FILE_EDIT', true);
        }
    }

    /**
     * Register data locations for cleanup system
     *
     * @return array Data storage locations
     */
    public function register_data_locations() {
        return [
            'options' => [],
            'option_patterns' => [],
            'tables' => [],
            'post_meta' => [],
            'user_meta' => [],
        ];
    }
}

// Initialize and register with data system
$switchboard_instance = new SwitchboardDisableFileEditing();
Switchboard_Data_Registry::get_instance()->auto_register($switchboard_instance, __FILE__);
