Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Fixed incorrect triggering of the condition #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ public function loadDriver(array $scriptProperties = array()) {
* @return string The parsed and cleansed string.
*/
public function parseSearchString($str = '') {
$minChars = $this->modx->getOption('minChars', $this->config, 4);
$minChars = $this->modx->getOption('minChars', $this->config, 3);

$this->searchArray = explode(' ',$str);
$this->searchArray = $this->modx->sanitize($this->searchArray, $this->modx->sanitizePatterns);

$reserved = array('AND', 'OR', 'IN', 'NOT');
foreach ($this->searchArray as $key => $term) {
$this->searchArray[$key] = strip_tags($term);
if (strlen($term) < $minChars && !in_array($term, $reserved)) {
if (iconv_strlen($term) < $minChars && in_array($term, $reserved)) {
unset($this->searchArray[$key]);
}
}
Expand Down