Plugin Directory

Changeset 3273594


Ignore:
Timestamp:
04/15/2025 01:04:14 PM (12 months ago)
Author:
wpdreams
Message:

4.12.7 release

Location:
ajax-search-lite
Files:
363 added
7 edited

Legend:

Unmodified
Added
Removed
  • ajax-search-lite/trunk/ajax-search-lite.php

    r3229495 r3273594  
    44Plugin URI: http://wp-dreams.com
    55Description: The lite version of the most powerful ajax powered search engine for WordPress.
    6 Version: 4.12.6
     6Version: 4.12.7
    77Author: Ernest Marcinko
    88Author URI: http://wp-dreams.com
     
    2727);
    2828define('ASL_URL_NP',  str_replace(array("http://", "https://"), "//", plugin_dir_url(__FILE__)));
    29 define('ASL_CURRENT_VERSION', 4768);
    30 define('ASL_CURR_VER_STRING', "4.12.6");
     29define('ASL_CURRENT_VERSION', 4769);
     30define('ASL_CURR_VER_STRING', "4.12.7");
    3131define('ASL_DEBUG', 0);
    3232define('ASL_DEMO', get_option('wd_asl_demo', 0) );
  • ajax-search-lite/trunk/includes/classes/core/class-asl-init.php

    r2844657 r3273594  
    1818    private function __construct() {
    1919        wd_asl()->db = WD_ASL_DBMan::getInstance();
    20 
    21         load_plugin_textdomain( 'ajax-search-lite', false, ASL_DIR . '/languages' );
    2220    }
    2321
  • ajax-search-lite/trunk/includes/classes/core/class-asl-manager.php

    r3120326 r3273594  
    7171                return false;
    7272
     73            // After 6.7 this must be executed in the "init" hook
     74            load_plugin_textdomain( 'ajax-search-lite', false, ASL_DIR . '/languages' );
     75
    7376            $this->getContext();
    7477            /**
  • ajax-search-lite/trunk/includes/classes/filters/class-asl-searchoverride.php

    r2727983 r3273594  
    5050            $_POST['asl_get_as_array'] = 1;*/
    5151
    52             // Additional arguments and filters
    53             //add_filter('asl_query_add_args', array($this, 'getAdditionalArgs'), 10, 1);
    5452
    5553            $posts_per_page = $sd['results_per_page'];
     
    7472                "page"  => $paged
    7573            );
    76             $args = self::getAdditionalArgs($args);
     74
     75            add_filter('asl_query_args', array($this, 'getAdditionalArgs'), 10, 1);
    7776
    7877            if ( count($s_data) == 0 )
     
    9594            global $wpdb;
    9695
    97             // Separate case for WooCommerce
    98             if ( isset($_GET['post_type']) && $_GET['post_type'] == 'product') {
    99                 // WooCommerce price filter
    100                 if ( isset($_GET['min_price'], $_GET['max_price']) ) {
    101                     $qry = "( $wpdb->postmeta.meta_value BETWEEN ". ($_GET['min_price'] + 0) ." AND " .($_GET['max_price'] + 0)." )";
    102                     $args['where'] .= "
    103                         AND ((
    104                           SELECT IF(meta_key IS NULL, 1, IF($qry, COUNT(post_id), 0))
    105                           FROM $wpdb->postmeta
    106                           WHERE $wpdb->postmeta.post_id = $wpdb->posts.ID AND $wpdb->postmeta.meta_key='_price'
    107                         ) >= 1)
    108                     ";
    109                 }
    110 
    111                 // WooCommerce custom Ordering
    112                 if ( isset($_GET['orderby']) ) {
    113                     $o_by = str_replace(' ', '', (strtolower($_GET['orderby'])));
    114                     switch ( $o_by ) {
    115                         case 'popularity':
    116                             $args['fields'] .= "
    117                             (SELECT IF(meta_value IS NULL, 0, meta_value)
    118                                 FROM $wpdb->postmeta
    119                                 WHERE
    120                                     $wpdb->postmeta.meta_key='total_sales' AND
    121                                     $wpdb->postmeta.post_id=$wpdb->posts.ID
    122                                 LIMIT 1
    123                             ) as customfp,
    124                             ";
    125                             $args['orderby'] .= "CAST(customfp as SIGNED) DESC, ";
    126                             break;
    127                         case 'rating':
    128                             // Custom query args here
    129                             $args['fields'] .= "
    130                             (
    131                                 SELECT
    132                                     IF(AVG( $wpdb->commentmeta.meta_value ) IS NULL, 0, AVG( $wpdb->commentmeta.meta_value ))
    133                                 FROM
    134                                     $wpdb->comments
    135                                     LEFT JOIN $wpdb->commentmeta ON($wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id)
    136                                 WHERE
    137                                     $wpdb->posts.ID = $wpdb->comments.comment_post_ID
    138                                     AND ( $wpdb->commentmeta.meta_key = 'rating' OR $wpdb->commentmeta.meta_key IS null )
    139                             ) as average_rating,
    140                             ";
    141                             $args['orderby'] = "average_rating DESC, ";
    142                             break;
    143                         case 'date':
    144                             $args['orderby'] = 'post_date DESC, ';
    145                             break;
    146                         case 'price':
    147                             $args['fields'] .= "
    148                             (SELECT IF(meta_value IS NULL, 0, meta_value)
    149                                 FROM $wpdb->postmeta
    150                                 WHERE
    151                                     $wpdb->postmeta.meta_key='_price' AND
    152                                     $wpdb->postmeta.post_id=$wpdb->posts.ID
    153                                 LIMIT 1
    154                             ) as customfp,
    155                             ";
    156                             $args['orderby'] .= "CAST(customfp as SIGNED) ASC, ";
    157                             break;
    158                         case 'price-desc':
    159                             $args['fields'] .= "
    160                             (SELECT IF(meta_value IS NULL, 0, meta_value)
    161                                 FROM $wpdb->postmeta
    162                                 WHERE
    163                                     $wpdb->postmeta.meta_key='_price' AND
    164                                     $wpdb->postmeta.post_id=$wpdb->posts.ID
    165                                 LIMIT 1
    166                             ) as customfp,
    167                             ";
    168                             $args['orderby'] .= "CAST(customfp as SIGNED) DESC, ";
    169                             break;
    170                     }
    171                 }
    172             } else if ( isset($_GET['orderby']) ) {
    173                 $o_by = str_replace(' ', '', (strtolower($_GET['orderby'])));
    174                 $o_by_arg = '';
    175                 if ( in_array($o_by, array('id', 'post_id', 'post_title', 'post_date')) ) {
    176                     $o_by_resolve = array(
    177                         'id' => 'id', 'post_id' => 'id',
    178                         'post_title' =>'title',
    179                         'post_date' => 'date'
    180                     );
    181                     $o_by_arg = $o_by_resolve[$o_by];
    182                     if ( isset($_GET['order']) ) {
    183                         $o_way = str_replace(' ', '', strtolower($_GET['order']));
    184                         if ( in_array($o_way, array('asc', 'desc')) )
    185                             $o_by_arg .= ' ' . $o_way;
    186                     }
    187                 }
    188 
    189                 if ( $o_by_arg != '' ) {
    190                     $args['orderby'] .= $o_by_arg . ', ';
    191                 }
    192             }
     96            // WooCommerce or other custom Ordering
     97            if ( isset($_GET['orderby']) || isset($_GET['product_orderby']) ) {
     98                $o_by = $_GET['orderby'] ?? $_GET['product_orderby'];
     99                $o_by = str_replace(' ', '', ( strtolower($o_by) ));
     100                if ( isset($_GET['order']) || isset($_GET['product_order']) ) {
     101                    $o_way = $_GET['order'] ?? $_GET['product_order'];
     102                } elseif ( $o_by == 'price' || $o_by == 'product_price' ) {
     103                    $o_way = 'ASC';
     104                } elseif ( $o_by == 'alphabetical' ) {
     105                    $o_way = 'ASC';
     106                } else {
     107                    $o_way = 'DESC';
     108                }
     109                $o_way = strtoupper($o_way);
     110                if ( $o_way != 'DESC' && $o_way != 'ASC' ) {
     111                    $o_way = 'DESC';
     112                }
     113                switch ( $o_by ) {
     114                    case 'id':
     115                    case 'post_id':
     116                    case 'product_id':
     117                        $args['post_primary_order'] = "id $o_way";
     118                        break;
     119                    case 'popularity':
     120                    case 'post_popularity':
     121                    case 'product_popularity':
     122                        $args['post_primary_order']          = "customfp $o_way";
     123                        $args['post_primary_order_metatype'] = 'numeric';
     124                        $args['_post_primary_order_metakey'] = 'total_sales';
     125                        break;
     126                    case 'rating':
     127                    case 'post_rating':
     128                    case 'product_rating':
     129                        // Custom query args here
     130                        $args['cpt_query']['fields']  = "(
     131                            SELECT
     132                                IF(AVG( $wpdb->commentmeta.meta_value ) IS NULL, 0, AVG( $wpdb->commentmeta.meta_value ))
     133                            FROM
     134                                $wpdb->comments
     135                                LEFT JOIN $wpdb->commentmeta ON($wpdb->comments.comment_ID = $wpdb->commentmeta.comment_id)
     136                            WHERE
     137                                $wpdb->posts.ID = $wpdb->comments.comment_post_ID
     138                                AND ( $wpdb->commentmeta.meta_key = 'rating' OR $wpdb->commentmeta.meta_key IS null )
     139                        ) as average_rating, ";
     140                        $args['cpt_query']['orderby'] = "average_rating $o_way, ";
     141
     142                        // Force different field order for index table
     143                        $args['post_primary_order'] = "average_rating $o_way";
     144                        break;
     145                    case 'date':
     146                    case 'post_date':
     147                    case 'product_date':
     148                        $args['post_primary_order'] = "post_date $o_way";
     149                        break;
     150                    case 'name':
     151                    case 'post_name':
     152                    case 'product_name':
     153                    case 'alphabetical':
     154                    case 'reverse_alpha':
     155                    case 'reverse_alphabetical':
     156                        $args['post_primary_order'] = "post_title $o_way";
     157                        break;
     158                    case 'price':
     159                    case 'product_price':
     160                    case 'price-desc':
     161                        $args['post_primary_order']          = "customfp $o_way";
     162                        $args['post_primary_order_metatype'] = 'numeric';
     163                        $args['_post_primary_order_metakey'] = '_price';
     164                        break;
     165                    case 'relevance':
     166                        $args['post_primary_order'] = "relevance $o_way";
     167                        break;
     168                }
     169            }
    193170
    194171            return $args;
     
    248225        public function isSearch($wp_query) {
    249226            $is_search = true;
    250             $soft_check = defined('ELEMENTOR_VERSION') || wd_asl()->o['asl_compatibility']['query_soft_check'];
     227            $soft_check =
     228                defined('ELEMENTOR_VERSION') || // Elementor
     229                defined('ET_CORE') || // Divi
     230                wd_asl()->o['asl_compatibility']['query_soft_check'];
    251231
    252232            // This can't be a search query if none of this is set
  • ajax-search-lite/trunk/includes/classes/search/class-asl-search-cpt.php

    r3120326 r3273594  
    11551155                    return strcasecmp($a->title, $b->title);
    11561156                case "menu_order DESC":
    1157                     return $b->menu_order - $a->menu_order;
     1157                    return isset($b->menu_order) ? $b->menu_order - $a->menu_order : 0;
    11581158                case "menu_order ASC":
    1159                     return $a->menu_order - $b->menu_order;
     1159                    return isset($b->menu_order) ? $a->menu_order - $b->menu_order : 0;
    11601160                case "customfp DESC":
    11611161                    if ($this->args['post_primary_order_metatype'] == 'numeric')
     
    12071207                        return strcasecmp($a->title, $b->title);
    12081208                    case "menu_order DESC":
    1209                         return $b->menu_order - $a->menu_order;
     1209                        return isset($b->menu_order) ? $b->menu_order - $a->menu_order : 0;
    12101210                    case "menu_order ASC":
    1211                         return $a->menu_order - $b->menu_order;
     1211                        return isset($b->menu_order) ? $a->menu_order - $b->menu_order : 0;
    12121212                    case "customfs DESC":
    12131213                        if ($this->args['post_secondary_order_metatype'] == 'numeric')
  • ajax-search-lite/trunk/languages/ajax-search-lite.pot

    r3229495 r3273594  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Ajax Search Lite 4.12.6\n"
     5"Project-Id-Version: Ajax Search Lite 4.12.7\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ajax-search-lite\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-01-27T12:18:02+00:00\n"
     12"POT-Creation-Date: 2025-04-15T12:51:10+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    14 "X-Generator: WP-CLI 2.10.0\n"
     14"X-Generator: WP-CLI 2.11.0\n"
    1515"X-Domain: ajax-search-lite\n"
    1616
  • ajax-search-lite/trunk/readme.txt

    r3229507 r3273594  
    55Requires at least: 3.5
    66Requires PHP: 7.4
    7 Tested up to: 6.7
    8 Stable tag: 4.12.6
     7Tested up to: 6.8
     8Stable tag: 4.12.7
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    135135
    136136== Changelog ==
     137= 4.12.7 =
     138* Fixed an issue when the plugin textdomain was registered too early
     139* Fixed an issue with sorting parameters on the results page
     140
    137141= 4.12.6 =
    138142* Fixed an issue with the advanced title and content fields where HTML was not properly processed and validated
Note: See TracChangeset for help on using the changeset viewer.