detector = new ADFC_Detector(); $this->settings = new ADFC_Settings( $this ); $this->chatbot = new ADFC_Chatbot_Disclosure( $this ); $this->media = new ADFC_Media_Labels( $this ); // Translations load automatically for wordpress.org-hosted plugins // via language packs since WP 4.6; no manual loading needed. } /** * Default settings. * * @return array */ public static function defaults() { return array( 'chatbot_disclosure_enabled' => 1, 'chatbot_badge_text' => '', // Empty = locale-appropriate default. 'chatbot_badge_position' => 'top', 'auto_detect_embeds' => 1, 'custom_selectors' => '', 'media_labels_enabled' => 1, 'media_auto_detect' => 1, 'media_badge_text' => '', 'media_badge_style' => 'corner', 'media_machine_readable' => 1, ); } /** * Get a setting value with fallback to defaults. * * @param string $key Setting key. * @return mixed */ public function get_setting( $key ) { $options = get_option( self::OPTION_KEY, array() ); $defaults = self::defaults(); if ( isset( $options[ $key ] ) ) { return $options[ $key ]; } return isset( $defaults[ $key ] ) ? $defaults[ $key ] : null; } /** * Locale-appropriate default disclosure text for chatbots. * * Wording follows the plain-language approach of the European * Commission's July 2026 Article 50 guidance: clear, at first * interaction, not buried in terms. * * @return string */ public function default_chatbot_text() { /* translators: Shown to site visitors near a chatbot window. */ return __( 'You are interacting with an AI chatbot, not a human.', 'ai-disclosure-for-chatbots' ); } /** * Locale-appropriate default label text for AI media. * * @return string */ public function default_media_text() { /* translators: Short badge label shown over AI-generated images. */ return __( 'AI-generated', 'ai-disclosure-for-chatbots' ); } /** * Activation hook: seed defaults without overwriting existing settings. * * @return void */ public static function activate() { $existing = get_option( self::OPTION_KEY, false ); if ( false === $existing ) { add_option( self::OPTION_KEY, self::defaults() ); } } }