Skip to content

Commit

Permalink
change to callable decl for PHP 8.2 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhunt committed Oct 7, 2024
1 parent 197bd38 commit 013b98b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function filter($text, array $options = []) {
// non string data can not be filtered anyway
return $text;
}
$newtext = preg_replace_callback($search, 'self::filter_poodll_process', $newtext);
$newtext = preg_replace_callback($search, [$this, 'filter_poodll_process'], $newtext);
}

// if the text has a poodll player widget we want to prevent other filters from messing with it
Expand All @@ -107,18 +107,18 @@ public function filter($text, array $options = []) {
$handleextstring = implode('|', $handleexts);
// $oldsearch = '/<a\s[^>]*href="([^"#\?]+\.(' . $handleextstring. '))(\?d=([\d]{1,4})x([\d]{1,4}))?"[^>]*>([^>]*)<\/a>/is';
$search = '/<a\s[^>]*href="([^"#\?]+\.(' . $handleextstring . '))(.*?)"[^>]*>([^>]*)<\/a>/is';
$newtext = preg_replace_callback($search, 'self::filter_poodll_allexts_callback', $newtext);
$newtext = preg_replace_callback($search, [$this, 'filter_poodll_allexts_callback'], $newtext);
}

// check for legacy pdl links
$search = '/<a\s[^>]*href="([^"#\?]+\.(pdl))(.*?)"[^>]*>([^>]*)<\/a>/is';
$newtext = preg_replace_callback($search, 'self::filter_poodll_pdl_callback', $newtext);
$newtext = preg_replace_callback($search, [$this, 'filter_poodll_pdl_callback'], $newtext);

// check for youtube
if ($this->fetchconf('handleyoutube')) {
$search =
'/<a\s[^>]*href="(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=|v\/)?([\w-]{10,})(?:.*?)<\/a>/is';
$newtext = preg_replace_callback($search, 'self::filter_poodll_youtube_callback', $newtext);
$newtext = preg_replace_callback($search, [$this, 'filter_poodll_youtube_callback'], $newtext);
}
}// end of if $havelinks

Expand All @@ -131,7 +131,7 @@ public function filter($text, array $options = []) {
// } else {

// return the correct thing to wherever called us
if (is_null($newtext) or $newtext === $text) {
if (is_null($newtext) || $newtext === $text) {
// error or not filtered
return $text;
}
Expand Down

0 comments on commit 013b98b

Please sign in to comment.