Skip to content

Commit

Permalink
Fix error 500 during indexation (#241)
Browse files Browse the repository at this point in the history
* use strip_tags instead of custom function stripHtml

* increase version
  • Loading branch information
yuloma authored Sep 30, 2024
1 parent 526441b commit b8b36c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
4 changes: 2 additions & 2 deletions doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class Doofinder extends Module
const DOOMANAGER_URL = 'https://admin.doofinder.com';
const GS_SHORT_DESCRIPTION = 1;
const GS_LONG_DESCRIPTION = 2;
const VERSION = '4.8.8';
const VERSION = '4.8.9';
const YES = 1;
const NO = 0;

public function __construct()
{
$this->name = 'doofinder';
$this->tab = 'search_filter';
$this->version = '4.8.8';
$this->version = '4.8.9';
$this->author = 'Doofinder (http://www.doofinder.com)';
$this->ps_versions_compliancy = ['min' => '1.5', 'max' => _PS_VERSION_];
$this->module_key = 'd1504fe6432199c7f56829be4bd16347';
Expand Down
35 changes: 1 addition & 34 deletions lib/dfTools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -997,39 +997,6 @@ public static function truncateText($text, $length)
return $r;
}

public static function stripHtml($text)
{
if (!function_exists('cb1')) {
function cb1($matches)
{
return chr($matches[1]);
}
}

if (!function_exists('cb2')) {
function cb2($matches)
{
return chr('0x' . $matches[1]);
}
}
html_entity_decode($text, ENT_QUOTES, 'ISO-8859-1');
$text = preg_replace_callback(
'/&#(\d+);/mu',
'cb1',
$text
); // decimal notation
$text = preg_replace_callback(
'/&#x([a-f0-9]+);/miu',
'cb2',
$text
); // hex notation
$text = str_replace('><', '> <', $text);
$text = preg_replace('/\<br(\s*)?\/?\>/i', ' ', $text);
$text = strip_tags($text);

return $text;
}

public static function cleanURL($text)
{
$text = trim($text);
Expand Down Expand Up @@ -1078,7 +1045,7 @@ public static function cleanString($text)

$text = preg_replace('/[^\P{C}]+/u', ' ', $text);
$text = str_replace(["\t", "\r", "\n"], ' ', $text);
$text = self::stripHtml($text);
$text = strip_tags($text);
$text = preg_replace('/\s+/', ' ', $text);
$text = trim($text);
$text = preg_replace('/^["\']+/', '', $text); // remove first quotes
Expand Down

0 comments on commit b8b36c9

Please sign in to comment.