admin_url( 'admin-ajax.php' ) ) ); wp_localize_script( 'ai-content-wizard-settings-script', 'ai_content_wizard_settings', array( 'selectWatermarkImageTitle' => __( 'Select Watermark Image', 'ai-content-wizard' ), 'selectWatermarkButtonText' => __( 'Select Image', 'ai-content-wizard' ) ) ); // Подключаем стили вкладок и новый облик настроек wp_enqueue_style( 'ai-content-wizard-content-plan-style', AI_CONTENT_WIZARD_URL . 'css/content-plan-styles.css', array(), AI_CONTENT_WIZARD_VERSION ); $settings_lite_style = AI_CONTENT_WIZARD_PATH . 'css/settings-page-lite.css'; $settings_lite_version = AI_CONTENT_WIZARD_VERSION; if ( file_exists( $settings_lite_style ) ) { $settings_lite_version .= '-' . filemtime( $settings_lite_style ); } wp_enqueue_style( 'ai-content-wizard-settings-lite-style', AI_CONTENT_WIZARD_URL . 'css/settings-page-lite.css', array( 'ai-content-wizard-content-plan-style' ), $settings_lite_version ); } add_action( 'admin_enqueue_scripts', 'enqueue_settings_page_script' ); function ai_content_wizard_settings_page() { if ( ! current_user_can( 'manage_options' ) ) { return; } $latest_post = get_posts( array( 'numberposts' => 1 ) ); if ( ! empty( $latest_post ) ) { $latest_post = $latest_post[0]; } else { $latest_post = null; } if ( $latest_post ) { $latest_post_title = get_the_title( $latest_post ); $latest_post_date = get_the_date( get_option( 'date_format' ), $latest_post ); $latest_status = get_post_status( $latest_post ); $status_object = $latest_status ? get_post_status_object( $latest_status ) : null; $latest_post_status_label = $status_object ? $status_object->label : ( $latest_status ? ucfirst( $latest_status ) : __( 'Published', 'ai-content-wizard' ) ); } else { $latest_post_title = __( 'Ready to publish', 'ai-content-wizard' ); $latest_post_date = __( 'No posts yet', 'ai-content-wizard' ); $latest_post_status_label = __( 'Not available', 'ai-content-wizard' ); } $errors = array(); if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) { if ( ! isset( $_POST['ai_content_wizard_nonce'] ) || ! wp_verify_nonce( $_POST['ai_content_wizard_nonce'], 'ai_content_wizard_save_settings' ) ) { $errors[] = __( 'Security error. Please try again.', 'ai-content-wizard' ); } else { // Обработка основных настроек (без e-mail уведомлений, категорий и Telegram) ai_content_wizard_update_setting( 'ai_content_wizard_image_size', sanitize_text_field( $_POST['ai_content_wizard_image_size'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_image_quality', sanitize_text_field( $_POST['ai_content_wizard_image_quality'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_image_style', sanitize_text_field( $_POST['ai_content_wizard_image_style'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_prompt_specification', sanitize_text_field( $_POST['ai_content_wizard_prompt_specification'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_format', sanitize_text_field( $_POST['ai_content_wizard_format'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_text_length', sanitize_text_field( $_POST['ai_content_wizard_text_length'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_site_type', sanitize_text_field( $_POST['ai_content_wizard_site_type'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_writing_style', sanitize_text_field( $_POST['ai_content_wizard_writing_style'] ) ); // Удалены поля Custom Theme и Additional Requests ai_content_wizard_update_setting( 'ai_content_wizard_target_audience', sanitize_text_field( $_POST['ai_content_wizard_target_audience'] ) ); // Регионы заблокированы – их значение не меняется // ai_content_wizard_update_setting( 'ai_content_wizard_target_region', sanitize_text_field( $_POST['ai_content_wizard_target_region'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_post_status', sanitize_text_field( $_POST['ai_content_wizard_post_status'] ) ); ai_content_wizard_update_setting( 'ai_content_wizard_enable_image_generation', isset( $_POST['ai_content_wizard_enable_image_generation'] ) ? 1 : 0 ); // E-mail уведомления удалены в lite-версии // Footer Credit – всегда включён (locked) ai_content_wizard_update_setting( 'ai_content_wizard_enable_footer_credit', 1 ); // Telegram настройки – в lite-версии не доступны, поэтому не сохраняем // Настройка генерации тегов ai_content_wizard_update_setting( 'ai_content_wizard_enable_tags_generation', isset( $_POST['ai_content_wizard_enable_tags_generation'] ) ? 1 : 0 ); // Водяной знак – блокируется в lite-версии (сохраняем как выключено) ai_content_wizard_update_setting( 'ai_content_wizard_enable_watermark', 0 ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_type', 'text' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_text', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_image_id', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_color', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_opacity', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_size', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_watermark_position', '' ); // Дополнительные изображения и оптимизация – блокируются ai_content_wizard_update_setting( 'ai_content_wizard_enable_additional_images', 0 ); ai_content_wizard_update_setting( 'ai_content_wizard_additional_images_count', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_enable_image_optimization', 0 ); // Enhanced Generation Quality – сохраняем как выключено ai_content_wizard_update_setting( 'ai_content_wizard_enhanced_generation_quality', 0 ); // Telegram формат сообщений – блокируются ai_content_wizard_update_setting( 'ai_content_wizard_custom_announcement_prompt', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_telegram_message_format', '' ); ai_content_wizard_update_setting( 'ai_content_wizard_telegram_format_type', 'standard' ); if ( empty( $errors ) ) { echo '

' . esc_html__( 'Settings saved.', 'ai-content-wizard' ) . '

'; } } } // В lite-версии доступны только модели dall-e-2 и dall-e-3 $model_names = array( 'dall-e-2' => 'DALL-E 2', 'dall-e-3' => 'DALL-E 3' ); // Получаем выбранную модель. Если выбрана другая – принудительно возвращаем default (dall-e-3) $image_model = ai_content_wizard_get_setting( 'ai_content_wizard_image_model', 'dall-e-3' ); if ( ! array_key_exists( $image_model, $model_names ) ) { $image_model = 'dall-e-3'; } $model_display_name = $model_names[ $image_model ]; $image_size = ai_content_wizard_get_setting( 'ai_content_wizard_image_size', '' ); $image_quality = ai_content_wizard_get_setting( 'ai_content_wizard_image_quality', '' ); $image_style = ai_content_wizard_get_setting( 'ai_content_wizard_image_style', '' ); $prompt_specification = ai_content_wizard_get_setting( 'ai_content_wizard_prompt_specification', '' ); // Параметры только для dall-e моделей if ( $image_model === 'dall-e-2' ) { $size_options = array( '256x256', '512x512', '1024x1024' ); $quality_options = array( 'standard' ); $style_options = array( 'vivid' ); } elseif ( $image_model === 'dall-e-3' ) { $size_options = array( '1024x1024', '1792x1024', '1024x1792' ); $quality_options = array( 'standard', 'hd' ); $style_options = array( 'natural', 'vivid' ); } else { $size_options = array(); $quality_options = array(); $style_options = array(); } // Массивы данных по текстовым моделям (без изменений) $text_model_names = array( 'gpt-3.5-turbo' => 'GPT-3.5-turbo', 'gpt-3.5-turbo-16k' => 'GPT-3.5-turbo 16k', 'gpt-4' => 'GPT-4', 'gpt-4-turbo' => 'GPT-4 Turbo', 'gpt-4o' => 'GPT-4o', 'gpt-4o-mini' => 'GPT-4o mini', 'gpt-4o1-preview' => 'GPT-4o1-preview', 'gpt-4o1-mini' => 'GPT-4o1-mini', 'gpt-4.5-preview' => 'GPT-4.5-preview', 'gpt-5-mini' => 'GPT-5 mini', ); $text_model = ai_content_wizard_get_setting( 'ai_content_wizard_text_model', 'gpt-4o-mini' ); $text_model_display_name = array_key_exists( $text_model, $text_model_names ) ? $text_model_names[ $text_model ] : 'Unknown Model'; echo '
'; if ( class_exists( 'AiContentWizard_PromoPilot' ) ) { AiContentWizard_PromoPilot::render_settings_banner(); } echo '
'; echo '
'; echo '
'; echo '

' . esc_html__( 'Lite version overview', 'ai-content-wizard' ) . '

'; echo '

' . esc_html__( 'AI Content Wizard Settings', 'ai-content-wizard' ) . '

'; echo '

' . esc_html__( 'Fine-tune defaults for text, images, and publishing. Upgrade to Pro for automations, bulk scheduling, and multi-channel support.', 'ai-content-wizard' ) . '

'; echo '
'; echo ' '; echo ' ' . esc_html__( 'Unlock In Pro', 'ai-content-wizard' ) . ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo '
'; echo '
'; echo '
'; echo ' ' . esc_html__( 'Text model', 'ai-content-wizard' ) . ''; echo ' ' . esc_html( strtoupper( $text_model_display_name ) ) . ''; echo '

' . esc_html__( 'Switch providers and unlock premium prompts in the API settings.', 'ai-content-wizard' ) . '

'; echo ' ' . esc_html__( 'Manage text model', 'ai-content-wizard' ) . ''; echo '
'; echo '
'; echo ' ' . esc_html__( 'Image model', 'ai-content-wizard' ) . ''; echo ' ' . esc_html( strtoupper( $model_display_name ) ) . ''; echo '

' . esc_html__( 'Lite users can work with DALL-E defaults. Pro unlocks more formats.', 'ai-content-wizard' ) . '

'; echo ' ' . esc_html__( 'Adjust image model', 'ai-content-wizard' ) . ''; echo '
'; echo '
'; echo ' ' . esc_html__( 'Latest publish state', 'ai-content-wizard' ) . ''; echo ' ' . esc_html( $latest_post_status_label ) . ''; echo '

' . esc_html( $latest_post_title ) . '

'; echo ' ' . esc_html( $latest_post_date ) . ''; echo '
'; echo '
'; if ( ! empty( $errors ) ) { echo '

' . implode( '
', array_map( 'esc_html', $errors ) ) . '

'; } ?>

PRO

PRO

PRO

'; ai_content_wizard_display_tooltips(); echo '
'; echo '
'; } add_action( 'wp_ajax_get_current_text_model', 'ai_content_wizard_get_current_text_model' ); function ai_content_wizard_get_current_text_model() { echo esc_html( ai_content_wizard_get_setting( 'ai_content_wizard_text_model', 'gpt-4o-mini' ) ); wp_die(); } add_action( 'wp_ajax_ai_content_wizard_reset_all_categories', 'ai_content_wizard_reset_all_categories' ); function ai_content_wizard_reset_all_categories() { // В lite-версии категорийные настройки отсутствуют, поэтому ничего не делаем. wp_die(); } function ai_content_wizard_delete_category_setting( $category_id, $key ) { global $wpdb; $table_name = $wpdb->prefix . 'ai_content_wizard_settings'; $wpdb->delete( $table_name, array( 'setting_key' => $category_id . '_' . $key ) ); }