Plugin Directory

Changeset 3470237


Ignore:
Timestamp:
02/26/2026 11:49:19 AM (5 weeks ago)
Author:
enkic
Message:

v2.5.1

Location:
ai-builder
Files:
8 edited
54 copied

Legend:

Unmodified
Added
Removed
  • ai-builder/tags/2.5.1/admin/pages/headers-footers.php

    r3460851 r3470237  
    88    return;
    99}
     10
     11// Check if the active theme is a supported FSE theme
     12$supported_fse_themes = array(
     13    'twentytwentytwo',
     14    'twentytwentythree',
     15    'twentytwentyfour',
     16    'twentytwentyfive',
     17    'spectra-one',
     18    'neve-fse',
     19    'raft',
     20    'ollie',
     21    'ona',
     22    'ona-studio',
     23    'ona-fashion',
     24    'ona-architecture',
     25    'ona-photography',
     26    'blockbase',
     27    'bricksy',
     28    'poe',
     29    'beaumont',
     30    'abisko',
     31    'hideo',
     32    'quadrat',
     33    'videomaker',
     34    'axton',
     35    'artsylens',
     36    'catch-fse',
     37    'inspiro-blocks',
     38    'plover',
     39    'jace',
     40    'miniblock-ooak',
     41    'yith-wonder',
     42);
     43
     44$current_theme      = wp_get_theme();
     45$current_theme_slug = $current_theme ? $current_theme->get_stylesheet() : '';
     46$is_supported_fse   = in_array($current_theme_slug, $supported_fse_themes, true);
    1047
    1148// Get Site Editor URLs for header and footer pattern selection
     
    1552<div class="wrap ai-builder-headers-footers">
    1653    <div class="ai-headers-footers-container">
     54        <?php if (!$is_supported_fse) : ?>
     55            <div class="ai-message ai-message-theme-warning">
     56                <p>
     57                    <?php esc_html_e("Le thème actuellement installé n'est pas un thème FSE (Full Site Editing). Il n'est donc pas possible de modifier l'en-tête (header) et le pied de page (footer) avec AI Builder.", 'ai-builder'); ?>
     58                </p>
     59                <p>
     60                    <?php esc_html_e("Pour activer cette fonctionnalité, installez et activez un thème compatible FSE, par exemple Twenty Twenty-Five, puis revenez sur cette page.", 'ai-builder'); ?>
     61                </p>
     62            </div>
     63        <?php endif; ?>
    1764        <!-- Header -->
    1865        <div class="ai-headers-footers-header">
     
    2269
    2370        <!-- Main Content -->
    24         <div class="ai-headers-footers-content">
     71        <div class="ai-headers-footers-content <?php echo !$is_supported_fse ? 'ai-headers-footers-disabled' : ''; ?>">
    2572            <!-- Step 1: Header -->
    2673            <div class="ai-step-card">
     
    173220}
    174221
     222.ai-headers-footers-disabled {
     223    opacity: 0.5;
     224    filter: grayscale(1);
     225    pointer-events: none;
     226    user-select: none;
     227}
     228
    175229.ai-step-card {
    176230    background: #ffffff;
  • ai-builder/tags/2.5.1/admin/pages/tuto.php

    r3412592 r3470237  
    168168                    <div class="ai-tip-icon">💡</div>
    169169                    <div class="ai-tip-content">
    170                         <strong>Pro Tip:</strong> The more detailed your prompt, the better the AI-generated content
    171                         will be. Include information about your target audience, tone, and specific sections you want.
     170                        <strong>Pro Tip:</strong> If you don’t like how a block looks, you can reset it to the default style by removing the text in the right-hand sidebar under Block → Advanced → Additional CSS class(es).
    172171                    </div>
    173172                </div>
     
    216215                    <div class="ai-tip-icon">💡</div>
    217216                    <div class="ai-tip-content">
    218                         <strong>Pro Tip:</strong> AI Blocks are perfect for creating testimonials, product descriptions,
    219                         FAQ sections, and any other content that needs to be generated dynamically.
     217                        <strong>Pro Tip:</strong>AI blocks are perfect for adding content in a specific spot while keeping the rest of the page intact.
    220218                    </div>
    221219                </div>
     
    257255                    <div class="ai-tip-icon">💡</div>
    258256                    <div class="ai-tip-content">
    259                         <strong>Pro Tip:</strong> Be specific about style, mood, colors, and composition. Include
    260                         details like "professional", "vintage", "minimalist", or "colorful" to get better results.
     257                        <strong>Pro Tip:</strong> You can select the aspect ratio when generating the image.
    261258                    </div>
    262259                </div>
  • ai-builder/tags/2.5.1/aibui-builder.php

    r3460851 r3470237  
    44 * Plugin URI:        https://website-ai-builder.com/
    55 * Description: This plugin is used to build your website with AI.
    6  * Version: 2.5.0
     6 * Version: 2.5.1
    77 * Author: enkic
    88 * Author URI:        https://enkicorbin.fr/
     
    1818
    1919// Définir la version du plugin
    20 define('AIBUI_VERSION', '2.5.0');
     20define('AIBUI_VERSION', '2.5.1');
    2121
    2222/**
     
    968968        array('wp-blocks', 'wp-block-editor', 'wp-element', 'wp-components', 'wp-i18n'),
    969969        filemtime(plugin_dir_path(__FILE__) . 'assets/js/language-switcher-block.js'),
     970        true
     971    );
     972
     973    // Unregister legacy/unused AI Builder blocks from the inserter
     974    wp_enqueue_script(
     975        'ai-builder-unregister-ai-blocks',
     976        plugin_dir_url(__FILE__) . 'assets/js/unregister-ai-blocks.js',
     977        array('ai-builder-blocks', 'wp-blocks'),
     978        AIBUI_VERSION,
    970979        true
    971980    );
  • ai-builder/tags/2.5.1/assets/js/chat-widget.js

    r3460851 r3470237  
    6868    // Sinon, si p contient un template/pattern spécifique (ex: /wp_template_part/...), afficher le widget
    6969    return true;
    70   }
    71 
    72   // Vérifier initialement si on doit afficher le widget
    73   if (!shouldShowWidgetInSiteEditor()) {
    74     return; // Ne pas afficher le chat widget
    7570  }
    7671
  • ai-builder/tags/2.5.1/assets/js/pattern-translation.js

    r3404221 r3470237  
    7979      document.body.appendChild(button);
    8080    }
     81  }
     82
     83  // Same visibility logic as the chat widget:
     84  // hide the floating button on the pattern selection screen (p=/pattern)
     85  // and only show it when a specific template part is being edited.
     86  function shouldShowPatternTranslateButton() {
     87    const isSiteEditor = window.location.pathname.includes('site-editor.php');
     88    if (!isSiteEditor) {
     89      return true; // Always allow outside Site Editor (for safety/future use)
     90    }
     91
     92    const urlParams = new URLSearchParams(window.location.search);
     93    const pParam = urlParams.get('p');
     94
     95    // Do not show on:
     96    // 1. No "p" parameter
     97    // 2. p === '/pattern' (pattern chooser screen)
     98    if (!pParam || pParam === '/pattern') {
     99      return false;
     100    }
     101
     102    return true;
    81103  }
    82104
     
    179201    const { id, type } = getEditedPostContext();
    180202    const isPart = id && type === 'wp_template_part';
    181     button.disabled = !isPart;
    182     button.style.display = isPart ? '' : 'none';
     203    const shouldShow = isPart && shouldShowPatternTranslateButton();
     204
     205    button.disabled = !shouldShow;
     206    button.style.display = shouldShow ? '' : 'none';
    183207  }
    184208
  • ai-builder/tags/2.5.1/debug-template-part.log

    r3422788 r3470237  
    7777[2025-12-09 09:41:22][Template Part Translation][found_post] {"post_id":323,"post_title":"Footer"}
    7878[2025-12-09 09:41:22][Template Part Translation][calling_handle_translation] {"post_id":323,"target_lang":"es"}
     79[2026-02-26 11:22:33][Template Part Translation][start] {"POST":{"action":"aibui_translate_template_part","nonce":"c91aec5dc3","template_part_id":"spectra-one\/\/footer","target_lang":"fr"}}
     80[2026-02-26 11:22:33][Template Part Translation][template_part_id] spectra-one//footer
     81[2026-02-26 11:22:33][Template Part Translation][parsed] {"theme":"spectra-one","slug":"footer"}
     82[2026-02-26 11:22:33][Template Part Translation][query_result] {"found_posts":0,"post_count":1}
     83[2026-02-26 11:22:33][Template Part Translation][found_post] {"post_id":176,"post_title":"Footer"}
     84[2026-02-26 11:22:33][Template Part Translation][calling_handle_translation] {"post_id":176,"target_lang":"fr"}
  • ai-builder/tags/2.5.1/includes/class-translation-manager.php

    r3404766 r3470237  
    9797        }
    9898        if (!$post) {
     99            return $permalink;
     100        }
     101
     102        // Only append ai_lang if this post actually belongs to a translation group
     103        // and has at least one other translation. Otherwise, keep the URL clean.
     104        $group = get_post_meta($post->ID, '_ai_translation_group', true);
     105        if (!$group) {
     106            return $permalink;
     107        }
     108
     109        $translations = $this->get_group_posts($group, get_post_type($post));
     110        if (empty($translations) || count($translations) <= 1) {
     111            // No real translations available for this post
    99112            return $permalink;
    100113        }
  • ai-builder/tags/2.5.1/readme.txt

    r3460858 r3470237  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 2.5.0
     7Stable tag: 2.5.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • ai-builder/trunk/admin/pages/headers-footers.php

    r3460851 r3470237  
    88    return;
    99}
     10
     11// Check if the active theme is a supported FSE theme
     12$supported_fse_themes = array(
     13    'twentytwentytwo',
     14    'twentytwentythree',
     15    'twentytwentyfour',
     16    'twentytwentyfive',
     17    'spectra-one',
     18    'neve-fse',
     19    'raft',
     20    'ollie',
     21    'ona',
     22    'ona-studio',
     23    'ona-fashion',
     24    'ona-architecture',
     25    'ona-photography',
     26    'blockbase',
     27    'bricksy',
     28    'poe',
     29    'beaumont',
     30    'abisko',
     31    'hideo',
     32    'quadrat',
     33    'videomaker',
     34    'axton',
     35    'artsylens',
     36    'catch-fse',
     37    'inspiro-blocks',
     38    'plover',
     39    'jace',
     40    'miniblock-ooak',
     41    'yith-wonder',
     42);
     43
     44$current_theme      = wp_get_theme();
     45$current_theme_slug = $current_theme ? $current_theme->get_stylesheet() : '';
     46$is_supported_fse   = in_array($current_theme_slug, $supported_fse_themes, true);
    1047
    1148// Get Site Editor URLs for header and footer pattern selection
     
    1552<div class="wrap ai-builder-headers-footers">
    1653    <div class="ai-headers-footers-container">
     54        <?php if (!$is_supported_fse) : ?>
     55            <div class="ai-message ai-message-theme-warning">
     56                <p>
     57                    <?php esc_html_e("Le thème actuellement installé n'est pas un thème FSE (Full Site Editing). Il n'est donc pas possible de modifier l'en-tête (header) et le pied de page (footer) avec AI Builder.", 'ai-builder'); ?>
     58                </p>
     59                <p>
     60                    <?php esc_html_e("Pour activer cette fonctionnalité, installez et activez un thème compatible FSE, par exemple Twenty Twenty-Five, puis revenez sur cette page.", 'ai-builder'); ?>
     61                </p>
     62            </div>
     63        <?php endif; ?>
    1764        <!-- Header -->
    1865        <div class="ai-headers-footers-header">
     
    2269
    2370        <!-- Main Content -->
    24         <div class="ai-headers-footers-content">
     71        <div class="ai-headers-footers-content <?php echo !$is_supported_fse ? 'ai-headers-footers-disabled' : ''; ?>">
    2572            <!-- Step 1: Header -->
    2673            <div class="ai-step-card">
     
    173220}
    174221
     222.ai-headers-footers-disabled {
     223    opacity: 0.5;
     224    filter: grayscale(1);
     225    pointer-events: none;
     226    user-select: none;
     227}
     228
    175229.ai-step-card {
    176230    background: #ffffff;
  • ai-builder/trunk/admin/pages/tuto.php

    r3412592 r3470237  
    168168                    <div class="ai-tip-icon">💡</div>
    169169                    <div class="ai-tip-content">
    170                         <strong>Pro Tip:</strong> The more detailed your prompt, the better the AI-generated content
    171                         will be. Include information about your target audience, tone, and specific sections you want.
     170                        <strong>Pro Tip:</strong> If you don’t like how a block looks, you can reset it to the default style by removing the text in the right-hand sidebar under Block → Advanced → Additional CSS class(es).
    172171                    </div>
    173172                </div>
     
    216215                    <div class="ai-tip-icon">💡</div>
    217216                    <div class="ai-tip-content">
    218                         <strong>Pro Tip:</strong> AI Blocks are perfect for creating testimonials, product descriptions,
    219                         FAQ sections, and any other content that needs to be generated dynamically.
     217                        <strong>Pro Tip:</strong>AI blocks are perfect for adding content in a specific spot while keeping the rest of the page intact.
    220218                    </div>
    221219                </div>
     
    257255                    <div class="ai-tip-icon">💡</div>
    258256                    <div class="ai-tip-content">
    259                         <strong>Pro Tip:</strong> Be specific about style, mood, colors, and composition. Include
    260                         details like "professional", "vintage", "minimalist", or "colorful" to get better results.
     257                        <strong>Pro Tip:</strong> You can select the aspect ratio when generating the image.
    261258                    </div>
    262259                </div>
  • ai-builder/trunk/aibui-builder.php

    r3460851 r3470237  
    44 * Plugin URI:        https://website-ai-builder.com/
    55 * Description: This plugin is used to build your website with AI.
    6  * Version: 2.5.0
     6 * Version: 2.5.1
    77 * Author: enkic
    88 * Author URI:        https://enkicorbin.fr/
     
    1818
    1919// Définir la version du plugin
    20 define('AIBUI_VERSION', '2.5.0');
     20define('AIBUI_VERSION', '2.5.1');
    2121
    2222/**
     
    968968        array('wp-blocks', 'wp-block-editor', 'wp-element', 'wp-components', 'wp-i18n'),
    969969        filemtime(plugin_dir_path(__FILE__) . 'assets/js/language-switcher-block.js'),
     970        true
     971    );
     972
     973    // Unregister legacy/unused AI Builder blocks from the inserter
     974    wp_enqueue_script(
     975        'ai-builder-unregister-ai-blocks',
     976        plugin_dir_url(__FILE__) . 'assets/js/unregister-ai-blocks.js',
     977        array('ai-builder-blocks', 'wp-blocks'),
     978        AIBUI_VERSION,
    970979        true
    971980    );
  • ai-builder/trunk/assets/js/chat-widget.js

    r3460851 r3470237  
    6868    // Sinon, si p contient un template/pattern spécifique (ex: /wp_template_part/...), afficher le widget
    6969    return true;
    70   }
    71 
    72   // Vérifier initialement si on doit afficher le widget
    73   if (!shouldShowWidgetInSiteEditor()) {
    74     return; // Ne pas afficher le chat widget
    7570  }
    7671
  • ai-builder/trunk/assets/js/pattern-translation.js

    r3404221 r3470237  
    7979      document.body.appendChild(button);
    8080    }
     81  }
     82
     83  // Same visibility logic as the chat widget:
     84  // hide the floating button on the pattern selection screen (p=/pattern)
     85  // and only show it when a specific template part is being edited.
     86  function shouldShowPatternTranslateButton() {
     87    const isSiteEditor = window.location.pathname.includes('site-editor.php');
     88    if (!isSiteEditor) {
     89      return true; // Always allow outside Site Editor (for safety/future use)
     90    }
     91
     92    const urlParams = new URLSearchParams(window.location.search);
     93    const pParam = urlParams.get('p');
     94
     95    // Do not show on:
     96    // 1. No "p" parameter
     97    // 2. p === '/pattern' (pattern chooser screen)
     98    if (!pParam || pParam === '/pattern') {
     99      return false;
     100    }
     101
     102    return true;
    81103  }
    82104
     
    179201    const { id, type } = getEditedPostContext();
    180202    const isPart = id && type === 'wp_template_part';
    181     button.disabled = !isPart;
    182     button.style.display = isPart ? '' : 'none';
     203    const shouldShow = isPart && shouldShowPatternTranslateButton();
     204
     205    button.disabled = !shouldShow;
     206    button.style.display = shouldShow ? '' : 'none';
    183207  }
    184208
  • ai-builder/trunk/debug-template-part.log

    r3422788 r3470237  
    7777[2025-12-09 09:41:22][Template Part Translation][found_post] {"post_id":323,"post_title":"Footer"}
    7878[2025-12-09 09:41:22][Template Part Translation][calling_handle_translation] {"post_id":323,"target_lang":"es"}
     79[2026-02-26 11:22:33][Template Part Translation][start] {"POST":{"action":"aibui_translate_template_part","nonce":"c91aec5dc3","template_part_id":"spectra-one\/\/footer","target_lang":"fr"}}
     80[2026-02-26 11:22:33][Template Part Translation][template_part_id] spectra-one//footer
     81[2026-02-26 11:22:33][Template Part Translation][parsed] {"theme":"spectra-one","slug":"footer"}
     82[2026-02-26 11:22:33][Template Part Translation][query_result] {"found_posts":0,"post_count":1}
     83[2026-02-26 11:22:33][Template Part Translation][found_post] {"post_id":176,"post_title":"Footer"}
     84[2026-02-26 11:22:33][Template Part Translation][calling_handle_translation] {"post_id":176,"target_lang":"fr"}
  • ai-builder/trunk/includes/class-translation-manager.php

    r3404766 r3470237  
    9797        }
    9898        if (!$post) {
     99            return $permalink;
     100        }
     101
     102        // Only append ai_lang if this post actually belongs to a translation group
     103        // and has at least one other translation. Otherwise, keep the URL clean.
     104        $group = get_post_meta($post->ID, '_ai_translation_group', true);
     105        if (!$group) {
     106            return $permalink;
     107        }
     108
     109        $translations = $this->get_group_posts($group, get_post_type($post));
     110        if (empty($translations) || count($translations) <= 1) {
     111            // No real translations available for this post
    99112            return $permalink;
    100113        }
  • ai-builder/trunk/readme.txt

    r3460858 r3470237  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 2.5.0
     7Stable tag: 2.5.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.