'The header contains the project name,', 'Header (zobacz tu) zawiera nazwę projektu,' => 'The header contains the project name,', 'Header zawiera nazwę projektu,' => 'The header contains the project name,', 'Header zawiera nazwę projektu' => 'The header contains the project name', 'zawiera nazwę projektu,' => 'contains the project name,', 'zawiera nazwę projektu' => 'contains the project name', 'zobacz tu' => 'see here', 'oraz the main user-facing value proposition' => 'and the main user-facing value proposition', 'oraz główne przesłanie dla użytkownika' => 'and the main user-facing value proposition', 'główne przesłanie dla użytkownika' => 'the main user-facing value proposition', 'aktualny komunikat o statusie projektu' => 'the current project status message', 'wyraźne CTA kierujące do przewodnika startowego' => 'a strong CTA leading to the getting started guide', 'jasny opis działania' => 'a clear description', 'nazwa projektu' => 'project name', 'Struktura jest zgodna z wytycznymi marki i nie wymaga zmian w motywie.' => 'The structure follows the brand guidelines and does not require theme changes.', ' oraz ' => ' and ', ]; uksort($map, function($a, $b) { return strlen($b) <=> strlen($a); }); $text = strtr($text, $map); $text = str_replace( [ 'Header (*see here) contains the project name,', 'Header (see here) contains the project name,', 'Header contains the project name,' ], 'The header contains the project name,', $text ); } return $text; } function aiwest_site_builder_migrate_legacy_admin_notes() { if (!class_exists('AIWEST_Product') || !AIWEST_Product::is_en()) return; foreach (['aiwest_header_plan', 'aiwest_footer_plan'] as $option_name) { $plan = get_option($option_name, []); if (!is_array($plan) || empty($plan['admin_note'])) continue; $normalized = aiwest_site_builder_admin_note($plan['admin_note']); if ($normalized !== $plan['admin_note']) { $plan['admin_note'] = $normalized; update_option($option_name, $plan); } } } function aiwest_site_builder_page() { if (!current_user_can('manage_options')) return; aiwest_site_builder_migrate_legacy_admin_notes(); $notice = ''; $tab = AIWEST_Security::get_key('tab', 'home'); $allowed_tabs = ['home', 'menu', 'header', 'footer', 'pages', 'style', 'graphics', 'directory-map', 'motion', 'blog', 'redirects']; if (!in_array($tab, $allowed_tabs, true)) $tab = 'home'; if (AIWEST_Security::is_post_request() && AIWEST_Security::post_bool('aiwest_site_builder_action')) { check_admin_referer('aiwest_site_builder_action'); $action = AIWEST_Security::post_key('aiwest_site_builder_action'); if ($action === 'save_canvas_background') { update_option('aiwest_canvas_bg_url', AIWEST_Security::post_url('aiwest_canvas_bg_url')); update_option('aiwest_canvas_bg_opacity', max(0, min(1, AIWEST_Security::post_float('aiwest_canvas_bg_opacity', 0.16)))); update_option('aiwest_header_bg_url', AIWEST_Security::post_url('aiwest_header_bg_url')); update_option('aiwest_header_bg_opacity', max(0, min(1, AIWEST_Security::post_float('aiwest_header_bg_opacity', 0.18)))); $notice = '

' . esc_html(__('Canvas and Header background settings were saved.', 'ai-webmaster-studio')) . '

'; $tab = 'style'; } if ($action === 'link_front_page') { $front_id = intval(get_option('page_on_front', 0)); if ($front_id && class_exists('AIWEST_Internal_Links')) { $result = AIWEST_Internal_Links::link_post($front_id, 16); if (is_wp_error($result)) { $notice = '

' . esc_html(__('Could not add links:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

'; } elseif (!empty($result['changed'])) { $items = ''; foreach ((array)$result['links'] as $link) { $items .= '
  • ' . esc_html($link['phrase']) . ' → ' . esc_html($link['title']) . '
  • '; } $notice = '

    ' . esc_html(__('Internal links have been added to the homepage.', 'ai-webmaster-studio')) . '

    ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html($result['message'] ?? __('No new links were added.', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The homepage or internal linking module was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'home'; } if ($action === 'save_header_logo') { update_option('aiwest_header_logo_url', AIWEST_Security::post_url('aiwest_header_logo_url')); update_option('aiwest_header_logo_width', max(1, AIWEST_Security::post_int('aiwest_header_logo_width', 180))); $h = AIWEST_Security::post_text('aiwest_header_logo_height', 'auto'); update_option('aiwest_header_logo_height', $h === '' ? 'auto' : $h); update_option('aiwest_header_logo_alt', AIWEST_Security::post_text('aiwest_header_logo_alt', get_bloginfo('name'))); update_option('aiwest_header_hide_text_title', AIWEST_Security::post_bool('aiwest_header_hide_text_title') ? '1' : '0'); $notice = '

    ' . esc_html(__('AI Header logo has been saved.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Refresh the homepage to see the change.', 'ai-webmaster-studio')) . '

    '; $tab = 'header'; } if ($action === 'build_ai_dropdown_menu') { $create_drafts = AIWEST_Security::post_bool('create_menu_drafts'); $result = class_exists('AIWEST_Site_Structure') ? AIWEST_Site_Structure::apply_menu_plan_to_ai_header($create_drafts) : new WP_Error('aiwest_menu_missing', __('The AI menu module is not available.', 'ai-webmaster-studio')); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not apply the menu to the header:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $header_id = intval($result['post_id'] ?? 0); $notice = '

    ' . esc_html(__('The menu plan was applied to the active AI Header.', 'ai-webmaster-studio')) . '

    '; if ($header_id) $notice .= '

    ' . esc_html(__('Edit AI Header', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View AI Header', 'ai-webmaster-studio')) . '

    '; $notice .= '

    ' . esc_html(__('The visible header menu uses the structure saved in the Current menu plan table.', 'ai-webmaster-studio')) . '

    '; } $tab = 'menu'; } if ($action === 'save_and_apply_ai_menu') { if (class_exists('AIWEST_AI_Menu')) { $result = AIWEST_AI_Menu::inject_into_active_header(AIWEST_Security::post_bool('create_menu_drafts')); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not apply the menu:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The menu plan has been applied to the active AI Header.', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The AI menu module is not available.', 'ai-webmaster-studio')) . '

    '; } $tab = 'menu'; } if ($action === 'link_active_footer') { $create_missing = AIWEST_Security::post_bool('create_missing_footer_pages'); $result = class_exists('AIWEST_Internal_Links') ? AIWEST_Internal_Links::link_active_footer($create_missing) : new WP_Error('aiwest_links_missing', __('The linking module is not available.', 'ai-webmaster-studio')); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not link the footer:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } elseif (!empty($result['changed'])) { $items = ''; foreach ((array)$result['links'] as $link) { $suffix = !empty($link['created']) ? ' (' . esc_html(__('draft created', 'ai-webmaster-studio')) . ')' : ''; $items .= '
  • ' . esc_html($link['phrase']) . ' → ' . esc_html($link['title']) . '' . $suffix . '
  • '; } $notice = '

    ' . esc_html(__('The active AI Footer was linked.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html($result['message'] ?? __('No new footer links were added.', 'ai-webmaster-studio')) . '

    '; } $tab = 'footer'; } if ($action === 'link_active_header_menu') { $create_missing = AIWEST_Security::post_bool('create_missing_header_pages'); $result = class_exists('AIWEST_Internal_Links') ? AIWEST_Internal_Links::link_active_header_menu($create_missing) : new WP_Error('aiwest_links_missing', __('The linking module is not available.', 'ai-webmaster-studio')); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not link the header:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } elseif (!empty($result['changed'])) { $items = ''; foreach ((array)$result['links'] as $link) { $suffix = !empty($link['created']) ? ' (' . esc_html(__('draft created', 'ai-webmaster-studio')) . ')' : ''; $items .= '
  • ' . esc_html($link['phrase']) . ' → ' . esc_html($link['title']) . '' . $suffix . '
  • '; } $notice = '

    ' . esc_html(__('Static AI Header items were linked.', 'ai-webmaster-studio')) . '

    ' . esc_html(__('A native WordPress menu configured on the Menu tab is recommended.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html($result['message'] ?? __('No new header links were added.', 'ai-webmaster-studio')) . '

    '; } $tab = 'header'; } if ($action === 'clean_front_canvas_shortcodes') { $front_id = intval(get_option('page_on_front', 0)); if ($front_id && class_exists('AIWEST_Canvas')) { $result = AIWEST_Canvas::clean_structural_shortcodes($front_id); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not clean the homepage:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } elseif ($result === 'cleaned') { $notice = '

    ' . esc_html(__('Duplicate [aiwest_header] / [aiwest_footer] shortcodes were removed from homepage content.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Canvas continues to render the active AI Header and AI Footer automatically.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('No [aiwest_header] or [aiwest_footer] shortcode was found in homepage content. No changes were made.', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The static homepage or Canvas module was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'home'; } if ($action === 'set_front_canvas') { $front_id = intval(get_option('page_on_front', 0)); if ($front_id && class_exists('AIWEST_Canvas')) { AIWEST_Canvas::enable_for_page($front_id); $notice = '

    ' . esc_html(__('AI Webmaster Studio Canvas has been enabled for the homepage.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('The static homepage or Canvas module was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'home'; } if ($action === 'unset_front_canvas') { $front_id = intval(get_option('page_on_front', 0)); if ($front_id && class_exists('AIWEST_Canvas')) { AIWEST_Canvas::disable_for_page($front_id); $notice = '

    ' . esc_html(__('AI Webmaster Studio Canvas was disabled for the homepage.', 'ai-webmaster-studio')) . ' ' . esc_html(__('The page now uses the standard theme template.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('The static homepage or Canvas module was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'home'; } if ($action === 'aiwest_undo_post') { $post_id = AIWEST_Security::post_int('post_id'); if ($post_id && class_exists('AIWEST_Undo')) { $result = AIWEST_Undo::restore_last($post_id); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not undo the changes:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The latest AI changes have been undone.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Restored snapshot from:', 'ai-webmaster-studio')) . ' ' . esc_html($result['snapshot_time']) . '. ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('Preview', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The selected page or Undo module is unavailable.', 'ai-webmaster-studio')) . '

    '; } $tab = AIWEST_Security::get_key('tab', 'home'); } if ($action === 'enable_page_canvas') { $post_id = AIWEST_Security::post_int('post_id'); if ($post_id && class_exists('AIWEST_Canvas')) { AIWEST_Canvas::enable_for_page($post_id); $notice = '

    ' . esc_html(__('AI Webmaster Studio Canvas has been enabled for this page.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('Could not enable Canvas for this page.', 'ai-webmaster-studio')) . '

    '; } $tab = 'pages'; } if ($action === 'disable_page_canvas') { $post_id = AIWEST_Security::post_int('post_id'); if ($post_id && class_exists('AIWEST_Canvas')) { AIWEST_Canvas::disable_for_page($post_id); $notice = '

    ' . esc_html(__('AI Webmaster Studio Canvas was disabled for the page.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('Could not disable Canvas for this page.', 'ai-webmaster-studio')) . '

    '; } $tab = 'pages'; } if ($action === 'create_page') { $command = AIWEST_Security::post_textarea('site_command'); $status = AIWEST_Security::allowed_post_status(AIWEST_Security::post_key('page_status', get_option('aiwest_site_builder_default_status', 'draft')), 'draft', true); update_option('aiwest_site_builder_default_status', in_array($status, ['draft', 'publish'], true) ? $status : 'draft'); $result = AIWEST_Site_Builder::create_page_from_command($command, $status); $notice = aiwest_site_builder_result_notice($result, __('The page has been created.', 'ai-webmaster-studio')); } if ($action === 'create_homepage') { $status = AIWEST_Security::allowed_post_status(AIWEST_Security::post_key('page_status', 'draft'), 'draft', true); $command = AIWEST_Security::post_textarea('homepage_command'); if (!$command) { $command = __('Create a modern visual homepage for this website. Do not create a plan. Create a real page with a hero, cards, topic sections, FAQ and CTA. Use the imported design reference and the brand visual style.', 'ai-webmaster-studio'); } $result = AIWEST_Site_Builder::create_page_from_command($command, $status); if (!is_wp_error($result) && !empty($result['page_id']) && AIWEST_Security::post_bool('enable_aiwest_canvas') && class_exists('AIWEST_Canvas')) { AIWEST_Canvas::enable_for_page(intval($result['page_id'])); } if (!is_wp_error($result) && !empty($result['page_id']) && AIWEST_Security::post_bool('embed_ai_header_footer') && !AIWEST_Security::post_bool('enable_aiwest_canvas')) { $page_id = intval($result['page_id']); $post = get_post($page_id); if ($post) { $content = $post->post_content; if (strpos($content, '[aiwest_header]') === false) { $content = "[aiwest_header]\n\n" . $content; } if (strpos($content, '[aiwest_footer]') === false) { $content .= "\n\n[aiwest_footer]"; } wp_update_post([ 'ID' => $page_id, 'post_content' => $content, ]); } } if (!is_wp_error($result) && !empty($result['page_id']) && AIWEST_Security::post_bool('set_as_front')) { update_option('show_on_front', 'page'); update_option('page_on_front', intval($result['page_id'])); } $notice = aiwest_site_builder_result_notice($result, __('The homepage has been prepared.', 'ai-webmaster-studio')); } if ($action === 'generate_menu_plan') { $instruction = AIWEST_Security::post_textarea('menu_instruction'); $result = AIWEST_Site_Structure::generate_menu_plan($instruction); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not prepare the menu:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The menu plan was prepared.', 'ai-webmaster-studio')) . ' ' . esc_html($result['admin_note'] ?? '') . '

    '; } $tab = 'menu'; } if ($action === 'save_menu_plan') { $ids = AIWEST_Security::post_array('menu_id'); $titles = AIWEST_Security::post_array('menu_title'); $types = AIWEST_Security::post_array('menu_type'); $destinations = AIWEST_Security::post_array('menu_destination'); $parents = AIWEST_Security::post_array('menu_parent'); $orders = AIWEST_Security::post_array('menu_order'); $items = []; foreach ((array)$titles as $i => $title) { $type = sanitize_key($types[$i] ?? 'page'); if (!in_array($type, ['page', 'custom'], true)) $type = 'page'; $destination = sanitize_text_field($destinations[$i] ?? ''); $items[] = [ 'id' => sanitize_key($ids[$i] ?? ''), 'title' => sanitize_text_field($title), 'type' => $type, 'slug' => $type === 'page' ? sanitize_title($destination ?: $title) : '', 'url' => $type === 'custom' ? esc_url_raw($destination) : '', 'parent' => sanitize_key($parents[$i] ?? ''), 'order' => max(0, intval($orders[$i] ?? (($i + 1) * 10))), ]; } AIWEST_Site_Structure::save_menu_plan($items); if (AIWEST_Security::post_bool('apply_to_ai_header')) { $result = AIWEST_Site_Structure::apply_menu_plan_to_ai_header(AIWEST_Security::post_bool('create_menu_drafts')); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('The menu plan was saved but could not be applied to AI Header:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The menu plan was saved and applied to the active AI Header.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Refresh the page to see the new header items.', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The menu plan has been saved.', 'ai-webmaster-studio')) . ' ' . esc_html(__('It has also been synchronized with the AI Header menu.', 'ai-webmaster-studio')) . ' ' . esc_html(__('To immediately fix header embedding, use the “Save and apply to AI Header” button.', 'ai-webmaster-studio')) . '

    '; } $tab = 'menu'; } if ($action === 'create_menu_pages') { $result = AIWEST_Site_Structure::create_pages_from_menu_plan(); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not create the pages:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('Pages created or found for menu items:', 'ai-webmaster-studio')) . ' ' . intval(count($result)) . '.

    '; } $tab = 'menu'; } if ($action === 'create_wp_menu') { $result = AIWEST_Site_Structure::create_or_update_wp_menu(); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not create the WordPress menu:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $location = $result['location'] ? ' ' . esc_html(__('Theme location:', 'ai-webmaster-studio')) . ' ' . esc_html($result['location']) . '.' : ' ' . esc_html(__('No theme menu location was detected. The menu was created but may require manual assignment in WordPress.', 'ai-webmaster-studio')); $notice = '

    ' . esc_html(__('The WordPress menu was created or updated.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Menu ID:', 'ai-webmaster-studio')) . ' ' . intval($result['menu_id']) . '.' . $location . '

    ' . esc_html(__('The menu plan was also synchronized with the AI Header dropdown menu.', 'ai-webmaster-studio')) . '

    '; } $tab = 'menu'; } if ($action === 'update_active_header_content') { $post_id = AIWEST_Security::post_int('post_id'); $content = AIWEST_Security::post_html('project_content'); if ($post_id && get_post_type($post_id) === 'page') { if (class_exists('AIWEST_Undo')) AIWEST_Undo::snapshot($post_id, 'site_builder_header_edit', __('Backup before manually editing the active AI Header.', 'ai-webmaster-studio')); $updated = wp_update_post([ 'ID' => $post_id, 'post_content' => $content, ], true); if (is_wp_error($updated)) { $notice = '

    ' . esc_html(__('Could not save AI Header:', 'ai-webmaster-studio')) . ' ' . esc_html($updated->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('AI Header was saved.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit in WordPress', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The active AI Header project was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'header'; } if ($action === 'update_active_footer_content') { $post_id = AIWEST_Security::post_int('post_id'); $content = AIWEST_Security::post_html('project_content'); if ($post_id && get_post_type($post_id) === 'page') { if (class_exists('AIWEST_Undo')) AIWEST_Undo::snapshot($post_id, 'site_builder_footer_edit', __('Backup before manually editing the active AI Footer.', 'ai-webmaster-studio')); $updated = wp_update_post([ 'ID' => $post_id, 'post_content' => $content, ], true); if (is_wp_error($updated)) { $notice = '

    ' . esc_html(__('Could not save AI Footer:', 'ai-webmaster-studio')) . ' ' . esc_html($updated->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('AI Footer was saved.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit in WordPress', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } } else { $notice = '

    ' . esc_html(__('The active AI Footer project was not found.', 'ai-webmaster-studio')) . '

    '; } $tab = 'footer'; } if ($action === 'generate_header_plan') { $instruction = AIWEST_Security::post_textarea('header_instruction'); $result = AIWEST_Site_Structure::generate_header_plan($instruction); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not prepare the header:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The header structure was prepared.', 'ai-webmaster-studio')) . ' ' . esc_html(__('This is a safe header content project and does not change the theme.', 'ai-webmaster-studio')) . '

    '; } $tab = 'header'; } if ($action === 'create_header_draft') { $header_status = AIWEST_Security::allowed_post_status(AIWEST_Security::post_key('header_status', 'draft'), 'draft', true); $result = AIWEST_Site_Structure::create_header_draft_page($header_status); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not create the header project:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The header project was created.', 'ai-webmaster-studio')) . ' ID: ' . intval($result) . '. ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('Preview', 'ai-webmaster-studio')) . '

    '; } $tab = 'header'; } if ($action === 'set_active_header') { $post_id = AIWEST_Security::post_int('post_id'); if ($post_id && get_post_type($post_id) === 'page') { update_option('aiwest_active_header_page_id', $post_id); $notice = '

    ' . esc_html(__('The active AI Header was set.', 'ai-webmaster-studio')) . ' ' . wp_kses_post(__('Use the [aiwest_header] shortcode or the homepage embedding option.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('Could not set the active header.', 'ai-webmaster-studio')) . '

    '; } $tab = 'header'; } if ($action === 'set_active_footer') { $post_id = AIWEST_Security::post_int('post_id'); if ($post_id && get_post_type($post_id) === 'page') { update_option('aiwest_active_footer_page_id', $post_id); $notice = '

    ' . esc_html(__('The active AI Footer was set.', 'ai-webmaster-studio')) . ' ' . wp_kses_post(__('Use the [aiwest_footer] shortcode or the homepage embedding option.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('View', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('Could not set the active footer.', 'ai-webmaster-studio')) . '

    '; } $tab = 'footer'; } if ($action === 'generate_footer_plan') { $instruction = AIWEST_Security::post_textarea('footer_instruction'); $result = AIWEST_Site_Structure::generate_footer_plan($instruction); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not prepare the footer:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The footer structure was prepared.', 'ai-webmaster-studio')) . ' ' . esc_html(__('You can now create a draft page with the footer project.', 'ai-webmaster-studio')) . '

    '; } $tab = 'footer'; } if ($action === 'create_footer_draft') { $footer_status = AIWEST_Security::allowed_post_status(AIWEST_Security::post_key('footer_status', 'draft'), 'draft', true); $result = AIWEST_Site_Structure::create_footer_draft_page($footer_status); if (is_wp_error($result)) { $notice = '

    ' . esc_html(__('Could not create the footer project:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('The footer project was created.', 'ai-webmaster-studio')) . ' ID: ' . intval($result) . '. ' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' | ' . esc_html(__('Preview', 'ai-webmaster-studio')) . '

    '; } $tab = 'footer'; } if ($action === 'create_core_pages') { $created = AIWEST_Site_Structure::create_pages_from_menu_plan(); if (is_wp_error($created)) { $notice = '

    ' . esc_html(__('Could not prepare the subpages:', 'ai-webmaster-studio')) . ' ' . esc_html($created->get_error_message()) . '

    '; } else { $notice = '

    ' . esc_html(__('Core subpages were created as drafts or already exist. Item count:', 'ai-webmaster-studio')) . ' ' . intval(count($created)) . '.

    '; } $tab = 'pages'; } if ($action === 'save_graphics_rules') { if (class_exists('AIWEST_Graphics_Rules')) { AIWEST_Graphics_Rules::save_from_post(AIWEST_Security::post_array('aiwest_graphics')); $notice = '

    ' . esc_html(__('Global graphics rules were saved.', 'ai-webmaster-studio')) . ' ' . esc_html(__('Content generation and administrator-started image actions will use these rules unless item-specific settings are selected.', 'ai-webmaster-studio')) . '

    '; } else { $notice = '

    ' . esc_html(__('The graphics rules module is not available.', 'ai-webmaster-studio')) . '

    '; } $tab = 'graphics'; } if ($action === 'save_style') { update_option('aiwest_visual_brand_style', AIWEST_Security::post_textarea('aiwest_visual_brand_style')); $layout_mode = AIWEST_Security::post_key('aiwest_layout_mode', 'ai_independent'); update_option('aiwest_layout_mode', in_array($layout_mode, ['ai_independent','theme_compatible'], true) ? $layout_mode : 'ai_independent'); update_option('aiwest_image_style', AIWEST_Security::post_textarea('aiwest_image_style')); $notice = '

    ' . esc_html(__('The website and image visual style was saved.', 'ai-webmaster-studio')) . '

    '; $tab = 'style'; } } $status = class_exists('AIWEST_Site_Structure') ? AIWEST_Site_Structure::site_status() : []; ?>






    /
    __('Homepage', 'ai-webmaster-studio'), 'menu' => __('Menu', 'ai-webmaster-studio'), 'header' => __('Header', 'ai-webmaster-studio'), 'footer' => __('Footer', 'ai-webmaster-studio'), 'pages' => __('Subpages', 'ai-webmaster-studio'), 'style' => __('Appearance', 'ai-webmaster-studio'), 'graphics' => __('Graphics', 'ai-webmaster-studio'), 'directory-map' => __('Locations & Partners Map', 'ai-webmaster-studio'), 'motion' => __('3D & motion', 'ai-webmaster-studio'), 'blog' => __('Blog', 'ai-webmaster-studio'), 'redirects' => __('Redirects', 'ai-webmaster-studio'), ]; echo ''; } function aiwest_site_builder_tab_directory_map() { if (class_exists('AIWEST_Directory_Map') && method_exists('AIWEST_Directory_Map', 'admin_page')) { AIWEST_Directory_Map::admin_page(true); return; } echo '

    ' . esc_html(__('Locations & Partners Map', 'ai-webmaster-studio')) . '

    ' . esc_html(__('The locations and partners map module is not available.', 'ai-webmaster-studio')) . '

    '; } function aiwest_site_builder_result_notice($result, $success_label) { if (is_wp_error($result)) { return '

    ' . esc_html(__('The action could not be completed:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

    '; } $page_id = intval($result['page_id']); $edit_link = get_edit_post_link($page_id); $preview_link = get_preview_post_link($page_id); $permalink = get_permalink($page_id); $notice = '

    ' . esc_html($success_label) . ' ID: ' . $page_id . ', status: ' . esc_html($result['status']) . '. '; if ($edit_link) $notice .= '' . esc_html(__('Edit', 'ai-webmaster-studio')) . ' '; if ($result['status'] === 'publish' && $permalink) { $notice .= '| ' . esc_html(__('View', 'ai-webmaster-studio')) . ''; } elseif ($preview_link) { $notice .= '| ' . esc_html(__('Preview', 'ai-webmaster-studio')) . ''; } if (!empty($result['admin_note'])) { $admin_note = $result['admin_note']; if (class_exists('AIWEST_Site_Builder') && method_exists('AIWEST_Site_Builder', 'normalize_admin_note')) { $admin_note = AIWEST_Site_Builder::normalize_admin_note($admin_note); } $notice .= '
    ' . esc_html($admin_note) . ''; } $notice .= '

    '; return $notice; } function aiwest_site_builder_tab_home() { ?>

    — ID

    Canvas: ' . esc_html(__('Enabled', 'ai-webmaster-studio')) . '' : '' . esc_html(__('Disabled', 'ai-webmaster-studio')) . ''; ?>

    [aiwest_header] + page content + [aiwest_footer], without the active theme global header and footer for this specific page.', 'ai-webmaster-studio')); ?>

    Current menu plan table below.', 'ai-webmaster-studio')); ?>

    $item): $item_id = sanitize_key($item['id'] ?? 'menu-item-' . ($i + 1)); $item_type = ($item['type'] ?? 'page') === 'custom' ? 'custom' : 'page'; $destination = $item_type === 'custom' ? ($item['url'] ?? '') : ($item['slug'] ?? ''); ?>

    Independent AI layout mode, the active theme remains the technical base while AI prepares a clear header and menu project.', 'ai-webmaster-studio')); ?>

    ID — shortcode: [aiwest_header] |

    [aiwest_header] shortcode / Canvas. It is not the active theme global header, so it is not edited in the active theme settings.', 'ai-webmaster-studio')); ?>

    <span> items. Use a real WordPress menu in the Menu tab as the target solution.', 'ai-webmaster-studio')); ?>

    ID — shortcode: [aiwest_footer] |

    [aiwest_footer] shortcode / Canvas. It is not the active theme global footer, so it is not edited in the active theme settings.', 'ai-webmaster-studio')); ?>

    AI Webmaster Studio Canvas can be enabled separately for each subpage. Canvas lets AI Webmaster Studio control the layout of that specific page without changing the active theme global settings.', 'ai-webmaster-studio')); ?>

    Undo changes is always visible. If no backup exists, clicking it will show a message that no undo snapshot is available.', 'ai-webmaster-studio')); ?>

    ' . esc_html(__('Exists', 'ai-webmaster-studio')) . '' : '' . esc_html(__('Missing', 'ai-webmaster-studio')) . ''; ?> ID)): ?> — ID)): ?> — ID)): ?>
    —

    · ·

    The AI Header background is also applied to the internal header card. If the header project has its own inline background, AI Webmaster Studio automatically makes it semi-transparent so the image remains visible.', 'ai-webmaster-studio')); ?>