Plugin Directory

Changeset 3341043


Ignore:
Timestamp:
08/07/2025 12:54:46 PM (8 months ago)
Author:
david.kane
Message:

Releasing v2.26.5

Location:
supapress/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • supapress/trunk/composer.json

    r3333728 r3341043  
    33  "description": "Quickly and easily connect your book metadata (ONIX) to your WordPress site.",
    44  "type": "wordpress-plugin",
    5   "version": "2.26.4",
     5  "version": "2.26.5",
    66  "authors": [
    77    {
  • supapress/trunk/includes/typesense-functions.php

    r3333728 r3341043  
    3535        $publicationDate = $this->get_publication_date();
    3636
    37         if ( isset( $this->properties['show_pubdate'] ) && $this->properties['show_pubdate'] !== 'on' && !empty( $publicationDate ) ) {
     37        if ( isset( $this->properties['show_pubdate'] ) && $this->properties['show_pubdate'] !== 'on' ) {
     38            return '';
     39        }
     40
     41        if( !isset( $publicationDate ) ) {
    3842            return '';
    3943        }
     
    135139        }
    136140
     141        if ( empty( $authors ) ) {
     142            return '';
     143        }
     144
    137145        $authors = $before . implode( $separator, $authors ) . $after;
    138 
    139         if ( empty( $authors ) ) {
    140             return '';
    141         }
    142146       
    143147        if ( $echo ) {
     
    261265   
    262266    $args = supapress_ts_search_args( $params, $properties );
     267   
     268    $orderedIsbns = !empty( $params['isbns'] ) && $params["order"] === 'as-entered' ? explode(',', $params['isbns']) : "";
     269   
    263270    $results = supapress_call_typesense( $args );
    264271
    265     return supapress_map_search_ts_data( $results );
    266 }
    267 
    268 function supapress_map_search_ts_data($results) {
     272    return supapress_map_search_ts_data( $results, $orderedIsbns );
     273}
     274
     275function supapress_map_search_ts_data($results, $orderedIsbns = array() ) {
    269276    if( empty( $results["hits"] ) ) {
    270277        return 'Something went wrong';
     278    }
     279
     280    if (!empty($orderedIsbns)) {
     281        $results['hits'] = supapress_reorder_hits_by_isbn($results['hits'], $orderedIsbns);
    271282    }
    272283   
     
    279290       
    280291        $result[] = (object) $item['document'];
    281     }   
     292    }
    282293
    283294    if( empty( $result ) ) {
     
    288299        "search" => $result
    289300    ];
     301}
     302
     303function supapress_reorder_hits_by_isbn($hits, $orderedIsbns) {
     304
     305    if( empty( $hits ) && empty( $orderedIsbns ) ) {
     306        return '';
     307    }
     308
     309    $hitsByIsbn = [];
     310
     311    foreach ($hits as $hit) {
     312        $isbn = $hit['document']['isbn13'] ?? null;
     313        if ($isbn) {
     314            $hitsByIsbn[$isbn] = $hit;
     315        }
     316    }
     317
     318    $reorderedHits = [];
     319    foreach ($orderedIsbns as $isbn) {
     320        if (isset($hitsByIsbn[$isbn])) {
     321            $reorderedHits[] = $hitsByIsbn[$isbn];
     322        }
     323    }
     324
     325    return $reorderedHits;
    290326}
    291327
  • supapress/trunk/readme.txt

    r3333728 r3341043  
    33Tags: supadü, supadu, folio, books, publishers, supafolio, supadu for wordpress, supapress, supafolio for wordpress
    44Requires at least: 6.0
    5 Tested up to: 6.7.2
    6 Stable tag: 2.26.4
     5Tested up to: 6.8.2
     6Stable tag: 2.26.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838
    3939== Changelog ==
     40
     41= 2.26.5 =
     42Release Date: Aug 2025
     43* Change: typesense functions refactored
    4044
    4145= 2.26.4 =
  • supapress/trunk/supapress.php

    r3333728 r3341043  
    77 * Plugin URI: https://www.supadu.com
    88 * Description: Quickly and easily connect your book metadata (ONIX) to your WordPress site.
    9  * Version: 2.26.4
     9 * Version: 2.26.5
    1010 * Author: Supadü
    1111 * Author URI: https://www.supadu.com
     
    3737defined( 'ABSPATH' ) or die( 'Illegal Access!' );
    3838
    39 define( 'SUPAPRESS_VERSION', '2.26.4' );
     39define( 'SUPAPRESS_VERSION', '2.26.5' );
    4040
    4141define( 'SUPAPRESS_SITE_URL', get_site_url() );
Note: See TracChangeset for help on using the changeset viewer.