ID, $excluded_ids, true)) { return; } } // Check protected post types – if list is set, only load for those types. if (!empty($options['protected_post_types']) && is_array($options['protected_post_types'])) { if (!in_array($post->post_type, $options['protected_post_types'], true)) { return; } } } // Enqueue the protection script. wp_enqueue_script( 'accelvia-protection', ACCELVIA_PLUGIN_URL . 'assets/js/protection.js', array(), // No dependencies – pure Vanilla JS. ACCELVIA_VERSION, true // Load in footer. ); // Pass configuration to JS. $config = array( 'disableRightClick' => !empty($options['disable_right_click']) && '1' === $options['disable_right_click'], 'disableShortcuts' => !empty($options['disable_shortcuts']) && '1' === $options['disable_shortcuts'], 'disableTextSelection' => !empty($options['disable_text_selection']) && '1' === $options['disable_text_selection'], 'disableImageDrag' => !empty($options['disable_image_drag']) && '1' === $options['disable_image_drag'], 'disableCopy' => !empty($options['disable_copy']) && '1' === $options['disable_copy'], 'notificationType' => isset($options['notification_type']) ? $options['notification_type'] : 'toast', 'notificationMessage' => isset($options['notification_message']) ? $options['notification_message'] : __('This content is protected by Accelvia.', 'accelvia-content-protection'), ); wp_localize_script('accelvia-protection', 'accelvia_config', $config); } add_action('wp_enqueue_scripts', 'accelvia_enqueue_frontend_protection');