Plugin Directory

Changeset 3309786


Ignore:
Timestamp:
06/11/2025 12:06:37 PM (10 months ago)
Author:
zarhasan
Message:

Release v1.1.6 to trunk.

Location:
fast-fuzzy-search/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • fast-fuzzy-search/trunk/fast-fuzzy-search.php

    r3284130 r3309786  
    44 * Plugin URI: https://redoxbird.com/product/fast-fuzzy-search
    55 * Description: A blazing fast and lightweight search engine plugin for your WordPress site.
    6  * Version: 1.1.5
     6 * Version: 1.1.6
    77 * Author: RedOxbird
    88 * Author URI: https://redoxbird.com
     
    1717}
    1818
     19// Automatically deactivate free plugin if pro plugin is activated (on activation hook)
     20register_activation_hook(__FILE__, function() {
     21    if (!function_exists('deactivate_plugins')) {
     22        require_once ABSPATH . 'wp-admin/includes/plugin.php';
     23    }
     24
     25    $pro_plugin = 'fast-fuzzy-search-pro/fast-fuzzy-search.php';
     26    $free_plugin = 'fast-fuzzy-search/fast-fuzzy-search.php';
     27    // If this is the pro plugin and the free plugin is active, deactivate the free plugin
     28    if (basename(__FILE__) === 'fast-fuzzy-search.php' && is_plugin_active($free_plugin)) {
     29        deactivate_plugins($free_plugin);
     30    }
     31});
     32
    1933require_once plugin_dir_path(__FILE__) . 'includes/settings-framework.php';
    2034
    21 define('FAST_FUZZY_SEARCH_VERSION', '1.1.5');
    22 define('FAST_FUZZY_SEARCH_JOIN_SYMBOL', ' / ');
    23 define('FAST_FUZZY_SEARCH_CACHE_DIR',  WP_CONTENT_DIR . '/cache/fast-fuzzy-search/');
    24 define('FAST_FUZZY_SEARCH_DIR_URL', plugin_dir_url(__FILE__));
    25 define('FAST_FUZZY_SEARCH_PLUGIN_FILE', __FILE__ );
    26 define('FAST_FUZZY_SEARCH_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
     35if (!defined('FAST_FUZZY_SEARCH_VERSION')) {
     36    define('FAST_FUZZY_SEARCH_VERSION', '1.1.6');
     37}
     38if (!defined('FAST_FUZZY_SEARCH_JOIN_SYMBOL')) {
     39    define('FAST_FUZZY_SEARCH_JOIN_SYMBOL', ' / ');
     40}
     41if (!defined('FAST_FUZZY_SEARCH_CACHE_DIR')) {
     42    define('FAST_FUZZY_SEARCH_CACHE_DIR',  WP_CONTENT_DIR . '/cache/fast-fuzzy-search/');
     43}
     44if (!defined('FAST_FUZZY_SEARCH_DIR_URL')) {
     45    define('FAST_FUZZY_SEARCH_DIR_URL', plugin_dir_url(__FILE__));
     46}
     47if (!defined('FAST_FUZZY_SEARCH_PLUGIN_FILE')) {
     48    define('FAST_FUZZY_SEARCH_PLUGIN_FILE', __FILE__ );
     49}
     50if (!defined('FAST_FUZZY_SEARCH_PLUGIN_DIR')) {
     51    define('FAST_FUZZY_SEARCH_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
     52}
    2753
    2854/**
     
    387413
    388414                $search_text = $post_type_labels->name . FAST_FUZZY_SEARCH_JOIN_SYMBOL . get_the_title();
     415
     416                // WooCommerce Integration
     417                if (class_exists('WooCommerce') && $post_type === 'product') {
     418                    $product = wc_get_product($post->ID);
     419               
     420                    if ($product) {
     421                        $entry['price'] = wp_strip_all_tags(wc_price($product->get_price()));
     422                        $search_text .= FAST_FUZZY_SEARCH_JOIN_SYMBOL . $product->get_sku();
     423                        $product_id = $product->get_id();
     424                       
     425                       
     426                    }
     427                }       
    389428
    390429               
     
    493532add_action('wp_body_open', 'fast_fuzzy_search_render_search_field');
    494533
    495 function fast_fuzzy_search_render_search_field() {
    496     $options = get_option('fast_fuzzy_search_options');
    497     $type = !empty($options['type']) ? $options['type'] : 'input-field';
    498 
    499     if(!empty($options) && !empty($options['mode']) && $options['mode'] === 'shortcode') {
    500         if($type !== 'input-field') {
    501             fast_fuzzy_search_get_template_part('template-parts/search-panel', null, ['is_inline' => true, 'options' => $options]);
    502         }
    503        
    504         return;
    505     }
    506 
    507 
    508     // Render the input field
    509     if (!is_admin()) {
    510         if($type !== 'input-field') {
    511             fast_fuzzy_search_get_template_part('template-parts/search-panel', null, ['is_inline' => true, 'options' => $options]);
    512         }
    513        
    514         fast_fuzzy_search_get_template_part('template-parts/'. $type);
    515     }
     534if(!function_exists('fast_fuzzy_search_render_search_field')) {
     535    function fast_fuzzy_search_render_search_field() {
     536        $options = get_option('fast_fuzzy_search_options');
     537        $type = !empty($options['type']) ? $options['type'] : 'input-field';
     538
     539        if(!empty($options) && !empty($options['mode']) && $options['mode'] === 'shortcode') {
     540            if($type !== 'input-field') {
     541                fast_fuzzy_search_get_template_part('template-parts/search-panel', null, ['is_inline' => true, 'options' => $options]);
     542            }
     543           
     544            return;
     545        }
     546
     547
     548        // Render the input field
     549        if (!is_admin()) {
     550            if($type !== 'input-field') {
     551                fast_fuzzy_search_get_template_part('template-parts/search-panel', null, ['is_inline' => true, 'options' => $options]);
     552            }
     553           
     554            fast_fuzzy_search_get_template_part('template-parts/'. $type);
     555        }
     556    };
    516557};
    517558
     
    10591100});
    10601101
    1061 function fast_fuzzy_search_allowed_svg_tags() {
    1062     return [
    1063         'svg'    => ['xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'fill' => true, 'class' => true, 'aria-hidden' => true, 'role' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true],
    1064         'g'      => ['fill' => true, 'stroke' => true, 'stroke-width' => true],
    1065         'path'   => ['d' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
    1066         'circle' => ['cx' => true, 'cy' => true, 'r' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
    1067         'rect'   => ['x' => true, 'y' => true, 'width' => true, 'height' => true, 'fill' => true, 'stroke' => true],
    1068         'line'   => ['x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, 'stroke' => true, 'stroke-width' => true],
    1069         'polyline' => ['points' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
    1070         'polygon'  => ['points' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
    1071         'title'  => [], // Allows adding a title inside SVG
    1072         'desc'   => [], // Allows adding a description inside SVG
    1073         'use'    => ['href' => true, 'x' => true, 'y' => true, 'width' => true, 'height' => true],
    1074         'animatetransform' => [
    1075             'attributename'  => true, 'attributetype' => true, 'type' => true,
    1076             'from' => true, 'to' => true, 'dur' => true, 'repeatcount' => true,
    1077             'calcmode' => true, 'values' => true, 'keytimes' => true,
    1078             'keysplines' => true, 'additive' => true, 'accumulate' => true,
    1079             'begin' => true, 'end' => true, 'restart' => true, 'fill' => true
    1080         ],
    1081     ];
    1082 }
     1102if(!function_exists('fast_fuzzy_search_allowed_svg_tags')) {
     1103    function fast_fuzzy_search_allowed_svg_tags() {
     1104        return [
     1105            'svg'    => ['xmlns' => true, 'width' => true, 'height' => true, 'viewbox' => true, 'fill' => true, 'class' => true, 'aria-hidden' => true, 'role' => true, 'stroke' => true, 'stroke-width' => true, 'stroke-linecap' => true, 'stroke-linejoin' => true],
     1106            'g'      => ['fill' => true, 'stroke' => true, 'stroke-width' => true],
     1107            'path'   => ['d' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
     1108            'circle' => ['cx' => true, 'cy' => true, 'r' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
     1109            'rect'   => ['x' => true, 'y' => true, 'width' => true, 'height' => true, 'fill' => true, 'stroke' => true],
     1110            'line'   => ['x1' => true, 'y1' => true, 'x2' => true, 'y2' => true, 'stroke' => true, 'stroke-width' => true],
     1111            'polyline' => ['points' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
     1112            'polygon'  => ['points' => true, 'fill' => true, 'stroke' => true, 'stroke-width' => true],
     1113            'title'  => [], // Allows adding a title inside SVG
     1114            'desc'   => [], // Allows adding a description inside SVG
     1115            'use'    => ['href' => true, 'x' => true, 'y' => true, 'width' => true, 'height' => true],
     1116            'animatetransform' => [
     1117                'attributename'  => true, 'attributetype' => true, 'type' => true,
     1118                'from' => true, 'to' => true, 'dur' => true, 'repeatcount' => true,
     1119                'calcmode' => true, 'values' => true, 'keytimes' => true,
     1120                'keysplines' => true, 'additive' => true, 'accumulate' => true,
     1121                'begin' => true, 'end' => true, 'restart' => true, 'fill' => true
     1122            ],
     1123        ];
     1124    }
     1125}
  • fast-fuzzy-search/trunk/includes/settings-framework.php

    r3277206 r3309786  
    22if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    33
    4 function fast_fuzzy_search_register_settings_framework($page_title, $menu_title, $option_name) {
    5     $fields = [];
    6 
    7     add_action('admin_menu', function() use ($page_title, $menu_title, $option_name, &$fields) {
    8         fast_fuzzy_search_add_settings_page($page_title, $menu_title, $option_name, $fields);
    9     });
    10 
    11     add_action('admin_init', function() use ($option_name, &$fields) {
    12         fast_fuzzy_search_register_settings($option_name, $fields);
    13     });
    14 
    15     return function($field) use (&$fields) {
    16         $fields[] = $field;
    17     };
    18 }
    19 
    20 function fast_fuzzy_search_add_settings_page($page_title, $menu_title, $option_name, &$fields) {
    21     add_menu_page(
    22         $page_title,
    23         $menu_title,
    24         'manage_options',
    25         $option_name,
    26         function() use ($page_title, $option_name, &$fields) {
    27             fast_fuzzy_search_render_settings_page($page_title, $option_name, $fields);
    28         },
    29         'data:image/svg+xml;base64,' . base64_encode(fast_fuzzy_search_svg('icon')),
    30     );
    31 }
    32 
    33 function fast_fuzzy_search_register_settings($option_name, &$fields) {
    34 
    35     register_setting($option_name, $option_name, function($value) use ($fields) {
    36         return fast_fuzzy_search_sanitize_settings($value, $fields);
    37     });
    38 
    39     foreach ($fields as $field) {
    40         add_settings_field(
    41             $field['id'],
    42             $field['label'],
    43             function() use ($field, $option_name) {
    44                 fast_fuzzy_search_render_field($field, $option_name);
     4
     5if(!function_exists("fast_fuzzy_search_register_settings_framework")) {
     6    function fast_fuzzy_search_register_settings_framework($page_title, $menu_title, $option_name) {
     7        $fields = [];
     8
     9        add_action('admin_menu', function() use ($page_title, $menu_title, $option_name, &$fields) {
     10            fast_fuzzy_search_add_settings_page($page_title, $menu_title, $option_name, $fields);
     11        });
     12
     13        add_action('admin_init', function() use ($option_name, &$fields) {
     14            fast_fuzzy_search_register_settings($option_name, $fields);
     15        });
     16
     17        return function($field) use (&$fields) {
     18            $fields[] = $field;
     19        };
     20    }
     21}
     22
     23if(!function_exists("fast_fuzzy_search_add_settings_page")) {
     24    function fast_fuzzy_search_add_settings_page($page_title, $menu_title, $option_name, &$fields) {
     25        add_menu_page(
     26            $page_title,
     27            $menu_title,
     28            'manage_options',
     29            $option_name,
     30            function() use ($page_title, $option_name, &$fields) {
     31                fast_fuzzy_search_render_settings_page($page_title, $option_name, $fields);
    4532            },
    46             $option_name,
    47             $option_name,
    48             $field
     33            'data:image/svg+xml;base64,' . base64_encode(fast_fuzzy_search_svg('icon')),
    4934        );
    5035    }
    51 
    52     add_settings_section($option_name, '', null, $option_name);
    53 }
    54 
    55 function fast_fuzzy_search_sanitize_settings($value, $field) {
    56     switch ($field['type']) {
    57         case 'text':
    58         case 'number':
    59         case 'textarea':
    60             // For text, number, and textarea fields, sanitize and return the value.
    61             return sanitize_text_field($value);
    62 
    63         case 'checkbox':
    64             // For checkbox, check if the value is set to '1', otherwise '0'.
    65             return ($value === '1') ? '1' : '0';
    66 
    67         case 'checkbox_group':
    68             // For checkbox group, sanitize each selected option.
    69             if (is_array($value)) {
    70                 return array_map('sanitize_text_field', $value);
    71             }
    72             return [];
    73 
    74         case 'radio':
    75             // For radio buttons, return the selected option value.
    76             return sanitize_text_field($value);
    77 
    78         case 'select':
    79             // For select dropdown, return the selected option value.
    80             return sanitize_text_field($value);
    81 
    82         case 'color_picker':
    83             // For color picker, sanitize the color value (hex format).
    84             return sanitize_hex_color($value);
    85 
    86         case 'range':
    87             // For range, sanitize and return the value within the defined min/max range.
    88             $min = $field['min'] ?? 0;
    89             $max = $field['max'] ?? 100;
    90             $value = intval($value);
    91             return ($value >= $min && $value <= $max) ? $value : $min;
    92 
    93         case 'switch':
    94             // For switch (checkbox), sanitize value as a boolean.
    95             return ($value === '1') ? '1' : '0';
    96 
    97         case 'image_radio':
    98             // For image radio, return the selected option value.
    99             return sanitize_text_field($value);
    100 
    101         case 'tabbed_radio':
    102             // For tabbed radio, return the selected option value.
    103             return sanitize_text_field($value);
    104 
    105         case 'file':
    106             // For file input, sanitize the file URL or leave it empty if no file is uploaded.
    107             return sanitize_file_name($value);
    108 
    109         case 'date':
    110             // For date input, sanitize and validate the date format (Y-m-d).
    111             return (preg_match('/\d{4}-\d{2}-\d{2}/', $value)) ? $value : '';
    112 
    113         case 'repeater':
    114             // For repeater, sanitize each item in the repeater array.
    115             if (is_array($value)) {
    116                 return array_map(function($item) {
    117                     return sanitize_text_field($item);
    118                 }, $value);
    119             }
    120             return [];
    121     }
    122 
    123     return $value;
    124 }
    125 
    126 
    127 function fast_fuzzy_search_render_field($field, $option_name) {
    128     $value = get_option($option_name)[$field['id']] ?? ($field['default'] ?? '');
    129     $type = $field['type'] ?? 'text';
    130 
    131     switch ($type) {
    132         default:
    133             include plugin_dir_path(__FILE__) . 'advanced-fields.php';
    134             break;
    135     }
    136 }
    137 
    138 function fast_fuzzy_search_render_settings_page($page_title, $option_name, &$fields) {
    139     ?>
    140 
    141    
    142 
    143     <div class="wrap">
    144         <h1 class="text-2xl font-bold"><?php echo esc_html($page_title); ?></h1>
     36}
     37
     38if(!function_exists("fast_fuzzy_search_register_settings")) {
     39    function fast_fuzzy_search_register_settings($option_name, &$fields) {
     40
     41        register_setting($option_name, $option_name, function($value) use ($fields) {
     42            return fast_fuzzy_search_sanitize_settings($value, $fields);
     43        });
     44
     45        foreach ($fields as $field) {
     46            add_settings_field(
     47                $field['id'],
     48                $field['label'],
     49                function() use ($field, $option_name) {
     50                    fast_fuzzy_search_render_field($field, $option_name);
     51                },
     52                $option_name,
     53                $option_name,
     54                $field
     55            );
     56        }
     57
     58        add_settings_section($option_name, '', null, $option_name);
     59    }
     60};
     61
     62
     63if(!function_exists("fast_fuzzy_search_sanitize_settings")) {
     64
     65    function fast_fuzzy_search_sanitize_settings($value, $field) {
     66        switch ($field['type']) {
     67            case 'text':
     68            case 'number':
     69            case 'textarea':
     70                // For text, number, and textarea fields, sanitize and return the value.
     71                return sanitize_text_field($value);
     72
     73            case 'checkbox':
     74                // For checkbox, check if the value is set to '1', otherwise '0'.
     75                return ($value === '1') ? '1' : '0';
     76
     77            case 'checkbox_group':
     78                // For checkbox group, sanitize each selected option.
     79                if (is_array($value)) {
     80                    return array_map('sanitize_text_field', $value);
     81                }
     82                return [];
     83
     84            case 'radio':
     85                // For radio buttons, return the selected option value.
     86                return sanitize_text_field($value);
     87
     88            case 'select':
     89                // For select dropdown, return the selected option value.
     90                return sanitize_text_field($value);
     91
     92            case 'color_picker':
     93                // For color picker, sanitize the color value (hex format).
     94                return sanitize_hex_color($value);
     95
     96            case 'range':
     97                // For range, sanitize and return the value within the defined min/max range.
     98                $min = $field['min'] ?? 0;
     99                $max = $field['max'] ?? 100;
     100                $value = intval($value);
     101                return ($value >= $min && $value <= $max) ? $value : $min;
     102
     103            case 'switch':
     104                // For switch (checkbox), sanitize value as a boolean.
     105                return ($value === '1') ? '1' : '0';
     106
     107            case 'image_radio':
     108                // For image radio, return the selected option value.
     109                return sanitize_text_field($value);
     110
     111            case 'tabbed_radio':
     112                // For tabbed radio, return the selected option value.
     113                return sanitize_text_field($value);
     114
     115            case 'file':
     116                // For file input, sanitize the file URL or leave it empty if no file is uploaded.
     117                return sanitize_file_name($value);
     118
     119            case 'date':
     120                // For date input, sanitize and validate the date format (Y-m-d).
     121                return (preg_match('/\d{4}-\d{2}-\d{2}/', $value)) ? $value : '';
     122
     123            case 'repeater':
     124                // For repeater, sanitize each item in the repeater array.
     125                if (is_array($value)) {
     126                    return array_map(function($item) {
     127                        return sanitize_text_field($item);
     128                    }, $value);
     129                }
     130                return [];
     131        }
     132
     133        return $value;
     134    }
     135}
     136
     137if(!function_exists("fast_fuzzy_search_render_field")) {
     138    function fast_fuzzy_search_render_field($field, $option_name) {
     139        $value = get_option($option_name)[$field['id']] ?? ($field['default'] ?? '');
     140        $type = $field['type'] ?? 'text';
     141
     142        switch ($type) {
     143            default:
     144                include plugin_dir_path(__FILE__) . 'advanced-fields.php';
     145                break;
     146        }
     147    }
     148}
     149
     150
     151if(!function_exists("fast_fuzzy_search_render_settings_page")) {
     152
     153    function fast_fuzzy_search_render_settings_page($page_title, $option_name, &$fields) {
     154        ?>
     155
    145156       
    146         <?php
    147             $current_memory_limit = ini_get('memory_limit');
    148             $current_time_limit = ini_get('max_execution_time');
    149             $posts_count = fast_fuzzy_search_get_post_type_counts();
    150             $recommended_limits = fast_fuzzy_search_get_recommended_limits($posts_count['total_count']);
    151             $options = get_option('fast_fuzzy_search_options');
    152             $color_shades = fast_fuzzy_search_generate_color_Shades($options['primary_color']);
    153         ?>
    154 
    155         <?php if(fast_fuzzy_search_convert_hr_to_bytes($current_memory_limit) < $recommended_limits['memory_limit']): ?>
    156             <div class="notice notice-warning">
    157                 <p>
    158                     <strong><?php esc_html_e('Warning', 'fast-fuzzy-search'); ?>: </strong>
    159                     <?php
    160                         echo sprintf(
    161                             // translators: 1: Current server memory limit, 2: Recommended memory limit
    162                             esc_html__('Server memory limit <strong>(%1$s)</strong> is lower than recommended <strong>(%2$s)</strong>', 'fast-fuzzy-search'),
    163                             esc_html($current_memory_limit),
    164                             esc_html($recommended_limits['memory_limit'])
    165                         );
    166                     ?>
    167                 </p>
    168             </div>
    169         <?php endif; ?>
    170 
    171         <?php if($current_time_limit < $recommended_limits['max_execution_time']): ?>
    172             <div class="notice notice-warning">
    173                 <p>
    174                     <strong><?php esc_html_e('Warning', 'fast-fuzzy-search'); ?>: </strong>
    175                     <?php
    176                         echo sprintf(
    177                             // translators: 1: Current max execution time, 2: Recommended max execution time
    178                             esc_html__('Server max execution time <strong>(%1$s)</strong> is lower than recommended <strong>(%2$s)</strong>', 'fast-fuzzy-search'),
    179                             esc_html($current_time_limit),
    180                             esc_html($recommended_limits['max_execution_time'])
    181                         );
    182                     ?>
    183                 </p>
    184             </div>
    185         <?php endif; ?>
    186 
    187         <h2><?php esc_html_e('Search Index Stats', 'fast-fuzzy-search'); ?></h2>
    188         <div x-data="stats" class="max-w-full card !px-6 py-8">
    189             <div class="grid items-center lg:grid-cols-12 gap-6 lg:gap-12">
    190                 <div class="lg:col-span-4 border-0 border-r border-gray-300 border-solid">
    191                     <div class="lg:pe-6 xl:pe-12">
    192                         <span class="text-6xl font-bold m-0 leading-10 text-gray-900 whitespace-nowrap">
    193                             <span x-text="state !== 'idle' ? stateLabels[state] : data.length"></span>
    194                             <span
    195                                 x-show="state === 'idle'"
    196                                 class="ms-1 inline-flex items-center gap-x-1 bg-green-100 font-medium text-green-800 text-xs leading-4 rounded-full py-0.5 pl-1 pr-2"
    197                                 x-bind:class="data?.length > 0 ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'">
    198                                 <svg class="shrink-0 size-4" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
    199                                     <path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z"/>
    200                                 </svg>
    201                                 <span x-text="data?.length > 0 ? '<?php esc_html_e('Entries Found', 'fast-fuzzy-search') ?>' : '<?php esc_html_e('No Entries Found', 'fast-fuzzy-search') ?>'"></span>
     157
     158        <div class="wrap">
     159            <h1 class="text-2xl font-bold"><?php echo esc_html($page_title); ?></h1>
     160           
     161            <?php
     162                $current_memory_limit = ini_get('memory_limit');
     163                $current_time_limit = ini_get('max_execution_time');
     164                $posts_count = fast_fuzzy_search_get_post_type_counts();
     165                $recommended_limits = fast_fuzzy_search_get_recommended_limits($posts_count['total_count']);
     166                $options = get_option('fast_fuzzy_search_options');
     167                $color_shades = fast_fuzzy_search_generate_color_Shades($options['primary_color']);
     168            ?>
     169
     170            <?php if(fast_fuzzy_search_convert_hr_to_bytes($current_memory_limit) < $recommended_limits['memory_limit']): ?>
     171                <div class="notice notice-warning">
     172                    <p>
     173                        <strong><?php esc_html_e('Warning', 'fast-fuzzy-search'); ?>: </strong>
     174                        <?php
     175                            echo sprintf(
     176                                // translators: 1: Current server memory limit, 2: Recommended memory limit
     177                                esc_html__('Server memory limit <strong>(%1$s)</strong> is lower than recommended <strong>(%2$s)</strong>', 'fast-fuzzy-search'),
     178                                esc_html($current_memory_limit),
     179                                esc_html($recommended_limits['memory_limit'])
     180                            );
     181                        ?>
     182                    </p>
     183                </div>
     184            <?php endif; ?>
     185
     186            <?php if($current_time_limit < $recommended_limits['max_execution_time']): ?>
     187                <div class="notice notice-warning">
     188                    <p>
     189                        <strong><?php esc_html_e('Warning', 'fast-fuzzy-search'); ?>: </strong>
     190                        <?php
     191                            echo sprintf(
     192                                // translators: 1: Current max execution time, 2: Recommended max execution time
     193                                esc_html__('Server max execution time <strong>(%1$s)</strong> is lower than recommended <strong>(%2$s)</strong>', 'fast-fuzzy-search'),
     194                                esc_html($current_time_limit),
     195                                esc_html($recommended_limits['max_execution_time'])
     196                            );
     197                        ?>
     198                    </p>
     199                </div>
     200            <?php endif; ?>
     201
     202            <h2><?php esc_html_e('Search Index Stats', 'fast-fuzzy-search'); ?></h2>
     203            <div x-data="stats" class="max-w-full card !px-6 py-8">
     204                <div class="grid items-center lg:grid-cols-12 gap-6 lg:gap-12">
     205                    <div class="lg:col-span-4 border-0 border-r border-gray-300 border-solid">
     206                        <div class="lg:pe-6 xl:pe-12">
     207                            <span class="text-6xl font-bold m-0 leading-10 text-gray-900 whitespace-nowrap">
     208                                <span x-text="state !== 'idle' ? stateLabels[state] : data.length"></span>
     209                                <span
     210                                    x-show="state === 'idle'"
     211                                    class="ms-1 inline-flex items-center gap-x-1 bg-green-100 font-medium text-green-800 text-xs leading-4 rounded-full py-0.5 pl-1 pr-2"
     212                                    x-bind:class="data?.length > 0 ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'">
     213                                    <svg class="shrink-0 size-4" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
     214                                        <path d="M10.067.87a2.89 2.89 0 0 0-4.134 0l-.622.638-.89-.011a2.89 2.89 0 0 0-2.924 2.924l.01.89-.636.622a2.89 2.89 0 0 0 0 4.134l.637.622-.011.89a2.89 2.89 0 0 0 2.924 2.924l.89-.01.622.636a2.89 2.89 0 0 0 4.134 0l.622-.637.89.011a2.89 2.89 0 0 0 2.924-2.924l-.01-.89.636-.622a2.89 2.89 0 0 0 0-4.134l-.637-.622.011-.89a2.89 2.89 0 0 0-2.924-2.924l-.89.01-.622-.636zm.287 5.984-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7 8.793l2.646-2.647a.5.5 0 0 1 .708.708z"/>
     215                                    </svg>
     216                                    <span x-text="data?.length > 0 ? '<?php esc_html_e('Entries Found', 'fast-fuzzy-search') ?>' : '<?php esc_html_e('No Entries Found', 'fast-fuzzy-search') ?>'"></span>
     217                                </span>
    202218                            </span>
    203                         </span>
    204 
    205                         <p>
    206                             <?php esc_html_e('Number of entries found in the search index', 'fast-fuzzy-search') ?>
    207                         </p>
    208 
    209                         <?php
    210                             $post_types = fast_fuzzy_search_get_searchable_post_types();
    211                         ?>
    212 
    213                         <ul>
    214                             <?php foreach($post_types as $post_type => $post_type_label): ?>
    215                                 <li class="flex justify-between items-center">
    216                                     <strong><?php echo esc_html($post_type_label) ?></strong>
    217                                     <span>
    218                                         <span x-text="groupedData['<?php echo esc_attr($post_type); ?>']?.length || 0"></span> / <span><?php echo esc_html(!empty($posts_count[$post_type]) ? $posts_count[$post_type] : 0) ?></span>
    219                                     </span>
    220                                 </li>
    221                             <?php endforeach; ?>
    222                         </ul>
    223 
    224                         <button
    225                             x-on:click.prevent="refreshIndex" class="button button-primary"
    226                             x-bind:disabled="state !== 'idle'">
    227                             Refresh Index
    228                         </button>
    229                     </div>
    230                 </div>
    231 
    232                 <div class="lg:col-span-8 relative lg:before:absolute lg:before:top-0 lg:before:-start-12 lg:before:w-px lg:before:h-full lg:before:bg-gray-200 lg:before:dark:bg-neutral-700">
    233                     <div class="grid gap-6 grid-cols-2 md:grid-cols-4 lg:grid-cols-3 sm:gap-8">
    234                         <div>
    235                             <span x-text="state !== 'idle' ? stateLabels[state] : size + ' MB'" class="text-3xl font-semibold text-gray-900"></span>
    236                             <p class="mt-1 text-gray-500 dark:text-neutral-500"><?php esc_html_e('Index size', 'fast-fuzzy-search'); ?></p>
     219
     220                            <p>
     221                                <?php esc_html_e('Number of entries found in the search index', 'fast-fuzzy-search') ?>
     222                            </p>
     223
     224                            <?php
     225                                $post_types = fast_fuzzy_search_get_searchable_post_types();
     226                            ?>
     227
     228                            <ul>
     229                                <?php foreach($post_types as $post_type => $post_type_label): ?>
     230                                    <li class="flex justify-between items-center">
     231                                        <strong><?php echo esc_html($post_type_label) ?></strong>
     232                                        <span>
     233                                            <span x-text="groupedData['<?php echo esc_attr($post_type); ?>']?.length || 0"></span> / <span><?php echo esc_html(!empty($posts_count[$post_type]) ? $posts_count[$post_type] : 0) ?></span>
     234                                        </span>
     235                                    </li>
     236                                <?php endforeach; ?>
     237                            </ul>
     238
     239                            <button
     240                                x-on:click.prevent="refreshIndex" class="button button-primary"
     241                                x-bind:disabled="state !== 'idle'">
     242                                Refresh Index
     243                            </button>
    237244                        </div>
    238 
    239                         <div>
    240                             <span class="text-3xl font-semibold text-gray-900"><span x-text="Object.keys(groupedData).length"></span></span>
    241                             <p class="mt-1 text-gray-500 dark:text-neutral-500"><?php esc_html_e('Post types', 'fast-fuzzy-search'); ?></p>
     245                    </div>
     246
     247                    <div class="lg:col-span-8 relative lg:before:absolute lg:before:top-0 lg:before:-start-12 lg:before:w-px lg:before:h-full lg:before:bg-gray-200 lg:before:dark:bg-neutral-700">
     248                        <div class="grid gap-6 grid-cols-2 md:grid-cols-4 lg:grid-cols-3 sm:gap-8">
     249                            <div>
     250                                <span x-text="state !== 'idle' ? stateLabels[state] : size + ' MB'" class="text-3xl font-semibold text-gray-900"></span>
     251                                <p class="mt-1 text-gray-500 dark:text-neutral-500"><?php esc_html_e('Index size', 'fast-fuzzy-search'); ?></p>
     252                            </div>
     253
     254                            <div>
     255                                <span class="text-3xl font-semibold text-gray-900"><span x-text="Object.keys(groupedData).length"></span></span>
     256                                <p class="mt-1 text-gray-500 dark:text-neutral-500"><?php esc_html_e('Post types', 'fast-fuzzy-search'); ?></p>
     257                            </div>
    242258                        </div>
    243259                    </div>
    244260                </div>
    245261            </div>
     262
     263            <div class="bg-white p-8 my-8 border border-gray-300 border-solid">
     264                <h2 class="mt-0"><?php esc_html_e('Settings', 'fast-fuzzy-search') ?></h2>
     265                <form class="fast-fuzzy-search-settings" method="post" action="options.php" x-data="optionsForm" x-bind:data-state="state">
     266                    <div x-cloak x-show="state === 'saved'" class="notice notice-success is-dismissible !fixed z-[1000] bottom-4 right-4">
     267                        <p><?php esc_html_e('Successfully saved the settings.', 'fast-fuzzy-search') ?></p>
     268                    </div>
     269
     270                    <div x-cloak x-show="state === 'error'" class="notice notice-error">
     271                        <p><?php esc_html_e('Something went wrong.', 'fast-fuzzy-search') ?></p>
     272                    </div>
     273
     274                    <?php
     275                        settings_fields($option_name);
     276                        do_settings_sections($option_name);
     277                        submit_button();
     278                    ?>
     279                </form>
     280            </div>
     281
     282            <?php fast_fuzzy_search_get_template_part('template-parts/admin/pricing'); ?>
     283
    246284        </div>
    247 
    248         <div class="bg-white p-8 my-8 border border-gray-300 border-solid">
    249             <h2 class="mt-0"><?php esc_html_e('Settings', 'fast-fuzzy-search') ?></h2>
    250             <form class="fast-fuzzy-search-settings" method="post" action="options.php" x-data="optionsForm" x-bind:data-state="state">
    251                 <div x-cloak x-show="state === 'saved'" class="notice notice-success is-dismissible !fixed z-[1000] bottom-4 right-4">
    252                     <p><?php esc_html_e('Successfully saved the settings.', 'fast-fuzzy-search') ?></p>
    253                 </div>
    254 
    255                 <div x-cloak x-show="state === 'error'" class="notice notice-error">
    256                     <p><?php esc_html_e('Something went wrong.', 'fast-fuzzy-search') ?></p>
    257                 </div>
    258 
    259                 <?php
    260                     settings_fields($option_name);
    261                     do_settings_sections($option_name);
    262                     submit_button();
    263                 ?>
    264             </form>
    265         </div>
    266 
    267         <?php fast_fuzzy_search_get_template_part('template-parts/admin/pricing'); ?>
    268 
    269     </div>
    270     <?php
    271 }
    272 
     285        <?php
     286    }
     287}
  • fast-fuzzy-search/trunk/readme.txt

    r3284130 r3309786  
    22Contributors: zarhasan 
    33Donate link: https://redoxbird.com
    4 Tags: wordpress search, woocommerce search, ajax search, live search, fuzzy search 
     4Tags: woocommerce search, ajax search, live search, fuzzy search, search by sku
    55Requires at least: 5.0 
    66Tested up to: 6.8
    77Requires PHP: 7.4 
    8 Stable tag: 1.1.5 
     8Stable tag: 1.1.6 
    99License: GPLv3 or later 
    1010License URI: [https://www.gnu.org/licenses/gpl-3.0.html](https://www.gnu.org/licenses/gpl-3.0.html) 
    1111
    12 The blazing fast, fuzzy, AJAX-powered search plugin for WordPress and WooCommerce. Designed for speed, built for conversions, and crafted for a stunning user experience.
     12Blazing fast, typo-tolerant, AJAX-powered search for WordPress and WooCommerce. Built for conversions and optimized for massive product catalogs.
    1313
    1414== Description == 
     
    8181- **Built-In Styles** – Drop-in themes and styles included 
    8282
    83 == Pro Version ($49) ==
     83== Pro Version ($29) ==
    8484
    8585- Better integration with WooCommerce, Easy Digital Downloads, and Easy Property Listings
  • fast-fuzzy-search/trunk/template-parts/admin/pricing.php

    r3277206 r3309786  
    8686
    8787                                <li class="flex gap-x-3">
     88                                    <span class="w-5 h-auto inline-flex items-center justify-center text-green-600">
     89                                    <?php echo wp_kses(fast_fuzzy_search_svg('rosette-discount-check-filled'), fast_fuzzy_search_allowed_svg_tags()); ?>
     90                                    </span>
     91                                    Search by SKU
     92                                </li>
     93
     94                                <li class="flex gap-x-3">
    8895                                    <span class="w-5 h-auto inline-flex items-center justify-center text-red-600">
    8996                                    <?php echo wp_kses(fast_fuzzy_search_svg('square-rounded-x'), fast_fuzzy_search_allowed_svg_tags()); ?>
     
    134141                                <span class="font-GeneralSans text-xl font-semibold text-ColorBlack">Pro</span>
    135142                                <div class="month">
    136                                     <span class="font-GeneralSans text-[48px] font-semibold leading-[1.3] text-ColorBlack xl:text-[72px]">$49</span>
     143                                    <span class="font-GeneralSans text-[48px] font-semibold leading-[1.3] text-ColorBlack xl:text-[72px]">$29</span>
    137144                                </div>
    138145                            </div>
     
    177184                                    </span>
    178185                                    Custom Post Type Support
     186                                </li>
     187
     188                                <li class="flex gap-x-3">
     189                                    <span class="w-5 h-auto inline-flex items-center justify-center text-green-600">
     190                                    <?php echo wp_kses(fast_fuzzy_search_svg('rosette-discount-check-filled'), fast_fuzzy_search_allowed_svg_tags()); ?>
     191                                    </span>
     192                                    Search by SKU
    179193                                </li>
    180194
     
    285299                                    <?php echo wp_kses(fast_fuzzy_search_svg('rosette-discount-check-filled'), fast_fuzzy_search_allowed_svg_tags()); ?>
    286300                                    </span>
     301                                    Search by SKU
     302                                </li>
     303
     304                                <li class="flex gap-x-3">
     305                                    <span class="w-5 h-auto inline-flex items-center justify-center text-green-600">
     306                                    <?php echo wp_kses(fast_fuzzy_search_svg('rosette-discount-check-filled'), fast_fuzzy_search_allowed_svg_tags()); ?>
     307                                    </span>
    287308                                    Search by Attributes (Color, Size, etc.)
    288309                                </li>
Note: See TracChangeset for help on using the changeset viewer.