%s', esc_url( $settings_url ), __( 'Settings', 'ai-featured-image' ) ); array_unshift( $links, $settings_link ); return $links; } // Add meta links --------------> function aifi_add_metalinks_to_plugins_page( $links, $file ) { $plugin = plugin_basename( AIFI_PLUGIN_DIR . 'ai-featured-image.php' ); if ($file == $plugin) { $donation_url = 'https://alternatives-manifest.de/wordpress'; $donation_link = sprintf( '%s', esc_url($donation_url), __( 'Donation', 'ai-featured-image' ) ); array_unshift( $links, $donation_link ); $rating_url = 'https://wordpress.org/support/plugin/ai-featured-image/reviews/?rate=5#new-post'; $rating_link = sprintf( '%s', esc_url($rating_url), __( 'Rate', 'ai-featured-image' ) ); array_unshift( $links, $rating_link ); $support_url = 'https://wordpress.org/support/plugin/ai-featured-image/#new-topic-0'; $support_link = sprintf( '%s', esc_url($support_url), __( 'Support', 'ai-featured-image' ) ); array_unshift( $links, $support_link ); } return $links; } // Stelle sicher, dass AIFI_PLUGIN_DIR definiert ist (aus der Hauptdatei) if (defined('AIFI_PLUGIN_DIR')) { $plugin_basename = plugin_basename( AIFI_PLUGIN_DIR . 'ai-featured-image.php' ); add_filter( 'plugin_action_links_' . $plugin_basename, 'aifi_add_settings_link_to_plugins_page' ); add_filter( 'plugin_row_meta', 'aifi_add_metalinks_to_plugins_page', 10, 2 ); } class AIFI_Settings { private static $options; public static function init() { add_action( 'admin_menu', [ self::class, 'add_settings_page' ] ); add_action( 'admin_init', [ self::class, 'register_settings' ] ); // Optionen nur einmal laden, wenn benötigt // self::$options = get_option( 'aifi_settings' ); // Besser erst laden, wenn gebraucht } public static function add_settings_page() { add_options_page( 'AI Featured Image - ' . __( 'Settings', 'ai-featured-image' ), 'AIFI - ' . __( 'Settings', 'ai-featured-image' ), 'manage_options', 'aifi-settings', [ self::class, 'create_settings_page' ] ); } public static function register_settings() { // Registriert die Einstellungs-Gruppe und die Option selbst mit Sanitization Callback register_setting( 'aifi_settings_group', 'aifi_settings', [ self::class, 'sanitize_settings' ] ); // Fügt einen Abschnitt zur Seite hinzu add_settings_section( 'aifi_api_settings_section', __( 'API Settings', 'ai-featured-image' ), null, // Callback für Sektions-Beschreibung (optional) 'aifi-settings' // Slug der Seite, zu der die Section gehört ); // --- Registriert die einzelnen Felder --- // Feld für Dienstauswahl add_settings_field( 'aifi_api_service', // Eindeutige ID des Feldes __( 'AI-Service', 'ai-featured-image' ), // Label für das Feld (wird im
' . esc_html__( 'Specify which text should be used as the basis for the automatically generated prompt if no manual prompt is entered in the editor.', 'ai-featured-image' ) . '
'; }, 'aifi-settings' // Gehört zur gleichen Seite ); // NEU: Feld für Prompt-Quelle add_settings_field( 'aifi_prompt_source', // ID des Feldes __( 'Source for auto-prompt', 'ai-featured-image' ), // Label [ self::class, 'render_prompt_source_field' ], // Callback-Funktion 'aifi-settings', // Page Slug 'aifi_prompt_settings_section', // ID der neuen Sektion ['label_for' => 'aifi_prompt_source'] // Für das Label-Tag ); } /** * NEU: Rendert die Steuerelemente für Stability AI Dimensionen (XL Select + v1.6 Inputs). * Enthält auch die versteckten Felder zum Speichern. */ public static function render_stabilityai_dimensions_controls( $args ) { // Aktuell gespeicherte Werte holen (oder Defaults) // Defaults werden jetzt besser im JS und im API Handler gesetzt, hier nur laden, was da ist. $current_width = self::get_option_value('stabilityai_width', 0); $current_height = self::get_option_value('stabilityai_height', 0); $current_engine = self::get_option_value('stabilityai_engine_id', 'stable-diffusion-v1-6'); // Definiere die XL Dimensionen $xl_dimensions = [ "1024x1024" => "1024 x 1024 (Default)", "1152x896" => "1152 x 896", "1216x832" => "1216 x 832", "1344x768" => "1344 x 768", "1536x640" => "1536 x 640" // keine Hochformate ]; $current_xl_dim_key = $current_width . 'x' . $current_height; ?> __( 'Page - or Post title', 'ai-featured-image' ), 'excerpt' => __( 'Excerpt (preferred)', 'ai-featured-image' ), 'content' => __( 'Page - or Post content', 'ai-featured-image' ), // Hier könnten später leicht weitere Quellen hinzugefügt werden ]; ?>
';
echo esc_html__('The AI Featured Image plugin (AIFI) generates featured images for each page or post if you want. The creation can be done as part of editing a post or page. The images are generated by AI based on the title, excerpt, or page content. Alternatively, you can define your own AI prompt for image generation.', 'ai-featured-image') . '
';
echo esc_html__('This is an experimental development. AIs are capricious and extremely volatile. I have had good experiences with Stability.AI and Pollutions.AI. Neither of them usually makes a fuss or complains. Clipdrop sometimes refuses to generate an image due to the text it reads from the website. Google refuses to generate practically any image due to some unknown rule. However, I am working on including Google and other AIs here. Perhaps a generic provider will be available in the future that will allow a wide variety of models to be selected. Pollutions.AI works without requiring an API key, so it works from scratch, so to speak. All other AIs require an account. Here, too, I am looking for solutions to circumvent the annoying logins and accounts. I would be grateful if you could give me any suggestions.', 'ai-featured-image') . '
' . esc_html__('To use the AI service, select it and configure its settings. You must first create an account with the AI service and generate an API key. Use the links at the bottom of this page to do so.', 'ai-featured-image') . '
'; ?>| | | Pollinations.ai API Docs