Ajax Search Lite - Version 3.11

Version Description

  • WPML compatibility fix
  • A possible security issue fix
Download this release

Release Info

Developer wpdreams
Plugin Icon 128x128 Ajax Search Lite
Version 3.11
Comparing to
See all releases

Code changes from version 3.06 to 3.11

ajax-search-lite.php CHANGED
@@ -3,9 +3,11 @@
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: 3.06
7
  Author: Ernest Marcinko
8
  Author URI: http://wp-dreams.com
 
 
9
  */
10
  ?>
11
  <?php
@@ -16,7 +18,7 @@ define('ASL_CACHE_PATH', plugin_dir_path(__FILE__)."/cache/");
16
  define('ASL_TT_CACHE_PATH', plugin_dir_path(__FILE__)."/includes/cache/");
17
  define('ASL_DIR', 'ajax-search-lite');
18
  define('ASL_URL', plugin_dir_url(__FILE__));
19
- define('ASL_CURRENT_VERSION', 300);
20
  define('ASL_DEBUG', 0);
21
 
22
  global $asl_admin_pages;
@@ -42,9 +44,10 @@ if (isset($_POST) && isset($_POST['action']) &&
42
  return;
43
  }
44
 
45
-
46
  $funcs = new aslInit();
47
 
 
 
48
  /* Includes only on ASP admin pages */
49
  if (wpdreams_on_backend_page($asl_admin_pages) == true) {
50
  require_once(ASL_PATH . "/backend/settings/types.inc.php");
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: 3.11
7
  Author: Ernest Marcinko
8
  Author URI: http://wp-dreams.com
9
+ Text Domain: ajax-search-lite
10
+ Domain Path: /languages/
11
  */
12
  ?>
13
  <?php
18
  define('ASL_TT_CACHE_PATH', plugin_dir_path(__FILE__)."/includes/cache/");
19
  define('ASL_DIR', 'ajax-search-lite');
20
  define('ASL_URL', plugin_dir_url(__FILE__));
21
+ define('ASL_CURRENT_VERSION', 311);
22
  define('ASL_DEBUG', 0);
23
 
24
  global $asl_admin_pages;
44
  return;
45
  }
46
 
 
47
  $funcs = new aslInit();
48
 
49
+ add_action('init', array($funcs, 'asl_init') );
50
+
51
  /* Includes only on ASP admin pages */
52
  if (wpdreams_on_backend_page($asl_admin_pages) == true) {
53
  require_once(ASL_PATH . "/backend/settings/types.inc.php");
backend/analytics.php CHANGED
@@ -4,16 +4,16 @@
4
  <div class="wpdreams-box">
5
  <?php ob_start(); ?>
6
  <div class="item">
7
- <?php $o = new wpdreamsYesNo("analytics", "Enable search Google Analytics integration?",
8
  wpdreams_setval_or_getoption($ana_options, 'analytics', 'asl_analytics_def')
9
  ); ?>
10
  </div>
11
  <div class="item">
12
- <?php $o = new wpdreamsText("analytics_string", "Google analytics pageview string",
13
  wpdreams_setval_or_getoption($ana_options, "analytics_string", 'asl_analytics_def')
14
  ); ?>
15
  <p class='infoMsg'>
16
- This is how the pageview will look like on the google analytics website. Use the {asl_term} variable to add the search term to the pageview.
17
  </p>
18
  </div>
19
  <div class="item">
@@ -37,14 +37,14 @@
37
  <form name='asl_analytics1' method='post'>
38
  <?php if($updated): ?><div class='successMsg'>Analytics options successfuly updated!</div><?php endif; ?>
39
  <fieldset>
40
- <legend>Analytics options</legend>
41
  <?php print $_r; ?>
42
  <input type='hidden' name='asl_analytics' value='1' />
43
  </fieldset>
44
  <fieldset>
45
- <legend>Result</legend>
46
  <p class='infoMsg'>
47
- After some time you should be able to see the hits on your analytics board.
48
  </p>
49
  <img src="http://i.imgur.com/s7BXiPV.png">
50
  </fieldset>
4
  <div class="wpdreams-box">
5
  <?php ob_start(); ?>
6
  <div class="item">
7
+ <?php $o = new wpdreamsYesNo("analytics", __("Enable search Google Analytics integration?", "ajax-search-lite"),
8
  wpdreams_setval_or_getoption($ana_options, 'analytics', 'asl_analytics_def')
9
  ); ?>
10
  </div>
11
  <div class="item">
12
+ <?php $o = new wpdreamsText("analytics_string", __("Google analytics pageview string", "ajax-search-lite"),
13
  wpdreams_setval_or_getoption($ana_options, "analytics_string", 'asl_analytics_def')
14
  ); ?>
15
  <p class='infoMsg'>
16
+ <?php _e("This is how the pageview will look like on the google analytics website. Use the {asl_term} variable to add the search term to the pageview.", "ajax-search-lite"); ?>
17
  </p>
18
  </div>
19
  <div class="item">
37
  <form name='asl_analytics1' method='post'>
38
  <?php if($updated): ?><div class='successMsg'>Analytics options successfuly updated!</div><?php endif; ?>
39
  <fieldset>
40
+ <legend><?php _e("Analytics options", "ajax-search-lite"); ?></legend>
41
  <?php print $_r; ?>
42
  <input type='hidden' name='asl_analytics' value='1' />
43
  </fieldset>
44
  <fieldset>
45
+ <legend><?php _e("Result", "ajax-search-lite"); ?></legend>
46
  <p class='infoMsg'>
47
+ <?php _e("After some time you should be able to see the hits on your analytics board.", "ajax-search-lite"); ?>
48
  </p>
49
  <img src="http://i.imgur.com/s7BXiPV.png">
50
  </fieldset>
backend/settings.php CHANGED
@@ -41,10 +41,10 @@ $_dk = 'asl_defaults';
41
  <?php ob_start(); ?>
42
  <div class="wpdreams-box">
43
 
44
- <label class="shortcode">Search shortcode:</label>
45
  <input type="text" class="shortcode" value="[wpdreams_ajaxsearchlite]"
46
  readonly="readonly"/>
47
- <label class="shortcode">Search shortcode for templates:</label>
48
  <input type="text" class="shortcode"
49
  value="&lt;?php echo do_shortcode('[wpdreams_ajaxsearchlite]'); ?&gt;"
50
  readonly="readonly"/>
@@ -55,16 +55,16 @@ $_dk = 'asl_defaults';
55
 
56
  <form action='' method='POST' name='asl_data'>
57
  <ul id="tabs" class='tabs'>
58
- <li><a tabid="1" class='current general'>General Options</a></li>
59
- <li><a tabid="2" class='multisite'>Image Options</a></li>
60
- <li><a tabid="3" class='frontend'>Frontend Options</a></li>
61
- <li><a tabid="4" class='layout'>Layout options</a></li>
62
- <li><a tabid="7" class='advanced'>Advanced</a></li>
63
  </ul>
64
  <div id="content" class='tabscontent'>
65
  <div tabid="1">
66
  <fieldset>
67
- <legend>Genearal Options</legend>
68
 
69
  <?php include(ASL_PATH . "backend/tabs/instance/general_options.php"); ?>
70
 
@@ -72,7 +72,7 @@ $_dk = 'asl_defaults';
72
  </div>
73
  <div tabid="2">
74
  <fieldset>
75
- <legend>Image Options</legend>
76
 
77
  <?php include(ASL_PATH . "backend/tabs/instance/image_options.php"); ?>
78
 
@@ -80,7 +80,7 @@ $_dk = 'asl_defaults';
80
  </div>
81
  <div tabid="3">
82
  <fieldset>
83
- <legend>Frontend Search Settings</legend>
84
 
85
  <?php include(ASL_PATH . "backend/tabs/instance/frontend_options.php"); ?>
86
 
@@ -88,7 +88,7 @@ $_dk = 'asl_defaults';
88
  </div>
89
  <div tabid="4">
90
  <fieldset>
91
- <legend>Layout Options</legend>
92
 
93
  <?php include(ASL_PATH . "backend/tabs/instance/layout_options.php"); ?>
94
 
@@ -96,7 +96,7 @@ $_dk = 'asl_defaults';
96
  </div>
97
  <div tabid="7">
98
  <fieldset>
99
- <legend>Advanced Options</legend>
100
 
101
  <?php include(ASL_PATH . "backend/tabs/instance/advanced_options.php"); ?>
102
 
@@ -116,7 +116,7 @@ $_dk = 'asl_defaults';
116
 
117
  update_option('asl_options', $_asl_options);
118
 
119
- $messages .= "<div class='infoMsg'>Ajax Search Lite settings saved!</div>";
120
  }
121
 
122
  echo str_replace("{--messages--}", $messages, $output);
41
  <?php ob_start(); ?>
42
  <div class="wpdreams-box">
43
 
44
+ <label class="shortcode"><?php _e("Search shortcode:", "ajax-search-lite"); ?></label>
45
  <input type="text" class="shortcode" value="[wpdreams_ajaxsearchlite]"
46
  readonly="readonly"/>
47
+ <label class="shortcode"><?php _e("Search shortcode for templates:", "ajax-search-lite"); ?></label>
48
  <input type="text" class="shortcode"
49
  value="&lt;?php echo do_shortcode('[wpdreams_ajaxsearchlite]'); ?&gt;"
50
  readonly="readonly"/>
55
 
56
  <form action='' method='POST' name='asl_data'>
57
  <ul id="tabs" class='tabs'>
58
+ <li><a tabid="1" class='current general'><?php _e("General Options", "ajax-search-lite"); ?></a></li>
59
+ <li><a tabid="2" class='multisite'><?php _e("Image Options", "ajax-search-lite"); ?></a></li>
60
+ <li><a tabid="3" class='frontend'><?php _e("Frontend Options", "ajax-search-lite"); ?></a></li>
61
+ <li><a tabid="4" class='layout'><?php _e("Layout options", "ajax-search-lite"); ?></a></li>
62
+ <li><a tabid="7" class='advanced'><?php _e("Advanced", "ajax-search-lite"); ?></a></li>
63
  </ul>
64
  <div id="content" class='tabscontent'>
65
  <div tabid="1">
66
  <fieldset>
67
+ <legend><?php _e("Genearal Options", "ajax-search-lite"); ?></legend>
68
 
69
  <?php include(ASL_PATH . "backend/tabs/instance/general_options.php"); ?>
70
 
72
  </div>
73
  <div tabid="2">
74
  <fieldset>
75
+ <legend><?php _e("Image Options", "ajax-search-lite"); ?></legend>
76
 
77
  <?php include(ASL_PATH . "backend/tabs/instance/image_options.php"); ?>
78
 
80
  </div>
81
  <div tabid="3">
82
  <fieldset>
83
+ <legend><?php _e("Frontend Search Settings", "ajax-search-lite"); ?></legend>
84
 
85
  <?php include(ASL_PATH . "backend/tabs/instance/frontend_options.php"); ?>
86
 
88
  </div>
89
  <div tabid="4">
90
  <fieldset>
91
+ <legend><?php _e("Layout Options", "ajax-search-lite"); ?></legend>
92
 
93
  <?php include(ASL_PATH . "backend/tabs/instance/layout_options.php"); ?>
94
 
96
  </div>
97
  <div tabid="7">
98
  <fieldset>
99
+ <legend><?php _e("Advanced Options", "ajax-search-lite"); ?></legend>
100
 
101
  <?php include(ASL_PATH . "backend/tabs/instance/advanced_options.php"); ?>
102
 
116
 
117
  update_option('asl_options', $_asl_options);
118
 
119
+ $messages .= "<div class='infoMsg'>" . __("Ajax Search Lite settings saved!", "ajax-search-lite") . "</div>";
120
  }
121
 
122
  echo str_replace("{--messages--}", $messages, $output);
backend/settings/class/customfields.class.php CHANGED
@@ -19,7 +19,7 @@ if (!class_exists("wpdreamsCustomFields")) {
19
  <div class='wpdreamsCustomFields'>
20
  <fieldset>
21
  <legend>" . $this->label . "</legend>";
22
- echo '<div class="sortablecontainer"><p>Available public custom fields types</p><ul id="sortable' . self::$_instancenumber . '" class="connectedSortable">';
23
  if ($this->types != null && is_array($this->types)) {
24
  foreach ($this->types as $k => $v) {
25
  if ($this->selected == null || !in_array($v['meta_key'], $this->selected)) {
@@ -28,7 +28,7 @@ if (!class_exists("wpdreamsCustomFields")) {
28
  }
29
  }
30
  echo "</ul></div>";
31
- echo '<div class="sortablecontainer"><p>Drag here the custom fields you want to use!</p><ul id="sortable_conn' . self::$_instancenumber . '" class="connectedSortable">';
32
  if ($this->selected != null && is_array($this->selected)) {
33
  foreach ($this->selected as $k => $v) {
34
  echo '<li class="ui-state-default">' . $v . '</li>';
19
  <div class='wpdreamsCustomFields'>
20
  <fieldset>
21
  <legend>" . $this->label . "</legend>";
22
+ echo '<div class="sortablecontainer"><p>'.__("Available public custom fields types", "ajax-search-lite").'</p><ul id="sortable' . self::$_instancenumber . '" class="connectedSortable">';
23
  if ($this->types != null && is_array($this->types)) {
24
  foreach ($this->types as $k => $v) {
25
  if ($this->selected == null || !in_array($v['meta_key'], $this->selected)) {
28
  }
29
  }
30
  echo "</ul></div>";
31
+ echo '<div class="sortablecontainer"><p>'. __("Drag here the custom fields you want to use!", "ajax-search-lite").'</p><ul id="sortable_conn' . self::$_instancenumber . '" class="connectedSortable">';
32
  if ($this->selected != null && is_array($this->selected)) {
33
  foreach ($this->selected as $k => $v) {
34
  echo '<li class="ui-state-default">' . $v . '</li>';
backend/settings/class/customposttypes.class.php CHANGED
@@ -20,7 +20,7 @@ if (!class_exists("wpdreamsCustomPostTypes")) {
20
  <div class='wpdreamsCustomPostTypes'>
21
  <fieldset>
22
  <legend>" . $this->label . "</legend>";
23
- echo '<div class="sortablecontainer"><p>Available post types</p><ul id="sortable' . self::$_instancenumber . '" class="connectedSortable">';
24
  if ($this->types != null && is_array($this->types)) {
25
  foreach ($this->types as $k => $v) {
26
  if ($this->selected == null || !in_array($v, $this->selected)) {
@@ -29,7 +29,7 @@ if (!class_exists("wpdreamsCustomPostTypes")) {
29
  }
30
  }
31
  echo "</ul></div>";
32
- echo '<div class="sortablecontainer"><p>Drag here the post types you want to use!</p><ul id="sortable_conn' . self::$_instancenumber . '" class="connectedSortable">';
33
  if ($this->selected != null && is_array($this->selected)) {
34
  foreach ($this->selected as $k => $v) {
35
  echo '<li class="ui-state-default">' . $v . '</li>';
20
  <div class='wpdreamsCustomPostTypes'>
21
  <fieldset>
22
  <legend>" . $this->label . "</legend>";
23
+ echo '<div class="sortablecontainer"><p>'. __("Available post types", "ajax-search-lite", "ajax-search-lite") . '</p><ul id="sortable' . self::$_instancenumber . '" class="connectedSortable">';
24
  if ($this->types != null && is_array($this->types)) {
25
  foreach ($this->types as $k => $v) {
26
  if ($this->selected == null || !in_array($v, $this->selected)) {
29
  }
30
  }
31
  echo "</ul></div>";
32
+ echo '<div class="sortablecontainer"><p>'. __("Drag here the post types you want to use!", "ajax-search-lite") . '</p><ul id="sortable_conn' . self::$_instancenumber . '" class="connectedSortable">';
33
  if ($this->selected != null && is_array($this->selected)) {
34
  foreach ($this->selected as $k => $v) {
35
  echo '<li class="ui-state-default">' . $v . '</li>';
backend/settings/types.inc.php CHANGED
@@ -50,15 +50,7 @@ include('class/yesno.class.php');
50
 
51
 
52
  add_action('admin_print_styles', 'admin_stylesV04');
53
- add_action('admin_enqueue_scripts', 'admin_scriptsV04');
54
- add_action('wp_ajax_wpdreams-ajaxinput', "wpdreams_ajaxinputcallback");
55
- if (!function_exists("wpdreams_ajaxinputcallback")) {
56
- function wpdreams_ajaxinputcallback() {
57
- $param = $_POST;
58
- echo call_user_func($_POST['wpdreams_callback'], $param);
59
- exit;
60
- }
61
- }
62
 
63
  if (!function_exists("admin_scriptsV04")) {
64
  function admin_scriptsV04() {
50
 
51
 
52
  add_action('admin_print_styles', 'admin_stylesV04');
53
+ add_action('admin_enqueue_scripts', 'admin_scriptsV04');;
 
 
 
 
 
 
 
 
54
 
55
  if (!function_exists("admin_scriptsV04")) {
56
  function admin_scriptsV04() {
backend/tabs/instance/advanced_options.php CHANGED
@@ -1,6 +1,6 @@
1
  <div class="item">
2
  <?php
3
- $o = new wpdreamsCustomFSelect("titlefield", "Title Field", array(
4
  'selects'=>wpdreams_setval_or_getoption($sd, 'titlefield_def', $_dk),
5
  'value'=>wpdreams_setval_or_getoption($sd, 'titlefield', $_dk)
6
  ));
@@ -9,7 +9,7 @@
9
  </div>
10
  <div class="item">
11
  <?php
12
- $o = new wpdreamsCustomFSelect("descriptionfield", "Description Field", array(
13
  'selects'=>wpdreams_setval_or_getoption($sd, 'descriptionfield_def', $_dk),
14
  'value'=>wpdreams_setval_or_getoption($sd, 'descriptionfield', $_dk)
15
  ));
@@ -18,20 +18,20 @@
18
  </div>
19
  <div class="item">
20
  <?php
21
- $o = new wpdreamsCategories("excludecategories", "Exclude categories", wpdreams_setval_or_getoption($sd, 'excludecategories', $_dk));
22
  $params[$o->getName()] = $o->getData();
23
  $params['selected-'.$o->getName()] = $o->getSelected();
24
  ?>
25
  </div>
26
  <div class="item">
27
  <?php
28
- $o = new wpdreamsTextarea("excludeposts", "Exclude Posts by ID's (comma separated post ID-s)", wpdreams_setval_or_getoption($sd, 'excludeposts', $_dk));
29
  $params[$o->getName()] = $o->getData();
30
  ?>
31
  </div>
32
  <div class="item">
33
  <?php
34
- $o = new wpdreamsYesNo("wpml_compatibility", "WPML compatibility", wpdreams_setval_or_getoption($sd, 'wpml_compatibility', $_dk));
35
  $params[$o->getName()] = $o->getData();
36
  ?>
37
  </div>
1
  <div class="item">
2
  <?php
3
+ $o = new wpdreamsCustomFSelect("titlefield", __("Title Field", "ajax-search-lite"), array(
4
  'selects'=>wpdreams_setval_or_getoption($sd, 'titlefield_def', $_dk),
5
  'value'=>wpdreams_setval_or_getoption($sd, 'titlefield', $_dk)
6
  ));
9
  </div>
10
  <div class="item">
11
  <?php
12
+ $o = new wpdreamsCustomFSelect("descriptionfield", __("Description Field", "ajax-search-lite"), array(
13
  'selects'=>wpdreams_setval_or_getoption($sd, 'descriptionfield_def', $_dk),
14
  'value'=>wpdreams_setval_or_getoption($sd, 'descriptionfield', $_dk)
15
  ));
18
  </div>
19
  <div class="item">
20
  <?php
21
+ $o = new wpdreamsCategories("excludecategories", __("Exclude categories", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'excludecategories', $_dk));
22
  $params[$o->getName()] = $o->getData();
23
  $params['selected-'.$o->getName()] = $o->getSelected();
24
  ?>
25
  </div>
26
  <div class="item">
27
  <?php
28
+ $o = new wpdreamsTextarea("excludeposts", __("Exclude Posts by ID's (comma separated post ID-s)", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'excludeposts', $_dk));
29
  $params[$o->getName()] = $o->getData();
30
  ?>
31
  </div>
32
  <div class="item">
33
  <?php
34
+ $o = new wpdreamsYesNo("wpml_compatibility", __("WPML compatibility", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'wpml_compatibility', $_dk));
35
  $params[$o->getName()] = $o->getData();
36
  ?>
37
  </div>
backend/tabs/instance/frontend_options.php CHANGED
@@ -1,15 +1,15 @@
1
  <div class="item">
2
  <?php
3
- $o = new wpdreamsYesNo("show_frontend_search_settings", "Show search settings on the frontend?", wpdreams_setval_or_getoption($sd, 'show_frontend_search_settings', $_dk));
4
  $params[$o->getName()] = $o->getData();
5
  ?>
6
  </div>
7
  <div class="item" style="text-align:center;">
8
- The default values of the checkboxes on the frontend are the values set above.
9
  </div>
10
  <div class="item">
11
  <?php
12
- $o = new wpdreamsYesNo("showexactmatches", "Show exact matches selector?", wpdreams_setval_or_getoption($sd, 'showexactmatches', $_dk));
13
  $params[$o->getName()] = $o->getData();
14
  $o = new wpdreamsText("exactmatchestext", "Text", wpdreams_setval_or_getoption($sd, 'exactmatchestext', $_dk));
15
  $params[$o->getName()] = $o->getData();
@@ -17,61 +17,61 @@
17
  </div>
18
  <div class="item">
19
  <?php
20
- $o = new wpdreamsYesNo("showsearchinposts", "Show search in posts selector?", wpdreams_setval_or_getoption($sd, 'showsearchinposts', $_dk));
21
  $params[$o->getName()] = $o->getData();
22
  $o = new wpdreamsText("searchinpoststext", "Text", wpdreams_setval_or_getoption($sd, 'searchinpoststext', $_dk));
23
  $params[$o->getName()] = $o->getData();
24
  ?></div>
25
  <div class="item">
26
  <?php
27
- $o = new wpdreamsYesNo("showsearchinpages", "Show search in pages selector?", wpdreams_setval_or_getoption($sd, 'showsearchinpages', $_dk));
28
  $params[$o->getName()] = $o->getData();
29
  $o = new wpdreamsText("searchinpagestext", "Text", wpdreams_setval_or_getoption($sd, 'searchinpagestext', $_dk));
30
  $params[$o->getName()] = $o->getData();
31
  ?></div>
32
  <div class="item">
33
  <?php
34
- $o = new wpdreamsYesNo("showsearchintitle", "Show search in title selector?", wpdreams_setval_or_getoption($sd, 'showsearchintitle', $_dk));
35
  $params[$o->getName()] = $o->getData();
36
  $o = new wpdreamsText("searchintitletext", "Text", wpdreams_setval_or_getoption($sd, 'searchintitletext', $_dk));
37
  $params[$o->getName()] = $o->getData();
38
  ?></div>
39
  <div class="item">
40
  <?php
41
- $o = new wpdreamsYesNo("showsearchincontent", "Show search in content selector?", wpdreams_setval_or_getoption($sd, 'showsearchincontent', $_dk));
42
  $params[$o->getName()] = $o->getData();
43
  $o = new wpdreamsText("searchincontenttext", "Text", wpdreams_setval_or_getoption($sd, 'searchincontenttext', $_dk));
44
  $params[$o->getName()] = $o->getData();
45
  ?></div>
46
  <div class="item"><?php
47
- $o = new wpdreamsCustomPostTypesEditable("showcustomtypes", "Show search in custom post types selectors", wpdreams_setval_or_getoption($sd, 'showcustomtypes', $_dk));
48
  $params[$o->getName()] = $o->getData();
49
  $params['selected-'.$o->getName()] = $o->getSelected();
50
  ?></div>
51
  <div class="item">
52
- <p class='infoMsg'>Nor recommended if you have more than 500 categories! (the HTML output will get too big)</p>
53
  <?php
54
- $o = new wpdreamsYesNo("showsearchincategories", "Show the categories selectors?", wpdreams_setval_or_getoption($sd, 'showsearchincategories', $_dk));
55
  $params[$o->getName()] = $o->getData();
56
  ?></div>
57
  <div class="item">
58
  <?php
59
- $o = new wpdreamsYesNo("showuncategorised", "Show the uncategorised category?", wpdreams_setval_or_getoption($sd, 'showuncategorised', $_dk));
60
  $params[$o->getName()] = $o->getData();
61
  ?></div>
62
  <div class="item"><?php
63
- $o = new wpdreamsCategories("exsearchincategories", "Select which categories exclude", wpdreams_setval_or_getoption($sd, 'exsearchincategories', $_dk));
64
  $params[$o->getName()] = $o->getData();
65
  $params['selected-'.$o->getName()] = $o->getSelected();
66
  ?>
67
  </div>
68
  <div class="item">
69
  <?php
70
- $o = new wpdreamsText("exsearchincategoriestext", "Categories filter box header text", wpdreams_setval_or_getoption($sd, 'exsearchincategoriestext', $_dk));
71
  $params[$o->getName()] = $o->getData();
72
  ?>
73
  </div>
74
  <div class="item">
75
  <input type="hidden" name='asl_submit' value=1 />
76
- <input name="submit_asl" type="submit" value="Save options!" />
77
  </div>
1
  <div class="item">
2
  <?php
3
+ $o = new wpdreamsYesNo("show_frontend_search_settings", __("Show search settings on the frontend?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'show_frontend_search_settings', $_dk));
4
  $params[$o->getName()] = $o->getData();
5
  ?>
6
  </div>
7
  <div class="item" style="text-align:center;">
8
+ <?php _e("The default values of the checkboxes on the frontend are the values set above.", "ajax-search-lite"); ?>
9
  </div>
10
  <div class="item">
11
  <?php
12
+ $o = new wpdreamsYesNo("showexactmatches", __("Show exact matches selector?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showexactmatches', $_dk));
13
  $params[$o->getName()] = $o->getData();
14
  $o = new wpdreamsText("exactmatchestext", "Text", wpdreams_setval_or_getoption($sd, 'exactmatchestext', $_dk));
15
  $params[$o->getName()] = $o->getData();
17
  </div>
18
  <div class="item">
19
  <?php
20
+ $o = new wpdreamsYesNo("showsearchinposts", __("Show search in posts selector?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showsearchinposts', $_dk));
21
  $params[$o->getName()] = $o->getData();
22
  $o = new wpdreamsText("searchinpoststext", "Text", wpdreams_setval_or_getoption($sd, 'searchinpoststext', $_dk));
23
  $params[$o->getName()] = $o->getData();
24
  ?></div>
25
  <div class="item">
26
  <?php
27
+ $o = new wpdreamsYesNo("showsearchinpages", __("Show search in pages selector?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showsearchinpages', $_dk));
28
  $params[$o->getName()] = $o->getData();
29
  $o = new wpdreamsText("searchinpagestext", "Text", wpdreams_setval_or_getoption($sd, 'searchinpagestext', $_dk));
30
  $params[$o->getName()] = $o->getData();
31
  ?></div>
32
  <div class="item">
33
  <?php
34
+ $o = new wpdreamsYesNo("showsearchintitle", __("Show search in title selector?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showsearchintitle', $_dk));
35
  $params[$o->getName()] = $o->getData();
36
  $o = new wpdreamsText("searchintitletext", "Text", wpdreams_setval_or_getoption($sd, 'searchintitletext', $_dk));
37
  $params[$o->getName()] = $o->getData();
38
  ?></div>
39
  <div class="item">
40
  <?php
41
+ $o = new wpdreamsYesNo("showsearchincontent", __("Show search in content selector?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showsearchincontent', $_dk));
42
  $params[$o->getName()] = $o->getData();
43
  $o = new wpdreamsText("searchincontenttext", "Text", wpdreams_setval_or_getoption($sd, 'searchincontenttext', $_dk));
44
  $params[$o->getName()] = $o->getData();
45
  ?></div>
46
  <div class="item"><?php
47
+ $o = new wpdreamsCustomPostTypesEditable("showcustomtypes", __("Show search in custom post types selectors", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showcustomtypes', $_dk));
48
  $params[$o->getName()] = $o->getData();
49
  $params['selected-'.$o->getName()] = $o->getSelected();
50
  ?></div>
51
  <div class="item">
52
+ <p class='infoMsg'><?php _e("Nor recommended if you have more than 500 categories! (the HTML output will get too big)", "ajax-search-lite"); ?></p>
53
  <?php
54
+ $o = new wpdreamsYesNo("showsearchincategories", __("Show the categories selectors?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showsearchincategories', $_dk));
55
  $params[$o->getName()] = $o->getData();
56
  ?></div>
57
  <div class="item">
58
  <?php
59
+ $o = new wpdreamsYesNo("showuncategorised", __("Show the uncategorised category?", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'showuncategorised', $_dk));
60
  $params[$o->getName()] = $o->getData();
61
  ?></div>
62
  <div class="item"><?php
63
+ $o = new wpdreamsCategories("exsearchincategories", __("Select which categories exclude", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'exsearchincategories', $_dk));
64
  $params[$o->getName()] = $o->getData();
65
  $params['selected-'.$o->getName()] = $o->getSelected();
66
  ?>
67
  </div>
68
  <div class="item">
69
  <?php
70
+ $o = new wpdreamsText("exsearchincategoriestext", __("Categories filter box header text", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'exsearchincategoriestext', $_dk));
71
  $params[$o->getName()] = $o->getData();
72
  ?>
73
  </div>
74
  <div class="item">
75
  <input type="hidden" name='asl_submit' value=1 />
76
+ <input name="submit_asl" type="submit" value="<?php _e("Save options!", "ajax-search-lite"); ?>" />
77
  </div>
backend/tabs/instance/general_options.php CHANGED
@@ -9,7 +9,7 @@ $themes = array(
9
  ?>
10
  <div class="item">
11
  <?php
12
- $o = new wpdreamsCustomSelect("theme", "Theme", array(
13
  'selects'=>$themes,
14
  'value'=>wpdreams_setval_or_getoption($sd, 'theme', $_dk)
15
  ));
@@ -18,47 +18,47 @@ $themes = array(
18
  </div>
19
  <div class="item">
20
  <?php
21
- $o = new wpdreamsYesNo("searchinposts", "Search in posts?",
22
  wpdreams_setval_or_getoption($sd, "searchinposts", $_dk));
23
  $params[$o->getName()] = $o->getData();
24
  ?>
25
  </div>
26
  <div class="item">
27
  <?php
28
- $o = new wpdreamsYesNo("searchinpages", "Search in pages?",
29
  wpdreams_setval_or_getoption($sd, 'searchinpages', $_dk));
30
  $params[$o->getName()] = $o->getData();
31
  ?>
32
  </div>
33
  <div class="item"><?php
34
- $o = new wpdreamsCustomPostTypes("customtypes", "Search in custom post types",
35
  wpdreams_setval_or_getoption($sd, 'customtypes', $_dk));
36
  $params[$o->getName()] = $o->getData();
37
  $params['selected-'.$o->getName()] = $o->getSelected();
38
  ?></div>
39
  <div class="item">
40
  <?php
41
- $o = new wpdreamsYesNo("searchintitle", "Search in title?",
42
  wpdreams_setval_or_getoption($sd, 'searchintitle', $_dk));
43
  $params[$o->getName()] = $o->getData();
44
  ?>
45
  </div>
46
  <div class="item">
47
  <?php
48
- $o = new wpdreamsYesNo("searchincontent", "Search in content?",
49
  wpdreams_setval_or_getoption($sd, 'searchincontent', $_dk));
50
  $params[$o->getName()] = $o->getData();
51
  ?>
52
  </div>
53
  <div class="item">
54
  <?php
55
- $o = new wpdreamsYesNo("searchinexcerpt", "Search in post excerpts?",
56
  wpdreams_setval_or_getoption($sd, 'searchinexcerpt', $_dk));
57
  $params[$o->getName()] = $o->getData();
58
  ?>
59
  </div>
60
  <div class="item"><?php
61
- $o = new wpdreamsCustomFields("customfields", "Search in custom fields",
62
  wpdreams_setval_or_getoption($sd, 'customfields', $_dk));
63
  $params[$o->getName()] = $o->getData();
64
  $params['selected-'.$o->getName()] = $o->getSelected();
@@ -66,20 +66,20 @@ $themes = array(
66
  </div>
67
  <div class="item">
68
  <?php
69
- $o = new wpdreamsYesNo("exactonly", "Show exact matches only?",
70
  wpdreams_setval_or_getoption($sd, 'exactonly', $_dk));
71
  $params[$o->getName()] = $o->getData();
72
  ?>
73
  </div>
74
  <div class="item">
75
  <?php
76
- $o = new wpdreamsYesNo("searchinterms", "Search in terms? (categories, tags)",
77
  wpdreams_setval_or_getoption($sd, 'searchinterms', $_dk));
78
  $params[$o->getName()] = $o->getData();
79
  ?>
80
  </div>
81
  <div class="item"><?php
82
- $o = new wpdreamsCustomSelect("orderby", "Result ordering",
83
  array(
84
  'selects' => wpdreams_setval_or_getoption($sd, 'orderby_def', $_dk),
85
  'value' => wpdreams_setval_or_getoption($sd, 'orderby', $_dk)
@@ -88,44 +88,44 @@ $themes = array(
88
  ?></div>
89
  <div class="item">
90
  <?php
91
- $o = new wpdreamsYesNo("triggeronclick", "Trigger search when clicking on search icon?",
92
  wpdreams_setval_or_getoption($sd, 'triggeronclick', $_dk));
93
  $params[$o->getName()] = $o->getData();
94
  ?>
95
  </div>
96
  <div class="item">
97
  <?php
98
- $o = new wpdreamsYesNo("redirectonclick", "<b>Redirect</b> to search results page when clicking on search icon?",
99
  wpdreams_setval_or_getoption($sd, 'redirectonclick', $_dk));
100
  $params[$o->getName()] = $o->getData();
101
  ?>
102
  </div>
103
  <div class="item">
104
  <?php
105
- $o = new wpdreamsYesNo("triggerontype", "Trigger search when typing?",
106
  wpdreams_setval_or_getoption($sd, 'triggerontype', $_dk));
107
  $params[$o->getName()] = $o->getData();
108
  ?>
109
  </div>
110
  <div class="item">
111
  <?php
112
- $o = new wpdreamsTextSmall("charcount", "Minimal character count to trigger search",
113
  wpdreams_setval_or_getoption($sd, 'charcount', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
114
  $params[$o->getName()] = $o->getData();
115
  ?>
116
  </div>
117
  <div class="item">
118
  <?php
119
- $o = new wpdreamsTextSmall("maxresults", "Max. results", wpdreams_setval_or_getoption($sd, 'maxresults', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
120
  $params[$o->getName()] = $o->getData();
121
  ?>
122
  </div>
123
  <div class="item"><?php
124
- $o = new wpdreamsTextSmall("itemscount", "Results box viewport (in item numbers)", wpdreams_setval_or_getoption($sd, 'itemscount', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
125
  $params[$o->getName()] = $o->getData();
126
  ?>
127
  </div>
128
  <div class="item">
129
  <input type="hidden" name='asl_submit' value=1 />
130
- <input name="submit_asl" type="submit" value="Save options!" />
131
  </div>
9
  ?>
10
  <div class="item">
11
  <?php
12
+ $o = new wpdreamsCustomSelect("theme", __("Theme", "ajax-search-lite"), array(
13
  'selects'=>$themes,
14
  'value'=>wpdreams_setval_or_getoption($sd, 'theme', $_dk)
15
  ));
18
  </div>
19
  <div class="item">
20
  <?php
21
+ $o = new wpdreamsYesNo("searchinposts", __("Search in posts?", "ajax-search-lite"),
22
  wpdreams_setval_or_getoption($sd, "searchinposts", $_dk));
23
  $params[$o->getName()] = $o->getData();
24
  ?>
25
  </div>
26
  <div class="item">
27
  <?php
28
+ $o = new wpdreamsYesNo("searchinpages", __("Search in pages?", "ajax-search-lite"),
29
  wpdreams_setval_or_getoption($sd, 'searchinpages', $_dk));
30
  $params[$o->getName()] = $o->getData();
31
  ?>
32
  </div>
33
  <div class="item"><?php
34
+ $o = new wpdreamsCustomPostTypes("customtypes", __("Search in custom post types", "ajax-search-lite"),
35
  wpdreams_setval_or_getoption($sd, 'customtypes', $_dk));
36
  $params[$o->getName()] = $o->getData();
37
  $params['selected-'.$o->getName()] = $o->getSelected();
38
  ?></div>
39
  <div class="item">
40
  <?php
41
+ $o = new wpdreamsYesNo("searchintitle", __("Search in title?", "ajax-search-lite"),
42
  wpdreams_setval_or_getoption($sd, 'searchintitle', $_dk));
43
  $params[$o->getName()] = $o->getData();
44
  ?>
45
  </div>
46
  <div class="item">
47
  <?php
48
+ $o = new wpdreamsYesNo("searchincontent", __("Search in content?", "ajax-search-lite"),
49
  wpdreams_setval_or_getoption($sd, 'searchincontent', $_dk));
50
  $params[$o->getName()] = $o->getData();
51
  ?>
52
  </div>
53
  <div class="item">
54
  <?php
55
+ $o = new wpdreamsYesNo("searchinexcerpt", __("Search in post excerpts?", "ajax-search-lite"),
56
  wpdreams_setval_or_getoption($sd, 'searchinexcerpt', $_dk));
57
  $params[$o->getName()] = $o->getData();
58
  ?>
59
  </div>
60
  <div class="item"><?php
61
+ $o = new wpdreamsCustomFields("customfields", __("Search in custom fields", "ajax-search-lite"),
62
  wpdreams_setval_or_getoption($sd, 'customfields', $_dk));
63
  $params[$o->getName()] = $o->getData();
64
  $params['selected-'.$o->getName()] = $o->getSelected();
66
  </div>
67
  <div class="item">
68
  <?php
69
+ $o = new wpdreamsYesNo("exactonly", __("Show exact matches only?", "ajax-search-lite"),
70
  wpdreams_setval_or_getoption($sd, 'exactonly', $_dk));
71
  $params[$o->getName()] = $o->getData();
72
  ?>
73
  </div>
74
  <div class="item">
75
  <?php
76
+ $o = new wpdreamsYesNo("searchinterms", __("Search in terms? (categories, tags)", "ajax-search-lite"),
77
  wpdreams_setval_or_getoption($sd, 'searchinterms', $_dk));
78
  $params[$o->getName()] = $o->getData();
79
  ?>
80
  </div>
81
  <div class="item"><?php
82
+ $o = new wpdreamsCustomSelect("orderby", __("Result ordering", "ajax-search-lite"),
83
  array(
84
  'selects' => wpdreams_setval_or_getoption($sd, 'orderby_def', $_dk),
85
  'value' => wpdreams_setval_or_getoption($sd, 'orderby', $_dk)
88
  ?></div>
89
  <div class="item">
90
  <?php
91
+ $o = new wpdreamsYesNo("triggeronclick", __("Trigger search when clicking on search icon?", "ajax-search-lite"),
92
  wpdreams_setval_or_getoption($sd, 'triggeronclick', $_dk));
93
  $params[$o->getName()] = $o->getData();
94
  ?>
95
  </div>
96
  <div class="item">
97
  <?php
98
+ $o = new wpdreamsYesNo("redirectonclick", __("Redirect to search results page when clicking on search icon?", "ajax-search-lite"),
99
  wpdreams_setval_or_getoption($sd, 'redirectonclick', $_dk));
100
  $params[$o->getName()] = $o->getData();
101
  ?>
102
  </div>
103
  <div class="item">
104
  <?php
105
+ $o = new wpdreamsYesNo("triggerontype", __("Trigger search when typing?", "ajax-search-lite"),
106
  wpdreams_setval_or_getoption($sd, 'triggerontype', $_dk));
107
  $params[$o->getName()] = $o->getData();
108
  ?>
109
  </div>
110
  <div class="item">
111
  <?php
112
+ $o = new wpdreamsTextSmall("charcount", __("Minimal character count to trigger search", "ajax-search-lite"),
113
  wpdreams_setval_or_getoption($sd, 'charcount', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
114
  $params[$o->getName()] = $o->getData();
115
  ?>
116
  </div>
117
  <div class="item">
118
  <?php
119
+ $o = new wpdreamsTextSmall("maxresults", __("Max. results", "ajax-search-lite"), wpdreams_setval_or_getoption($sd, 'maxresults', $_dk), array(array("func" => "ctype_digit", "op" => "eq", "val" => true)));
120
  $params[$o->getName()] = $o->getData();
121
  ?>
122
  </div>
123
  <div class="item"><?php
124
+ $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)));
125
  $params[$o->getName()] = $o->getData();
126
  ?>
127
  </div>
128
  <div class="item">
129
  <input type="hidden" name='asl_submit' value=1 />
130
+ <input name="submit_asl" type="submit" value="<?php _e("Save options!", "ajax-search-lite"); ?>" />
131
  </div>
backend/tabs/instance/image_options.php CHANGED
@@ -1,7 +1,7 @@
1
  <div class="item">
2
  <?php
3
  $option_name = "show_images";
4
- $option_desc = "Show images in results?";
5
  $o = new wpdreamsYesNo($option_name, $option_desc,
6
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
7
  $params[$o->getName()] = $o->getData();
@@ -10,7 +10,7 @@
10
  <div class="item">
11
  <?php
12
  $option_name = "image_width";
13
- $option_desc = "Image width";
14
  $o = new wpdreamsTextSmall($option_name, $option_desc,
15
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
16
  $params[$o->getName()] = $o->getData();
@@ -19,7 +19,7 @@
19
  <div class="item">
20
  <?php
21
  $option_name = "image_height";
22
- $option_desc = "Image height";
23
  $o = new wpdreamsTextSmall($option_name, $option_desc,
24
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
25
  $params[$o->getName()] = $o->getData();
@@ -30,7 +30,7 @@
30
  <div class="item">
31
  <?php
32
  $option_name = "image_source1";
33
- $option_desc = "Primary image source";
34
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
35
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
36
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
@@ -41,7 +41,7 @@
41
  <div class="item">
42
  <?php
43
  $option_name = "image_source2";
44
- $option_desc = "Alternative image source 1";
45
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
46
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
47
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
@@ -52,7 +52,7 @@
52
  <div class="item">
53
  <?php
54
  $option_name = "image_source3";
55
- $option_desc = "Alternative image source 2";
56
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
57
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
58
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
@@ -63,7 +63,7 @@
63
  <div class="item">
64
  <?php
65
  $option_name = "image_source4";
66
- $option_desc = "Alternative image source 3";
67
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
68
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
69
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
@@ -74,7 +74,7 @@
74
  <div class="item">
75
  <?php
76
  $option_name = "image_source5";
77
- $option_desc = "Alternative image source 4";
78
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
79
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
80
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
@@ -85,7 +85,7 @@
85
  <div class="item">
86
  <?php
87
  $option_name = "image_default";
88
- $option_desc = "Default image url";
89
  $o = new wpdreamsUpload($option_name, $option_desc,
90
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
91
  $params[$o->getName()] = $o->getData();
@@ -94,7 +94,7 @@
94
  <div class="item">
95
  <?php
96
  $option_name = "image_custom_field";
97
- $option_desc = "Custom field containing the image";
98
  $o = new wpdreamsText($option_name, $option_desc,
99
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
100
  $params[$o->getName()] = $o->getData();
@@ -103,5 +103,5 @@
103
  </fieldset>
104
  <div class="item">
105
  <input type="hidden" name='asl_submit' value=1 />
106
- <input name="submit_asl" type="submit" value="Save options!" />
107
  </div>
1
  <div class="item">
2
  <?php
3
  $option_name = "show_images";
4
+ $option_desc = __("Show images in results?", "ajax-search-lite");
5
  $o = new wpdreamsYesNo($option_name, $option_desc,
6
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
7
  $params[$o->getName()] = $o->getData();
10
  <div class="item">
11
  <?php
12
  $option_name = "image_width";
13
+ $option_desc = __("Image width", "ajax-search-lite");
14
  $o = new wpdreamsTextSmall($option_name, $option_desc,
15
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
16
  $params[$o->getName()] = $o->getData();
19
  <div class="item">
20
  <?php
21
  $option_name = "image_height";
22
+ $option_desc = __("Image height", "ajax-search-lite");
23
  $o = new wpdreamsTextSmall($option_name, $option_desc,
24
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
25
  $params[$o->getName()] = $o->getData();
30
  <div class="item">
31
  <?php
32
  $option_name = "image_source1";
33
+ $option_desc = __("Primary image source", "ajax-search-lite");
34
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
35
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
36
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
41
  <div class="item">
42
  <?php
43
  $option_name = "image_source2";
44
+ $option_desc = __("Alternative image source 1", "ajax-search-lite");
45
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
46
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
47
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
52
  <div class="item">
53
  <?php
54
  $option_name = "image_source3";
55
+ $option_desc = __("Alternative image source 2", "ajax-search-lite");
56
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
57
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
58
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
63
  <div class="item">
64
  <?php
65
  $option_name = "image_source4";
66
+ $option_desc = __("Alternative image source 3", "ajax-search-lite");
67
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
68
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
69
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
74
  <div class="item">
75
  <?php
76
  $option_name = "image_source5";
77
+ $option_desc = __("Alternative image source 4", "ajax-search-lite");
78
  $o = new wpdreamsCustomSelect($option_name, $option_desc, array(
79
  'selects'=>wpdreams_setval_or_getoption($sd, 'image_sources', $_dk),
80
  'value'=>wpdreams_setval_or_getoption($sd, $option_name, $_dk)
85
  <div class="item">
86
  <?php
87
  $option_name = "image_default";
88
+ $option_desc = __("Default image url", "ajax-search-lite");
89
  $o = new wpdreamsUpload($option_name, $option_desc,
90
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
91
  $params[$o->getName()] = $o->getData();
94
  <div class="item">
95
  <?php
96
  $option_name = "image_custom_field";
97
+ $option_desc = __("Custom field containing the image", "ajax-search-lite");
98
  $o = new wpdreamsText($option_name, $option_desc,
99
  wpdreams_setval_or_getoption($sd, $option_name, $_dk));
100
  $params[$o->getName()] = $o->getData();
103
  </fieldset>
104
  <div class="item">
105
  <input type="hidden" name='asl_submit' value=1 />
106
+ <input name="submit_asl" type="submit" value="<?php _e("Save options!", "ajax-search-lite"); ?>" />
107
  </div>
backend/tabs/instance/layout_options.php CHANGED
@@ -1,22 +1,22 @@
1
  <ul id="subtabs" class='tabs'>
2
- <li><a tabid="201" class='subtheme current'>Results layout</a></li>
3
- <li><a tabid="202" class='subtheme'>Results Behaviour</a></li>
4
  </ul>
5
  <div class='tabscontent'>
6
  <div tabid="201">
7
  <fieldset>
8
- <legend>Results layout</legend>
9
  <?php include(ASL_PATH."backend/tabs/instance/layout/results_layout.php"); ?>
10
  </fieldset>
11
  </div>
12
  <div tabid="202">
13
  <fieldset>
14
- <legend>Results Behaviour</legend>
15
  <?php include(ASL_PATH."backend/tabs/instance/layout/results_behaviour.php"); ?>
16
  </fieldset>
17
  </div>
18
  </div>
19
  <div class="item">
20
  <input type="hidden" name='asl_submit' value=1 />
21
- <input name="submit_asl" type="submit" value="Save options!" />
22
  </div>
1
  <ul id="subtabs" class='tabs'>
2
+ <li><a tabid="201" class='subtheme current'><?php _e("Results layout", "ajax-search-lite"); ?></a></li>
3
+ <li><a tabid="202" class='subtheme'><?php _e("Results Behaviour", "ajax-search-lite"); ?></a></li>
4
  </ul>
5
  <div class='tabscontent'>
6
  <div tabid="201">
7
  <fieldset>
8
+ <legend><?php _e("Results layout", "ajax-search-lite"); ?></legend>
9
  <?php include(ASL_PATH."backend/tabs/instance/layout/results_layout.php"); ?>
10
  </fieldset>
11
  </div>
12
  <div tabid="202">
13
  <fieldset>
14
+ <legend><?php _e("Results Behaviour", "ajax-search-lite"); ?></legend>
15
  <?php include(ASL_PATH."backend/tabs/instance/layout/results_behaviour.php"); ?>
16
  </fieldset>
17
  </div>
18
  </div>
19
  <div class="item">
20
  <input type="hidden" name='asl_submit' value=1 />
21
+ <input name="submit_asl" type="submit" value="<?php _e("Save options!", "ajax-search-lite"); ?>" />
22
  </div>
includes/asl_init.class.php CHANGED
@@ -5,12 +5,15 @@ class aslInit {
5
  $this->chmod();
6
  }
7
 
 
 
 
 
8
  function navigation_menu() {
9
  if (current_user_can('manage_options')) {
10
- if (!defined("EMU2_I18N_DOMAIN")) define('EMU2_I18N_DOMAIN', "");
11
  add_menu_page(
12
- __('Ajax Search Lite', EMU2_I18N_DOMAIN),
13
- __('Ajax Search Lite', EMU2_I18N_DOMAIN),
14
  'manage_options',
15
  ASL_DIR.'/backend/settings.php',
16
  '',
@@ -19,8 +22,8 @@ class aslInit {
19
  );
20
  add_submenu_page(
21
  ASL_DIR.'/backend/settings.php',
22
- __("Ajax Search Lite", EMU2_I18N_DOMAIN),
23
- __("Analytics Integration", EMU2_I18N_DOMAIN),
24
  'manage_options',
25
  ASL_DIR.'/backend/analytics.php'
26
  );
5
  $this->chmod();
6
  }
7
 
8
+ function asl_init() {
9
+ load_plugin_textdomain( 'ajax-search-lite', false, ASL_DIR . '/languages' );
10
+ }
11
+
12
  function navigation_menu() {
13
  if (current_user_can('manage_options')) {
 
14
  add_menu_page(
15
+ __('Ajax Search Lite', 'ajax-search-lite'),
16
+ __('Ajax Search Lite', 'ajax-search-lite'),
17
  'manage_options',
18
  ASL_DIR.'/backend/settings.php',
19
  '',
22
  );
23
  add_submenu_page(
24
  ASL_DIR.'/backend/settings.php',
25
+ __("Ajax Search Lite", 'ajax-search-lite'),
26
+ __("Analytics Integration", 'ajax-search-lite'),
27
  'manage_options',
28
  ASL_DIR.'/backend/analytics.php'
29
  );
includes/bfi_thumb.php ADDED
@@ -0,0 +1,839 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * bfi_thumb - WP Image Resizer v1.3
4
+ *
5
+ * (c) 2013 Benjamin F. Intal / Gambit
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
+ */
20
+
21
+ /** Uses WP's Image Editor Class to resize and filter images
22
+ *
23
+ * @param $url string the local image URL to manipulate
24
+ * @param $params array the options to perform on the image. Keys and values supported:
25
+ * 'width' int pixels
26
+ * 'height' int pixels
27
+ * 'opacity' int 0-100
28
+ * 'color' string hex-color #000000-#ffffff
29
+ * 'grayscale' bool
30
+ * 'negate' bool
31
+ * 'crop' bool
32
+ * 'crop_only' bool
33
+ * 'crop_x' bool string
34
+ * 'crop_y' bool string
35
+ * 'crop_width' bool string
36
+ * 'crop_height' bool string
37
+ * 'quality' int 1-100
38
+ * @param $single boolean, if false then an array of data will be returned
39
+ * @return string|array containing the url of the resized modified image
40
+ */
41
+
42
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
43
+
44
+ if ( ! function_exists( 'bfi_thumb' ) ) {
45
+
46
+ function bfi_thumb( $url, $params = array(), $single = true ) {
47
+ $class = BFI_Class_Factory::getNewestVersion( 'BFI_Thumb' );
48
+ return call_user_func( array( $class, 'thumb' ), $url, $params, $single );
49
+ }
50
+
51
+ }
52
+
53
+
54
+ /**
55
+ * Class factory, this is to make sure that when multiple bfi_thumb scripts
56
+ * are used (e.g. a plugin and a theme both use it), we always use the
57
+ * latest version.
58
+ */
59
+ if ( ! class_exists( 'BFI_Class_Factory' ) ) {
60
+
61
+ class BFI_Class_Factory {
62
+
63
+ public static $versions = array();
64
+ public static $latestClass = array();
65
+
66
+
67
+ public static function addClassVersion( $baseClassName, $className, $version ) {
68
+ if ( empty( self::$versions[ $baseClassName ] ) ) {
69
+ self::$versions[ $baseClassName ] = array();
70
+ }
71
+ self::$versions[ $baseClassName ][] = array(
72
+ 'class' => $className,
73
+ 'version' => $version
74
+ );
75
+ }
76
+
77
+
78
+ public static function getNewestVersion( $baseClassName ) {
79
+ if ( empty( self::$latestClass[ $baseClassName ] ) ) {
80
+ usort( self::$versions[ $baseClassName ], array( __CLASS__, "versionCompare" ) );
81
+ self::$latestClass[ $baseClassName ] = self::$versions[ $baseClassName ][0]['class'];
82
+ unset( self::$versions[ $baseClassName ] );
83
+ }
84
+ return self::$latestClass[ $baseClassName ];
85
+ }
86
+
87
+
88
+ public static function versionCompare( $a, $b ) {
89
+ return version_compare( $a['version'], $b['version'] ) == 1 ? -1 : 1;
90
+ }
91
+ }
92
+
93
+ }
94
+
95
+
96
+
97
+ /*
98
+ * Change the default image editors
99
+ */
100
+ add_filter( 'wp_image_editors', 'bfi_wp_image_editor' );
101
+
102
+ // Instead of using the default image editors, use our extended ones
103
+ if ( ! function_exists( 'bfi_wp_image_editor' ) ) {
104
+
105
+ function bfi_wp_image_editor( $editorArray ) {
106
+ // Make sure that we use the latest versions
107
+ return array(
108
+ BFI_Class_Factory::getNewestVersion( 'BFI_Image_Editor_GD' ),
109
+ BFI_Class_Factory::getNewestVersion( 'BFI_Image_Editor_Imagick' ),
110
+ );
111
+ }
112
+
113
+ }
114
+
115
+
116
+ /*
117
+ * Include the WP Image classes
118
+ */
119
+
120
+ require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
121
+ require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
122
+ require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
123
+
124
+
125
+ /**
126
+ * check for ImageMagick or GD
127
+ */
128
+
129
+
130
+ add_action( 'admin_init', 'bfi_wp_image_editor_check' );
131
+ if ( ! function_exists( 'bfi_wp_image_editor_check' ) ) {
132
+
133
+ function bfi_wp_image_editor_check() {
134
+ $arg = array( 'mime_type' => 'image/jpeg' );
135
+ if ( wp_image_editor_supports( $arg ) !== true ) {
136
+ add_filter( 'admin_notices', 'bfi_wp_image_editor_check_notice' );
137
+ }
138
+ }
139
+
140
+ }
141
+
142
+ if ( ! function_exists( 'bfi_wp_image_editor_check_notice' ) ) {
143
+ function bfi_wp_image_editor_check_notice() {
144
+ printf( "<div class='error'><p>%s</div>",
145
+ __( "The server does not have ImageMagick or GD installed and/or enabled! Any of these libraries are required for WordPress to be able to resize images. Please contact your server administrator to enable this before continuing.", "default" ) );
146
+ }
147
+ }
148
+
149
+
150
+ /*
151
+ * Enhanced Imagemagick Image Editor
152
+ */
153
+
154
+
155
+ if ( ! class_exists( 'BFI_Image_Editor_Imagick_1_3' ) ) {
156
+
157
+ BFI_Class_Factory::addClassVersion( 'BFI_Image_Editor_Imagick', 'BFI_Image_Editor_Imagick_1_3', '1.3' );
158
+
159
+
160
+ class BFI_Image_Editor_Imagick_1_3 extends WP_Image_Editor_Imagick {
161
+
162
+ /** Changes the opacity of the image
163
+ *
164
+ * @supports 3.5.1
165
+ * @access public
166
+ *
167
+ * @param float $opacity (0.0-1.0)
168
+ * @return boolean|WP_Error
169
+ */
170
+ public function opacity( $opacity ) {
171
+ $opacity /= 100;
172
+
173
+ try {
174
+ // From: http://stackoverflow.com/questions/3538851/php-imagick-setimageopacity-destroys-transparency-and-does-nothing
175
+ // preserves transparency
176
+ //$this->image->setImageOpacity($opacity);
177
+ return $this->image->evaluateImage( Imagick::EVALUATE_MULTIPLY, $opacity, Imagick::CHANNEL_ALPHA );
178
+
179
+ } catch ( Exception $e ) {
180
+ return new WP_Error( 'image_opacity_error', $e->getMessage() );
181
+ }
182
+ }
183
+
184
+
185
+ /** Tints the image a different color
186
+ *
187
+ * @supports 3.5.1
188
+ * @access public
189
+ *
190
+ * @param string hex color e.g. #ff00ff
191
+ * @return boolean|WP_Error
192
+ */
193
+ public function colorize( $hexColor ) {
194
+ try {
195
+ return $this->image->colorizeImage( $hexColor, 1.0 );
196
+ } catch ( Exception $e ) {
197
+ return new WP_Error( 'image_colorize_error', $e->getMessage() );
198
+ }
199
+ }
200
+
201
+
202
+ /** Makes the image grayscale
203
+ *
204
+ * @supports 3.5.1
205
+ * @access public
206
+ *
207
+ * @return boolean|WP_Error
208
+ */
209
+ public function grayscale() {
210
+ try {
211
+ return $this->image->modulateImage( 100, 0, 100 );
212
+ } catch ( Exception $e ) {
213
+ return new WP_Error( 'image_grayscale_error', $e->getMessage() );
214
+ }
215
+ }
216
+
217
+
218
+ /** Negates the image
219
+ *
220
+ * @supports 3.5.1
221
+ * @access public
222
+ *
223
+ * @return boolean|WP_Error
224
+ */
225
+ public function negate() {
226
+ try {
227
+ return $this->image->negateImage( false );
228
+ } catch ( Exception $e ) {
229
+ return new WP_Error( 'image_negate_error', $e->getMessage() );
230
+ }
231
+ }
232
+ }
233
+ }
234
+
235
+
236
+ /*
237
+ * Enhanced GD Image Editor
238
+ */
239
+
240
+
241
+ if ( ! class_exists( 'BFI_Image_Editor_GD_1_3' ) ) {
242
+
243
+ BFI_Class_Factory::addClassVersion( 'BFI_Image_Editor_GD', 'BFI_Image_Editor_GD_1_3', '1.3' );
244
+
245
+ class BFI_Image_Editor_GD_1_3 extends WP_Image_Editor_GD {
246
+
247
+ /** Rotates current image counter-clockwise by $angle.
248
+ * Ported from image-edit.php
249
+ * Added presevation of alpha channels
250
+ *
251
+ * @since 3.5.0
252
+ * @access public
253
+ *
254
+ * @param float $angle
255
+ * @return boolean|WP_Error
256
+ */
257
+ public function rotate( $angle ) {
258
+ if ( function_exists('imagerotate') ) {
259
+ $rotated = imagerotate( $this->image, $angle, 0 );
260
+
261
+ // Add alpha blending
262
+ imagealphablending( $rotated, true );
263
+ imagesavealpha( $rotated, true );
264
+
265
+ if ( is_resource( $rotated ) ) {
266
+ imagedestroy( $this->image );
267
+ $this->image = $rotated;
268
+ $this->update_size();
269
+ return true;
270
+ }
271
+ }
272
+
273
+ return new WP_Error( 'image_rotate_error', __( 'Image rotate failed.', 'default' ), $this->file );
274
+ }
275
+
276
+
277
+ /** Changes the opacity of the image
278
+ *
279
+ * @supports 3.5.1
280
+ * @access public
281
+ *
282
+ * @param float $opacity (0.0-1.0)
283
+ * @return boolean|WP_Error
284
+ */
285
+ public function opacity( $opacity ) {
286
+ $opacity /= 100;
287
+
288
+ $filtered = $this->_opacity( $this->image, $opacity );
289
+
290
+ if ( is_resource( $filtered ) ) {
291
+ // imagedestroy($this->image);
292
+ $this->image = $filtered;
293
+ return true;
294
+ }
295
+
296
+ return new WP_Error( 'image_opacity_error', __('Image opacity change failed.', 'default' ), $this->file );
297
+ }
298
+
299
+
300
+ // from: http://php.net/manual/en/function.imagefilter.php
301
+ // params: image resource id, opacity (eg. 0.0-1.0)
302
+ protected function _opacity( $image, $opacity ) {
303
+ if ( ! function_exists( 'imagealphablending' ) ||
304
+ ! function_exists( 'imagecolorat' ) ||
305
+ ! function_exists( 'imagecolorallocatealpha' ) ||
306
+ ! function_exists( 'imagesetpixel' ) ) {
307
+ return false;
308
+ }
309
+
310
+ // get image width and height
311
+ $w = imagesx( $image );
312
+ $h = imagesy( $image );
313
+
314
+ // turn alpha blending off
315
+ imagealphablending( $image, false );
316
+
317
+ // find the most opaque pixel in the image (the one with the smallest alpha value)
318
+ $minalpha = 127;
319
+ for ( $x = 0; $x < $w; $x++ ) {
320
+ for ( $y = 0; $y < $h; $y++ ) {
321
+ $alpha = ( imagecolorat( $image, $x, $y ) >> 24 ) & 0xFF;
322
+ if ( $alpha < $minalpha ) {
323
+ $minalpha = $alpha;
324
+ }
325
+ }
326
+ }
327
+
328
+ // loop through image pixels and modify alpha for each
329
+ for ( $x = 0; $x < $w; $x++ ) {
330
+ for ( $y = 0; $y < $h; $y++ ) {
331
+
332
+ // get current alpha value (represents the TANSPARENCY!)
333
+ $colorxy = imagecolorat( $image, $x, $y );
334
+ $alpha = ( $colorxy >> 24 ) & 0xFF;
335
+
336
+ // calculate new alpha
337
+ if ( $minalpha !== 127 ) {
338
+ $alpha = 127 + 127 * $opacity * ( $alpha - 127 ) / ( 127 - $minalpha );
339
+ } else {
340
+ $alpha += 127 * $opacity;
341
+ }
342
+
343
+ // get the color index with new alpha
344
+ $alphacolorxy = imagecolorallocatealpha( $image, ( $colorxy >> 16 ) & 0xFF, ( $colorxy >> 8 ) & 0xFF, $colorxy & 0xFF, $alpha );
345
+
346
+ // set pixel with the new color + opacity
347
+ if( ! imagesetpixel( $image, $x, $y, $alphacolorxy ) ) {
348
+ return false;
349
+ }
350
+ }
351
+ }
352
+
353
+ imagesavealpha( $image, true );
354
+
355
+ return $image;
356
+ }
357
+
358
+
359
+ /** Tints the image a different color
360
+ *
361
+ * @supports 3.5.1
362
+ * @access public
363
+ *
364
+ * @param string hex color e.g. #ff00ff
365
+ * @return boolean|WP_Error
366
+ */
367
+ public function colorize( $hexColor ) {
368
+ if ( function_exists( 'imagefilter' ) &&
369
+ function_exists( 'imagesavealpha' ) &&
370
+ function_exists( 'imagealphablending' ) ) {
371
+
372
+ $hexColor = preg_replace( '#^\##', '', $hexColor );
373
+ $r = hexdec( substr( $hexColor, 0, 2 ) );
374
+ $g = hexdec( substr( $hexColor, 2, 2 ) );
375
+ $b = hexdec( substr( $hexColor, 2, 2 ) );
376
+
377
+ imagealphablending( $this->image, false );
378
+ if ( imagefilter( $this->image, IMG_FILTER_COLORIZE, $r, $g, $b, 0 ) ) {
379
+ imagesavealpha( $this->image, true );
380
+ return true;
381
+ }
382
+ }
383
+ return new WP_Error( 'image_colorize_error', __( 'Image color change failed.', 'default' ), $this->file );
384
+ }
385
+
386
+
387
+ /** Makes the image grayscale
388
+ *
389
+ * @supports 3.5.1
390
+ * @access public
391
+ *
392
+ * @return boolean|WP_Error
393
+ */
394
+ public function grayscale() {
395
+ if ( function_exists( 'imagefilter' ) ) {
396
+ if ( imagefilter( $this->image, IMG_FILTER_GRAYSCALE ) ) {
397
+ return true;
398
+ }
399
+ }
400
+ return new WP_Error( 'image_grayscale_error', __( 'Image grayscale failed.', 'default' ), $this->file );
401
+ }
402
+
403
+
404
+ /** Negates the image
405
+ *
406
+ * @supports 3.5.1
407
+ * @access public
408
+ *
409
+ * @return boolean|WP_Error
410
+ */
411
+ public function negate() {
412
+ if ( function_exists( 'imagefilter' ) ) {
413
+ if ( imagefilter( $this->image, IMG_FILTER_NEGATE ) ) {
414
+ return true;
415
+ }
416
+ }
417
+ return new WP_Error( 'image_negate_error', __( 'Image negate failed.', 'default' ), $this->file );
418
+ }
419
+ }
420
+ }
421
+
422
+
423
+ /*
424
+ * Main Class
425
+ */
426
+ if ( ! class_exists( 'BFI_Thumb_1_3' ) ) {
427
+
428
+ BFI_Class_Factory::addClassVersion( 'BFI_Thumb', 'BFI_Thumb_1_3', '1.3' );
429
+
430
+ class BFI_Thumb_1_3 {
431
+
432
+ /** Uses WP's Image Editor Class to resize and filter images
433
+ * Inspired by: https://github.com/sy4mil/Aqua-Resizer/blob/master/aq_resizer.php
434
+ *
435
+ * @param $url string the local image URL to manipulate
436
+ * @param $params array the options to perform on the image. Keys and values supported:
437
+ * 'width' int pixels
438
+ * 'height' int pixels
439
+ * 'opacity' int 0-100
440
+ * 'color' string hex-color #000000-#ffffff
441
+ * 'grayscale' bool
442
+ * 'crop' bool
443
+ * 'negate' bool
444
+ * 'crop_only' bool
445
+ * 'crop_x' bool string
446
+ * 'crop_y' bool string
447
+ * 'crop_width' bool string
448
+ * 'crop_height' bool string
449
+ * 'quality' int 1-100
450
+ * @param $single boolean, if false then an array of data will be returned
451
+ * @return string|array
452
+ */
453
+ public static function thumb( $url, $params = array(), $single = true ) {
454
+ extract( $params );
455
+
456
+ //validate inputs
457
+ if ( ! $url ) {
458
+ return false;
459
+ }
460
+
461
+ $crop_only = isset( $crop_only ) ? $crop_only : false;
462
+
463
+ //define upload path & dir
464
+ $upload_info = wp_upload_dir();
465
+ $upload_dir = $upload_info['basedir'];
466
+ $upload_url = $upload_info['baseurl'];
467
+ $theme_url = get_template_directory_uri();
468
+ $theme_dir = get_template_directory();
469
+
470
+ // find the path of the image. Perform 2 checks:
471
+ // #1 check if the image is in the uploads folder
472
+ if ( strpos( $url, $upload_url ) !== false ) {
473
+ $rel_path = str_replace( $upload_url, '', $url );
474
+ $img_path = $upload_dir . $rel_path;
475
+
476
+ // #2 check if the image is in the current theme folder
477
+ } else if ( strpos( $url, $theme_url ) !== false ) {
478
+ $rel_path = str_replace( $theme_url, '', $url );
479
+ $img_path = $theme_dir . $rel_path;
480
+ }
481
+
482
+ // Fail if we can't find the image in our WP local directory
483
+ if ( empty( $img_path ) ) {
484
+ return $url;
485
+ }
486
+
487
+ // check if img path exists, and is an image indeed
488
+ if( ! @file_exists( $img_path ) || ! getimagesize( $img_path ) ) {
489
+ return $url;
490
+ }
491
+
492
+ // This is the filename
493
+ $basename = basename( $img_path );
494
+
495
+ //get image info
496
+ $info = pathinfo( $img_path );
497
+ $ext = $info['extension'];
498
+ list( $orig_w, $orig_h ) = getimagesize( $img_path );
499
+
500
+ // support percentage dimensions. compute percentage based on
501
+ // the original dimensions
502
+ if ( isset( $width ) ) {
503
+ if ( stripos( $width, '%' ) !== false ) {
504
+ $width = (int) ( (float) str_replace( '%', '', $width ) / 100 * $orig_w );
505
+ }
506
+ }
507
+ if ( isset( $height ) ) {
508
+ if ( stripos( $height, '%' ) !== false ) {
509
+ $height = (int) ( (float) str_replace( '%', '', $height ) / 100 * $orig_h );
510
+ }
511
+ }
512
+ // The only purpose of this is to determine the final width and height
513
+ // without performing any actual image manipulation, which will be used
514
+ // to check whether a resize was previously done.
515
+ if ( isset( $width ) && $crop_only === false ) {
516
+ //get image size after cropping
517
+ $dims = image_resize_dimensions( $orig_w, $orig_h, $width, isset( $height ) ? $height : null, isset( $crop ) ? $crop : false );
518
+ $dst_w = $dims[4];
519
+ $dst_h = $dims[5];
520
+
521
+ } else if ( $crop_only === true ) {
522
+ // we don't want a resize,
523
+ // but only a crop in the image
524
+
525
+ // get x position to start croping
526
+ $src_x = ( isset( $crop_x ) ) ? $crop_x : 0;
527
+
528
+ // get y position to start croping
529
+ $src_y = ( isset( $crop_y ) ) ? $crop_y : 0;
530
+
531
+ // width of the crop
532
+ if ( isset( $crop_width ) ) {
533
+ $src_w = $crop_width;
534
+ } else if ( isset( $width ) ) {
535
+ $src_w = $width;
536
+ } else {
537
+ $src_w = $orig_w;
538
+ }
539
+
540
+ // height of the crop
541
+ if ( isset( $crop_height ) ) {
542
+ $src_h = $crop_height;
543
+ } else if ( isset( $height ) ) {
544
+ $src_h = $height;
545
+ } else {
546
+ $src_h = $orig_h;
547
+ }
548
+
549
+ // set the width resize with the crop
550
+ if ( isset( $crop_width ) && isset( $width ) ) {
551
+ $dst_w = $width;
552
+ } else {
553
+ $dst_w = null;
554
+ }
555
+
556
+ // set the height resize with the crop
557
+ if ( isset( $crop_height ) && isset( $height ) ) {
558
+ $dst_h = $height;
559
+ } else {
560
+ $dst_h = null;
561
+ }
562
+
563
+ // allow percentages
564
+ if ( isset( $dst_w ) ) {
565
+ if ( stripos( $dst_w, '%' ) !== false ) {
566
+ $dst_w = (int) ( (float) str_replace( '%', '', $dst_w ) / 100 * $orig_w );
567
+ }
568
+ }
569
+ if ( isset( $dst_h ) ) {
570
+ if ( stripos( $dst_h, '%' ) !== false ) {
571
+ $dst_h = (int) ( (float) str_replace( '%', '', $dst_h ) / 100 * $orig_h );
572
+ }
573
+ }
574
+
575
+ $dims = image_resize_dimensions( $src_w, $src_h, $dst_w, $dst_h, false );
576
+ $dst_w = $dims[4];
577
+ $dst_h = $dims[5];
578
+
579
+ // Make the pos x and pos y work with percentages
580
+ if ( stripos( $src_x, '%' ) !== false ) {
581
+ $src_x = (int) ( (float) str_replace( '%', '', $width ) / 100 * $orig_w );
582
+ }
583
+ if ( stripos( $src_y, '%' ) !== false ) {
584
+ $src_y = (int) ( (float) str_replace( '%', '', $height ) / 100 * $orig_h );
585
+ }
586
+
587
+ // allow center to position crop start
588
+ if ( $src_x === 'center' ) {
589
+ $src_x = ( $orig_w - $src_w ) / 2;
590
+ }
591
+ if ( $src_y === 'center' ) {
592
+ $src_y = ( $orig_h - $src_h ) / 2;
593
+ }
594
+ }
595
+
596
+ // create the suffix for the saved file
597
+ // we can use this to check whether we need to create a new file or just use an existing one.
598
+ $suffix = (string) filemtime( $img_path ) .
599
+ ( isset( $width ) ? str_pad( (string) $width, 5, '0', STR_PAD_LEFT ) : '00000' ) .
600
+ ( isset( $height ) ? str_pad( (string) $height, 5, '0', STR_PAD_LEFT ) : '00000' ) .
601
+ ( isset( $opacity ) ? str_pad( (string) $opacity, 3, '0', STR_PAD_LEFT ) : '100' ) .
602
+ ( isset( $color ) ? str_pad( preg_replace( '#^\##', '', $color ), 8, '0', STR_PAD_LEFT ) : '00000000' ) .
603
+ ( isset( $grayscale ) ? ( $grayscale ? '1' : '0' ) : '0' ) .
604
+ ( isset( $crop ) ? ( $crop ? '1' : '0' ) : '0' ) .
605
+ ( isset( $negate ) ? ( $negate ? '1' : '0' ) : '0' ) .
606
+ ( isset( $crop_only ) ? ( $crop_only ? '1' : '0' ) : '0' ) .
607
+ ( isset( $src_x ) ? str_pad( (string) $src_x, 5, '0', STR_PAD_LEFT ) : '00000' ) .
608
+ ( isset( $src_y ) ? str_pad( (string) $src_y, 5, '0', STR_PAD_LEFT ) : '00000' ) .
609
+ ( isset( $src_w ) ? str_pad( (string) $src_w, 5, '0', STR_PAD_LEFT ) : '00000' ) .
610
+ ( isset( $src_h ) ? str_pad( (string) $src_h, 5, '0', STR_PAD_LEFT ) : '00000' ) .
611
+ ( isset( $dst_w ) ? str_pad( (string) $dst_w, 5, '0', STR_PAD_LEFT ) : '00000' ) .
612
+ ( isset( $dst_h ) ? str_pad( (string) $dst_h, 5, '0', STR_PAD_LEFT ) : '00000' ) .
613
+ ( ( isset ( $quality ) && $quality > 0 && $quality <= 100 ) ? ( $quality ? (string) $quality : '0' ) : '0' );
614
+ $suffix = self::base_convert_arbitrary( $suffix, 10, 36 );
615
+
616
+ // use this to check if cropped image already exists, so we can return that instead
617
+ $dst_rel_path = str_replace( '.' . $ext, '', basename( $img_path ) );
618
+
619
+ // If opacity is set, change the image type to png
620
+ if ( isset( $opacity ) ) {
621
+ $ext = 'png';
622
+ }
623
+
624
+
625
+ // Create the upload subdirectory, this is where
626
+ // we store all our generated images
627
+ if ( defined( 'BFITHUMB_UPLOAD_DIR' ) ) {
628
+ $upload_dir .= "/" . BFITHUMB_UPLOAD_DIR;
629
+ $upload_url .= "/" . BFITHUMB_UPLOAD_DIR;
630
+ } else {
631
+ $upload_dir .= "/bfi_thumb";
632
+ $upload_url .= "/bfi_thumb";
633
+ }
634
+ if ( ! is_dir( $upload_dir ) ) {
635
+ wp_mkdir_p( $upload_dir );
636
+ }
637
+
638
+
639
+ // desination paths and urls
640
+ $destfilename = "{$upload_dir}/{$dst_rel_path}-{$suffix}.{$ext}";
641
+
642
+ // The urls generated have lower case extensions regardless of the original case
643
+ $ext = strtolower( $ext );
644
+ $img_url = "{$upload_url}/{$dst_rel_path}-{$suffix}.{$ext}";
645
+
646
+ // if file exists, just return it
647
+ if ( @file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
648
+ } else {
649
+ // perform resizing and other filters
650
+ $editor = wp_get_image_editor( $img_path );
651
+
652
+ if ( is_wp_error( $editor ) ) return false;
653
+
654
+ /*
655
+ * Perform image manipulations
656
+ */
657
+ if ( $crop_only === false ) {
658
+ if ( ( isset( $width ) && $width ) || ( isset( $height ) && $height ) ) {
659
+ if ( is_wp_error( $editor->resize( isset( $width ) ? $width : null, isset( $height ) ? $height : null, isset( $crop ) ? $crop : false ) ) ) {
660
+ return false;
661
+ }
662
+ }
663
+ } else {
664
+ if ( is_wp_error( $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h ) ) ) {
665
+ return false;
666
+ }
667
+ }
668
+
669
+ if ( isset( $negate ) ) {
670
+ if ( $negate ) {
671
+ if ( is_wp_error( $editor->negate() ) ) {
672
+ return false;
673
+ }
674
+ }
675
+ }
676
+
677
+ if ( isset( $opacity ) ) {
678
+ if ( is_wp_error( $editor->opacity( $opacity ) ) ) {
679
+ return false;
680
+ }
681
+ }
682
+
683
+ if ( isset( $grayscale ) ) {
684
+ if ( $grayscale ) {
685
+ if ( is_wp_error( $editor->grayscale() ) ) {
686
+ return false;
687
+ }
688
+ }
689
+ }
690
+
691
+ if ( isset( $color ) ) {
692
+ if ( is_wp_error( $editor->colorize( $color ) ) ) {
693
+ return false;
694
+ }
695
+ }
696
+
697
+ // set the image quality (1-100) to save this image at
698
+ if ( isset( $quality ) && $quality > 0 && $quality <= 100 && $ext != 'png' ) {
699
+ $editor->set_quality( $quality );
700
+ }
701
+
702
+ // save our new image
703
+ $mime_type = isset( $opacity ) ? 'image/png' : null;
704
+ $resized_file = $editor->save( $destfilename, $mime_type );
705
+ }
706
+
707
+ //return the output
708
+ if ( $single ) {
709
+ $image = $img_url;
710
+ } else {
711
+ //array return
712
+ $image = array (
713
+ 0 => $img_url,
714
+ 1 => isset( $dst_w ) ? $dst_w : $orig_w,
715
+ 2 => isset( $dst_h ) ? $dst_h : $orig_h,
716
+ );
717
+ }
718
+
719
+ return $image;
720
+ }
721
+
722
+
723
+ /** Shortens a number into a base 36 string
724
+ *
725
+ * @param $number string a string of numbers to convert
726
+ * @param $fromBase starting base
727
+ * @param $toBase base to convert the number to
728
+ * @return string base converted characters
729
+ */
730
+ protected static function base_convert_arbitrary( $number, $fromBase, $toBase ) {
731
+ $digits = '0123456789abcdefghijklmnopqrstuvwxyz';
732
+ $length = strlen( $number );
733
+ $result = '';
734
+
735
+ $nibbles = array();
736
+ for ( $i = 0; $i < $length; ++$i ) {
737
+ $nibbles[ $i ] = strpos( $digits, $number[ $i ] );
738
+ }
739
+
740
+ do {
741
+ $value = 0;
742
+ $newlen = 0;
743
+
744
+ for ( $i = 0; $i < $length; ++$i ) {
745
+
746
+ $value = $value * $fromBase + $nibbles[ $i ];
747
+
748
+ if ( $value >= $toBase ) {
749
+ $nibbles[ $newlen++ ] = (int) ( $value / $toBase );
750
+ $value %= $toBase;
751
+
752
+ } else if ( $newlen > 0 ) {
753
+ $nibbles[ $newlen++ ] = 0;
754
+ }
755
+ }
756
+
757
+ $length = $newlen;
758
+ $result = $digits[ $value ] . $result;
759
+ }
760
+ while ( $newlen != 0 );
761
+
762
+ return $result;
763
+ }
764
+ }
765
+ }
766
+
767
+
768
+
769
+ // don't use the default resizer since we want to allow resizing to larger sizes (than the original one)
770
+ // Parts are copied from media.php
771
+ // Crop is always applied (just like timthumb)
772
+ // Don't use this inside the admin since sometimes images in the media library get resized
773
+ if ( ! is_admin() || (defined( 'DOING_AJAX' ) && DOING_AJAX) ) {
774
+ add_filter( 'image_resize_dimensions', 'bfi_image_resize_dimensions', 10, 5 );
775
+ }
776
+
777
+ if ( ! function_exists( 'bfi_image_resize_dimensions' ) ) {
778
+ function bfi_image_resize_dimensions( $payload, $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
779
+ $aspect_ratio = $orig_w / $orig_h;
780
+ $d_aspect_ratio = $dest_w / $dest_h;
781
+
782
+ $new_w = $dest_w;
783
+ $new_h = $dest_h;
784
+
785
+ if ( ! $new_w ) {
786
+ $new_w = intval( $new_h * $aspect_ratio );
787
+ }
788
+
789
+ if ( ! $new_h ) {
790
+ $new_h = intval( $new_w / $aspect_ratio );
791
+ }
792
+
793
+ $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
794
+
795
+ $crop_w = round( $new_w / $size_ratio );
796
+ $crop_h = round( $new_h / $size_ratio );
797
+ $s_x = floor( ( $orig_w - $crop_w ) / 2 );
798
+ $s_y = floor( ( $orig_h - $crop_h ) / 2 );
799
+
800
+ // the return array matches the parameters to imagecopyresampled()
801
+ // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
802
+ return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
803
+ }
804
+ }
805
+
806
+
807
+ // This function allows us to latch on WP image functions such as
808
+ // the_post_thumbnail, get_image_tag and wp_get_attachment_image_src
809
+ // so that you won't have to use the function bfi_thumb in order to do resizing.
810
+ // To make this work, in the WP image functions, when specifying an
811
+ // array for the image dimensions, add a 'bfi_thumb' => true to
812
+ // the array, then add your normal $params arguments.
813
+ //
814
+ // e.g. the_post_thumbnail( array( 1024, 400, 'bfi_thumb' => true, 'grayscale' => true ) );
815
+ add_filter( 'image_downsize', 'bfi_image_downsize', 1, 3 );
816
+
817
+ if ( ! function_exists( 'bfi_image_downsize' ) ) {
818
+ function bfi_image_downsize( $out, $id, $size ) {
819
+ if ( ! is_array( $size ) ) {
820
+ return false;
821
+ }
822
+ if ( ! array_key_exists( 'bfi_thumb', $size ) ) {
823
+ return false;
824
+ }
825
+ if ( empty( $size['bfi_thumb'] ) ) {
826
+ return false;
827
+ }
828
+
829
+ $img_url = wp_get_attachment_url( $id );
830
+
831
+ $params = $size;
832
+ $params['width'] = $size[0];
833
+ $params['height'] = $size[1];
834
+
835
+ $resized_img_url = bfi_thumb( $img_url, $params );
836
+
837
+ return array( $resized_img_url, $size[0], $size[1], false );
838
+ }
839
+ }
includes/cache/timthumb_int_924fd749b06d87972550ce2462181116.timthumb.txt ADDED
Binary file
includes/cache/timthumb_int_ad6f2bfa65b8bde7a5b2840f7fbc3e8e.timthumb.txt DELETED
Binary file
includes/cache/timthumb_int_c85b341bfdcfa5f2c4847db20d8b52d1.timthumb.txt ADDED
Binary file
includes/cache/timthumb_int_decd49cb06bfb5b66187e1919079ba6d.timthumb.txt ADDED
Binary file
includes/cache/timthumb_int_f12d4dd7b87d24f6c7cfacf3f36a9231.timthumb.txt ADDED
Binary file
includes/search_content.class.php CHANGED
@@ -48,15 +48,15 @@ if (!class_exists('wpdreams_searchContent')) {
48
 
49
  /*----------------------- Title query ---------------------------*/
50
  if ($options['set_intitle']) {
51
- $words = $options['set_exactonly']==1?$s:$_si;
52
  //$parts[] = "(lower($wpdb->posts.post_title) REGEXP '$words')";
53
 
54
- $op = 'OR';
55
- if (count($_s)>0)
56
- $_like = implode("%' ".$op." lower($wpdb->posts.post_title) LIKE '%", $words);
57
- else
58
- $_like = $s;
59
- $parts[] = "( lower($wpdb->posts.post_title) LIKE '%".$_like."%' )";
60
 
61
  $relevance_parts[] = "(case when
62
  (lower($wpdb->posts.post_title) REGEXP '$words')
@@ -69,15 +69,15 @@ if (!class_exists('wpdreams_searchContent')) {
69
 
70
  /*---------------------- Content query --------------------------*/
71
  if ($options['set_incontent']) {
72
- $words = $options['set_exactonly']==1?$s:$_si;
73
  //$parts[] = "(lower($wpdb->posts.post_content) REGEXP '$words')";
74
 
75
- $op = 'OR';
76
- if (count($_s)>0)
77
- $_like = implode("%' ".$op." lower($wpdb->posts.post_content) LIKE '%", $words);
78
- else
79
- $_like = $s;
80
- $parts[] = "( lower($wpdb->posts.post_content) LIKE '%".$_like."%' )";
81
 
82
  $relevance_parts[] = "(case when
83
  (lower($wpdb->posts.post_content) REGEXP '$words')
@@ -90,8 +90,16 @@ if (!class_exists('wpdreams_searchContent')) {
90
 
91
  /*---------------------- Excerpt query --------------------------*/
92
  if ($options['set_inexcerpt']) {
93
- $words = $options['set_exactonly']==1?$s:$_si;
94
- $parts[] = "(lower($wpdb->posts.post_excerpt) REGEXP '$words')";
 
 
 
 
 
 
 
 
95
  $relevance_parts[] = "(case when
96
  (lower($wpdb->posts.post_excerpt) REGEXP '$words')
97
  then 7 else 0 end)";
@@ -103,8 +111,16 @@ if (!class_exists('wpdreams_searchContent')) {
103
 
104
  /*------------------------ Term query ---------------------------*/
105
  if ($options['searchinterms']) {
106
- $words = $options['set_exactonly']==1?$s:$_si;
107
- $parts[] = "(lower($wpdb->terms.name) REGEXP '$words')";
 
 
 
 
 
 
 
 
108
  $relevance_parts[] = "(case when
109
  (lower($wpdb->terms.name) REGEXP '$words')
110
  then 5 else 0 end)";
@@ -198,10 +214,19 @@ if (!class_exists('wpdreams_searchContent')) {
198
  }
199
  /*---------------------------------------------------------------*/
200
 
 
201
  /*------------------------- WPML filter -------------------------*/
202
  $wpml_join = "";
203
- if (defined('ICL_LANGUAGE_CODE') && ICL_LANGUAGE_CODE != '' && w_isset_def($searchData['wpml_compatibility'], 1) == 1)
204
- $wpml_join = "RIGHT JOIN ".$wpdb->base_prefix."icl_translations ON ($wpdb->posts.ID = ".$wpdb->base_prefix."icl_translations.element_id AND ".$wpdb->base_prefix."icl_translations.language_code = '".ICL_LANGUAGE_CODE."')";
 
 
 
 
 
 
 
 
205
  /*---------------------------------------------------------------*/
206
 
207
 
@@ -285,16 +310,27 @@ if (!class_exists('wpdreams_searchContent')) {
285
 
286
  $r->link = get_permalink($v->id);
287
 
288
- $use_timthumb = w_isset_def($caching_options['usetimthumb'], 1);
289
-
290
  $image_settings = $searchData['image_options'];
291
 
292
  if ($image_settings['show_images'] != 0) {
 
293
  $im = $this->getTimThumbImage($r);
294
  if ($im != '' && strpos($im, "mshots/v1") === false)
295
  $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);
296
  else
297
  $r->image = $im;
 
 
 
 
 
 
 
 
 
 
 
 
298
  }
299
 
300
 
@@ -367,9 +403,9 @@ if (!class_exists('wpdreams_searchContent')) {
367
  return $this->results;
368
  }
369
  /**
370
- * Fetches an image for thimthumb class
371
  */
372
- function getTimThumbImage($post) {
373
  if (!isset($post->image) || $post->image == null) {
374
  $home_url = network_home_url();
375
  $home_url = home_url();
48
 
49
  /*----------------------- Title query ---------------------------*/
50
  if ($options['set_intitle']) {
51
+ $words = $options['set_exactonly']==1 ? array($s) : $_s;
52
  //$parts[] = "(lower($wpdb->posts.post_title) REGEXP '$words')";
53
 
54
+ $op = 'OR';
55
+ if (count($_s)>0)
56
+ $_like = implode("%' ".$op." lower($wpdb->posts.post_title) LIKE '%", $words);
57
+ else
58
+ $_like = $s;
59
+ $parts[] = "( lower($wpdb->posts.post_title) LIKE '%".$_like."%' )";
60
 
61
  $relevance_parts[] = "(case when
62
  (lower($wpdb->posts.post_title) REGEXP '$words')
69
 
70
  /*---------------------- Content query --------------------------*/
71
  if ($options['set_incontent']) {
72
+ $words = $options['set_exactonly']==1 ? array($s) : $_s;
73
  //$parts[] = "(lower($wpdb->posts.post_content) REGEXP '$words')";
74
 
75
+ $op = 'OR';
76
+ if (count($_s)>0)
77
+ $_like = implode("%' ".$op." lower($wpdb->posts.post_content) LIKE '%", $words);
78
+ else
79
+ $_like = $s;
80
+ $parts[] = "( lower($wpdb->posts.post_content) LIKE '%".$_like."%' )";
81
 
82
  $relevance_parts[] = "(case when
83
  (lower($wpdb->posts.post_content) REGEXP '$words')
90
 
91
  /*---------------------- Excerpt query --------------------------*/
92
  if ($options['set_inexcerpt']) {
93
+ $words = $options['set_exactonly']==1 ? array($s) : $_s;
94
+ //$parts[] = "(lower($wpdb->posts.post_excerpt) REGEXP '$words')";
95
+
96
+ $op = 'OR';
97
+ if (count($_s)>0)
98
+ $_like = implode("%' ".$op." lower($wpdb->posts.post_excerpt) LIKE '%", $words);
99
+ else
100
+ $_like = $s;
101
+ $parts[] = "( lower($wpdb->posts.post_excerpt) LIKE '%".$_like."%' )";
102
+
103
  $relevance_parts[] = "(case when
104
  (lower($wpdb->posts.post_excerpt) REGEXP '$words')
105
  then 7 else 0 end)";
111
 
112
  /*------------------------ Term query ---------------------------*/
113
  if ($options['searchinterms']) {
114
+ $words = $options['set_exactonly']==1 ? array($s) : $_s;
115
+ //$parts[] = "(lower($wpdb->terms.name) REGEXP '$words')";
116
+
117
+ $op = 'OR';
118
+ if (count($_s)>0)
119
+ $_like = implode("%' ".$op." lower($wpdb->terms.name) LIKE '%", $words);
120
+ else
121
+ $_like = $s;
122
+ $parts[] = "( lower($wpdb->terms.name) LIKE '%".$_like."%' )";
123
+
124
  $relevance_parts[] = "(case when
125
  (lower($wpdb->terms.name) REGEXP '$words')
126
  then 5 else 0 end)";
214
  }
215
  /*---------------------------------------------------------------*/
216
 
217
+
218
  /*------------------------- WPML filter -------------------------*/
219
  $wpml_join = "";
220
+ if (defined('ICL_LANGUAGE_CODE')
221
+ && ICL_LANGUAGE_CODE != ''
222
+ && defined('ICL_SITEPRESS_VERSION')
223
+ && w_isset_def($searchData['wpml_compatibility'], 1) == 1
224
+ )
225
+ $wpml_join = "RIGHT JOIN " . $wpdb->base_prefix . "icl_translations ON (
226
+ $wpdb->posts.ID = " . $wpdb->base_prefix . "icl_translations.element_id AND
227
+ " . $wpdb->base_prefix . "icl_translations.language_code = '" . ICL_LANGUAGE_CODE . "' AND
228
+ " . $wpdb->base_prefix . "icl_translations.element_type LIKE '%post_%'
229
+ )";
230
  /*---------------------------------------------------------------*/
231
 
232
 
310
 
311
  $r->link = get_permalink($v->id);
312
 
 
 
313
  $image_settings = $searchData['image_options'];
314
 
315
  if ($image_settings['show_images'] != 0) {
316
+ /*
317
  $im = $this->getTimThumbImage($r);
318
  if ($im != '' && strpos($im, "mshots/v1") === false)
319
  $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);
320
  else
321
  $r->image = $im;
322
+ */
323
+ $im = $this->getBFIimage($r);
324
+ if ($im != '' && strpos($im, "mshots/v1") === false) {
325
+ if (w_isset_def($image_settings['image_transparency'], 1) == 1)
326
+ $bfi_params = array( 'width' => $image_settings['image_width'], 'height' => $image_settings['image_height'], 'crop' => true );
327
+ else
328
+ $bfi_params = array( 'width' => $image_settings['image_width'], 'height' => $image_settings['image_height'], 'crop' => true, 'color' => wpdreams_rgb2hex($image_settings['image_bg_color']) );
329
+
330
+ $r->image = bfi_thumb( $im, $bfi_params );
331
+ } else {
332
+ $r->image = $im;
333
+ }
334
  }
335
 
336
 
403
  return $this->results;
404
  }
405
  /**
406
+ * Fetches an image for BFI class
407
  */
408
+ function getBFIimage($post) {
409
  if (!isset($post->image) || $post->image == null) {
410
  $home_url = network_home_url();
411
  $home_url = home_url();
includes/timthumb.php DELETED
@@ -1,1266 +0,0 @@
1
- <?php
2
- /**
3
- * TimThumb by Ben Gillbanks and Mark Maunder
4
- * Based on work done by Tim McDaniels and Darren Hoyt
5
- * http://code.google.com/p/timthumb/
6
- *
7
- * GNU General Public License, version 2
8
- * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9
- *
10
- * Examples and documentation available on the project homepage
11
- * http://www.binarymoon.co.uk/projects/timthumb/
12
- *
13
- * $Rev$
14
- */
15
-
16
- /*
17
- * --- TimThumb CONFIGURATION ---
18
- * To edit the configs it is best to create a file called timthumb-config.php
19
- * and define variables you want to customize in there. It will automatically be
20
- * loaded by timthumb. This will save you having to re-edit these variables
21
- * everytime you download a new version
22
- */
23
- define ('VERSION', '2.8.13'); // Version of this script
24
- //Load a config file if it exists. Otherwise, use the values below
25
- if( file_exists(dirname(__FILE__) . '/timthumb-config.php')) require_once('timthumb-config.php');
26
- if(! defined('DEBUG_ON') ) define ('DEBUG_ON', false); // Enable debug logging to web server error log (STDERR)
27
- if(! defined('DEBUG_LEVEL') ) define ('DEBUG_LEVEL', 1); // Debug level 1 is less noisy and 3 is the most noisy
28
- if(! defined('MEMORY_LIMIT') ) define ('MEMORY_LIMIT', '30M'); // Set PHP memory limit
29
- if(! defined('BLOCK_EXTERNAL_LEECHERS') ) define ('BLOCK_EXTERNAL_LEECHERS', false); // If the image or webshot is being loaded on an external site, display a red "No Hotlinking" gif.
30
- if(! defined('DISPLAY_ERROR_MESSAGES') ) define ('DISPLAY_ERROR_MESSAGES', true); // Display error messages. Set to false to turn off errors (good for production websites)
31
- //Image fetching and caching
32
- if(! defined('ALLOW_EXTERNAL') ) define ('ALLOW_EXTERNAL', TRUE); // Allow image fetching from external websites. Will check against ALLOWED_SITES if ALLOW_ALL_EXTERNAL_SITES is false
33
- if(! defined('ALLOW_ALL_EXTERNAL_SITES') ) define ('ALLOW_ALL_EXTERNAL_SITES', TRUE); // Less secure.
34
- if(! defined('FILE_CACHE_ENABLED') ) define ('FILE_CACHE_ENABLED', TRUE); // Should we store resized/modified images on disk to speed things up?
35
- if(! defined('FILE_CACHE_TIME_BETWEEN_CLEANS')) define ('FILE_CACHE_TIME_BETWEEN_CLEANS', 86400); // How often the cache is cleaned
36
-
37
- if(! defined('FILE_CACHE_MAX_FILE_AGE') ) define ('FILE_CACHE_MAX_FILE_AGE', 86400); // How old does a file have to be to be deleted from the cache
38
- if(! defined('FILE_CACHE_SUFFIX') ) define ('FILE_CACHE_SUFFIX', '.timthumb.txt'); // What to put at the end of all files in the cache directory so we can identify them
39
- if(! defined('FILE_CACHE_PREFIX') ) define ('FILE_CACHE_PREFIX', 'timthumb'); // What to put at the beg of all files in the cache directory so we can identify them
40
- if(! defined('FILE_CACHE_DIRECTORY') ) define ('FILE_CACHE_DIRECTORY', './cache'); // Directory where images are cached. Left blank it will use the system temporary directory (which is better for security)
41
- if(! defined('MAX_FILE_SIZE') ) define ('MAX_FILE_SIZE', 10485760); // 10 Megs is 10485760. This is the max internal or external file size that we'll process.
42
- if(! defined('CURL_TIMEOUT') ) define ('CURL_TIMEOUT', 20); // Timeout duration for Curl. This only applies if you have Curl installed and aren't using PHP's default URL fetching mechanism.
43
- if(! defined('WAIT_BETWEEN_FETCH_ERRORS') ) define ('WAIT_BETWEEN_FETCH_ERRORS', 3600); // Time to wait between errors fetching remote file
44
-
45
- //Browser caching
46
- if(! defined('BROWSER_CACHE_MAX_AGE') ) define ('BROWSER_CACHE_MAX_AGE', 864000); // Time to cache in the browser
47
- if(! defined('BROWSER_CACHE_DISABLE') ) define ('BROWSER_CACHE_DISABLE', false); // Use for testing if you want to disable all browser caching
48
-
49
- //Image size and defaults
50
- if(! defined('MAX_WIDTH') ) define ('MAX_WIDTH', 1500); // Maximum image width
51
- if(! defined('MAX_HEIGHT') ) define ('MAX_HEIGHT', 1500); // Maximum image height
52
- if(! defined('NOT_FOUND_IMAGE') ) define ('NOT_FOUND_IMAGE', ''); // Image to serve if any 404 occurs
53
- if(! defined('ERROR_IMAGE') ) define ('ERROR_IMAGE', ''); // Image to serve if an error occurs instead of showing error message
54
- if(! defined('PNG_IS_TRANSPARENT') ) define ('PNG_IS_TRANSPARENT', false); // Define if a png image should have a transparent background color. Use False value if you want to display a custom coloured canvas_colour
55
- if(! defined('DEFAULT_Q') ) define ('DEFAULT_Q', 90); // Default image quality. Allows overrid in timthumb-config.php
56
- if(! defined('DEFAULT_ZC') ) define ('DEFAULT_ZC', 1); // Default zoom/crop setting. Allows overrid in timthumb-config.php
57
- if(! defined('DEFAULT_F') ) define ('DEFAULT_F', ''); // Default image filters. Allows overrid in timthumb-config.php
58
- if(! defined('DEFAULT_S') ) define ('DEFAULT_S', 0); // Default sharpen value. Allows overrid in timthumb-config.php
59
- if(! defined('DEFAULT_CC') ) define ('DEFAULT_CC', 'ffffff'); // Default canvas colour. Allows overrid in timthumb-config.php
60
- if(! defined('DEFAULT_WIDTH') ) define ('DEFAULT_WIDTH', 100); // Default thumbnail width. Allows overrid in timthumb-config.php
61
- if(! defined('DEFAULT_HEIGHT') ) define ('DEFAULT_HEIGHT', 100); // Default thumbnail height. Allows overrid in timthumb-config.php
62
-
63
- /**
64
- * Additional Parameters:
65
- * LOCAL_FILE_BASE_DIRECTORY = Override the DOCUMENT_ROOT. This is best used in timthumb-config.php
66
- */
67
-
68
- //Image compression is enabled if either of these point to valid paths
69
-
70
- //These are now disabled by default because the file sizes of PNGs (and GIFs) are much smaller than we used to generate.
71
- //They only work for PNGs. GIFs and JPEGs are not affected.
72
- if(! defined('OPTIPNG_ENABLED') ) define ('OPTIPNG_ENABLED', false);
73
- if(! defined('OPTIPNG_PATH') ) define ('OPTIPNG_PATH', '/usr/bin/optipng'); //This will run first because it gives better compression than pngcrush.
74
- if(! defined('PNGCRUSH_ENABLED') ) define ('PNGCRUSH_ENABLED', false);
75
- if(! defined('PNGCRUSH_PATH') ) define ('PNGCRUSH_PATH', '/usr/bin/pngcrush'); //This will only run if OPTIPNG_PATH is not set or is not valid
76
-
77
- /*
78
- -------====Website Screenshots configuration - BETA====-------
79
-
80
- If you just want image thumbnails and don't want website screenshots, you can safely leave this as is.
81
-
82
- If you would like to get website screenshots set up, you will need root access to your own server.
83
-
84
- Enable ALLOW_ALL_EXTERNAL_SITES so you can fetch any external web page. This is more secure now that we're using a non-web folder for cache.
85
- Enable BLOCK_EXTERNAL_LEECHERS so that your site doesn't generate thumbnails for the whole Internet.
86
-
87
- Instructions to get website screenshots enabled on Ubuntu Linux:
88
-
89
- 1. Install Xvfb with the following command: sudo apt-get install subversion libqt4-webkit libqt4-dev g++ xvfb
90
- 2. Go to a directory where you can download some code
91
- 3. Check-out the latest version of CutyCapt with the following command: svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
92
- 4. Compile CutyCapt by doing: cd cutycapt/CutyCapt
93
- 5. qmake
94
- 6. make
95
- 7. cp CutyCapt /usr/local/bin/
96
- 8. Test it by running: xvfb-run --server-args="-screen 0, 1024x768x24" CutyCapt --url="http://markmaunder.com/" --out=test.png
97
- 9. If you get a file called test.png with something in it, it probably worked. Now test the script by accessing it as follows:
98
- 10. http://yoursite.com/path/to/timthumb.php?src=http://markmaunder.com/&webshot=1
99
-
100
- Notes on performance:
101
- The first time a webshot loads, it will take a few seconds.
102
- From then on it uses the regular timthumb caching mechanism with the configurable options above
103
- and loading will be very fast.
104
-
105
- --ADVANCED USERS ONLY--
106
- If you'd like a slight speedup (about 25%) and you know Linux, you can run the following command which will keep Xvfb running in the background.
107
- nohup Xvfb :100 -ac -nolisten tcp -screen 0, 1024x768x24 > /dev/null 2>&1 &
108
- Then set WEBSHOT_XVFB_RUNNING = true below. This will save your server having to fire off a new Xvfb server and shut it down every time a new shot is generated.
109
- You will need to take responsibility for keeping Xvfb running in case it crashes. (It seems pretty stable)
110
- You will also need to take responsibility for server security if you're running Xvfb as root.
111
-
112
-
113
- */
114
- if(! defined('WEBSHOT_ENABLED') ) define ('WEBSHOT_ENABLED', false); //Beta feature. Adding webshot=1 to your query string will cause the script to return a browser screenshot rather than try to fetch an image.
115
- if(! defined('WEBSHOT_CUTYCAPT') ) define ('WEBSHOT_CUTYCAPT', '/usr/local/bin/CutyCapt'); //The path to CutyCapt.
116
- if(! defined('WEBSHOT_XVFB') ) define ('WEBSHOT_XVFB', '/usr/bin/xvfb-run'); //The path to the Xvfb server
117
- if(! defined('WEBSHOT_SCREEN_X') ) define ('WEBSHOT_SCREEN_X', '1024'); //1024 works ok
118
- if(! defined('WEBSHOT_SCREEN_Y') ) define ('WEBSHOT_SCREEN_Y', '768'); //768 works ok
119
- if(! defined('WEBSHOT_COLOR_DEPTH') ) define ('WEBSHOT_COLOR_DEPTH', '24'); //I haven't tested anything besides 24
120
- if(! defined('WEBSHOT_IMAGE_FORMAT') ) define ('WEBSHOT_IMAGE_FORMAT', 'png'); //png is about 2.5 times the size of jpg but is a LOT better quality
121
- if(! defined('WEBSHOT_TIMEOUT') ) define ('WEBSHOT_TIMEOUT', '20'); //Seconds to wait for a webshot
122
- if(! defined('WEBSHOT_USER_AGENT') ) define ('WEBSHOT_USER_AGENT', "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18"); //I hate to do this, but a non-browser robot user agent might not show what humans see. So we pretend to be Firefox
123
- if(! defined('WEBSHOT_JAVASCRIPT_ON') ) define ('WEBSHOT_JAVASCRIPT_ON', true); //Setting to false might give you a slight speedup and block ads. But it could cause other issues.
124
- if(! defined('WEBSHOT_JAVA_ON') ) define ('WEBSHOT_JAVA_ON', false); //Have only tested this as fase
125
- if(! defined('WEBSHOT_PLUGINS_ON') ) define ('WEBSHOT_PLUGINS_ON', true); //Enable flash and other plugins
126
- if(! defined('WEBSHOT_PROXY') ) define ('WEBSHOT_PROXY', ''); //In case you're behind a proxy server.
127
- if(! defined('WEBSHOT_XVFB_RUNNING') ) define ('WEBSHOT_XVFB_RUNNING', false); //ADVANCED: Enable this if you've got Xvfb running in the background.
128
-
129
-
130
- // If ALLOW_EXTERNAL is true and ALLOW_ALL_EXTERNAL_SITES is false, then external images will only be fetched from these domains and their subdomains.
131
- if(! isset($ALLOWED_SITES)){
132
- $ALLOWED_SITES = array (
133
- 'flickr.com',
134
- 'staticflickr.com',
135
- 'picasa.com',
136
- 'img.youtube.com',
137
- 'upload.wikimedia.org',
138
- 'photobucket.com',
139
- 'imgur.com',
140
- 'imageshack.us',
141
- 'tinypic.com',
142
- );
143
- }
144
- // -------------------------------------------------------------
145
- // -------------- STOP EDITING CONFIGURATION HERE --------------
146
- // -------------------------------------------------------------
147
-
148
- timthumb::start();
149
-
150
- class timthumb {
151
- protected $src = "";
152
- protected $is404 = false;
153
- protected $docRoot = "";
154
- protected $lastURLError = false;
155
- protected $localImage = "";
156
- protected $localImageMTime = 0;
157
- protected $url = false;
158
- protected $myHost = "";
159
- protected $isURL = false;
160
- protected $cachefile = '';
161
- protected $errors = array();
162
- protected $toDeletes = array();
163
- protected $cacheDirectory = '';
164
- protected $startTime = 0;
165
- protected $lastBenchTime = 0;
166
- protected $cropTop = false;
167
- protected $salt = "";
168
- protected $fileCacheVersion = 1; //Generally if timthumb.php is modifed (upgraded) then the salt changes and all cache files are recreated. This is a backup mechanism to force regen.
169
- protected $filePrependSecurityBlock = "<?php die('Execution denied!'); //"; //Designed to have three letter mime type, space, question mark and greater than symbol appended. 6 bytes total.
170
- protected static $curlDataWritten = 0;
171
- protected static $curlFH = false;
172
- public static function start(){
173
- $tim = new timthumb();
174
- $tim->handleErrors();
175
- $tim->securityChecks();
176
- if($tim->tryBrowserCache()){
177
- exit(0);
178
- }
179
- $tim->handleErrors();
180
- if(FILE_CACHE_ENABLED && $tim->tryServerCache()){
181
- exit(0);
182
- }
183
- $tim->handleErrors();
184
- $tim->run();
185
- $tim->handleErrors();
186
- exit(0);
187
- }
188
- public function __construct(){
189
- global $ALLOWED_SITES;
190
- $this->startTime = microtime(true);
191
- date_default_timezone_set('UTC');
192
- $this->debug(1, "Starting new request from " . $this->getIP() . " to " . $_SERVER['REQUEST_URI']);
193
- $this->calcDocRoot();
194
- //On windows systems I'm assuming fileinode returns an empty string or a number that doesn't change. Check this.
195
- $this->salt = @filemtime(__FILE__) . '-' . @fileinode(__FILE__);
196
- $this->debug(3, "Salt is: " . $this->salt);
197
- if(FILE_CACHE_DIRECTORY){
198
- if(! is_dir(FILE_CACHE_DIRECTORY)){
199
- @mkdir(FILE_CACHE_DIRECTORY);
200
- if(! is_dir(FILE_CACHE_DIRECTORY)){
201
- $this->error("Could not create the file cache directory.");
202
- return false;
203
- }
204
- }
205
- $this->cacheDirectory = FILE_CACHE_DIRECTORY;
206
- if (!touch($this->cacheDirectory . '/index.html')) {
207
- $this->error("Could not create the index.html file - to fix this create an empty file named index.html file in the cache directory.");
208
- }
209
- } else {
210
- $this->cacheDirectory = sys_get_temp_dir();
211
- }
212
- //Clean the cache before we do anything because we don't want the first visitor after FILE_CACHE_TIME_BETWEEN_CLEANS expires to get a stale image.
213
- $this->cleanCache();
214
-
215
- $this->myHost = preg_replace('/^www\./i', '', $_SERVER['HTTP_HOST']);
216
- $this->src = $this->param('src');
217
- $this->url = parse_url($this->src);
218
- $this->src = preg_replace('/https?:\/\/(?:www\.)?' . $this->myHost . '/i', '', $this->src);
219
-
220
- if(strlen($this->src) <= 3){
221
- $this->error("No image specified");
222
- return false;
223
- }
224
- if(BLOCK_EXTERNAL_LEECHERS && array_key_exists('HTTP_REFERER', $_SERVER) && (! preg_match('/^https?:\/\/(?:www\.)?' . $this->myHost . '(?:$|\/)/i', $_SERVER['HTTP_REFERER']))){
225
- // base64 encoded red image that says 'no hotlinkers'
226
- // nothing to worry about! :)
227
- $imgData = base64_decode("R0lGODlhUAAMAIAAAP8AAP///yH5BAAHAP8ALAAAAABQAAwAAAJpjI+py+0Po5y0OgAMjjv01YUZ\nOGplhWXfNa6JCLnWkXplrcBmW+spbwvaVr/cDyg7IoFC2KbYVC2NQ5MQ4ZNao9Ynzjl9ScNYpneb\nDULB3RP6JuPuaGfuuV4fumf8PuvqFyhYtjdoeFgAADs=");
228
- header('Content-Type: image/gif');
229
- header('Content-Length: ' . strlen($imgData));
230
- header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
231
- header("Pragma: no-cache");
232
- header('Expires: ' . gmdate ('D, d M Y H:i:s', time()));
233
- echo $imgData;
234
- return false;
235
- exit(0);
236
- }
237
- if(preg_match('/^https?:\/\/[^\/]+/i', $this->src)){
238
- $this->debug(2, "Is a request for an external URL: " . $this->src);
239
- $this->isURL = true;
240
- } else {
241
- $this->debug(2, "Is a request for an internal file: " . $this->src);
242
- }
243
- if($this->isURL && (! ALLOW_EXTERNAL)){
244
- $this->error("You are not allowed to fetch images from an external website.");
245
- return false;
246
- }
247
- if($this->isURL){
248
- if(ALLOW_ALL_EXTERNAL_SITES){
249
- $this->debug(2, "Fetching from all external sites is enabled.");
250
- } else {
251
- $this->debug(2, "Fetching only from selected external sites is enabled.");
252
- $allowed = false;
253
- foreach($ALLOWED_SITES as $site){
254
- if ((strtolower(substr($this->url['host'],-strlen($site)-1)) === strtolower(".$site")) || (strtolower($this->url['host'])===strtolower($site))) {
255
- $this->debug(3, "URL hostname {$this->url['host']} matches $site so allowing.");
256
- $allowed = true;
257
- }
258
- }
259
- if(! $allowed){
260
- return $this->error("You may not fetch images from that site. To enable this site in timthumb, you can either add it to \$ALLOWED_SITES and set ALLOW_EXTERNAL=true. Or you can set ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs.");
261
- }
262
- }
263
- }
264
-
265
- $cachePrefix = ($this->isURL ? '_ext_' : '_int_');
266
- if($this->isURL){
267
- $arr = explode('&', $_SERVER ['QUERY_STRING']);
268
- asort($arr);
269
- $this->cachefile = $this->cacheDirectory . '/' . FILE_CACHE_PREFIX . $cachePrefix . md5($this->salt . implode('', $arr) . $this->fileCacheVersion) . FILE_CACHE_SUFFIX;
270
- } else {
271
- $this->localImage = $this->getLocalImagePath($this->src);
272
- if(! $this->localImage){
273
- $this->debug(1, "Could not find the local image: {$this->localImage}");
274
- $this->error("Could not find the internal image you specified.");
275
- $this->set404();
276
- return false;
277
- }
278
- $this->debug(1, "Local image path is {$this->localImage}");
279
- $this->localImageMTime = @filemtime($this->localImage);
280
- //We include the mtime of the local file in case in changes on disk.
281
- $this->cachefile = $this->cacheDirectory . '/' . FILE_CACHE_PREFIX . $cachePrefix . md5($this->salt . $this->localImageMTime . $_SERVER ['QUERY_STRING'] . $this->fileCacheVersion) . FILE_CACHE_SUFFIX;
282
- }
283
- $this->debug(2, "Cache file is: " . $this->cachefile);
284
-
285
- return true;
286
- }
287
- public function __destruct(){
288
- foreach($this->toDeletes as $del){
289
- $this->debug(2, "Deleting temp file $del");
290
- @unlink($del);
291
- }
292
- }
293
- public function run(){
294
- if($this->isURL){
295
- if(! ALLOW_EXTERNAL){
296
- $this->debug(1, "Got a request for an external image but ALLOW_EXTERNAL is disabled so returning error msg.");
297
- $this->error("You are not allowed to fetch images from an external website.");
298
- return false;
299
- }
300
- $this->debug(3, "Got request for external image. Starting serveExternalImage.");
301
- if($this->param('webshot')){
302
- if(WEBSHOT_ENABLED){
303
- $this->debug(3, "webshot param is set, so we're going to take a webshot.");
304
- $this->serveWebshot();
305
- } else {
306
- $this->error("You added the webshot parameter but webshots are disabled on this server. You need to set WEBSHOT_ENABLED == true to enable webshots.");
307
- }
308
- } else {
309
- $this->debug(3, "webshot is NOT set so we're going to try to fetch a regular image.");
310
- $this->serveExternalImage();
311
-
312
- }
313
- } else {
314
- $this->debug(3, "Got request for internal image. Starting serveInternalImage()");
315
- $this->serveInternalImage();
316
- }
317
- return true;
318
- }
319
- protected function handleErrors(){
320
- if($this->haveErrors()){
321
- if(NOT_FOUND_IMAGE && $this->is404()){
322
- if($this->serveImg(NOT_FOUND_IMAGE)){
323
- exit(0);
324
- } else {
325
- $this->error("Additionally, the 404 image that is configured could not be found or there was an error serving it.");
326
- }
327
- }
328
- if(ERROR_IMAGE){
329
- if($this->serveImg(ERROR_IMAGE)){
330
- exit(0);
331
- } else {
332
- $this->error("Additionally, the error image that is configured could not be found or there was an error serving it.");
333
- }
334
- }
335
- $this->serveErrors();
336
- exit(0);
337
- }
338
- return false;
339
- }
340
- protected function tryBrowserCache(){
341
- if(BROWSER_CACHE_DISABLE){ $this->debug(3, "Browser caching is disabled"); return false; }
342
- if(!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ){
343
- $this->debug(3, "Got a conditional get");
344
- $mtime = false;
345
- //We've already checked if the real file exists in the constructor
346
- if(! is_file($this->cachefile)){
347
- //If we don't have something cached, regenerate the cached image.
348
- return false;
349
- }
350
- if($this->localImageMTime){
351
- $mtime = $this->localImageMTime;
352
- $this->debug(3, "Local real file's modification time is $mtime");
353
- } else if(is_file($this->cachefile)){ //If it's not a local request then use the mtime of the cached file to determine the 304
354
- $mtime = @filemtime($this->cachefile);
355
- $this->debug(3, "Cached file's modification time is $mtime");
356
- }
357
- if(! $mtime){ return false; }
358
-
359
- $iftime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
360
- $this->debug(3, "The conditional get's if-modified-since unixtime is $iftime");
361
- if($iftime < 1){
362
- $this->debug(3, "Got an invalid conditional get modified since time. Returning false.");
363
- return false;
364
- }
365
- if($iftime < $mtime){ //Real file or cache file has been modified since last request, so force refetch.
366
- $this->debug(3, "File has been modified since last fetch.");
367
- return false;
368
- } else { //Otherwise serve a 304
369
- $this->debug(3, "File has not been modified since last get, so serving a 304.");
370
- header ($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
371
- $this->debug(1, "Returning 304 not modified");
372
- return true;
373
- }
374
- }
375
- return false;
376
- }
377
- protected function tryServerCache(){
378
- $this->debug(3, "Trying server cache");
379
- if(file_exists($this->cachefile)){
380
- $this->debug(3, "Cachefile {$this->cachefile} exists");
381
- if($this->isURL){
382
- $this->debug(3, "This is an external request, so checking if the cachefile is empty which means the request failed previously.");
383
- if(filesize($this->cachefile) < 1){
384
- $this->debug(3, "Found an empty cachefile indicating a failed earlier request. Checking how old it is.");
385
- //Fetching error occured previously
386
- if(time() - @filemtime($this->cachefile) > WAIT_BETWEEN_FETCH_ERRORS){
387
- $this->debug(3, "File is older than " . WAIT_BETWEEN_FETCH_ERRORS . " seconds. Deleting and returning false so app can try and load file.");
388
- @unlink($this->cachefile);
389
- return false; //to indicate we didn't serve from cache and app should try and load
390
- } else {
391
- $this->debug(3, "Empty cachefile is still fresh so returning message saying we had an error fetching this image from remote host.");
392
- $this->set404();
393
- $this->error("An error occured fetching image.");
394
- return false;
395
- }
396
- }
397
- } else {
398
- $this->debug(3, "Trying to serve cachefile {$this->cachefile}");
399
- }
400
- if($this->serveCacheFile()){
401
- $this->debug(3, "Succesfully served cachefile {$this->cachefile}");
402
- return true;
403
- } else {
404
- $this->debug(3, "Failed to serve cachefile {$this->cachefile} - Deleting it from cache.");
405
- //Image serving failed. We can't retry at this point, but lets remove it from cache so the next request recreates it
406
- @unlink($this->cachefile);
407
- return true;
408
- }
409
- }
410
- }
411
- protected function error($err){
412
- $this->debug(3, "Adding error message: $err");
413
- $this->errors[] = $err;
414
- return false;
415
-
416
- }
417
- protected function haveErrors(){
418
- if(sizeof($this->errors) > 0){
419
- return true;
420
- }
421
- return false;
422
- }
423
- protected function serveErrors(){
424
- header ($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
425
- if ( ! DISPLAY_ERROR_MESSAGES ) {
426
- return;
427
- }
428
- $html = '<ul>';
429
- foreach($this->errors as $err){
430
- $html .= '<li>' . htmlentities($err) . '</li>';
431
- }
432
- $html .= '</ul>';
433
- echo '<h1>A TimThumb error has occured</h1>The following error(s) occured:<br />' . $html . '<br />';
434
- echo '<br />Query String : ' . htmlentities( $_SERVER['QUERY_STRING'], ENT_QUOTES );
435
- echo '<br />TimThumb version : ' . VERSION . '</pre>';
436
- }
437
- protected function serveInternalImage(){
438
- $this->debug(3, "Local image path is $this->localImage");
439
- if(! $this->localImage){
440
- $this->sanityFail("localImage not set after verifying it earlier in the code.");
441
- return false;
442
- }
443
- $fileSize = filesize($this->localImage);
444
- if($fileSize > MAX_FILE_SIZE){
445
- $this->error("The file you specified is greater than the maximum allowed file size.");
446
- return false;
447
- }
448
- if($fileSize <= 0){
449
- $this->error("The file you specified is <= 0 bytes.");
450
- return false;
451
- }
452
- $this->debug(3, "Calling processImageAndWriteToCache() for local image.");
453
- if($this->processImageAndWriteToCache($this->localImage)){
454
- $this->serveCacheFile();
455
- return true;
456
- } else {
457
- return false;
458
- }
459
- }
460
- protected function cleanCache(){
461
- if (FILE_CACHE_TIME_BETWEEN_CLEANS < 0) {
462
- return;
463
- }
464
- $this->debug(3, "cleanCache() called");
465
- $lastCleanFile = $this->cacheDirectory . '/timthumb_cacheLastCleanTime.touch';
466
-
467
- //If this is a new timthumb installation we need to create the file
468
- if(! is_file($lastCleanFile)){
469
- $this->debug(1, "File tracking last clean doesn't exist. Creating $lastCleanFile");
470
- if (!touch($lastCleanFile)) {
471
- $this->error("Could not create cache clean timestamp file.");
472
- }
473
- return;
474
- }
475
- if(@filemtime($lastCleanFile) < (time() - FILE_CACHE_TIME_BETWEEN_CLEANS) ){ //Cache was last cleaned more than 1 day ago
476
- $this->debug(1, "Cache was last cleaned more than " . FILE_CACHE_TIME_BETWEEN_CLEANS . " seconds ago. Cleaning now.");
477
- // Very slight race condition here, but worst case we'll have 2 or 3 servers cleaning the cache simultaneously once a day.
478
- if (!touch($lastCleanFile)) {
479
- $this->error("Could not create cache clean timestamp file.");
480
- }
481
- $files = glob($this->cacheDirectory . '/*' . FILE_CACHE_SUFFIX);
482
- if ($files) {
483
- $timeAgo = time() - FILE_CACHE_MAX_FILE_AGE;
484
- foreach($files as $file){
485
- if(@filemtime($file) < $timeAgo){
486
- $this->debug(3, "Deleting cache file $file older than max age: " . FILE_CACHE_MAX_FILE_AGE . " seconds");
487
- @unlink($file);
488
- }
489
- }
490
- }
491
- return true;
492
- } else {
493
- $this->debug(3, "Cache was cleaned less than " . FILE_CACHE_TIME_BETWEEN_CLEANS . " seconds ago so no cleaning needed.");
494
- }
495
- return false;
496
- }
497
- protected function processImageAndWriteToCache($localImage){
498
- $sData = getimagesize($localImage);
499
- $origType = $sData[2];
500
- $mimeType = $sData['mime'];
501
-
502
- $this->debug(3, "Mime type of image is $mimeType");
503
- if(! preg_match('/^image\/(?:gif|jpg|jpeg|png)$/i', $mimeType)){
504
- return $this->error("The image being resized is not a valid gif, jpg or png.");
505
- }
506
-
507
- if (!function_exists ('imagecreatetruecolor')) {
508
- return $this->error('GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library');
509
- }
510
-
511
- if (function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) {
512
- $imageFilters = array (
513
- 1 => array (IMG_FILTER_NEGATE, 0),
514
- 2 => array (IMG_FILTER_GRAYSCALE, 0),
515
- 3 => array (IMG_FILTER_BRIGHTNESS, 1),
516
- 4 => array (IMG_FILTER_CONTRAST, 1),
517
- 5 => array (IMG_FILTER_COLORIZE, 4),
518
- 6 => array (IMG_FILTER_EDGEDETECT, 0),
519
- 7 => array (IMG_FILTER_EMBOSS, 0),
520
- 8 => array (IMG_FILTER_GAUSSIAN_BLUR, 0),
521
- 9 => array (IMG_FILTER_SELECTIVE_BLUR, 0),
522
- 10 => array (IMG_FILTER_MEAN_REMOVAL, 0),
523
- 11 => array (IMG_FILTER_SMOOTH, 0),
524
- );
525
- }
526
-
527
- // get standard input properties
528
- $new_width = (int) abs ($this->param('w', 0));
529
- $new_height = (int) abs ($this->param('h', 0));
530
- $zoom_crop = (int) $this->param('zc', DEFAULT_ZC);
531
- $quality = (int) abs ($this->param('q', DEFAULT_Q));
532
- $align = $this->cropTop ? 't' : $this->param('a', 'c');
533
- $filters = $this->param('f', DEFAULT_F);
534
- $sharpen = (bool) $this->param('s', DEFAULT_S);
535
- $canvas_color = $this->param('cc', DEFAULT_CC);
536
- $canvas_trans = (bool) $this->param('ct', '1');
537
-
538
- // set default width and height if neither are set already
539
- if ($new_width == 0 && $new_height == 0) {
540
- $new_width = (int) DEFAULT_WIDTH;
541
- $new_height = (int) DEFAULT_HEIGHT;
542
- }
543
-
544
- // ensure size limits can not be abused
545
- $new_width = min ($new_width, MAX_WIDTH);
546
- $new_height = min ($new_height, MAX_HEIGHT);
547
-
548
- // set memory limit to be able to have enough space to resize larger images
549
- $this->setMemoryLimit();
550
-
551
- // open the existing image
552
- $image = $this->openImage ($mimeType, $localImage);
553
- if ($image === false) {
554
- return $this->error('Unable to open image.');
555
- }
556
-
557
- // Get original width and height
558
- $width = imagesx ($image);
559
- $height = imagesy ($image);
560
- $origin_x = 0;
561
- $origin_y = 0;
562
-
563
- // generate new w/h if not provided
564
- if ($new_width && !$new_height) {
565
- $new_height = floor ($height * ($new_width / $width));
566
- } else if ($new_height && !$new_width) {
567
- $new_width = floor ($width * ($new_height / $height));
568
- }
569
-
570
- // scale down and add borders
571
- if ($zoom_crop == 3) {
572
-
573
- $final_height = $height * ($new_width / $width);
574
-
575
- if ($final_height > $new_height) {
576
- $new_width = $width * ($new_height / $height);
577
- } else {
578
- $new_height = $final_height;
579
- }
580
-
581
- }
582
-
583
- // create a new true color image
584
- $canvas = imagecreatetruecolor ($new_width, $new_height);
585
- //imagealphablending ($canvas, false);
586
-
587
- if (strlen($canvas_color) == 3) { //if is 3-char notation, edit string into 6-char notation
588
- $canvas_color = str_repeat(substr($canvas_color, 0, 1), 2) . str_repeat(substr($canvas_color, 1, 1), 2) . str_repeat(substr($canvas_color, 2, 1), 2);
589
- } else if (strlen($canvas_color) != 6) {
590
- $canvas_color = DEFAULT_CC; // on error return default canvas color
591
- }
592
-
593
- $canvas_color_R = hexdec (substr ($canvas_color, 0, 2));
594
- $canvas_color_G = hexdec (substr ($canvas_color, 2, 2));
595
- $canvas_color_B = hexdec (substr ($canvas_color, 4, 2));
596
-
597
- //var_dump($canvas_color_R);
598
- // Create a new transparent color for image
599
- // If is a png and PNG_IS_TRANSPARENT is false then remove the alpha transparency
600
- // (and if is set a canvas color show it in the background)
601
- if(preg_match('/^image\/png$/i', $mimeType) && !PNG_IS_TRANSPARENT && $canvas_trans){
602
- $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 127);
603
- }else{
604
- $color = imagecolorallocatealpha ($canvas, $canvas_color_R, $canvas_color_G, $canvas_color_B, 0);
605
- }
606
-
607
-
608
- // Completely fill the background of the new image with allocated color.
609
- imagefill ($canvas, 0, 0, $color);
610
-
611
- // scale down and add borders
612
- if ($zoom_crop == 2) {
613
-
614
- $final_height = $height * ($new_width / $width);
615
-
616
- if ($final_height > $new_height) {
617
-
618
- $origin_x = $new_width / 2;
619
- $new_width = $width * ($new_height / $height);
620
- $origin_x = round ($origin_x - ($new_width / 2));
621
-
622
- } else {
623
-
624
- $origin_y = $new_height / 2;
625
- $new_height = $final_height;
626
- $origin_y = round ($origin_y - ($new_height / 2));
627
-
628
- }
629
-
630
- }
631
-
632
- // Restore transparency blending
633
- imagesavealpha ($canvas, true);
634
-
635
- if ($zoom_crop > 0) {
636
-
637
- $src_x = $src_y = 0;
638
- $src_w = $width;
639
- $src_h = $height;
640
-
641
- $cmp_x = $width / $new_width;
642
- $cmp_y = $height / $new_height;
643
-
644
- // calculate x or y coordinate and width or height of source
645
- if ($cmp_x > $cmp_y) {
646
-
647
- $src_w = round ($width / $cmp_x * $cmp_y);
648
- $src_x = round (($width - ($width / $cmp_x * $cmp_y)) / 2);
649
-
650
- } else if ($cmp_y > $cmp_x) {
651
-
652
- $src_h = round ($height / $cmp_y * $cmp_x);
653
- $src_y = round (($height - ($height / $cmp_y * $cmp_x)) / 2);
654
-
655
- }
656
-
657
- // positional cropping!
658
- if ($align) {
659
- if (strpos ($align, 't') !== false) {
660
- $src_y = 0;
661
- }
662
- if (strpos ($align, 'b') !== false) {
663
- $src_y = $height - $src_h;
664
- }
665
- if (strpos ($align, 'l') !== false) {
666
- $src_x = 0;
667
- }
668
- if (strpos ($align, 'r') !== false) {
669
- $src_x = $width - $src_w;
670
- }
671
- }
672
-
673
- imagecopyresampled ($canvas, $image, $origin_x, $origin_y, $src_x, $src_y, $new_width, $new_height, $src_w, $src_h);
674
-
675
- } else {
676
-
677
- // copy and resize part of an image with resampling
678
- imagecopyresampled ($canvas, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
679
-
680
- }
681
-
682
- if ($filters != '' && function_exists ('imagefilter') && defined ('IMG_FILTER_NEGATE')) {
683
- // apply filters to image
684
- $filterList = explode ('|', $filters);
685
- foreach ($filterList as $fl) {
686
-
687
- $filterSettings = explode (',', $fl);
688
- if (isset ($imageFilters[$filterSettings[0]])) {
689
-
690
- for ($i = 0; $i < 4; $i ++) {
691
- if (!isset ($filterSettings[$i])) {
692
- $filterSettings[$i] = null;
693
- } else {
694
- $filterSettings[$i] = (int) $filterSettings[$i];
695
- }
696
- }
697
-
698
- switch ($imageFilters[$filterSettings[0]][1]) {
699
-
700
- case 1:
701
-
702
- imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1]);
703
- break;
704
-
705
- case 2:
706
-
707
- imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2]);
708
- break;
709
-
710
- case 3:
711
-
712
- imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3]);
713
- break;
714
-
715
- case 4:
716
-
717
- imagefilter ($canvas, $imageFilters[$filterSettings[0]][0], $filterSettings[1], $filterSettings[2], $filterSettings[3], $filterSettings[4]);
718
- break;
719
-
720
- default:
721
-
722
- imagefilter ($canvas, $imageFilters[$filterSettings[0]][0]);
723
- break;
724
-
725
- }
726
- }
727
- }
728
- }
729
-
730
- // sharpen image
731
- if ($sharpen && function_exists ('imageconvolution')) {
732
-
733
- $sharpenMatrix = array (
734
- array (-1,-1,-1),
735
- array (-1,16,-1),
736
- array (-1,-1,-1),
737
- );
738
-
739
- $divisor = 8;
740
- $offset = 0;
741
-
742
- imageconvolution ($canvas, $sharpenMatrix, $divisor, $offset);
743
-
744
- }
745
- //Straight from Wordpress core code. Reduces filesize by up to 70% for PNG's
746
- if ( (IMAGETYPE_PNG == $origType || IMAGETYPE_GIF == $origType) && function_exists('imageistruecolor') && !imageistruecolor( $image ) && imagecolortransparent( $image ) > 0 ){
747
- imagetruecolortopalette( $canvas, false, imagecolorstotal( $image ) );
748
- }
749
-
750
- $imgType = "";
751
- $tempfile = tempnam($this->cacheDirectory, 'timthumb_tmpimg_');
752
- if(preg_match('/^image\/(?:jpg|jpeg)$/i', $mimeType)){
753
- $imgType = 'jpg';
754
- imagejpeg($canvas, $tempfile, $quality);
755
- } else if(preg_match('/^image\/png$/i', $mimeType)){
756
- $imgType = 'png';
757
- //imagejpeg($canvas, $tempfile, $quality);
758
- imagepng($canvas, $tempfile, floor($quality * 0.09));
759
- } else if(preg_match('/^image\/gif$/i', $mimeType)){
760
- $imgType = 'gif';
761
- imagegif($canvas, $tempfile);
762
- } else {
763
- return $this->sanityFail("Could not match mime type after verifying it previously.");
764
- }
765
-
766
- if($imgType == 'png' && OPTIPNG_ENABLED && OPTIPNG_PATH && @is_file(OPTIPNG_PATH)){
767
- $exec = OPTIPNG_PATH;
768
- $this->debug(3, "optipng'ing $tempfile");
769
- $presize = filesize($tempfile);
770
- $out = `$exec -o1 $tempfile`; //you can use up to -o7 but it really slows things down
771
- clearstatcache();
772
- $aftersize = filesize($tempfile);
773
- $sizeDrop = $presize - $aftersize;
774
- if($sizeDrop > 0){
775
- $this->debug(1, "optipng reduced size by $sizeDrop");
776
- } else if($sizeDrop < 0){
777
- $this->debug(1, "optipng increased size! Difference was: $sizeDrop");
778
- } else {
779
- $this->debug(1, "optipng did not change image size.");
780
- }
781
- } else if($imgType == 'png' && PNGCRUSH_ENABLED && PNGCRUSH_PATH && @is_file(PNGCRUSH_PATH)){
782
- $exec = PNGCRUSH_PATH;
783
- $tempfile2 = tempnam($this->cacheDirectory, 'timthumb_tmpimg_');
784
- $this->debug(3, "pngcrush'ing $tempfile to $tempfile2");
785
- $out = `$exec $tempfile $tempfile2`;
786
- $todel = "";
787
- if(is_file($tempfile2)){
788
- $sizeDrop = filesize($tempfile) - filesize($tempfile2);
789
- if($sizeDrop > 0){
790
- $this->debug(1, "pngcrush was succesful and gave a $sizeDrop byte size reduction");
791
- $todel = $tempfile;
792
- $tempfile = $tempfile2;
793
- } else {
794
- $this->debug(1, "pngcrush did not reduce file size. Difference was $sizeDrop bytes.");
795
- $todel = $tempfile2;
796
- }
797
- } else {
798
- $this->debug(3, "pngcrush failed with output: $out");
799
- $todel = $tempfile2;
800
- }
801
- @unlink($todel);
802
- }
803
-
804
- $this->debug(3, "Rewriting image with security header.");
805
- $tempfile4 = tempnam($this->cacheDirectory, 'timthumb_tmpimg_');
806
- $context = stream_context_create ();
807
- $fp = fopen($tempfile,'r',0,$context);
808
- file_put_contents($tempfile4, $this->filePrependSecurityBlock . $imgType . ' ?' . '>'); //6 extra bytes, first 3 being image type
809
- file_put_contents($tempfile4, $fp, FILE_APPEND);
810
- fclose($fp);
811
- @unlink($tempfile);
812
- $this->debug(3, "Locking and replacing cache file.");
813
- $lockFile = $this->cachefile . '.lock';
814
- $fh = fopen($lockFile, 'w');
815
- if(! $fh){
816
- return $this->error("Could not open the lockfile for writing an image.");
817
- }
818
- if(flock($fh, LOCK_EX)){
819
- @unlink($this->cachefile); //rename generally overwrites, but doing this in case of platform specific quirks. File might not exist yet.
820
- rename($tempfile4, $this->cachefile);
821
- flock($fh, LOCK_UN);
822
- fclose($fh);
823
- @unlink($lockFile);
824
- } else {
825
- fclose($fh);
826
- @unlink($lockFile);
827
- @unlink($tempfile4);
828
- return $this->error("Could not get a lock for writing.");
829
- }
830
- $this->debug(3, "Done image replace with security header. Cleaning up and running cleanCache()");
831
- imagedestroy($canvas);
832
- imagedestroy($image);
833
- return true;
834
- }
835
- protected function calcDocRoot(){
836
- $docRoot = @$_SERVER['DOCUMENT_ROOT'];
837
- if (defined('LOCAL_FILE_BASE_DIRECTORY')) {
838
- $docRoot = LOCAL_FILE_BASE_DIRECTORY;
839
- }
840
- if(!isset($docRoot)){
841
- $this->debug(3, "DOCUMENT_ROOT is not set. This is probably windows. Starting search 1.");
842
- if(isset($_SERVER['SCRIPT_FILENAME'])){
843
- $docRoot = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])));
844
- $this->debug(3, "Generated docRoot using SCRIPT_FILENAME and PHP_SELF as: $docRoot");
845
- }
846
- }
847
- if(!isset($docRoot)){
848
- $this->debug(3, "DOCUMENT_ROOT still is not set. Starting search 2.");
849
- if(isset($_SERVER['PATH_TRANSLATED'])){
850
- $docRoot = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
851
- $this->debug(3, "Generated docRoot using PATH_TRANSLATED and PHP_SELF as: $docRoot");
852
- }
853
- }
854
- if($docRoot && $_SERVER['DOCUMENT_ROOT'] != '/'){ $docRoot = preg_replace('/\/$/', '', $docRoot); }
855
- $this->debug(3, "Doc root is: " . $docRoot);
856
- $this->docRoot = $docRoot;
857
-
858
- }
859
- protected function getLocalImagePath($src){
860
- $src = ltrim($src, '/'); //strip off the leading '/'
861
- if(! $this->docRoot){
862
- $this->debug(3, "We have no document root set, so as a last resort, lets check if the image is in the current dir and serve that.");
863
- //We don't support serving images outside the current dir if we don't have a doc root for security reasons.
864
- $file = preg_replace('/^.*?([^\/\\\\]+)$/', '$1', $src); //strip off any path info and just leave the filename.
865
- if(is_file($file)){
866
- return $this->realpath($file);
867
- }
868
- return $this->error("Could not find your website document root and the file specified doesn't exist in timthumbs directory. We don't support serving files outside timthumb's directory without a document root for security reasons.");
869
- } else if ( ! is_dir( $this->docRoot ) ) {
870
- $this->error("Server path does not exist. Ensure variable \$_SERVER['DOCUMENT_ROOT'] is set correctly");
871
- }
872
-
873
- //Do not go past this point without docRoot set
874
-
875
- //Try src under docRoot
876
- if(file_exists ($this->docRoot . '/' . $src)) {
877
- $this->debug(3, "Found file as " . $this->docRoot . '/' . $src);
878
- $real = $this->realpath($this->docRoot . '/' . $src);
879
- if(stripos($real, $this->docRoot) === 0){
880
- return $real;
881
- } else {
882
- $this->debug(1, "Security block: The file specified occurs outside the document root.");
883
- //allow search to continue
884
- }
885
- }
886
- //Check absolute paths and then verify the real path is under doc root
887
- $absolute = $this->realpath('/' . $src);
888
- if($absolute && file_exists($absolute)){ //realpath does file_exists check, so can probably skip the exists check here
889
- $this->debug(3, "Found absolute path: $absolute");
890
- if(! $this->docRoot){ $this->sanityFail("docRoot not set when checking absolute path."); }
891
- if(stripos($absolute, $this->docRoot) === 0){
892
- return $absolute;
893
- } else {
894
- $this->debug(1, "Security block: The file specified occurs outside the document root.");
895
- //and continue search
896
- }
897
- }
898
-
899
- $base = $this->docRoot;
900
-
901
- // account for Windows directory structure
902
- if (strstr($_SERVER['SCRIPT_FILENAME'],':')) {
903
- $sub_directories = explode('\\', str_replace($this->docRoot, '', $_SERVER['SCRIPT_FILENAME']));
904
- } else {
905
- $sub_directories = explode('/', str_replace($this->docRoot, '', $_SERVER['SCRIPT_FILENAME']));
906
- }
907
-
908
- foreach ($sub_directories as $sub){
909
- $base .= $sub . '/';
910
- $this->debug(3, "Trying file as: " . $base . $src);
911
- if(file_exists($base . $src)){
912
- $this->debug(3, "Found file as: " . $base . $src);
913
- $real = $this->realpath($base . $src);
914
- if(stripos($real, $this->realpath($this->docRoot)) === 0){
915
- return $real;
916
- } else {
917
- $this->debug(1, "Security block: The file specified occurs outside the document root.");
918
- //And continue search
919
- }
920
- }
921
- }
922
- return false;
923
- }
924
- protected function realpath($path){
925
- //try to remove any relative paths
926
- $remove_relatives = '/\w+\/\.\.\//';
927
- while(preg_match($remove_relatives,$path)){
928
- $path = preg_replace($remove_relatives, '', $path);
929
- }
930
- //if any remain use PHP realpath to strip them out, otherwise return $path
931
- //if using realpath, any symlinks will also be resolved
932
- return preg_match('#^\.\./|/\.\./#', $path) ? realpath($path) : $path;
933
- }
934
- protected function toDelete($name){
935
- $this->debug(3, "Scheduling file $name to delete on destruct.");
936
- $this->toDeletes[] = $name;
937
- }
938
- protected function serveWebshot(){
939
- $this->debug(3, "Starting serveWebshot");
940
- $instr = "Please follow the instructions at http://code.google.com/p/timthumb/ to set your server up for taking website screenshots.";
941
- if(! is_file(WEBSHOT_CUTYCAPT)){
942
- return $this->error("CutyCapt is not installed. $instr");
943
- }
944
- if(! is_file(WEBSHOT_XVFB)){
945
- return $this->Error("Xvfb is not installed. $instr");
946
- }
947
- $cuty = WEBSHOT_CUTYCAPT;
948
- $xv = WEBSHOT_XVFB;
949
- $screenX = WEBSHOT_SCREEN_X;
950
- $screenY = WEBSHOT_SCREEN_Y;
951
- $colDepth = WEBSHOT_COLOR_DEPTH;
952
- $format = WEBSHOT_IMAGE_FORMAT;
953
- $timeout = WEBSHOT_TIMEOUT * 1000;
954
- $ua = WEBSHOT_USER_AGENT;
955
- $jsOn = WEBSHOT_JAVASCRIPT_ON ? 'on' : 'off';
956
- $javaOn = WEBSHOT_JAVA_ON ? 'on' : 'off';
957
- $pluginsOn = WEBSHOT_PLUGINS_ON ? 'on' : 'off';
958
- $proxy = WEBSHOT_PROXY ? ' --http-proxy=' . WEBSHOT_PROXY : '';
959
- $tempfile = tempnam($this->cacheDirectory, 'timthumb_webshot');
960
- $url = $this->src;
961
- if(! preg_match('/^https?:\/\/[a-zA-Z0-9\.\-]+/i', $url)){
962
- return $this->error("Invalid URL supplied.");
963
- }
964
- $url = preg_replace('/[^A-Za-z0-9\-\.\_\~:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=]+/', '', $url); //RFC 3986
965
- //Very important we don't allow injection of shell commands here. URL is between quotes and we are only allowing through chars allowed by a the RFC
966
- // which AFAIKT can't be used for shell injection.
967
- if(WEBSHOT_XVFB_RUNNING){
968
- putenv('DISPLAY=:100.0');
969
- $command = "$cuty $proxy --max-wait=$timeout --user-agent=\"$ua\" --javascript=$jsOn --java=$javaOn --plugins=$pluginsOn --js-can-open-windows=off --url=\"$url\" --out-format=$format --out=$tempfile";
970
- } else {
971
- $command = "$xv --server-args=\"-screen 0, {$screenX}x{$screenY}x{$colDepth}\" $cuty $proxy --max-wait=$timeout --user-agent=\"$ua\" --javascript=$jsOn --java=$javaOn --plugins=$pluginsOn --js-can-open-windows=off --url=\"$url\" --out-format=$format --out=$tempfile";
972
- }
973
- $this->debug(3, "Executing command: $command");
974
- $out = `$command`;
975
- $this->debug(3, "Received output: $out");
976
- if(! is_file($tempfile)){
977
- $this->set404();
978
- return $this->error("The command to create a thumbnail failed.");
979
- }
980
- $this->cropTop = true;
981
- if($this->processImageAndWriteToCache($tempfile)){
982
- $this->debug(3, "Image processed succesfully. Serving from cache");
983
- return $this->serveCacheFile();
984
- } else {
985
- return false;
986
- }
987
- }
988
- protected function serveExternalImage(){
989
- if(! preg_match('/^https?:\/\/[a-zA-Z0-9\-\.]+/i', $this->src)){
990
- $this->error("Invalid URL supplied.");
991
- return false;
992
- }
993
- $tempfile = tempnam($this->cacheDirectory, 'timthumb');
994
- $this->debug(3, "Fetching external image into temporary file $tempfile");
995
- $this->toDelete($tempfile);
996
- #fetch file here
997
- if(! $this->getURL($this->src, $tempfile)){
998
- @unlink($this->cachefile);
999
- touch($this->cachefile);
1000
- $this->debug(3, "Error fetching URL: " . $this->lastURLError);
1001
- $this->error("Error reading the URL you specified from remote host." . $this->lastURLError);
1002
- return false;
1003
- }
1004
-
1005
- $mimeType = $this->getMimeType($tempfile);
1006
- if(! preg_match("/^image\/(?:jpg|jpeg|gif|png)$/i", $mimeType)){
1007
- $this->debug(3, "Remote file has invalid mime type: $mimeType");
1008
- @unlink($this->cachefile);
1009
- touch($this->cachefile);
1010
- $this->error("The remote file is not a valid image. Mimetype = '" . $mimeType . "'" . $tempfile);
1011
- return false;
1012
- }
1013
- if($this->processImageAndWriteToCache($tempfile)){
1014
- $this->debug(3, "Image processed succesfully. Serving from cache");
1015
- return $this->serveCacheFile();
1016
- } else {
1017
- return false;
1018
- }
1019
- }
1020
- public static function curlWrite($h, $d){
1021
- fwrite(self::$curlFH, $d);
1022
- self::$curlDataWritten += strlen($d);
1023
- if(self::$curlDataWritten > MAX_FILE_SIZE){
1024
- return 0;
1025
- } else {
1026
- return strlen($d);
1027
- }
1028
- }
1029
- protected function serveCacheFile(){
1030
- $this->debug(3, "Serving {$this->cachefile}");
1031
- if(! is_file($this->cachefile)){
1032
- $this->error("serveCacheFile called in timthumb but we couldn't find the cached file.");
1033
- return false;
1034
- }
1035
- $fp = fopen($this->cachefile, 'rb');
1036
- if(! $fp){ return $this->error("Could not open cachefile."); }
1037
- fseek($fp, strlen($this->filePrependSecurityBlock), SEEK_SET);
1038
- $imgType = fread($fp, 3);
1039
- fseek($fp, 3, SEEK_CUR);
1040
- if(ftell($fp) != strlen($this->filePrependSecurityBlock) + 6){
1041
- @unlink($this->cachefile);
1042
- return $this->error("The cached image file seems to be corrupt.");
1043
- }
1044
- $imageDataSize = filesize($this->cachefile) - (strlen($this->filePrependSecurityBlock) + 6);
1045
- $this->sendImageHeaders($imgType, $imageDataSize);
1046
- $bytesSent = @fpassthru($fp);
1047
- fclose($fp);
1048
- if($bytesSent > 0){
1049
- return true;
1050
- }
1051
- $content = file_get_contents ($this->cachefile);
1052
- if ($content != FALSE) {
1053
- $content = substr($content, strlen($this->filePrependSecurityBlock) + 6);
1054
- echo $content;
1055
- $this->debug(3, "Served using file_get_contents and echo");
1056
- return true;
1057
- } else {
1058
- $this->error("Cache file could not be loaded.");
1059
- return false;
1060
- }
1061
- }
1062
- protected function sendImageHeaders($mimeType, $dataSize){
1063
- if(! preg_match('/^image\//i', $mimeType)){
1064
- $mimeType = 'image/' . $mimeType;
1065
- }
1066
- if(strtolower($mimeType) == 'image/jpg'){
1067
- $mimeType = 'image/jpeg';
1068
- }
1069
- $gmdate_expires = gmdate ('D, d M Y H:i:s', strtotime ('now +10 days')) . ' GMT';
1070
- $gmdate_modified = gmdate ('D, d M Y H:i:s') . ' GMT';
1071
- // send content headers then display image
1072
- header ('Content-Type: ' . $mimeType);
1073
- header ('Accept-Ranges: none'); //Changed this because we don't accept range requests
1074
- header ('Last-Modified: ' . $gmdate_modified);
1075
- header ('Content-Length: ' . $dataSize);
1076
- if(BROWSER_CACHE_DISABLE){
1077
- $this->debug(3, "Browser cache is disabled so setting non-caching headers.");
1078
- header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
1079
- header("Pragma: no-cache");
1080
- header('Expires: ' . gmdate ('D, d M Y H:i:s', time()));
1081
- } else {
1082
- $this->debug(3, "Browser caching is enabled");
1083
- header('Cache-Control: max-age=' . BROWSER_CACHE_MAX_AGE . ', must-revalidate');
1084
- header('Expires: ' . $gmdate_expires);
1085
- }
1086
- return true;
1087
- }
1088
- protected function securityChecks(){
1089
- }
1090
- protected function param($property, $default = ''){
1091
- if (isset ($_GET[$property])) {
1092
- return $_GET[$property];
1093
- } else {
1094
- return $default;
1095
- }
1096
- }
1097
- protected function openImage($mimeType, $src){
1098
- switch ($mimeType) {
1099
- case 'image/jpeg':
1100
- $image = imagecreatefromjpeg ($src);
1101
- break;
1102
-
1103
- case 'image/png':
1104
- $image = imagecreatefrompng ($src);
1105
- imagealphablending( $image, true );
1106
- imagesavealpha( $image, true );
1107
- break;
1108
-
1109
- case 'image/gif':
1110
- $image = imagecreatefromgif ($src);
1111
- break;
1112
-
1113
- default:
1114
- $this->error("Unrecognised mimeType");
1115
- }
1116
-
1117
- return $image;
1118
- }
1119
- protected function getIP(){
1120
- $rem = @$_SERVER["REMOTE_ADDR"];
1121
- $ff = @$_SERVER["HTTP_X_FORWARDED_FOR"];
1122
- $ci = @$_SERVER["HTTP_CLIENT_IP"];
1123
- if(preg_match('/^(?:192\.168|172\.16|10\.|127\.)/', $rem)){
1124
- if($ff){ return $ff; }
1125
- if($ci){ return $ci; }
1126
- return $rem;
1127
- } else {
1128
- if($rem){ return $rem; }
1129
- if($ff){ return $ff; }
1130
- if($ci){ return $ci; }
1131
- return "UNKNOWN";
1132
- }
1133
- }
1134
- protected function debug($level, $msg){
1135
- if(DEBUG_ON && $level <= DEBUG_LEVEL){
1136
- $execTime = sprintf('%.6f', microtime(true) - $this->startTime);
1137
- $tick = sprintf('%.6f', 0);
1138
- if($this->lastBenchTime > 0){
1139
- $tick = sprintf('%.6f', microtime(true) - $this->lastBenchTime);
1140
- }
1141
- $this->lastBenchTime = microtime(true);
1142
- error_log("TimThumb Debug line " . __LINE__ . " [$execTime : $tick]: $msg");
1143
- }
1144
- }
1145
- protected function sanityFail($msg){
1146
- return $this->error("There is a problem in the timthumb code. Message: Please report this error at <a href='http://code.google.com/p/timthumb/issues/list'>timthumb's bug tracking page</a>: $msg");
1147
- }
1148
- protected function getMimeType($file){
1149
- $info = getimagesize($file);
1150
- if(is_array($info) && $info['mime']){
1151
- return $info['mime'];
1152
- }
1153
- return '';
1154
- }
1155
- protected function setMemoryLimit(){
1156
- $inimem = ini_get('memory_limit');
1157
- $inibytes = timthumb::returnBytes($inimem);
1158
- $ourbytes = timthumb::returnBytes(MEMORY_LIMIT);
1159
- if($inibytes < $ourbytes){
1160
- ini_set ('memory_limit', MEMORY_LIMIT);
1161
- $this->debug(3, "Increased memory from $inimem to " . MEMORY_LIMIT);
1162
- } else {
1163
- $this->debug(3, "Not adjusting memory size because the current setting is " . $inimem . " and our size of " . MEMORY_LIMIT . " is smaller.");
1164
- }
1165
- }
1166
- protected static function returnBytes($size_str){
1167
- switch (substr ($size_str, -1))
1168
- {
1169
- case 'M': case 'm': return (int)$size_str * 1048576;
1170
- case 'K': case 'k': return (int)$size_str * 1024;
1171
- case 'G': case 'g': return (int)$size_str * 1073741824;
1172
- default: return $size_str;
1173
- }
1174
- }
1175
-
1176
- protected function getURL($url, $tempfile){
1177
- $this->lastURLError = false;
1178
- $url = preg_replace('/ /', '%20', $url);
1179
- if(function_exists('curl_init')){
1180
- $this->debug(3, "Curl is installed so using it to fetch URL.");
1181
- self::$curlFH = fopen($tempfile, 'w');
1182
- if(! self::$curlFH){
1183
- $this->error("Could not open $tempfile for writing.");
1184
- return false;
1185
- }
1186
- self::$curlDataWritten = 0;
1187
- $this->debug(3, "Fetching url with curl: $url");
1188
- $curl = curl_init($url);
1189
- curl_setopt ($curl, CURLOPT_TIMEOUT, CURL_TIMEOUT);
1190
- curl_setopt ($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30");
1191
- curl_setopt ($curl, CURLOPT_RETURNTRANSFER, TRUE);
1192
- curl_setopt ($curl, CURLOPT_HEADER, 0);
1193
- curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
1194
- curl_setopt ($curl, CURLOPT_WRITEFUNCTION, 'timthumb::curlWrite');
1195
- @curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, true);
1196
- @curl_setopt ($curl, CURLOPT_MAXREDIRS, 10);
1197
-
1198
- $curlResult = curl_exec($curl);
1199
- fclose(self::$curlFH);
1200
- $httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
1201
- if($httpStatus == 404){
1202
- $this->set404();
1203
- }
1204
- if($httpStatus == 302){
1205
- $this->error("External Image is Redirecting. Try alternate image url");
1206
- return false;
1207
- }
1208
- if($curlResult){
1209
- curl_close($curl);
1210
- return true;
1211
- } else {
1212
- $this->lastURLError = curl_error($curl);
1213
- curl_close($curl);
1214
- return false;
1215
- }
1216
- } else {
1217
- $img = @file_get_contents ($url);
1218
- if($img === false){
1219
- $err = error_get_last();
1220
- if(is_array($err) && $err['message']){
1221
- $this->lastURLError = $err['message'];
1222
- } else {
1223
- $this->lastURLError = $err;
1224
- }
1225
- if(preg_match('/404/', $this->lastURLError)){
1226
- $this->set404();
1227
- }
1228
-
1229
- return false;
1230
- }
1231
- if(! file_put_contents($tempfile, $img)){
1232
- $this->error("Could not write to $tempfile.");
1233
- return false;
1234
- }
1235
- return true;
1236
- }
1237
-
1238
- }
1239
- protected function serveImg($file){
1240
- $s = getimagesize($file);
1241
- if(! ($s && $s['mime'])){
1242
- return false;
1243
- }
1244
- header ('Content-Type: ' . $s['mime']);
1245
- header ('Content-Length: ' . filesize($file) );
1246
- header ('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
1247
- header ("Pragma: no-cache");
1248
- $bytes = @readfile($file);
1249
- if($bytes > 0){
1250
- return true;
1251
- }
1252
- $content = @file_get_contents ($file);
1253
- if ($content != FALSE){
1254
- echo $content;
1255
- return true;
1256
- }
1257
- return false;
1258
-
1259
- }
1260
- protected function set404(){
1261
- $this->is404 = true;
1262
- }
1263
- protected function is404(){
1264
- return $this->is404;
1265
- }
1266
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
languages/ajax-search-lite-en_EN.mo ADDED
Binary file
languages/ajax-search-lite-en_EN.po ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Ajax Search Lite\n"
4
+ "POT-Creation-Date: 2014-12-10 20:42+0100\n"
5
+ "PO-Revision-Date: 2014-12-10 20:42+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: en\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.1\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+ "X-Poedit-SearchPathExcluded-0: ../js\n"
18
+ "X-Poedit-SearchPathExcluded-1: ../backend/settings/assets\n"
19
+
20
+ #: ../backend/analytics.php:7
21
+ msgid "Enable search Google Analytics integration?"
22
+ msgstr ""
23
+
24
+ #: ../backend/analytics.php:12
25
+ msgid "Google analytics pageview string"
26
+ msgstr ""
27
+
28
+ #: ../backend/analytics.php:16
29
+ msgid ""
30
+ "This is how the pageview will look like on the google analytics website. Use "
31
+ "the {asl_term} variable to add the search term to the pageview."
32
+ msgstr ""
33
+
34
+ #: ../backend/analytics.php:40
35
+ msgid "Analytics options"
36
+ msgstr ""
37
+
38
+ #: ../backend/analytics.php:45
39
+ msgid "Result"
40
+ msgstr ""
41
+
42
+ #: ../backend/analytics.php:47
43
+ msgid ""
44
+ "After some time you should be able to see the hits on your analytics board."
45
+ msgstr ""
46
+
47
+ #: ../backend/settings.php:44
48
+ msgid "Search shortcode:"
49
+ msgstr ""
50
+
51
+ #: ../backend/settings.php:47
52
+ msgid "Search shortcode for templates:"
53
+ msgstr ""
54
+
55
+ #: ../backend/settings.php:58
56
+ msgid "General Options"
57
+ msgstr ""
58
+
59
+ #: ../backend/settings.php:59 ../backend/settings.php:75
60
+ msgid "Image Options"
61
+ msgstr ""
62
+
63
+ #: ../backend/settings.php:60
64
+ msgid "Frontend Options"
65
+ msgstr ""
66
+
67
+ #: ../backend/settings.php:61
68
+ msgid "Layout options"
69
+ msgstr ""
70
+
71
+ #: ../backend/settings.php:62
72
+ msgid "Advanced"
73
+ msgstr ""
74
+
75
+ #: ../backend/settings.php:67
76
+ msgid "Genearal Options"
77
+ msgstr ""
78
+
79
+ #: ../backend/settings.php:83
80
+ msgid "Frontend Search Settings"
81
+ msgstr ""
82
+
83
+ #: ../backend/settings.php:91
84
+ msgid "Layout Options"
85
+ msgstr ""
86
+
87
+ #: ../backend/settings.php:99
88
+ msgid "Advanced Options"
89
+ msgstr ""
90
+
91
+ #: ../backend/settings.php:119
92
+ msgid "Ajax Search Lite settings saved!"
93
+ msgstr ""
94
+
95
+ #: ../backend/settings/class/customfields.class.php:22
96
+ msgid "Available public custom fields types"
97
+ msgstr ""
98
+
99
+ #: ../backend/settings/class/customfields.class.php:31
100
+ msgid "Drag here the custom fields you want to use!"
101
+ msgstr ""
102
+
103
+ #: ../backend/settings/class/customposttypes.class.php:23
104
+ msgid "Available post types"
105
+ msgstr ""
106
+
107
+ #: ../backend/settings/class/customposttypes.class.php:32
108
+ msgid "Drag here the post types you want to use!"
109
+ msgstr ""
110
+
111
+ #: ../backend/tabs/instance/advanced_options.php:3
112
+ msgid "Title Field"
113
+ msgstr ""
114
+
115
+ #: ../backend/tabs/instance/advanced_options.php:12
116
+ msgid "Description Field"
117
+ msgstr ""
118
+
119
+ #: ../backend/tabs/instance/advanced_options.php:21
120
+ msgid "Exclude categories"
121
+ msgstr ""
122
+
123
+ #: ../backend/tabs/instance/advanced_options.php:28
124
+ msgid "Exclude Posts by ID's (comma separated post ID-s)"
125
+ msgstr ""
126
+
127
+ #: ../backend/tabs/instance/advanced_options.php:34
128
+ msgid "WPML compatibility"
129
+ msgstr ""
130
+
131
+ #: ../backend/tabs/instance/frontend_options.php:3
132
+ msgid "Show search settings on the frontend?"
133
+ msgstr ""
134
+
135
+ #: ../backend/tabs/instance/frontend_options.php:8
136
+ msgid ""
137
+ "The default values of the checkboxes on the frontend are the values set "
138
+ "above."
139
+ msgstr ""
140
+
141
+ #: ../backend/tabs/instance/frontend_options.php:12
142
+ msgid "Show exact matches selector?"
143
+ msgstr ""
144
+
145
+ #: ../backend/tabs/instance/frontend_options.php:20
146
+ msgid "Show search in posts selector?"
147
+ msgstr ""
148
+
149
+ #: ../backend/tabs/instance/frontend_options.php:27
150
+ msgid "Show search in pages selector?"
151
+ msgstr ""
152
+
153
+ #: ../backend/tabs/instance/frontend_options.php:34
154
+ msgid "Show search in title selector?"
155
+ msgstr ""
156
+
157
+ #: ../backend/tabs/instance/frontend_options.php:41
158
+ msgid "Show search in content selector?"
159
+ msgstr ""
160
+
161
+ #: ../backend/tabs/instance/frontend_options.php:47
162
+ msgid "Show search in custom post types selectors"
163
+ msgstr ""
164
+
165
+ #: ../backend/tabs/instance/frontend_options.php:52
166
+ msgid ""
167
+ "Nor recommended if you have more than 500 categories! (the HTML output will "
168
+ "get too big)"
169
+ msgstr ""
170
+
171
+ #: ../backend/tabs/instance/frontend_options.php:54
172
+ msgid "Show the categories selectors?"
173
+ msgstr ""
174
+
175
+ #: ../backend/tabs/instance/frontend_options.php:59
176
+ msgid "Show the uncategorised category?"
177
+ msgstr ""
178
+
179
+ #: ../backend/tabs/instance/frontend_options.php:63
180
+ msgid "Select which categories exclude"
181
+ msgstr ""
182
+
183
+ #: ../backend/tabs/instance/frontend_options.php:70
184
+ msgid "Categories filter box header text"
185
+ msgstr ""
186
+
187
+ #: ../backend/tabs/instance/frontend_options.php:76
188
+ #: ../backend/tabs/instance/general_options.php:130
189
+ #: ../backend/tabs/instance/image_options.php:106
190
+ #: ../backend/tabs/instance/layout_options.php:21
191
+ msgid "Save options!"
192
+ msgstr ""
193
+
194
+ #: ../backend/tabs/instance/general_options.php:12
195
+ msgid "Theme"
196
+ msgstr ""
197
+
198
+ #: ../backend/tabs/instance/general_options.php:21
199
+ msgid "Search in posts?"
200
+ msgstr ""
201
+
202
+ #: ../backend/tabs/instance/general_options.php:28
203
+ msgid "Search in pages?"
204
+ msgstr ""
205
+
206
+ #: ../backend/tabs/instance/general_options.php:34
207
+ msgid "Search in custom post types"
208
+ msgstr ""
209
+
210
+ #: ../backend/tabs/instance/general_options.php:41
211
+ msgid "Search in title?"
212
+ msgstr ""
213
+
214
+ #: ../backend/tabs/instance/general_options.php:48
215
+ msgid "Search in content?"
216
+ msgstr ""
217
+
218
+ #: ../backend/tabs/instance/general_options.php:55
219
+ msgid "Search in post excerpts?"
220
+ msgstr ""
221
+
222
+ #: ../backend/tabs/instance/general_options.php:61
223
+ msgid "Search in custom fields"
224
+ msgstr ""
225
+
226
+ #: ../backend/tabs/instance/general_options.php:69
227
+ msgid "Show exact matches only?"
228
+ msgstr ""
229
+
230
+ #: ../backend/tabs/instance/general_options.php:76
231
+ msgid "Search in terms? (categories, tags)"
232
+ msgstr ""
233
+
234
+ #: ../backend/tabs/instance/general_options.php:82
235
+ msgid "Result ordering"
236
+ msgstr ""
237
+
238
+ #: ../backend/tabs/instance/general_options.php:91
239
+ msgid "Trigger search when clicking on search icon?"
240
+ msgstr ""
241
+
242
+ #: ../backend/tabs/instance/general_options.php:98
243
+ msgid "Redirect to search results page when clicking on search icon?"
244
+ msgstr ""
245
+
246
+ #: ../backend/tabs/instance/general_options.php:105
247
+ msgid "Trigger search when typing?"
248
+ msgstr ""
249
+
250
+ #: ../backend/tabs/instance/general_options.php:112
251
+ msgid "Minimal character count to trigger search"
252
+ msgstr ""
253
+
254
+ #: ../backend/tabs/instance/general_options.php:119
255
+ msgid "Max. results"
256
+ msgstr ""
257
+
258
+ #: ../backend/tabs/instance/general_options.php:124
259
+ msgid "Results box viewport (in item numbers)"
260
+ msgstr ""
261
+
262
+ #: ../backend/tabs/instance/image_options.php:4
263
+ msgid "Show images in results?"
264
+ msgstr ""
265
+
266
+ #: ../backend/tabs/instance/image_options.php:13
267
+ msgid "Image width"
268
+ msgstr ""
269
+
270
+ #: ../backend/tabs/instance/image_options.php:22
271
+ msgid "Image height"
272
+ msgstr ""
273
+
274
+ #: ../backend/tabs/instance/image_options.php:33
275
+ msgid "Primary image source"
276
+ msgstr ""
277
+
278
+ #: ../backend/tabs/instance/image_options.php:44
279
+ msgid "Alternative image source 1"
280
+ msgstr ""
281
+
282
+ #: ../backend/tabs/instance/image_options.php:55
283
+ msgid "Alternative image source 2"
284
+ msgstr ""
285
+
286
+ #: ../backend/tabs/instance/image_options.php:66
287
+ msgid "Alternative image source 3"
288
+ msgstr ""
289
+
290
+ #: ../backend/tabs/instance/image_options.php:77
291
+ msgid "Alternative image source 4"
292
+ msgstr ""
293
+
294
+ #: ../backend/tabs/instance/image_options.php:88
295
+ msgid "Default image url"
296
+ msgstr ""
297
+
298
+ #: ../backend/tabs/instance/image_options.php:97
299
+ msgid "Custom field containing the image"
300
+ msgstr ""
301
+
302
+ #: ../backend/tabs/instance/layout_options.php:2
303
+ #: ../backend/tabs/instance/layout_options.php:8
304
+ msgid "Results layout"
305
+ msgstr ""
306
+
307
+ #: ../backend/tabs/instance/layout_options.php:3
308
+ #: ../backend/tabs/instance/layout_options.php:14
309
+ msgid "Results Behaviour"
310
+ msgstr ""
311
+
312
+ #: ../includes/asl_init.class.php:12 ../includes/asl_init.class.php:13
313
+ #: ../includes/asl_init.class.php:22
314
+ msgid "Ajax Search Lite"
315
+ msgstr ""
316
+
317
+ #: ../includes/asl_init.class.php:23
318
+ msgid "Analytics Integration"
319
+ msgstr ""
languages/ajax-search-lite-en_EN.pot ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Ajax Search Lite\n"
4
+ "POT-Creation-Date: 2014-12-10 21:19+0100\n"
5
+ "PO-Revision-Date: 2014-12-10 21:20+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: en\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.1\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+ "X-Poedit-SearchPathExcluded-0: ../js\n"
18
+ "X-Poedit-SearchPathExcluded-1: ../backend/settings/assets\n"
19
+
20
+ #: ../backend/analytics.php:7
21
+ msgid "Enable search Google Analytics integration?"
22
+ msgstr ""
23
+
24
+ #: ../backend/analytics.php:12
25
+ msgid "Google analytics pageview string"
26
+ msgstr ""
27
+
28
+ #: ../backend/analytics.php:16
29
+ msgid ""
30
+ "This is how the pageview will look like on the google analytics website. Use "
31
+ "the {asl_term} variable to add the search term to the pageview."
32
+ msgstr ""
33
+
34
+ #: ../backend/analytics.php:40
35
+ msgid "Analytics options"
36
+ msgstr ""
37
+
38
+ #: ../backend/analytics.php:45
39
+ msgid "Result"
40
+ msgstr ""
41
+
42
+ #: ../backend/analytics.php:47
43
+ msgid ""
44
+ "After some time you should be able to see the hits on your analytics board."
45
+ msgstr ""
46
+
47
+ #: ../backend/settings.php:44
48
+ msgid "Search shortcode:"
49
+ msgstr ""
50
+
51
+ #: ../backend/settings.php:47
52
+ msgid "Search shortcode for templates:"
53
+ msgstr ""
54
+
55
+ #: ../backend/settings.php:58
56
+ msgid "General Options"
57
+ msgstr ""
58
+
59
+ #: ../backend/settings.php:59 ../backend/settings.php:75
60
+ msgid "Image Options"
61
+ msgstr ""
62
+
63
+ #: ../backend/settings.php:60
64
+ msgid "Frontend Options"
65
+ msgstr ""
66
+
67
+ #: ../backend/settings.php:61
68
+ msgid "Layout options"
69
+ msgstr ""
70
+
71
+ #: ../backend/settings.php:62
72
+ msgid "Advanced"
73
+ msgstr ""
74
+
75
+ #: ../backend/settings.php:67
76
+ msgid "Genearal Options"
77
+ msgstr ""
78
+
79
+ #: ../backend/settings.php:83
80
+ msgid "Frontend Search Settings"
81
+ msgstr ""
82
+
83
+ #: ../backend/settings.php:91
84
+ msgid "Layout Options"
85
+ msgstr ""
86
+
87
+ #: ../backend/settings.php:99
88
+ msgid "Advanced Options"
89
+ msgstr ""
90
+
91
+ #: ../backend/settings.php:119
92
+ msgid "Ajax Search Lite settings saved!"
93
+ msgstr ""
94
+
95
+ #: ../backend/settings/class/customfields.class.php:22
96
+ msgid "Available public custom fields types"
97
+ msgstr ""
98
+
99
+ #: ../backend/settings/class/customfields.class.php:31
100
+ msgid "Drag here the custom fields you want to use!"
101
+ msgstr ""
102
+
103
+ #: ../backend/settings/class/customposttypes.class.php:23
104
+ msgid "Available post types"
105
+ msgstr ""
106
+
107
+ #: ../backend/settings/class/customposttypes.class.php:32
108
+ msgid "Drag here the post types you want to use!"
109
+ msgstr ""
110
+
111
+ #: ../backend/tabs/instance/advanced_options.php:3
112
+ msgid "Title Field"
113
+ msgstr ""
114
+
115
+ #: ../backend/tabs/instance/advanced_options.php:12
116
+ msgid "Description Field"
117
+ msgstr ""
118
+
119
+ #: ../backend/tabs/instance/advanced_options.php:21
120
+ msgid "Exclude categories"
121
+ msgstr ""
122
+
123
+ #: ../backend/tabs/instance/advanced_options.php:28
124
+ msgid "Exclude Posts by ID's (comma separated post ID-s)"
125
+ msgstr ""
126
+
127
+ #: ../backend/tabs/instance/advanced_options.php:34
128
+ msgid "WPML compatibility"
129
+ msgstr ""
130
+
131
+ #: ../backend/tabs/instance/frontend_options.php:3
132
+ msgid "Show search settings on the frontend?"
133
+ msgstr ""
134
+
135
+ #: ../backend/tabs/instance/frontend_options.php:8
136
+ msgid ""
137
+ "The default values of the checkboxes on the frontend are the values set "
138
+ "above."
139
+ msgstr ""
140
+
141
+ #: ../backend/tabs/instance/frontend_options.php:12
142
+ msgid "Show exact matches selector?"
143
+ msgstr ""
144
+
145
+ #: ../backend/tabs/instance/frontend_options.php:20
146
+ msgid "Show search in posts selector?"
147
+ msgstr ""
148
+
149
+ #: ../backend/tabs/instance/frontend_options.php:27
150
+ msgid "Show search in pages selector?"
151
+ msgstr ""
152
+
153
+ #: ../backend/tabs/instance/frontend_options.php:34
154
+ msgid "Show search in title selector?"
155
+ msgstr ""
156
+
157
+ #: ../backend/tabs/instance/frontend_options.php:41
158
+ msgid "Show search in content selector?"
159
+ msgstr ""
160
+
161
+ #: ../backend/tabs/instance/frontend_options.php:47
162
+ msgid "Show search in custom post types selectors"
163
+ msgstr ""
164
+
165
+ #: ../backend/tabs/instance/frontend_options.php:52
166
+ msgid ""
167
+ "Nor recommended if you have more than 500 categories! (the HTML output will "
168
+ "get too big)"
169
+ msgstr ""
170
+
171
+ #: ../backend/tabs/instance/frontend_options.php:54
172
+ msgid "Show the categories selectors?"
173
+ msgstr ""
174
+
175
+ #: ../backend/tabs/instance/frontend_options.php:59
176
+ msgid "Show the uncategorised category?"
177
+ msgstr ""
178
+
179
+ #: ../backend/tabs/instance/frontend_options.php:63
180
+ msgid "Select which categories exclude"
181
+ msgstr ""
182
+
183
+ #: ../backend/tabs/instance/frontend_options.php:70
184
+ msgid "Categories filter box header text"
185
+ msgstr ""
186
+
187
+ #: ../backend/tabs/instance/frontend_options.php:76
188
+ #: ../backend/tabs/instance/general_options.php:130
189
+ #: ../backend/tabs/instance/image_options.php:106
190
+ #: ../backend/tabs/instance/layout_options.php:21
191
+ msgid "Save options!"
192
+ msgstr ""
193
+
194
+ #: ../backend/tabs/instance/general_options.php:12
195
+ msgid "Theme"
196
+ msgstr ""
197
+
198
+ #: ../backend/tabs/instance/general_options.php:21
199
+ msgid "Search in posts?"
200
+ msgstr ""
201
+
202
+ #: ../backend/tabs/instance/general_options.php:28
203
+ msgid "Search in pages?"
204
+ msgstr ""
205
+
206
+ #: ../backend/tabs/instance/general_options.php:34
207
+ msgid "Search in custom post types"
208
+ msgstr ""
209
+
210
+ #: ../backend/tabs/instance/general_options.php:41
211
+ msgid "Search in title?"
212
+ msgstr ""
213
+
214
+ #: ../backend/tabs/instance/general_options.php:48
215
+ msgid "Search in content?"
216
+ msgstr ""
217
+
218
+ #: ../backend/tabs/instance/general_options.php:55
219
+ msgid "Search in post excerpts?"
220
+ msgstr ""
221
+
222
+ #: ../backend/tabs/instance/general_options.php:61
223
+ msgid "Search in custom fields"
224
+ msgstr ""
225
+
226
+ #: ../backend/tabs/instance/general_options.php:69
227
+ msgid "Show exact matches only?"
228
+ msgstr ""
229
+
230
+ #: ../backend/tabs/instance/general_options.php:76
231
+ msgid "Search in terms? (categories, tags)"
232
+ msgstr ""
233
+
234
+ #: ../backend/tabs/instance/general_options.php:82
235
+ msgid "Result ordering"
236
+ msgstr ""
237
+
238
+ #: ../backend/tabs/instance/general_options.php:91
239
+ msgid "Trigger search when clicking on search icon?"
240
+ msgstr ""
241
+
242
+ #: ../backend/tabs/instance/general_options.php:98
243
+ msgid "Redirect to search results page when clicking on search icon?"
244
+ msgstr ""
245
+
246
+ #: ../backend/tabs/instance/general_options.php:105
247
+ msgid "Trigger search when typing?"
248
+ msgstr ""
249
+
250
+ #: ../backend/tabs/instance/general_options.php:112
251
+ msgid "Minimal character count to trigger search"
252
+ msgstr ""
253
+
254
+ #: ../backend/tabs/instance/general_options.php:119
255
+ msgid "Max. results"
256
+ msgstr ""
257
+
258
+ #: ../backend/tabs/instance/general_options.php:124
259
+ msgid "Results box viewport (in item numbers)"
260
+ msgstr ""
261
+
262
+ #: ../backend/tabs/instance/image_options.php:4
263
+ msgid "Show images in results?"
264
+ msgstr ""
265
+
266
+ #: ../backend/tabs/instance/image_options.php:13
267
+ msgid "Image width"
268
+ msgstr ""
269
+
270
+ #: ../backend/tabs/instance/image_options.php:22
271
+ msgid "Image height"
272
+ msgstr ""
273
+
274
+ #: ../backend/tabs/instance/image_options.php:33
275
+ msgid "Primary image source"
276
+ msgstr ""
277
+
278
+ #: ../backend/tabs/instance/image_options.php:44
279
+ msgid "Alternative image source 1"
280
+ msgstr ""
281
+
282
+ #: ../backend/tabs/instance/image_options.php:55
283
+ msgid "Alternative image source 2"
284
+ msgstr ""
285
+
286
+ #: ../backend/tabs/instance/image_options.php:66
287
+ msgid "Alternative image source 3"
288
+ msgstr ""
289
+
290
+ #: ../backend/tabs/instance/image_options.php:77
291
+ msgid "Alternative image source 4"
292
+ msgstr ""
293
+
294
+ #: ../backend/tabs/instance/image_options.php:88
295
+ msgid "Default image url"
296
+ msgstr ""
297
+
298
+ #: ../backend/tabs/instance/image_options.php:97
299
+ msgid "Custom field containing the image"
300
+ msgstr ""
301
+
302
+ #: ../backend/tabs/instance/layout_options.php:2
303
+ #: ../backend/tabs/instance/layout_options.php:8
304
+ msgid "Results layout"
305
+ msgstr ""
306
+
307
+ #: ../backend/tabs/instance/layout_options.php:3
308
+ #: ../backend/tabs/instance/layout_options.php:14
309
+ msgid "Results Behaviour"
310
+ msgstr ""
311
+
312
+ #: ../includes/asl_init.class.php:15 ../includes/asl_init.class.php:16
313
+ #: ../includes/asl_init.class.php:25
314
+ msgid "Ajax Search Lite"
315
+ msgstr ""
316
+
317
+ #: ../includes/asl_init.class.php:26
318
+ msgid "Analytics Integration"
319
+ msgstr ""
languages/ajax-search-lite-hu_HU.mo ADDED
Binary file
languages/ajax-search-lite-hu_HU.po ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Ajax Search Lite\n"
4
+ "POT-Creation-Date: 2014-12-10 21:20+0100\n"
5
+ "PO-Revision-Date: 2014-12-10 21:33+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: \n"
8
+ "Language: hu\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.1\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e\n"
16
+ "X-Poedit-SearchPath-0: ..\n"
17
+ "X-Poedit-SearchPathExcluded-0: ../js\n"
18
+ "X-Poedit-SearchPathExcluded-1: ../backend/settings/assets\n"
19
+
20
+ #: ../backend/analytics.php:7
21
+ msgid "Enable search Google Analytics integration?"
22
+ msgstr "Google Analytics integráció engedélyezése"
23
+
24
+ #: ../backend/analytics.php:12
25
+ msgid "Google analytics pageview string"
26
+ msgstr "Google analytics oldal-megtekintés szövege"
27
+
28
+ #: ../backend/analytics.php:16
29
+ msgid ""
30
+ "This is how the pageview will look like on the google analytics website. Use "
31
+ "the {asl_term} variable to add the search term to the pageview."
32
+ msgstr ""
33
+ "Így fog kinézni egy oldalmegjelenés a google analytics panelen. Használd az "
34
+ "{asl_term} változót a kulcsszó megjelöléséhez. "
35
+
36
+ #: ../backend/analytics.php:40
37
+ msgid "Analytics options"
38
+ msgstr "Analytics beállítások"
39
+
40
+ #: ../backend/analytics.php:45
41
+ msgid "Result"
42
+ msgstr "Eredmény"
43
+
44
+ #: ../backend/analytics.php:47
45
+ msgid ""
46
+ "After some time you should be able to see the hits on your analytics board."
47
+ msgstr ""
48
+ "Rövid idő elteltvével látni fogod a kereséseket az analytics weblapján."
49
+
50
+ #: ../backend/settings.php:44
51
+ msgid "Search shortcode:"
52
+ msgstr "Kereső shortkód"
53
+
54
+ #: ../backend/settings.php:47
55
+ msgid "Search shortcode for templates:"
56
+ msgstr "Kereső sortkód témákhoz (php)"
57
+
58
+ #: ../backend/settings.php:58
59
+ msgid "General Options"
60
+ msgstr "Általános Beállítások"
61
+
62
+ #: ../backend/settings.php:59 ../backend/settings.php:75
63
+ msgid "Image Options"
64
+ msgstr "Képbeállítások"
65
+
66
+ #: ../backend/settings.php:60
67
+ msgid "Frontend Options"
68
+ msgstr "Front-end beállítások"
69
+
70
+ #: ../backend/settings.php:61
71
+ msgid "Layout options"
72
+ msgstr "Megjelenés"
73
+
74
+ #: ../backend/settings.php:62
75
+ msgid "Advanced"
76
+ msgstr "Haladó"
77
+
78
+ #: ../backend/settings.php:67
79
+ msgid "Genearal Options"
80
+ msgstr "Általános"
81
+
82
+ #: ../backend/settings.php:83
83
+ msgid "Frontend Search Settings"
84
+ msgstr "Front-end beállítások"
85
+
86
+ #: ../backend/settings.php:91
87
+ msgid "Layout Options"
88
+ msgstr "Megjelenés"
89
+
90
+ #: ../backend/settings.php:99
91
+ msgid "Advanced Options"
92
+ msgstr "Haladó"
93
+
94
+ #: ../backend/settings.php:119
95
+ msgid "Ajax Search Lite settings saved!"
96
+ msgstr "Beállítások mentve!"
97
+
98
+ #: ../backend/settings/class/customfields.class.php:22
99
+ msgid "Available public custom fields types"
100
+ msgstr "Elérhető Egyedi Mezők"
101
+
102
+ #: ../backend/settings/class/customfields.class.php:31
103
+ msgid "Drag here the custom fields you want to use!"
104
+ msgstr "Húzd ide az Egyedi Mezőket, amelyeket használni szeretnél"
105
+
106
+ #: ../backend/settings/class/customposttypes.class.php:23
107
+ msgid "Available post types"
108
+ msgstr "Elérhető Bejegyzés Típusok"
109
+
110
+ #: ../backend/settings/class/customposttypes.class.php:32
111
+ msgid "Drag here the post types you want to use!"
112
+ msgstr "Húzd ide a Bejegyzés Típusokat, amiket használni szeretnél"
113
+
114
+ #: ../backend/tabs/instance/advanced_options.php:3
115
+ msgid "Title Field"
116
+ msgstr "Cím mező"
117
+
118
+ #: ../backend/tabs/instance/advanced_options.php:12
119
+ msgid "Description Field"
120
+ msgstr "Leírás mező"
121
+
122
+ #: ../backend/tabs/instance/advanced_options.php:21
123
+ msgid "Exclude categories"
124
+ msgstr "Kihagyandó kategóriák"
125
+
126
+ #: ../backend/tabs/instance/advanced_options.php:28
127
+ msgid "Exclude Posts by ID's (comma separated post ID-s)"
128
+ msgstr "Kihagyandó Bejegyzések (vesszővel elválaszott ID számok)"
129
+
130
+ #: ../backend/tabs/instance/advanced_options.php:34
131
+ msgid "WPML compatibility"
132
+ msgstr "WPML kompatibilitás"
133
+
134
+ #: ../backend/tabs/instance/frontend_options.php:3
135
+ msgid "Show search settings on the frontend?"
136
+ msgstr "Beállítások mutatása front-enden?"
137
+
138
+ #: ../backend/tabs/instance/frontend_options.php:8
139
+ msgid ""
140
+ "The default values of the checkboxes on the frontend are the values set "
141
+ "above."
142
+ msgstr "A jelölőnégyzetek alapértékei az itt beállított értékek lesznek"
143
+
144
+ #: ../backend/tabs/instance/frontend_options.php:12
145
+ msgid "Show exact matches selector?"
146
+ msgstr "Csak teljesen egyező találatok jelölő mutatása"
147
+
148
+ #: ../backend/tabs/instance/frontend_options.php:20
149
+ msgid "Show search in posts selector?"
150
+ msgstr "Bejegyzés jelölőnégyzet mutatása"
151
+
152
+ #: ../backend/tabs/instance/frontend_options.php:27
153
+ msgid "Show search in pages selector?"
154
+ msgstr "Oldal jelölőnégyzet mutatása"
155
+
156
+ #: ../backend/tabs/instance/frontend_options.php:34
157
+ msgid "Show search in title selector?"
158
+ msgstr "Keresés a címben jelölőnégyzet mutatása"
159
+
160
+ #: ../backend/tabs/instance/frontend_options.php:41
161
+ msgid "Show search in content selector?"
162
+ msgstr "Keresés a tartalomban jelölőnégyzet mutatása"
163
+
164
+ #: ../backend/tabs/instance/frontend_options.php:47
165
+ msgid "Show search in custom post types selectors"
166
+ msgstr "Keresés más bejegyzés típusokban jelölőnégyzet mutatása"
167
+
168
+ #: ../backend/tabs/instance/frontend_options.php:52
169
+ msgid ""
170
+ "Nor recommended if you have more than 500 categories! (the HTML output will "
171
+ "get too big)"
172
+ msgstr "Nem ajánlott ha több, mint 500 kategória található a blogodon"
173
+
174
+ #: ../backend/tabs/instance/frontend_options.php:54
175
+ msgid "Show the categories selectors?"
176
+ msgstr "Kategória jelölőnégyzetek mutatása"
177
+
178
+ #: ../backend/tabs/instance/frontend_options.php:59
179
+ msgid "Show the uncategorised category?"
180
+ msgstr "Mutassa a Kategorizálatlan jelölőt"
181
+
182
+ #: ../backend/tabs/instance/frontend_options.php:63
183
+ msgid "Select which categories exclude"
184
+ msgstr "Válaszd ki, mely kategóriák ne jelenjenek meg"
185
+
186
+ #: ../backend/tabs/instance/frontend_options.php:70
187
+ msgid "Categories filter box header text"
188
+ msgstr "A kategória doboz fejléc szövege"
189
+
190
+ #: ../backend/tabs/instance/frontend_options.php:76
191
+ #: ../backend/tabs/instance/general_options.php:130
192
+ #: ../backend/tabs/instance/image_options.php:106
193
+ #: ../backend/tabs/instance/layout_options.php:21
194
+ msgid "Save options!"
195
+ msgstr "Beállítások mentése!"
196
+
197
+ #: ../backend/tabs/instance/general_options.php:12
198
+ msgid "Theme"
199
+ msgstr "Téma"
200
+
201
+ #: ../backend/tabs/instance/general_options.php:21
202
+ msgid "Search in posts?"
203
+ msgstr "Keresés bejegyzésekben?"
204
+
205
+ #: ../backend/tabs/instance/general_options.php:28
206
+ msgid "Search in pages?"
207
+ msgstr "Keresés oldalakon?"
208
+
209
+ #: ../backend/tabs/instance/general_options.php:34
210
+ msgid "Search in custom post types"
211
+ msgstr "Keresés más típusokban"
212
+
213
+ #: ../backend/tabs/instance/general_options.php:41
214
+ msgid "Search in title?"
215
+ msgstr "Keresés a címben?"
216
+
217
+ #: ../backend/tabs/instance/general_options.php:48
218
+ msgid "Search in content?"
219
+ msgstr "Keresés a tartalomban?"
220
+
221
+ #: ../backend/tabs/instance/general_options.php:55
222
+ msgid "Search in post excerpts?"
223
+ msgstr "Keresés a kivonatokban?"
224
+
225
+ #: ../backend/tabs/instance/general_options.php:61
226
+ msgid "Search in custom fields"
227
+ msgstr "Keresés az Egyedi mezőkben?"
228
+
229
+ #: ../backend/tabs/instance/general_options.php:69
230
+ msgid "Show exact matches only?"
231
+ msgstr "Csak teljesen egyező találatok mutatása?"
232
+
233
+ #: ../backend/tabs/instance/general_options.php:76
234
+ msgid "Search in terms? (categories, tags)"
235
+ msgstr "Keresés kifejezésekben (kategória, tag, stb..)"
236
+
237
+ #: ../backend/tabs/instance/general_options.php:82
238
+ msgid "Result ordering"
239
+ msgstr "Eredmények elrendezése"
240
+
241
+ #: ../backend/tabs/instance/general_options.php:91
242
+ msgid "Trigger search when clicking on search icon?"
243
+ msgstr "A keresés indítása a kereső ikonra való kattintáskor"
244
+
245
+ #: ../backend/tabs/instance/general_options.php:98
246
+ msgid "Redirect to search results page when clicking on search icon?"
247
+ msgstr ""
248
+ "Átirányítás az alapértelmezett keresési eredményekhez ikonra való "
249
+ "kattintáskor?"
250
+
251
+ #: ../backend/tabs/instance/general_options.php:105
252
+ msgid "Trigger search when typing?"
253
+ msgstr "Keresés indítása gépelés közben?"
254
+
255
+ #: ../backend/tabs/instance/general_options.php:112
256
+ msgid "Minimal character count to trigger search"
257
+ msgstr "Minimális karakterszám a keresés indításához"
258
+
259
+ #: ../backend/tabs/instance/general_options.php:119
260
+ msgid "Max. results"
261
+ msgstr "Eredmények maximális száma"
262
+
263
+ #: ../backend/tabs/instance/general_options.php:124
264
+ msgid "Results box viewport (in item numbers)"
265
+ msgstr "Eredménydoboz mérete (elemszám)"
266
+
267
+ #: ../backend/tabs/instance/image_options.php:4
268
+ msgid "Show images in results?"
269
+ msgstr "Képek mutatása"
270
+
271
+ #: ../backend/tabs/instance/image_options.php:13
272
+ msgid "Image width"
273
+ msgstr "Képszélesség"
274
+
275
+ #: ../backend/tabs/instance/image_options.php:22
276
+ msgid "Image height"
277
+ msgstr "Képmagasság"
278
+
279
+ #: ../backend/tabs/instance/image_options.php:33
280
+ msgid "Primary image source"
281
+ msgstr "Elsődleges képforrás"
282
+
283
+ #: ../backend/tabs/instance/image_options.php:44
284
+ msgid "Alternative image source 1"
285
+ msgstr "Alternatív képforrás 1"
286
+
287
+ #: ../backend/tabs/instance/image_options.php:55
288
+ msgid "Alternative image source 2"
289
+ msgstr "Alternatív képforrás 2"
290
+
291
+ #: ../backend/tabs/instance/image_options.php:66
292
+ msgid "Alternative image source 3"
293
+ msgstr "Alternatív képforrás 3"
294
+
295
+ #: ../backend/tabs/instance/image_options.php:77
296
+ msgid "Alternative image source 4"
297
+ msgstr "Alternatív képforrás 4"
298
+
299
+ #: ../backend/tabs/instance/image_options.php:88
300
+ msgid "Default image url"
301
+ msgstr "Alapértelmezett kép URL"
302
+
303
+ #: ../backend/tabs/instance/image_options.php:97
304
+ msgid "Custom field containing the image"
305
+ msgstr "Egyedi mező, amely a képet tartalmazza"
306
+
307
+ #: ../backend/tabs/instance/layout_options.php:2
308
+ #: ../backend/tabs/instance/layout_options.php:8
309
+ msgid "Results layout"
310
+ msgstr "Megjelenés"
311
+
312
+ #: ../backend/tabs/instance/layout_options.php:3
313
+ #: ../backend/tabs/instance/layout_options.php:14
314
+ msgid "Results Behaviour"
315
+ msgstr "Viselkedés"
316
+
317
+ #: ../includes/asl_init.class.php:15 ../includes/asl_init.class.php:16
318
+ #: ../includes/asl_init.class.php:25
319
+ msgid "Ajax Search Lite"
320
+ msgstr "Ajax Search Lite"
321
+
322
+ #: ../includes/asl_init.class.php:26
323
+ msgid "Analytics Integration"
324
+ msgstr "Analytics integráció"
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, relevant search, better search plugin, ajax search, wp ajax search, custom fields search, custom field ajax, better search, ajax search plugin, wp search, wp search plugin, relevant search plugin, search plugin, wordpress search, advanced search, best wordpress search, ajax wordpress search, ajax search pro
5
  Requires at least: 3.5
6
- Tested up to: 4.0
7
- Stable tag: 3.06
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,8 +12,8 @@ A powerful ajax search engine for WordPress.
12
 
13
  == Description ==
14
 
15
- A resonsive search engine, which will boost your user experience by providing a user friendly ajax powered search form - an ajax live search. Very smooth animations with mobile device support.
16
- Boost 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 as well.
17
 
18
  Facebook: https://www.facebook.com/pages/WPDreams/383702515034741
19
 
@@ -100,6 +100,15 @@ and will let you know what to do.
100
 
101
  == Changelog ==
102
 
 
 
 
 
 
 
 
 
 
103
  = 3.06 =
104
  * Fixed long label names in frontend settings dropdown
105
  * Title and description substrings at word endings
1
+ === Ajax Search Lite ===
2
  Contributors: wpdreams
3
  Donate link: http://wp-dreams.com
4
+ Tags: search, better wordpress search, search plugin, relevance search, better search plugin, ajax search, wp ajax search, custom fields search, better search, ajax search plugin, wp search, wp search plugin, relevant search plugin, search plugin, wordpress search, live search
5
  Requires at least: 3.5
6
+ Tested up to: 4.2
7
+ Stable tag: 3.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ Ajax Search Lite - is a live search plugin for WordPress. This responsive live search engine, which will boost your user experience by providing a user friendly ajax powered search form - an ajax live search. Very smooth animations with mobile device support and regular updates.
16
+ 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 as well. Boost your site search engine with this custom built live search engine.
17
 
18
  Facebook: https://www.facebook.com/pages/WPDreams/383702515034741
19
 
100
 
101
  == Changelog ==
102
 
103
+ = 3.11 =
104
+ * WPML compatibility fix
105
+ * A possible security issue fix
106
+
107
+ = 3.1 =
108
+ * Updated engine with full UTF8 charset support
109
+ * Languages like chinese, persian are now searchable
110
+ * Language files added
111
+
112
  = 3.06 =
113
  * Fixed long label names in frontend settings dropdown
114
  * Title and description substrings at word endings
search.php CHANGED
@@ -3,6 +3,7 @@ add_action('wp_ajax_nopriv_ajaxsearchlite_search', 'ajaxsearchlite_search');
3
  add_action('wp_ajax_ajaxsearchlite_search', 'ajaxsearchlite_search');
4
 
5
  require_once(ASL_PATH . "/includes/imagecache.class.php");
 
6
  require_once(ASL_PATH . "/includes/suggest.class.php");
7
 
8
  require_once(ASL_PATH . "/includes/search.class.php");
3
  add_action('wp_ajax_ajaxsearchlite_search', 'ajaxsearchlite_search');
4
 
5
  require_once(ASL_PATH . "/includes/imagecache.class.php");
6
+ require_once(ASL_PATH . "/includes/bfi_thumb.php");
7
  require_once(ASL_PATH . "/includes/suggest.class.php");
8
 
9
  require_once(ASL_PATH . "/includes/search.class.php");