Plugin Directory

Changeset 3756447


Ignore:
Timestamp:
10/20/2026 10:35:15 AM (29 hours ago)
Author:
slabsit
Message:

Release 2.3.1

Location:
sernicola-labs-ai-friendly
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • sernicola-labs-ai-friendly/tags/2.3.1/CHANGELOG.md

    r3750598 r3756447  
    11# Changelog
     2
     3## 2.3.1
     4
     5- Conservate le virgole presenti negli URL `sameAs` configurati per l'identità e le entità collegate.
     6- Migliorate le descrizioni ricavate dal contenuto: eliminati i titoli e i link di ritorno iniziali e il troncamento con puntini di sospensione.
    27
    38## 2.3.0
  • sernicola-labs-ai-friendly/tags/2.3.1/README.md

    r3750598 r3756447  
    11# Sernicola Labs AI Friendly
    22
    3 **Version:** 2.3.0
     3**Version:** 2.3.1
    44**Author:** Sernicola Labs
    55**Requirements:** WordPress 6.0+, PHP 8.1+
  • sernicola-labs-ai-friendly/tags/2.3.1/includes/metadata.php

    r3709504 r3756447  
    153153    private static function generateExcerpt( WP_Post $post ): string {
    154154        $raw = $post->post_excerpt !== '' ? $post->post_excerpt : $post->post_content;
     155        if ( $post->post_excerpt === '' ) {
     156            // Skip leading headings and navigation links before deriving a description.
     157            $raw = preg_replace( '/^\s*(?:(?:<h[1-3]\b[^>]*>.*?<\/h[1-3]>|<p\b[^>]*>\s*<a\b[^>]*>\s*Torna\s+al(?:la|lo|l[\x{2019}\x{0027}])?\s+.*?<\/a>\s*<\/p>)\s*)+/isu', '', $raw ) ?? $raw;
     158        }
    155159        $text = preg_replace( '/\[[^\]]+\]/', '', $raw ) ?? $raw;
    156160        $text = wp_strip_all_tags( $text );
    … …  
    158162        $text = trim( $text );
    159163
    160         return wp_html_excerpt( $text, 300, '...' );
     164        if ( mb_strlen( $text ) <= 300 ) {
     165            return $text;
     166        }
     167
     168        $candidate = mb_substr( $text, 0, 301 );
     169        if ( preg_match( '/^(.+[.!?])(?:\s|$)/us', $candidate, $matches ) ) {
     170            return trim( $matches[1] );
     171        }
     172
     173        $cut = mb_substr( $text, 0, 300 );
     174        $whole_words = trim( (string) preg_replace( '/\s+\S*$/u', '', $cut ) );
     175        return $whole_words !== '' ? $whole_words : $cut;
    161176    }
    162177
  • sernicola-labs-ai-friendly/tags/2.3.1/includes/schema.php

    r3750598 r3756447  
    6464    $items = array_filter( $items, static fn( string $item ): bool => $item !== '' );
    6565    return array_values( array_unique( $items ) );
     66}
     67
     68/** URL lists are line-separated: a comma may be part of a valid URL. */
     69function saifr_schema_split_url_lines( string $value ): array {
     70    $items = preg_split( '/\r\n|\r|\n/', $value );
     71    if ( ! is_array( $items ) ) {
     72        return [];
     73    }
     74    return array_values( array_unique( array_filter( array_map( 'trim', $items ), static fn( string $item ): bool => $item !== '' ) ) );
    6675}
    6776
    … …  
    155164    }
    156165
    157     $same_as = saifr_schema_split_lines( (string) ( $options['schema_same_as'] ?? '' ) );
     166    $same_as = saifr_schema_split_url_lines( (string) ( $options['schema_same_as'] ?? '' ) );
    158167    $same_as = saifr_schema_dedupe_urls( $same_as );
    159168    if ( ! empty( $same_as ) ) {
    … …  
    531540        }
    532541
    533         $same_as = saifr_schema_dedupe_urls( saifr_schema_split_lines( (string) ( $row['sameAs'] ?? '' ) ) );
     542        $same_as = saifr_schema_dedupe_urls( saifr_schema_split_url_lines( (string) ( $row['sameAs'] ?? '' ) ) );
    534543        if ( ! empty( $same_as ) ) {
    535544            $node['sameAs'] = $same_as;
  • sernicola-labs-ai-friendly/tags/2.3.1/readme.txt

    r3750598 r3756447  
    55Tested up to: 7.1
    66Requires PHP: 8.1
    7 Stable tag: 2.3.0
     7Stable tag: 2.3.1
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    … …  
    6868
    6969== Changelog ==
     70
     71= 2.3.1 =
     72* Keep commas inside `sameAs` URLs when reading external profile lists.
     73* Improve generated descriptions by skipping leading headings and return links and ending at a complete sentence or word without ellipses.
    7074
    7175= 2.3.0 =
  • sernicola-labs-ai-friendly/tags/2.3.1/sernicola-labs-ai-friendly.php

    r3750598 r3756447  
    44 * Plugin URI:         https://www.sernicola-labs.com/plugin-geo-aeo-posizionamento-intelligenza-artificiale/
    55 * Description:        Toolkit GEO/AEO per llms.txt, contenuti Markdown e Semantic Schema JSON-LD su WordPress.
    6  * Version:            2.3.0
     6 * Version:            2.3.1
    77 * Author:             Sernicola Labs
    88 * Author URI:         https://www.sernicola-labs.com/
    … …  
    3535}
    3636if ( ! defined( 'SAIFR_VERSION' ) ) {
    37     define( 'SAIFR_VERSION', '2.3.0' );
     37    define( 'SAIFR_VERSION', '2.3.1' );
    3838}
    3939
  • sernicola-labs-ai-friendly/trunk/CHANGELOG.md

    r3750598 r3756447  
    11# Changelog
     2
     3## 2.3.1
     4
     5- Conservate le virgole presenti negli URL `sameAs` configurati per l'identità e le entità collegate.
     6- Migliorate le descrizioni ricavate dal contenuto: eliminati i titoli e i link di ritorno iniziali e il troncamento con puntini di sospensione.
    27
    38## 2.3.0
  • sernicola-labs-ai-friendly/trunk/README.md

    r3750598 r3756447  
    11# Sernicola Labs AI Friendly
    22
    3 **Version:** 2.3.0
     3**Version:** 2.3.1
    44**Author:** Sernicola Labs
    55**Requirements:** WordPress 6.0+, PHP 8.1+
  • sernicola-labs-ai-friendly/trunk/includes/metadata.php

    r3709504 r3756447  
    153153    private static function generateExcerpt( WP_Post $post ): string {
    154154        $raw = $post->post_excerpt !== '' ? $post->post_excerpt : $post->post_content;
     155        if ( $post->post_excerpt === '' ) {
     156            // Skip leading headings and navigation links before deriving a description.
     157            $raw = preg_replace( '/^\s*(?:(?:<h[1-3]\b[^>]*>.*?<\/h[1-3]>|<p\b[^>]*>\s*<a\b[^>]*>\s*Torna\s+al(?:la|lo|l[\x{2019}\x{0027}])?\s+.*?<\/a>\s*<\/p>)\s*)+/isu', '', $raw ) ?? $raw;
     158        }
    155159        $text = preg_replace( '/\[[^\]]+\]/', '', $raw ) ?? $raw;
    156160        $text = wp_strip_all_tags( $text );
    … …  
    158162        $text = trim( $text );
    159163
    160         return wp_html_excerpt( $text, 300, '...' );
     164        if ( mb_strlen( $text ) <= 300 ) {
     165            return $text;
     166        }
     167
     168        $candidate = mb_substr( $text, 0, 301 );
     169        if ( preg_match( '/^(.+[.!?])(?:\s|$)/us', $candidate, $matches ) ) {
     170            return trim( $matches[1] );
     171        }
     172
     173        $cut = mb_substr( $text, 0, 300 );
     174        $whole_words = trim( (string) preg_replace( '/\s+\S*$/u', '', $cut ) );
     175        return $whole_words !== '' ? $whole_words : $cut;
    161176    }
    162177
  • sernicola-labs-ai-friendly/trunk/includes/schema.php

    r3750598 r3756447  
    6464    $items = array_filter( $items, static fn( string $item ): bool => $item !== '' );
    6565    return array_values( array_unique( $items ) );
     66}
     67
     68/** URL lists are line-separated: a comma may be part of a valid URL. */
     69function saifr_schema_split_url_lines( string $value ): array {
     70    $items = preg_split( '/\r\n|\r|\n/', $value );
     71    if ( ! is_array( $items ) ) {
     72        return [];
     73    }
     74    return array_values( array_unique( array_filter( array_map( 'trim', $items ), static fn( string $item ): bool => $item !== '' ) ) );
    6675}
    6776
    … …  
    155164    }
    156165
    157     $same_as = saifr_schema_split_lines( (string) ( $options['schema_same_as'] ?? '' ) );
     166    $same_as = saifr_schema_split_url_lines( (string) ( $options['schema_same_as'] ?? '' ) );
    158167    $same_as = saifr_schema_dedupe_urls( $same_as );
    159168    if ( ! empty( $same_as ) ) {
    … …  
    531540        }
    532541
    533         $same_as = saifr_schema_dedupe_urls( saifr_schema_split_lines( (string) ( $row['sameAs'] ?? '' ) ) );
     542        $same_as = saifr_schema_dedupe_urls( saifr_schema_split_url_lines( (string) ( $row['sameAs'] ?? '' ) ) );
    534543        if ( ! empty( $same_as ) ) {
    535544            $node['sameAs'] = $same_as;
  • sernicola-labs-ai-friendly/trunk/readme.txt

    r3750598 r3756447  
    55Tested up to: 7.1
    66Requires PHP: 8.1
    7 Stable tag: 2.3.0
     7Stable tag: 2.3.1
    88License: GPLv3 or later
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
    … …  
    6868
    6969== Changelog ==
     70
     71= 2.3.1 =
     72* Keep commas inside `sameAs` URLs when reading external profile lists.
     73* Improve generated descriptions by skipping leading headings and return links and ending at a complete sentence or word without ellipses.
    7074
    7175= 2.3.0 =
  • sernicola-labs-ai-friendly/trunk/sernicola-labs-ai-friendly.php

    r3750598 r3756447  
    44 * Plugin URI:         https://www.sernicola-labs.com/plugin-geo-aeo-posizionamento-intelligenza-artificiale/
    55 * Description:        Toolkit GEO/AEO per llms.txt, contenuti Markdown e Semantic Schema JSON-LD su WordPress.
    6  * Version:            2.3.0
     6 * Version:            2.3.1
    77 * Author:             Sernicola Labs
    88 * Author URI:         https://www.sernicola-labs.com/
    … …  
    3535}
    3636if ( ! defined( 'SAIFR_VERSION' ) ) {
    37     define( 'SAIFR_VERSION', '2.3.0' );
     37    define( 'SAIFR_VERSION', '2.3.1' );
    3838}
    3939
Note: See TracChangeset for help on using the changeset viewer.