/**
 * execute the frontend output filter to modify email addresses
 * @param string actual content
 * @return string modified content
 */
function executeFrontendOutputFilter($content)
{
    $sFilterDirectory = str_replace('\\', '/', dirname(__FILE__)) . '/filters/';
    /* ### filter type: execute droplets filter ################################# */
    if (OPF_DROPLETS) {
        if (file_exists($sFilterDirectory . 'filterDroplets.php')) {
            require_once $sFilterDirectory . 'filterDroplets.php';
            $content = doFilterDroplets($content);
        }
    }
    /* ### filter type: Auto Add Placeholders for Javascript, CSS, Metas and Title   ################################# */
    if (OPF_AUTO_PLACEHOLDER) {
        if (class_exists("I")) {
            $content = I::AddPlaceholder($content);
        }
    }
    /* ### filter type: fill out placeholders for Javascript, CSS, Metas and Title  ################################# */
    if (OPF_INSERT) {
        if (class_exists("I")) {
            $content = I::Filter($content);
        }
    }
    /* ### filter type: protect email addresses ################################# */
    if (OPF_MAILTO_FILTER || OPF_EMAIL_FILTER) {
        if (file_exists($sFilterDirectory . 'filterEmail.php')) {
            require_once $sFilterDirectory . 'filterEmail.php';
            $content = doFilterEmail($content);
        }
    }
    /* ### filter type: change [wblinkxx] into real URLs ######################## */
    if (OPF_WBLINK) {
        if (file_exists($sFilterDirectory . 'filterWbLink.php')) {
            require_once $sFilterDirectory . 'filterWbLink.php';
            $content = doFilterWbLink($content);
        }
    }
    /* ### filter type: short url (instead of a droplet) ########### */
    if (OPF_SHORT_URL) {
        if (file_exists($sFilterDirectory . 'filter_short_url.php')) {
            require_once $sFilterDirectory . 'filter_short_url.php';
            $content = doFilterShortUrl($content);
        }
    }
    /* ### filter type: full qualified URLs to relative URLs##################### */
    if (OPF_SYS_REL) {
        if (file_exists($sFilterDirectory . 'filterRelUrl.php')) {
            require_once $sFilterDirectory . 'filterRelUrl.php';
            $content = doFilterRelUrl($content);
        }
    }
    /* ### filter type: moves css definitions from <body> into <head> ########### */
    if (OPF_CSS_TO_HEAD) {
        if (file_exists($sFilterDirectory . 'filterCssToHead.php')) {
            require_once $sFilterDirectory . 'filterCssToHead.php';
            $content = doFilterCssToHead($content);
        }
    }
    /* ### end of filters ####################################################### */
    return $content;
}
/**
 * execute the frontend output filter to modify email addresses
 * @param string actual content
 * @return string modified content
 */
function executeFrontendOutputFilter($content)
{
    // get output filter settings from database
    $filter_settings = getOutputFilterSettings();
    $sFilterDirectory = str_replace('\\', '/', dirname(__FILE__)) . '/filters/';
    $output_filter_mode = 0;
    $output_filter_mode |= $filter_settings['email_filter'] * pow(2, 0);
    // n | 2^0
    $output_filter_mode |= $filter_settings['mailto_filter'] * pow(2, 1);
    // n | 2^1
    if (!defined('OUTPUT_FILTER_AT_REPLACEMENT')) {
        define('OUTPUT_FILTER_AT_REPLACEMENT', $filter_settings['at_replacement']);
    }
    if (!defined('OUTPUT_FILTER_DOT_REPLACEMENT')) {
        define('OUTPUT_FILTER_DOT_REPLACEMENT', $filter_settings['dot_replacement']);
    }
    /* ### filter type: execute droplets filter ################################# */
    if (file_exists($sFilterDirectory . 'filterDroplets.php')) {
        require_once $sFilterDirectory . 'filterDroplets.php';
        $content = doFilterDroplets($content);
    }
    /* ### filter type: protect email addresses ################################# */
    if ($output_filter_mode & pow(2, 0) || $output_filter_mode & pow(2, 1)) {
        if (file_exists($sFilterDirectory . 'filterEmail.php')) {
            require_once $sFilterDirectory . 'filterEmail.php';
            $content = doFilterEmail($content, $output_filter_mode);
        }
    }
    /* ### filter type: change [wblinkxx] into real URLs ######################## */
    if (file_exists($sFilterDirectory . 'filterWbLink.php')) {
        require_once $sFilterDirectory . 'filterWbLink.php';
        $content = doFilterWbLink($content);
    }
    /* ### filter type: full qualified URLs to relative URLs##################### */
    if ($filter_settings['sys_rel'] == 1) {
        if (file_exists($sFilterDirectory . 'filterRelUrl.php')) {
            require_once $sFilterDirectory . 'filterRelUrl.php';
            $content = doFilterRelUrl($content);
        }
    }
    /* ### filter type: moves css definitions from <body> into <head> ########### */
    if (file_exists($sFilterDirectory . 'filterCssToHead.php')) {
        require_once $sFilterDirectory . 'filterCssToHead.php';
        $content = doFilterCssToHead($content);
    }
    /* ### end of filters ####################################################### */
    return $content;
}