load_dependencies(); $this->init_hooks(); } /** * Load required include files. */ private function load_dependencies() { require_once AIODIFY_CP_PLUGIN_DIR . 'includes/class-aiodify-admin.php'; require_once AIODIFY_CP_PLUGIN_DIR . 'includes/class-aiodify-frontend.php'; } /** * Initialize WordPress hooks. */ private function init_hooks() { // Plugin activation / deactivation defaults register_activation_hook( __FILE__, array( $this, 'activate' ) ); register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); // Add settings action link on plugins list page add_filter( 'plugin_action_links_' . AIODIFY_CP_PLUGIN_BASENAME, array( $this, 'add_action_links' ) ); // Initialize Admin & Frontend handlers if ( is_admin() ) { new Aiodify_Admin(); } new Aiodify_Frontend(); } /** * Plugin activation default options. */ public function activate() { $default_options = self::get_default_options(); $existing_options = get_option( 'aiodify_cp_settings' ); if ( $existing_options === false ) { update_option( 'aiodify_cp_settings', $default_options ); } else { // Merge with new defaults if missing $updated = wp_parse_args( $existing_options, $default_options ); update_option( 'aiodify_cp_settings', $updated ); } } /** * Plugin deactivation cleanup if needed. */ public function deactivate() { // Safe placeholder for deactivation } /** * Add quick settings link to plugins table. */ public function add_action_links( $links ) { $settings_link = '' . esc_html__( 'Settings', 'aiodify-content-protection' ) . ''; array_unshift( $links, $settings_link ); return $links; } /** * Get default plugin settings. */ public static function get_default_options() { return array( // Master & Content Protection 'enable_protection' => 1, 'disable_right_click' => 1, 'disable_text_selection' => 1, 'disable_copy_cut_paste' => 1, 'disable_drag_drop' => 1, 'disable_image_drag' => 1, // Keyboard Shortcuts 'disable_ctrl_a' => 1, // Select All 'disable_ctrl_c' => 1, // Copy 'disable_ctrl_x' => 1, // Cut 'disable_ctrl_v' => 1, // Paste 'disable_ctrl_s' => 1, // Save 'disable_ctrl_p' => 1, // Print 'disable_ctrl_u' => 1, // View Source 'disable_ctrl_f' => 1, // Find 'disable_devtools_f12' => 1, // F12, Ctrl+Shift+I/J/C 'disable_print_screen' => 1, // Print / PrintScreen suppress // Advanced Features 'exclude_admin' => 1, // Allow logged in administrator to copy 'exclude_logged_in' => 0, // Allow all logged-in users // Warning Toast Notification 'enable_warning_toast' => 1, 'warning_message' => __( '⚠️ Content is protected! Unauthorized copying is disabled. © All rights reserved.', 'aiodify-content-protection' ), 'toast_theme' => 'dark_glass', // dark_glass, neon_indigo, clean_light, amber_alert 'toast_position' => 'top_center', // top_center, top_right, bottom_center, bottom_right 'toast_duration' => 3000, // milliseconds 'toast_sound' => 0, ); } } /** * Bootstrap the plugin. */ function aiodify_content_protection_init() { return Aiodify_Content_Protection::instance(); } aiodify_content_protection_init();