Plugin Directory

Changeset 1779144


Ignore:
Timestamp:
12/01/2017 12:01:59 AM (8 years ago)
Author:
Magenta Cuda
Message:

version 1.8.2.4.2

Location:
bb-gallery/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bb-gallery/trunk/bbg_xiv-gallery.php

    r1771903 r1779144  
    55Plugin URI: https://bbfgallery.wordpress.com/
    66Description: Gallery using Backbone.js, Bootstrap 3 and CSS3 Flexbox
    7 Version: 1.8.2.4.1
     7Version: 1.8.2.4.2
    88Author: Magenta Cuda
    99Author URI: https://profiles.wordpress.org/magenta-cuda/
     
    274274                // Translate the terms of the proprietary 'bb_tags' attribute to ids
    275275                $bb_tags = array_map( 'trim', explode( ',', $atts['bb_tags'] ) );
    276                 $attributes[ 'bb-tags'  ] = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids' ] );
     276                $attributes[ 'bb-tags'  ] = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids', 'hide_empty' => FALSE ] );
    277277            } else if ( ! empty( $atts[ 'include' ] ) ) {
    278278                $attributes[ 'include'  ] = explode( ',', $atts[ 'include' ] );
     
    894894
    895895            if ( self::$wp_rest_api_available && self::$use_wp_rest_api_if_available ) {
    896                 add_filter( 'rest_pre_dispatch', function( $null, $server, $request ) {
    897                     # translate taxonomy slugs and names to ids since WP REST API doesn't accept slugs or names
    898                     if ( !empty( $request[ 'bb-tags' ] ) ) {
    899                         $bb_tags = array_map( 'trim', explode( ',', $request[ 'bb-tags' ] ) );
    900                         if ( !is_numeric( $bb_tags[ 0 ] ) ) {
    901                             $request[ 'bb-tags' ] = implode( ',', get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $bb_tags, 'name' => $bb_tags, 'fields' => 'ids' ] ) );
    902                         }
     896                # add_filter( 'rest_pre_dispatch', function( $null, $server, $request ) {
     897                #     error_log( 'FILTER::rest_pre_dispatch():$request=' . print_r( $request, true ) );
     898                #     return NULL;
     899                # }, 10, 3 );
     900                add_filter( 'rest_attachment_query', function( $args, $request ) {
     901                    if ( !empty( $args[ 's' ] ) ) {
     902                        $terms = get_terms( [ 'taxonomy' => 'bb_tags', 'slug' => $args[ 's' ], 'name' => $args[ 's' ], 'fields' => 'ids', 'hide_empty' => FALSE ] );
     903                        if ( $terms ) {
     904                            # taxonomy has a higher priority than search
     905                            unset( $args[ 's' ] );
     906                            $args['tax_query'][] = [
     907                                                       'taxonomy'         => 'bb_tags',
     908                                                       'field'            => 'term_id',
     909                                                       'terms'            => $terms,
     910                                                       'include_children' => FALSE,
     911                                                   ];
     912                       }
    903913                    }
    904                     return NULL;
    905                 }, 10, 3 );
     914                    return $args;
     915                }, 10, 2 );
    906916            }
    907917        } );
  • bb-gallery/trunk/js/bbg_xiv-gallery.js

    r1771903 r1779144  
    15631563                        data:{
    15641564                            search:query,
     1565                            // 'bb-tags':query,
    15651566                            page:page++,
    15661567                            per_page:searchLimit
  • bb-gallery/trunk/readme.txt

    r1771903 r1779144  
    44Requires at least: 4.4
    55Tested up to: 4.9
    6 Stable tag: 1.8.2.4.1
     6Stable tag: 1.8.2.4.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4444== Changelog ==
    4545
     46= 1.8.2.4.2 =
     47
     48* bb_tags now includes unattached images
     49* search now uses the bb_tags taxonomy
     50
    4651= 1.8.2.4.1 =
    4752
     
    198203== Upgrade Notice ==
    199204
     205= 1.8.2.4.2 =
     206
     207* bb_tags now includes unattached images
     208* search now uses the bb_tags taxonomy
     209
    200210= 1.8.2.4.1 =
    201211
Note: See TracChangeset for help on using the changeset viewer.