true], 'names' ); foreach ( $post_types as $post_type ) { // Prüfen ob Post Type Beitragsbilder unterstützt if ( post_type_supports( $post_type, 'thumbnail' ) ) { add_meta_box( 'aifi_generator_metabox', // Interne ID der Metabox 'AIFI-' .__( 'Generator', 'ai-featured-image' ), // Titel der Box [ self::class, 'render_metabox' ], // Callback zum Rendern des Inhalts $post_type, // Post Type 'side', // Kontext (Position) 'low' // Priorität ); } } } // Rendert den HTML-Inhalt der Metabox public static function render_metabox( $post ) { // Hole aktuelle Einstellungen $options = get_option( 'aifi_settings' ); // Fallback auf 'stabilityai', falls nichts gesetzt ist $api_service = isset( $options['api_service'] ) ? $options['api_service'] : 'stabilityai'; // Prüfe, ob für den GEWÄHLTEN Dienst ein API-Schlüssel vorhanden ist $api_key_present = false; $service_name = 'N/A'; // Default $allowed_sources = [ 'title' => __( 'Title', 'ai-featured-image' ), 'excerpt' => __( 'Excerpt', 'ai-featured-image' ), 'content' => __( 'Content', 'ai-featured-image' ), // Hier könnten später leicht weitere Quellen hinzugefügt werden ]; $prompt_source_key = isset( $options['prompt_source'] ) ? $options['prompt_source'] : 'excerpt'; $prompt_source = $allowed_sources[$prompt_source_key] ?? __( 'Unknown Source', 'ai-featured-image' ); if ($api_service === 'clipdrop') { $service_name = 'ClipDrop'; if (!empty($options['clipdrop_api_key'])) { $api_key_present = true; } } elseif ($api_service === 'stabilityai') { $service_name = 'Stability AI'; if (!empty($options['stabilityai_api_key'])) { $api_key_present = true; } } elseif ($api_service === 'google') { // *** NEU: Google Gemini hinzugefügt *** $service_name = 'Google Gemini'; if (!empty($options['google_api_key'])) { $api_key_present = true; } } elseif ($api_service === 'pollinations') { // *** NEU: Pollinations.ai hinzugefügt *** $service_name = 'Pollinations.ai'; // Die Annahme "kein API-Key" bleibt vorerst. } ?>

' . esc_html( $service_name ) . '
' ); // translators: %s: Source for auto-prompt, nach der gefiltert wurde. printf( esc_html__( 'Source for auto-prompt: %s', 'ai-featured-image' ), '' . esc_html( $prompt_source ) . '' ); ?>