Plugin Directory

Changeset 3492892


Ignore:
Timestamp:
03/27/2026 06:08:50 PM (32 hours ago)
Author:
alttextai
Message:

Update to version 1.10.33 from GitHub

Location:
alttext-ai
Files:
4 added
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • alttext-ai/tags/1.10.33/README.txt

    r3485945 r3492892  
    66Requires at least: 4.7
    77Tested up to: 6.9
    8 Stable tag: 1.10.32
     8Stable tag: 1.10.33
    99WC requires at least: 3.3
    1010WC tested up to: 10.1
     
    7171
    7272== Changelog ==
     73
     74= 1.10.33 - 2026-03-25 =
     75* NEW: YOOtheme Pro page builder support — alt text now syncs correctly on YOOtheme-built pages
    7376
    7477= 1.10.30 - 2026-03-06 =
  • alttext-ai/tags/1.10.33/atai.php

    r3485945 r3492892  
    1616 * Plugin URI:        https://alttext.ai/product
    1717 * Description:       Automatically generate image alt text with AltText.ai.
    18  * Version:           1.10.32
     18 * Version:           1.10.33
    1919 * Author:            AltText.ai
    2020 * Author URI:        https://alttext.ai
     
    3434 * Current plugin version.
    3535 */
    36 define( 'ATAI_VERSION', '1.10.32' );
     36define( 'ATAI_VERSION', '1.10.33' );
    3737
    3838/**
  • alttext-ai/tags/1.10.33/changelog.txt

    r3485945 r3492892  
    11*** AltText.ai Changelog ***
     2
     32026-03-25 - version 1.10.33
     4* NEW: YOOtheme Pro page builder support — alt text now syncs correctly on YOOtheme-built pages
    25
    362026-03-18 - version 1.10.32
  • alttext-ai/tags/1.10.33/includes/class-atai-post.php

    r3485945 r3492892  
    475475      $num_alttext_generated += $product_response['num_alttext_generated'];
    476476    }
    477    
     477
     478    // Process page builder images (YOOtheme, etc.)
     479    $builder_response = $this->process_builder_images( $post_id, $overwrite, $process_external, $keywords );
     480    $total_images_found += $builder_response['total_images_found'];
     481    $num_alttext_generated += $builder_response['num_alttext_generated'];
     482    if ( $builder_response['no_credits'] ) {
     483      $no_credits = true;
     484    }
     485
    478486    ATAI_Elementor_Sync::$paused = false;
    479487
    480     if ( !empty($updated_content) ) {
     488    // Skip HTML content update if a builder already saved post_content
     489    if ( !empty($updated_content) && ! $builder_response['saved_post_content'] ) {
    481490      wp_update_post( array(
    482491        'ID' => $post_id,
     
    510519      'num_alttext_generated' => $num_alttext_generated,
    511520      'no_credits' => $no_credits,
     521    );
     522  }
     523
     524  /**
     525   * Process images in page builder content.
     526   *
     527   * Iterates registered builder handlers, extracts images from their data,
     528   * generates alt text, and updates the builder's stored content.
     529   *
     530   * @since  1.10.33
     531   * @param  int   $post_id
     532   * @param  bool  $overwrite
     533   * @param  bool  $process_external
     534   * @param  array $keywords
     535   * @return array
     536   */
     537  private function process_builder_images( $post_id, $overwrite, $process_external, $keywords ) {
     538    $handlers = apply_filters( 'atai_page_builder_handlers', array(
     539      'yootheme' => 'ATAI_Builder_YooTheme',
     540    ) );
     541
     542    $total_images_found = 0;
     543    $num_alttext_generated = 0;
     544    $no_credits = false;
     545    $saved_post_content = false;
     546    $atai_attachment = new ATAI_Attachment();
     547
     548    foreach ( $handlers as $key => $handler_class ) {
     549      if ( ! class_exists( $handler_class ) ) {
     550        continue;
     551      }
     552
     553      if ( ! method_exists( $handler_class, 'is_active' ) || ! $handler_class::is_active() ) {
     554        continue;
     555      }
     556
     557      // Validate handler implements the full contract before instantiation
     558      $required_methods = array( 'has_builder_content', 'extract_images', 'update_image_alt', 'save', 'uses_post_content' );
     559      $valid = true;
     560      foreach ( $required_methods as $method ) {
     561        if ( ! method_exists( $handler_class, $method ) ) {
     562          $valid = false;
     563          break;
     564        }
     565      }
     566      if ( ! $valid ) {
     567        continue;
     568      }
     569
     570      $handler = new $handler_class();
     571
     572      if ( ! $handler->has_builder_content( $post_id ) ) {
     573        continue;
     574      }
     575
     576      $images = $handler->extract_images( $post_id );
     577      $handler_modified = false;
     578
     579      foreach ( $images as $image ) {
     580        $total_images_found++;
     581        $alt_text = false;
     582        $should_generate = false;
     583
     584        if ( $image['attachment_id'] ) {
     585          $alt_text = get_post_meta( $image['attachment_id'], '_wp_attachment_image_alt', true );
     586
     587          if ( $overwrite || empty( $alt_text ) ) {
     588            $should_generate = true;
     589            $alt_text = $atai_attachment->generate_alt( $image['attachment_id'], null, array( 'keywords' => $keywords ) );
     590          }
     591        } elseif ( $process_external ) {
     592          $alt_text = $image['current_alt'];
     593
     594          if ( $overwrite || empty( $alt_text ) ) {
     595            $should_generate = true;
     596            $alt_text = $atai_attachment->generate_alt( null, $image['url'], array( 'keywords' => $keywords ) );
     597          }
     598        }
     599
     600        if ( empty( $alt_text ) || ! is_string( $alt_text ) ) {
     601          continue;
     602        }
     603
     604        if ( $alt_text === 'insufficient_credits' ) {
     605          $no_credits = true;
     606          break;
     607        }
     608
     609        if ( $should_generate ) {
     610          $num_alttext_generated++;
     611        }
     612
     613        // Update alt text in builder data (even if not newly generated,
     614        // sync the media library alt text into the builder)
     615        if ( $handler->update_image_alt( $post_id, $image['ref'], $alt_text ) ) {
     616          $handler_modified = true;
     617        }
     618      }
     619
     620      if ( $handler_modified ) {
     621        if ( $handler->save( $post_id ) && $handler->uses_post_content() ) {
     622          $saved_post_content = true;
     623        }
     624      }
     625
     626      if ( $no_credits ) {
     627        break;
     628      }
     629    }
     630
     631    return array(
     632      'total_images_found'    => $total_images_found,
     633      'num_alttext_generated' => $num_alttext_generated,
     634      'no_credits'            => $no_credits,
     635      'saved_post_content'    => $saved_post_content,
    512636    );
    513637  }
  • alttext-ai/tags/1.10.33/includes/class-atai-utility.php

    r3485046 r3492892  
    174174    if ( empty( $src ) || ! is_string( $src ) ) {
    175175      return null;
     176    }
     177
     178    // Convert builder-relative paths (wp-content/..., images/...) to absolute URLs
     179    if ( substr( $src, 0, 10 ) === 'wp-content' || substr( $src, 0, 7 ) === 'images/' ) {
     180      if ( strpos( $src, '..' ) !== false ) {
     181        return null;
     182      }
     183      $src = trailingslashit( $home_url ) . $src;
    176184    }
    177185
  • alttext-ai/tags/1.10.33/includes/class-atai.php

    r3485046 r3492892  
    141141         */
    142142        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-atai-elementor-sync.php';
     143
     144        // Page builder handlers
     145        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/builders/class-atai-builder-yootheme.php';
    143146
    144147        /**
  • alttext-ai/trunk/README.txt

    r3485945 r3492892  
    66Requires at least: 4.7
    77Tested up to: 6.9
    8 Stable tag: 1.10.32
     8Stable tag: 1.10.33
    99WC requires at least: 3.3
    1010WC tested up to: 10.1
     
    7171
    7272== Changelog ==
     73
     74= 1.10.33 - 2026-03-25 =
     75* NEW: YOOtheme Pro page builder support — alt text now syncs correctly on YOOtheme-built pages
    7376
    7477= 1.10.30 - 2026-03-06 =
  • alttext-ai/trunk/atai.php

    r3485945 r3492892  
    1616 * Plugin URI:        https://alttext.ai/product
    1717 * Description:       Automatically generate image alt text with AltText.ai.
    18  * Version:           1.10.32
     18 * Version:           1.10.33
    1919 * Author:            AltText.ai
    2020 * Author URI:        https://alttext.ai
     
    3434 * Current plugin version.
    3535 */
    36 define( 'ATAI_VERSION', '1.10.32' );
     36define( 'ATAI_VERSION', '1.10.33' );
    3737
    3838/**
  • alttext-ai/trunk/changelog.txt

    r3485945 r3492892  
    11*** AltText.ai Changelog ***
     2
     32026-03-25 - version 1.10.33
     4* NEW: YOOtheme Pro page builder support — alt text now syncs correctly on YOOtheme-built pages
    25
    362026-03-18 - version 1.10.32
  • alttext-ai/trunk/includes/class-atai-post.php

    r3485945 r3492892  
    475475      $num_alttext_generated += $product_response['num_alttext_generated'];
    476476    }
    477    
     477
     478    // Process page builder images (YOOtheme, etc.)
     479    $builder_response = $this->process_builder_images( $post_id, $overwrite, $process_external, $keywords );
     480    $total_images_found += $builder_response['total_images_found'];
     481    $num_alttext_generated += $builder_response['num_alttext_generated'];
     482    if ( $builder_response['no_credits'] ) {
     483      $no_credits = true;
     484    }
     485
    478486    ATAI_Elementor_Sync::$paused = false;
    479487
    480     if ( !empty($updated_content) ) {
     488    // Skip HTML content update if a builder already saved post_content
     489    if ( !empty($updated_content) && ! $builder_response['saved_post_content'] ) {
    481490      wp_update_post( array(
    482491        'ID' => $post_id,
     
    510519      'num_alttext_generated' => $num_alttext_generated,
    511520      'no_credits' => $no_credits,
     521    );
     522  }
     523
     524  /**
     525   * Process images in page builder content.
     526   *
     527   * Iterates registered builder handlers, extracts images from their data,
     528   * generates alt text, and updates the builder's stored content.
     529   *
     530   * @since  1.10.33
     531   * @param  int   $post_id
     532   * @param  bool  $overwrite
     533   * @param  bool  $process_external
     534   * @param  array $keywords
     535   * @return array
     536   */
     537  private function process_builder_images( $post_id, $overwrite, $process_external, $keywords ) {
     538    $handlers = apply_filters( 'atai_page_builder_handlers', array(
     539      'yootheme' => 'ATAI_Builder_YooTheme',
     540    ) );
     541
     542    $total_images_found = 0;
     543    $num_alttext_generated = 0;
     544    $no_credits = false;
     545    $saved_post_content = false;
     546    $atai_attachment = new ATAI_Attachment();
     547
     548    foreach ( $handlers as $key => $handler_class ) {
     549      if ( ! class_exists( $handler_class ) ) {
     550        continue;
     551      }
     552
     553      if ( ! method_exists( $handler_class, 'is_active' ) || ! $handler_class::is_active() ) {
     554        continue;
     555      }
     556
     557      // Validate handler implements the full contract before instantiation
     558      $required_methods = array( 'has_builder_content', 'extract_images', 'update_image_alt', 'save', 'uses_post_content' );
     559      $valid = true;
     560      foreach ( $required_methods as $method ) {
     561        if ( ! method_exists( $handler_class, $method ) ) {
     562          $valid = false;
     563          break;
     564        }
     565      }
     566      if ( ! $valid ) {
     567        continue;
     568      }
     569
     570      $handler = new $handler_class();
     571
     572      if ( ! $handler->has_builder_content( $post_id ) ) {
     573        continue;
     574      }
     575
     576      $images = $handler->extract_images( $post_id );
     577      $handler_modified = false;
     578
     579      foreach ( $images as $image ) {
     580        $total_images_found++;
     581        $alt_text = false;
     582        $should_generate = false;
     583
     584        if ( $image['attachment_id'] ) {
     585          $alt_text = get_post_meta( $image['attachment_id'], '_wp_attachment_image_alt', true );
     586
     587          if ( $overwrite || empty( $alt_text ) ) {
     588            $should_generate = true;
     589            $alt_text = $atai_attachment->generate_alt( $image['attachment_id'], null, array( 'keywords' => $keywords ) );
     590          }
     591        } elseif ( $process_external ) {
     592          $alt_text = $image['current_alt'];
     593
     594          if ( $overwrite || empty( $alt_text ) ) {
     595            $should_generate = true;
     596            $alt_text = $atai_attachment->generate_alt( null, $image['url'], array( 'keywords' => $keywords ) );
     597          }
     598        }
     599
     600        if ( empty( $alt_text ) || ! is_string( $alt_text ) ) {
     601          continue;
     602        }
     603
     604        if ( $alt_text === 'insufficient_credits' ) {
     605          $no_credits = true;
     606          break;
     607        }
     608
     609        if ( $should_generate ) {
     610          $num_alttext_generated++;
     611        }
     612
     613        // Update alt text in builder data (even if not newly generated,
     614        // sync the media library alt text into the builder)
     615        if ( $handler->update_image_alt( $post_id, $image['ref'], $alt_text ) ) {
     616          $handler_modified = true;
     617        }
     618      }
     619
     620      if ( $handler_modified ) {
     621        if ( $handler->save( $post_id ) && $handler->uses_post_content() ) {
     622          $saved_post_content = true;
     623        }
     624      }
     625
     626      if ( $no_credits ) {
     627        break;
     628      }
     629    }
     630
     631    return array(
     632      'total_images_found'    => $total_images_found,
     633      'num_alttext_generated' => $num_alttext_generated,
     634      'no_credits'            => $no_credits,
     635      'saved_post_content'    => $saved_post_content,
    512636    );
    513637  }
  • alttext-ai/trunk/includes/class-atai-utility.php

    r3485046 r3492892  
    174174    if ( empty( $src ) || ! is_string( $src ) ) {
    175175      return null;
     176    }
     177
     178    // Convert builder-relative paths (wp-content/..., images/...) to absolute URLs
     179    if ( substr( $src, 0, 10 ) === 'wp-content' || substr( $src, 0, 7 ) === 'images/' ) {
     180      if ( strpos( $src, '..' ) !== false ) {
     181        return null;
     182      }
     183      $src = trailingslashit( $home_url ) . $src;
    176184    }
    177185
  • alttext-ai/trunk/includes/class-atai.php

    r3485046 r3492892  
    141141         */
    142142        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-atai-elementor-sync.php';
     143
     144        // Page builder handlers
     145        require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/builders/class-atai-builder-yootheme.php';
    143146
    144147        /**
Note: See TracChangeset for help on using the changeset viewer.