1
General Help & Support / Re: apply ShortUrl (or any filter) in Ajax file
« Last post by crnogorac081 on July 22, 2024, 12:49:25 PM »Here is solution how to apply ShortUrl or any other filter in Ajax file.
I hope it will help somebody
Code: [Select]
// at the top of page
use addon\output_filter\Filters\ShortUrl\{Filter};
....
// My content that goes to page
$sMyContent = '.....';
// Filter Short
$aFilterSettings = [];
$sSql = "SELECT `value` FROM ".TABLE_PREFIX."mod_output_filter WHERE `name` = 'ShortUrl' ";
$aFilterSettings['ShortUrl'] = ($oDb->get_one($sSql) ?? 0);
$cFilter = new Filter($oReg, $aFilterSettings);
// Apply filter
$sMyContent = $cFilter->execute($sMyContent);
I hope it will help somebody