Version Description
- Scripts are moved to the footer by default
- Inline scripts removed, using JS files for initialization
- Description context option introduced
- A CSS fix for title display
- An image parsing fix
Download this release
Release Info
Developer | wpdreams |
Plugin | Ajax Search Lite |
Version | 4.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.5 to 4.5.1
- ajax-search-lite.php +3 -3
- backend/performance_options.php +7 -1
- backend/settings/default_options.php +4 -2
- backend/tabs/instance/general_options.php +8 -0
- css/style.basic.css +1 -1
- includes/asl_init.class.php +19 -7
- includes/search_content.class.php +101 -10
- includes/views/asl.shortcode.php +46 -49
- js/nomin-scoped/asl_wrapper.js +59 -0
- js/nomin-scoped/jquery.ajaxsearchlite.js +2 -0
- readme.txt +12 -2
ajax-search-lite.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Ajax Search Lite
|
4 |
Plugin URI: http://wp-dreams.com
|
5 |
Description: The lite version of the most powerful ajax powered search engine for WordPress.
|
6 |
-
Version: 4.5
|
7 |
Author: Ernest Marcinko
|
8 |
Author URI: http://wp-dreams.com
|
9 |
Text Domain: ajax-search-lite
|
@@ -19,8 +19,8 @@ define('ASL_INCLUDES_PATH', plugin_dir_path(__FILE__)."/includes/");
|
|
19 |
define('ASL_TT_CACHE_PATH', plugin_dir_path(__FILE__)."/includes/cache/");
|
20 |
define('ASL_DIR', 'ajax-search-lite');
|
21 |
define('ASL_URL', plugin_dir_url(__FILE__));
|
22 |
-
define('ASL_CURRENT_VERSION',
|
23 |
-
define('ASL_CURR_VER_STRING', "4.5");
|
24 |
define('ASL_DEBUG', 0);
|
25 |
|
26 |
global $asl_admin_pages;
|
3 |
Plugin Name: Ajax Search Lite
|
4 |
Plugin URI: http://wp-dreams.com
|
5 |
Description: The lite version of the most powerful ajax powered search engine for WordPress.
|
6 |
+
Version: 4.5.1
|
7 |
Author: Ernest Marcinko
|
8 |
Author URI: http://wp-dreams.com
|
9 |
Text Domain: ajax-search-lite
|
19 |
define('ASL_TT_CACHE_PATH', plugin_dir_path(__FILE__)."/includes/cache/");
|
20 |
define('ASL_DIR', 'ajax-search-lite');
|
21 |
define('ASL_URL', plugin_dir_url(__FILE__));
|
22 |
+
define('ASL_CURRENT_VERSION', 4510);
|
23 |
+
define('ASL_CURR_VER_STRING', "4.5.1");
|
24 |
define('ASL_DEBUG', 0);
|
25 |
|
26 |
global $asl_admin_pages;
|
backend/performance_options.php
CHANGED
@@ -17,6 +17,11 @@ $cache_options = get_option( 'asl_performance' );
|
|
17 |
wpdreams_setval_or_getoption( $cache_options, 'image_cropping', 'asl_performance_def' ) ); ?>
|
18 |
<p class="descMsg">When turned OFF, it disables thumbnail generator, and the full sized images are used as cover. Not much difference visually, but saves a lot of CPU.</p>
|
19 |
</div>
|
|
|
|
|
|
|
|
|
|
|
20 |
<div class="item">
|
21 |
<input type='submit' class='submit' value='Save options'/>
|
22 |
</div>
|
@@ -28,7 +33,8 @@ $cache_options = get_option( 'asl_performance' );
|
|
28 |
if ( isset( $_POST ) && isset( $_POST['asl_performance'] ) ) {
|
29 |
$values = array(
|
30 |
"use_custom_ajax_handler" => $_POST['use_custom_ajax_handler'],
|
31 |
-
"image_cropping" => $_POST['image_cropping']
|
|
|
32 |
);
|
33 |
update_option( 'asl_performance', $values );
|
34 |
$updated = true;
|
17 |
wpdreams_setval_or_getoption( $cache_options, 'image_cropping', 'asl_performance_def' ) ); ?>
|
18 |
<p class="descMsg">When turned OFF, it disables thumbnail generator, and the full sized images are used as cover. Not much difference visually, but saves a lot of CPU.</p>
|
19 |
</div>
|
20 |
+
<div class="item">
|
21 |
+
<?php $o = new wpdreamsYesNo( "load_in_footer", "Load JavaScript in site footer?",
|
22 |
+
wpdreams_setval_or_getoption( $cache_options, 'load_in_footer', 'asl_performance_def' ) ); ?>
|
23 |
+
<p class="descMsg">Will load the JavaScript files in the site footer for better performance.</p>
|
24 |
+
</div>
|
25 |
<div class="item">
|
26 |
<input type='submit' class='submit' value='Save options'/>
|
27 |
</div>
|
33 |
if ( isset( $_POST ) && isset( $_POST['asl_performance'] ) ) {
|
34 |
$values = array(
|
35 |
"use_custom_ajax_handler" => $_POST['use_custom_ajax_handler'],
|
36 |
+
"image_cropping" => $_POST['image_cropping'],
|
37 |
+
"load_in_footer" => $_POST['load_in_footer']
|
38 |
);
|
39 |
update_option( 'asl_performance', $values );
|
40 |
$updated = true;
|
backend/settings/default_options.php
CHANGED
@@ -19,6 +19,7 @@ $options['asl_analytics_def']['analytics_string'] = "ajax_search-{asl_term}";
|
|
19 |
|
20 |
$options['asl_performance_def']['use_custom_ajax_handler'] = 0;
|
21 |
$options['asl_performance_def']['image_cropping'] = 0;
|
|
|
22 |
|
23 |
|
24 |
/* Default new search options */
|
@@ -153,10 +154,11 @@ $options['asl_defaults']['scroll_to_results'] = 0;
|
|
153 |
$options['asl_defaults']['resultareaclickable'] = 1;
|
154 |
$options['asl_defaults']['close_on_document_click'] = 1;
|
155 |
$options['asl_defaults']['show_close_icon'] = 1;
|
156 |
-
$options['asl_defaults']['showauthor'] =
|
157 |
-
$options['asl_defaults']['showdate'] =
|
158 |
$options['asl_defaults']['showdescription'] = 1;
|
159 |
$options['asl_defaults']['descriptionlength'] = 100;
|
|
|
160 |
$options['asl_defaults']['noresultstext'] = "No results!";
|
161 |
$options['asl_defaults']['didyoumeantext'] = "Did you mean:";
|
162 |
$options['asl_defaults']['highlight'] = 0;
|
19 |
|
20 |
$options['asl_performance_def']['use_custom_ajax_handler'] = 0;
|
21 |
$options['asl_performance_def']['image_cropping'] = 0;
|
22 |
+
$options['asl_performance_def']['load_in_footer'] = 1;
|
23 |
|
24 |
|
25 |
/* Default new search options */
|
154 |
$options['asl_defaults']['resultareaclickable'] = 1;
|
155 |
$options['asl_defaults']['close_on_document_click'] = 1;
|
156 |
$options['asl_defaults']['show_close_icon'] = 1;
|
157 |
+
$options['asl_defaults']['showauthor'] = 0;
|
158 |
+
$options['asl_defaults']['showdate'] = 0;
|
159 |
$options['asl_defaults']['showdescription'] = 1;
|
160 |
$options['asl_defaults']['descriptionlength'] = 100;
|
161 |
+
$options['asl_defaults']['description_context'] = 1;
|
162 |
$options['asl_defaults']['noresultstext'] = "No results!";
|
163 |
$options['asl_defaults']['didyoumeantext'] = "Did you mean:";
|
164 |
$options['asl_defaults']['highlight'] = 0;
|
backend/tabs/instance/general_options.php
CHANGED
@@ -128,6 +128,14 @@ $themes = array(
|
|
128 |
$params[$o->getName()] = $o->getData();
|
129 |
?>
|
130 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
<div class="item"><?php
|
132 |
$o = new wpdreamsTextSmall("itemscount", __("Results box viewport (in item numbers)", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'itemscount', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
|
133 |
$params[$o->getName()] = $o->getData();
|
128 |
$params[$o->getName()] = $o->getData();
|
129 |
?>
|
130 |
</div>
|
131 |
+
<div class="item">
|
132 |
+
<?php
|
133 |
+
$o = new wpdreamsYesNo("description_context", __("Display the description context?", "ajax-search-lite"),
|
134 |
+
wpdreams_setval_or_getoption($sd, 'description_context', $_dk));
|
135 |
+
$params[$o->getName()] = $o->getData();
|
136 |
+
?>
|
137 |
+
<p class="descMsg"><?php __("Will display the description from around the search phrase, not from the beginning.", "ajax-search-lite"); ?></p>
|
138 |
+
</div>
|
139 |
<div class="item"><?php
|
140 |
$o = new wpdreamsTextSmall("itemscount", __("Results box viewport (in item numbers)", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'itemscount', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
|
141 |
$params[$o->getName()] = $o->getData();
|
css/style.basic.css
CHANGED
@@ -346,7 +346,7 @@ div[id*="ajaxsearchliteres"] .results .item .asl_content {
|
|
346 |
div[id*='ajaxsearchliteres'] .results .item .asl_content h3 {
|
347 |
margin: 0;
|
348 |
padding: 0;
|
349 |
-
display: inline
|
350 |
line-height: inherit;
|
351 |
}
|
352 |
|
346 |
div[id*='ajaxsearchliteres'] .results .item .asl_content h3 {
|
347 |
margin: 0;
|
348 |
padding: 0;
|
349 |
+
display: inline;
|
350 |
line-height: inherit;
|
351 |
}
|
352 |
|
includes/asl_init.class.php
CHANGED
@@ -53,26 +53,38 @@ class aslInit {
|
|
53 |
$js_source = 'nomin-scoped';
|
54 |
$performance_options = get_option('asl_performance');
|
55 |
|
56 |
-
|
|
|
|
|
57 |
wp_enqueue_script('wpdreams-asljquery');
|
58 |
-
wp_register_script('wpdreams-gestures', ASL_URL.'js/'.$js_source.'/jquery.gestures.js', array($prereq), ASL_CURR_VER_STRING);
|
59 |
wp_enqueue_script('wpdreams-gestures');
|
60 |
-
wp_register_script('wpdreams-easing', ASL_URL.'js/'.$js_source.'/jquery.easing.js', array($prereq), ASL_CURR_VER_STRING);
|
61 |
wp_enqueue_script('wpdreams-easing');
|
62 |
-
wp_register_script('wpdreams-mousewheel',ASL_URL.'js/'.$js_source.'/jquery.mousewheel.js', array($prereq), ASL_CURR_VER_STRING);
|
63 |
wp_enqueue_script('wpdreams-mousewheel');
|
64 |
-
wp_register_script('wpdreams-scroll', ASL_URL.'js/'.$js_source.'/jquery.mCustomScrollbar.js', array($prereq, 'wpdreams-mousewheel'), ASL_CURR_VER_STRING);
|
65 |
wp_enqueue_script('wpdreams-scroll');
|
66 |
-
wp_register_script('wpdreams-ajaxsearchlite', ASL_URL.'js/'.$js_source.'/jquery.ajaxsearchlite.js', array($prereq, "wpdreams-scroll"), ASL_CURR_VER_STRING);
|
67 |
wp_enqueue_script('wpdreams-ajaxsearchlite');
|
|
|
|
|
68 |
|
69 |
$ajax_url = admin_url('admin-ajax.php');
|
70 |
if ( w_isset_def($performance_options['use_custom_ajax_handler'], 0) == 1 )
|
71 |
$ajax_url = ASL_URL . 'ajax_search.php';
|
72 |
|
|
|
73 |
wp_localize_script( 'wpdreams-ajaxsearchlite', 'ajaxsearchlite', array(
|
74 |
'ajaxurl' => $ajax_url,
|
75 |
-
'backend_ajaxurl' => admin_url( 'admin-ajax.php')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
));
|
77 |
|
78 |
}
|
53 |
$js_source = 'nomin-scoped';
|
54 |
$performance_options = get_option('asl_performance');
|
55 |
|
56 |
+
$load_in_footer = w_isset_def($performance_options['load_in_footer'], 1) == 1 ? true : false;
|
57 |
+
|
58 |
+
wp_register_script('wpdreams-asljquery', ASL_URL.'js/'.$js_source.'/asljquery.js', array(), ASL_CURR_VER_STRING, $load_in_footer);
|
59 |
wp_enqueue_script('wpdreams-asljquery');
|
60 |
+
wp_register_script('wpdreams-gestures', ASL_URL.'js/'.$js_source.'/jquery.gestures.js', array($prereq), ASL_CURR_VER_STRING, $load_in_footer);
|
61 |
wp_enqueue_script('wpdreams-gestures');
|
62 |
+
wp_register_script('wpdreams-easing', ASL_URL.'js/'.$js_source.'/jquery.easing.js', array($prereq), ASL_CURR_VER_STRING, $load_in_footer);
|
63 |
wp_enqueue_script('wpdreams-easing');
|
64 |
+
wp_register_script('wpdreams-mousewheel',ASL_URL.'js/'.$js_source.'/jquery.mousewheel.js', array($prereq), ASL_CURR_VER_STRING, $load_in_footer);
|
65 |
wp_enqueue_script('wpdreams-mousewheel');
|
66 |
+
wp_register_script('wpdreams-scroll', ASL_URL.'js/'.$js_source.'/jquery.mCustomScrollbar.js', array($prereq, 'wpdreams-mousewheel'), ASL_CURR_VER_STRING, $load_in_footer);
|
67 |
wp_enqueue_script('wpdreams-scroll');
|
68 |
+
wp_register_script('wpdreams-ajaxsearchlite', ASL_URL.'js/'.$js_source.'/jquery.ajaxsearchlite.js', array($prereq, "wpdreams-scroll"), ASL_CURR_VER_STRING, $load_in_footer);
|
69 |
wp_enqueue_script('wpdreams-ajaxsearchlite');
|
70 |
+
wp_register_script('wpdreams-asl-wrapper', ASL_URL.'js/'.$js_source.'/asl_wrapper.js', array($prereq, "wpdreams-ajaxsearchlite"), ASL_CURR_VER_STRING, $load_in_footer);
|
71 |
+
wp_enqueue_script('wpdreams-asl-wrapper');
|
72 |
|
73 |
$ajax_url = admin_url('admin-ajax.php');
|
74 |
if ( w_isset_def($performance_options['use_custom_ajax_handler'], 0) == 1 )
|
75 |
$ajax_url = ASL_URL . 'ajax_search.php';
|
76 |
|
77 |
+
// @deprecated
|
78 |
wp_localize_script( 'wpdreams-ajaxsearchlite', 'ajaxsearchlite', array(
|
79 |
'ajaxurl' => $ajax_url,
|
80 |
+
'backend_ajaxurl' => admin_url( 'admin-ajax.php'),
|
81 |
+
'js_scope' => 'asljQuery'
|
82 |
+
));
|
83 |
+
|
84 |
+
wp_localize_script( 'wpdreams-ajaxsearchlite', 'ASL', array(
|
85 |
+
'ajaxurl' => $ajax_url,
|
86 |
+
'backend_ajaxurl' => admin_url( 'admin-ajax.php'),
|
87 |
+
'js_scope' => 'asljQuery'
|
88 |
));
|
89 |
|
90 |
}
|
includes/search_content.class.php
CHANGED
@@ -478,14 +478,9 @@ if ( ! class_exists( 'wpdreams_searchContent' ) ) {
|
|
478 |
|
479 |
|
480 |
if ( $image_settings['show_images'] != 0 ) {
|
481 |
-
|
482 |
-
$im = $this->getTimThumbImage($r);
|
483 |
-
if ($im != '' && strpos($im, "mshots/v1") === false)
|
484 |
-
$r->image = $home_url . '/wp-content/plugins/ajax-search-lite/includes/timthumb.php' . '?ct=' . $image_settings['image_transparency'] . '&cc=' . str_replace('#', '', wpdreams_rgb2hex($image_settings['image_bg_color'])) . '&q=95&w=' . $image_settings['image_width'] . '&h=' . $image_settings['image_height']. '&a=' . $image_settings['image_crop_location'] . '&src=' . rawurlencode($im);
|
485 |
-
else
|
486 |
-
$r->image = $im;
|
487 |
-
*/
|
488 |
$im = $this->getBFIimage( $r );
|
|
|
489 |
if ( $im != '' && strpos( $im, "mshots/v1" ) === false && w_isset_def($performance_options['image_cropping'], 0) == 1 ) {
|
490 |
if ( w_isset_def( $image_settings['image_transparency'], 1 ) == 1 ) {
|
491 |
$bfi_params = array( 'width' => $image_settings['image_width'],
|
@@ -574,8 +569,11 @@ if ( ! class_exists( 'wpdreams_searchContent' ) ) {
|
|
574 |
|
575 |
$_content = strip_tags( $_content );
|
576 |
|
577 |
-
|
578 |
-
|
|
|
|
|
|
|
579 |
|
580 |
$_content = wd_closetags( $_content );
|
581 |
$r->content = $_content;
|
@@ -614,6 +612,8 @@ if ( ! class_exists( 'wpdreams_searchContent' ) ) {
|
|
614 |
* Fetches an image for BFI class
|
615 |
*/
|
616 |
function getBFIimage( $post ) {
|
|
|
|
|
617 |
if ( ! isset( $post->image ) || $post->image == null ) {
|
618 |
$home_url = network_home_url();
|
619 |
$home_url = home_url();
|
@@ -632,7 +632,13 @@ if ( ! class_exists( 'wpdreams_searchContent' ) ) {
|
|
632 |
}
|
633 |
break;
|
634 |
case "content":
|
635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
636 |
if ( is_multisite() ) {
|
637 |
$im = str_replace( home_url(), network_home_url(), $im );
|
638 |
}
|
@@ -675,6 +681,91 @@ if ( ! class_exists( 'wpdreams_searchContent' ) ) {
|
|
675 |
}
|
676 |
}
|
677 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
/**
|
679 |
* An empty function to override individual shortcodes, this must be public
|
680 |
*
|
478 |
|
479 |
|
480 |
if ( $image_settings['show_images'] != 0 ) {
|
481 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
$im = $this->getBFIimage( $r );
|
483 |
+
|
484 |
if ( $im != '' && strpos( $im, "mshots/v1" ) === false && w_isset_def($performance_options['image_cropping'], 0) == 1 ) {
|
485 |
if ( w_isset_def( $image_settings['image_transparency'], 1 ) == 1 ) {
|
486 |
$bfi_params = array( 'width' => $image_settings['image_width'],
|
569 |
|
570 |
$_content = strip_tags( $_content );
|
571 |
|
572 |
+
// Get the words from around the search phrase, or just the description
|
573 |
+
if ( w_isset_def($searchData['description_context'], 1) == 1 && count( $_s ) > 0 )
|
574 |
+
$_content = $this->context_find( $_content, $_s[0], floor($searchData['descriptionlength'] / 6), $searchData['descriptionlength'] );
|
575 |
+
else if ( $_content != '' && ( strlen( $_content ) > $searchData['descriptionlength'] ) )
|
576 |
+
$_content = wd_substr_at_word( $_content, $searchData['descriptionlength'] ) . "...";
|
577 |
|
578 |
$_content = wd_closetags( $_content );
|
579 |
$r->content = $_content;
|
612 |
* Fetches an image for BFI class
|
613 |
*/
|
614 |
function getBFIimage( $post ) {
|
615 |
+
$searchData = $this->searchData;
|
616 |
+
|
617 |
if ( ! isset( $post->image ) || $post->image == null ) {
|
618 |
$home_url = network_home_url();
|
619 |
$home_url = home_url();
|
632 |
}
|
633 |
break;
|
634 |
case "content":
|
635 |
+
if ($searchData['showdescription'] == 0)
|
636 |
+
$content = get_post_field('post_content', $post->id);
|
637 |
+
else
|
638 |
+
$content = $post->content;
|
639 |
+
$content = apply_filters('the_content', $content);
|
640 |
+
|
641 |
+
$im = wpdreams_get_image_from_content( $content, 1 );
|
642 |
if ( is_multisite() ) {
|
643 |
$im = str_replace( home_url(), network_home_url(), $im );
|
644 |
}
|
681 |
}
|
682 |
}
|
683 |
|
684 |
+
/**
|
685 |
+
* Returns the context of a phrase within a text.
|
686 |
+
*
|
687 |
+
* @param $str string context
|
688 |
+
* @param $needle string context
|
689 |
+
* @param $context int length of the context
|
690 |
+
* @param $maxlength int maximum length of the string in characters
|
691 |
+
* @return string
|
692 |
+
*/
|
693 |
+
function context_find($str, $needle, $context, $maxlength) {
|
694 |
+
$haystack = ' '.trim($str).' ';
|
695 |
+
|
696 |
+
$fn_strpos = "strpos";
|
697 |
+
$fn_substr = "substr";
|
698 |
+
$fn_strlen = "strlen";
|
699 |
+
|
700 |
+
// Use multibyte string functions if available
|
701 |
+
if ( function_exists('mb_substr') ) {
|
702 |
+
$fn_strpos = "mb_strpos";
|
703 |
+
$fn_substr = "mb_substr";
|
704 |
+
$fn_strlen = "mb_strlen";
|
705 |
+
|
706 |
+
$haystack = mb_strtolower($haystack);
|
707 |
+
$needle = mb_strtolower($needle);
|
708 |
+
} else {
|
709 |
+
$haystack = strtolower($haystack);
|
710 |
+
$needle = strtolower($needle);
|
711 |
+
}
|
712 |
+
|
713 |
+
if ( $i = $fn_strpos($haystack, $needle) ) {
|
714 |
+
$start=$i;
|
715 |
+
$end=$i;
|
716 |
+
$spaces=0;
|
717 |
+
|
718 |
+
while ($spaces < ((int) $context/2) && $start > 0) {
|
719 |
+
$start--;
|
720 |
+
if ($fn_substr($haystack, $start, 1) == ' ') {
|
721 |
+
$spaces++;
|
722 |
+
}
|
723 |
+
}
|
724 |
+
|
725 |
+
while ($spaces < ($context +1) && $end < $fn_strlen($haystack)) {
|
726 |
+
$end++;
|
727 |
+
if ($fn_substr($haystack,$end,1) == ' ') {
|
728 |
+
$spaces++;
|
729 |
+
}
|
730 |
+
}
|
731 |
+
|
732 |
+
while ($spaces < ($context +1) && $start > 0) {
|
733 |
+
$start--;
|
734 |
+
if ($fn_substr($haystack, $start, 1) == ' ') {
|
735 |
+
$spaces++;
|
736 |
+
}
|
737 |
+
}
|
738 |
+
|
739 |
+
$result = trim($fn_substr($haystack, $start, ($end - $start)));
|
740 |
+
|
741 |
+
// Somewhere inbetween..
|
742 |
+
if ( $start != 0 && $end < $fn_strlen($haystack) )
|
743 |
+
return "..." . $result . "...";
|
744 |
+
|
745 |
+
// Beginning
|
746 |
+
if ( $start == 0 && $end < $fn_strlen($haystack) )
|
747 |
+
return $result . "...";
|
748 |
+
|
749 |
+
// End
|
750 |
+
if ( $start != 0 && $end == $fn_strlen($haystack) )
|
751 |
+
return "..." . $result;
|
752 |
+
|
753 |
+
// If it is too long, strip it
|
754 |
+
if ( $fn_strlen($result) > $maxlength)
|
755 |
+
return wd_substr_at_word( $result, $maxlength ) . "...";
|
756 |
+
|
757 |
+
// Else, it is the whole
|
758 |
+
return $result;
|
759 |
+
|
760 |
+
} else {
|
761 |
+
// If it is too long, strip it
|
762 |
+
if ( $fn_strlen($str) > $maxlength)
|
763 |
+
return wd_substr_at_word( $str, $maxlength ) . "...";
|
764 |
+
|
765 |
+
return $str;
|
766 |
+
}
|
767 |
+
}
|
768 |
+
|
769 |
/**
|
770 |
* An empty function to override individual shortcodes, this must be public
|
771 |
*
|
includes/views/asl.shortcode.php
CHANGED
@@ -285,52 +285,49 @@
|
|
285 |
$ana_options = get_option('asl_analytics');
|
286 |
$scope = "asljQuery";
|
287 |
?>
|
288 |
-
|
289 |
-
|
290 |
-
<?php echo
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
});
|
335 |
-
});
|
336 |
-
</script>
|
285 |
$ana_options = get_option('asl_analytics');
|
286 |
$scope = "asljQuery";
|
287 |
?>
|
288 |
+
<div class="asl_init_data" style="display:none !important;" id="asl_init_id_<?php echo $id; ?>">
|
289 |
+
{
|
290 |
+
"homeurl": "<?php echo home_url('/'); ?>",
|
291 |
+
"resultstype": "vertical",
|
292 |
+
"resultsposition": "hover",
|
293 |
+
"itemscount": <?php echo ((isset($style['itemscount']) && $style['itemscount']!="")?$style['itemscount']:"10"); ?>,
|
294 |
+
"imagewidth": <?php echo ((isset($style['settings-imagesettings']['width']))?$style['settings-imagesettings']['width']:"70"); ?>,
|
295 |
+
"imageheight": <?php echo ((isset($style['settings-imagesettings']['height']))?$style['settings-imagesettings']['height']:"70"); ?>,
|
296 |
+
"resultitemheight": "<?php echo ((isset($style['resultitemheight']) && $style['resultitemheight']!="")?$style['resultitemheight']:"70"); ?>",
|
297 |
+
"showauthor": <?php echo ((isset($style['showauthor']) && $style['showauthor']!="")?$style['showauthor']:"1"); ?>,
|
298 |
+
"showdate": <?php echo ((isset($style['showdate']) && $style['showdate']!="")?$style['showdate']:"1"); ?>,
|
299 |
+
"showdescription": <?php echo ((isset($style['showdescription']) && $style['showdescription']!="")?$style['showdescription']:"1"); ?>,
|
300 |
+
"charcount": <?php echo ((isset($style['charcount']) && $style['charcount']!="")?$style['charcount']:"3"); ?>,
|
301 |
+
"noresultstext": "<?php echo ((isset($style['noresultstext']) && $style['noresultstext']!="")?$style['noresultstext']:"3"); ?>",
|
302 |
+
"didyoumeantext": "<?php echo ((isset($style['didyoumeantext']) && $style['didyoumeantext']!="")?$style['didyoumeantext']:"3"); ?>",
|
303 |
+
"defaultImage": "<?php echo w_isset_def($style['image_default'], "")==""?ASL_URL."img/default.jpg":$style['image_default']; ?>",
|
304 |
+
"highlight": 0,
|
305 |
+
"highlightwholewords": 0,
|
306 |
+
"scrollToResults": <?php echo w_isset_def($style['scroll_to_results'], 1); ?>,
|
307 |
+
"resultareaclickable": <?php echo ((isset($style['resultareaclickable']) && $style['resultareaclickable']!="")?$style['resultareaclickable']:0); ?>,
|
308 |
+
"defaultsearchtext": "<?php echo ((isset($style['defaultsearchtext']) && $style['defaultsearchtext']!="")?$style['defaultsearchtext']:""); ?>",
|
309 |
+
"autocomplete": 0,
|
310 |
+
"triggerontype": <?php echo ((isset($style['triggerontype']) && $style['triggerontype']!="")?$style['triggerontype']:1); ?>,
|
311 |
+
"triggeronclick": <?php echo ((isset($style['triggeronclick']) && $style['triggeronclick']!="")?$style['triggeronclick']:1); ?>,
|
312 |
+
"redirectonclick": <?php echo ((isset($style['redirectonclick']) && $style['redirectonclick']!="")?$style['redirectonclick']:0); ?>,
|
313 |
+
"trigger_on_facet_change": <?php echo w_isset_def($style['trigger_on_facet_change'], 0); ?>,
|
314 |
+
"settingsimagepos": "<?php echo w_isset_def($style['theme'], 'classic-blue')=='classic-blue'?'left':'right'; ?>",
|
315 |
+
"hresultanimation": "fx-none",
|
316 |
+
"vresultanimation": "fx-none",
|
317 |
+
"hresulthidedesc": "<?php echo ((isset($style['hhidedesc']) && $style['hhidedesc']!="")?$style['hhidedesc']:1); ?>",
|
318 |
+
"prescontainerheight": "<?php echo ((isset($style['prescontainerheight']) && $style['prescontainerheight']!="")?$style['prescontainerheight']:"400px"); ?>",
|
319 |
+
"pshowsubtitle": "<?php echo ((isset($style['pshowsubtitle']) && $style['pshowsubtitle']!="")?$style['pshowsubtitle']:0); ?>",
|
320 |
+
"pshowdesc": "<?php echo ((isset($style['pshowdesc']) && $style['pshowdesc']!="")?$style['pshowdesc']:1); ?>",
|
321 |
+
"closeOnDocClick": <?php echo w_isset_def($style['close_on_document_click'], 1); ?>,
|
322 |
+
"iifNoImage": "<?php echo w_isset_def($style['i_ifnoimage'], 'description'); ?>",
|
323 |
+
"iiRows": <?php echo w_isset_def($style['i_rows'], 2); ?>,
|
324 |
+
"iitemsWidth": <?php echo w_isset_def($style['i_item_width'], 200); ?>,
|
325 |
+
"iitemsHeight": <?php echo w_isset_def($style['i_item_height'], 200); ?>,
|
326 |
+
"iishowOverlay": <?php echo w_isset_def($style['i_overlay'], 1); ?>,
|
327 |
+
"iiblurOverlay": <?php echo w_isset_def($style['i_overlay_blur'], 1); ?>,
|
328 |
+
"iihideContent": <?php echo w_isset_def($style['i_hide_content'], 1); ?>,
|
329 |
+
"iianimation": "<?php echo w_isset_def($style['i_animation'], 1); ?>",
|
330 |
+
"analytics": <?php echo w_isset_def($ana_options['analytics'], 0); ?>,
|
331 |
+
"analyticsString": "<?php echo w_isset_def($ana_options['analytics_string'], ""); ?>"
|
332 |
+
}
|
333 |
+
</div>
|
|
|
|
|
|
js/nomin-scoped/asl_wrapper.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(jQuery, $, window){
|
2 |
+
// INIT CODE
|
3 |
+
|
4 |
+
// Use the window to make sure it is in the main scope, I do not trust IE
|
5 |
+
window.ASL = window.ASL || {};
|
6 |
+
|
7 |
+
window.ASL.getScope = function() {
|
8 |
+
/**
|
9 |
+
* Explanation:
|
10 |
+
* If the sript is scoped, the first argument is always passed in a localized jQuery
|
11 |
+
* variable, while the actual parameter can be aspjQuery or jQuery (or anything) as well.
|
12 |
+
*/
|
13 |
+
if (typeof jQuery !== "undefined") return jQuery;
|
14 |
+
|
15 |
+
// The code should never reach this point, but sometimes magic happens (unloaded or undefined jQuery??)
|
16 |
+
// .. I am almost positive at this point this is going to fail anyways, but worth a try.
|
17 |
+
if (typeof window[ASL.js_scope] !== "undefined")
|
18 |
+
return window[ASL.js_scope];
|
19 |
+
else
|
20 |
+
return eval(ASL.js_scope);
|
21 |
+
};
|
22 |
+
|
23 |
+
// Call this function if you need to initialize an instance that is printed after an AJAX call
|
24 |
+
// Calling without an argument initializes all instances found.
|
25 |
+
window.ASL.initialize = function(id) {
|
26 |
+
// Yeah I could use $ or jQuery as the scope variable, but I like to avoid magical errors..
|
27 |
+
var scope = window.ASL.getScope();
|
28 |
+
var selector = ".asl_init_data";
|
29 |
+
|
30 |
+
if (typeof id !== 'undefined')
|
31 |
+
selector = "div[id*=asl_init_id_" + id + "]";
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Getting around inline script declarations with this solution.
|
35 |
+
* So these new, invisible divs contains a JSON object with the parameters.
|
36 |
+
* Parse all of them and do the declaration.
|
37 |
+
*/
|
38 |
+
scope(selector).each(function(index, value){
|
39 |
+
var rid = scope(this).attr('id').match(/^asl_init_id_(.*)/)[1];
|
40 |
+
var jsonData = scope(this).html();
|
41 |
+
if (typeof jsonData === "undefined") return false;
|
42 |
+
var args = JSON.parse(jsonData);
|
43 |
+
|
44 |
+
return scope("#ajaxsearchlite" + rid).ajaxsearchlite(args);
|
45 |
+
});
|
46 |
+
};
|
47 |
+
|
48 |
+
window.ASL.ready = function() {
|
49 |
+
var scope = window.ASL.getScope();
|
50 |
+
|
51 |
+
scope(document).ready(function () {
|
52 |
+
window.ASL.initialize();
|
53 |
+
});
|
54 |
+
};
|
55 |
+
|
56 |
+
// Do the init here
|
57 |
+
window.ASL.ready();
|
58 |
+
|
59 |
+
})(asljQuery, asljQuery, window);
|
js/nomin-scoped/jquery.ajaxsearchlite.js
CHANGED
@@ -1473,4 +1473,6 @@
|
|
1473 |
$.plugin('ajaxsearchlite', methods);
|
1474 |
})(jQuery);
|
1475 |
|
|
|
|
|
1476 |
})(asljQuery, asljQuery, window);
|
1473 |
$.plugin('ajaxsearchlite', methods);
|
1474 |
})(jQuery);
|
1475 |
|
1476 |
+
|
1477 |
+
|
1478 |
})(asljQuery, asljQuery, window);
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== Ajax Search Lite ===
|
2 |
Contributors: wpdreams
|
3 |
Donate link: http://wp-dreams.com
|
4 |
Tags: search, better wordpress search, search plugin, relevance search, widget, Post, ajax search, wp ajax search, custom fields search, better search, ajax search plugin, wp search, wp search plugin, relevant search plugin, wordpress search, live search, shortcode, google, woocommerce, woocommerce search, product, product search, custom search, ajax, suggest, autosuggest, autocomplete, search autocomplete, live, plugin, sidebar, product tag search, woocommerce tag search, WooCommerce Plugin, shop, search by sku, relevant search, highlight, term, image
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 4.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -17,6 +17,9 @@ Ajax Search Lite - is a live search plugin for WordPress. This responsive live s
|
|
17 |
Very smooth animations with mobile device support and regular updates.
|
18 |
Fine-tune the user experience by providing a powerful ajax search plugin to your visitors. It will rock your site! Supports custom post types and custom fields and more. Boost your site search engine with this custom built live search engine.
|
19 |
|
|
|
|
|
|
|
20 |
Facebook: https://www.facebook.com/pages/WPDreams/383702515034741
|
21 |
|
22 |
Twitter: https://twitter.com/ernest_marcinko
|
@@ -105,6 +108,13 @@ and will let you know what to do.
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 4.5 =
|
109 |
* New menus: Performance Options and Support
|
110 |
* JSON responses transformed into HTML
|
1 |
+
=== Ajax Search Lite ===
|
2 |
Contributors: wpdreams
|
3 |
Donate link: http://wp-dreams.com
|
4 |
Tags: search, better wordpress search, search plugin, relevance search, widget, Post, ajax search, wp ajax search, custom fields search, better search, ajax search plugin, wp search, wp search plugin, relevant search plugin, wordpress search, live search, shortcode, google, woocommerce, woocommerce search, product, product search, custom search, ajax, suggest, autosuggest, autocomplete, search autocomplete, live, plugin, sidebar, product tag search, woocommerce tag search, WooCommerce Plugin, shop, search by sku, relevant search, highlight, term, image
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 4.5.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
17 |
Very smooth animations with mobile device support and regular updates.
|
18 |
Fine-tune the user experience by providing a powerful ajax search plugin to your visitors. It will rock your site! Supports custom post types and custom fields and more. Boost your site search engine with this custom built live search engine.
|
19 |
|
20 |
+
**Live Demo**
|
21 |
+
[http://wp-dreams.com/demo/ajax-search-lite/](http://wp-dreams.com/demo/ajax-search-lite/)
|
22 |
+
|
23 |
Facebook: https://www.facebook.com/pages/WPDreams/383702515034741
|
24 |
|
25 |
Twitter: https://twitter.com/ernest_marcinko
|
108 |
|
109 |
== Changelog ==
|
110 |
|
111 |
+
= 4.5.1 =
|
112 |
+
* Scripts are moved to the footer by default
|
113 |
+
* Inline scripts removed, using JS files for initialization
|
114 |
+
* Description context option introduced
|
115 |
+
* A CSS fix for title display
|
116 |
+
* An image parsing fix
|
117 |
+
|
118 |
= 4.5 =
|
119 |
* New menus: Performance Options and Support
|
120 |
* JSON responses transformed into HTML
|