/**
 * 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;
}
/**
 * execute the backend output filter
 * Only the basic ones here as sooner or later opf dashboardt will take this place
 * @param string actual content
 * @return string modified content
 */
function executeBackendOutputFilter($content)
{
    $sFilterDirectory = str_replace('\\', '/', dirname(__FILE__)) . '/filters/';
    /* ### filter type: execute droplets filter for backend ################################# */
    if (OPF_DROPLETS_BE) {
        if (file_exists($sFilterDirectory . 'filterDropletsBe.php')) {
            require_once $sFilterDirectory . 'filterDropletsBe.php';
            $content = doFilterDropletsBe($content);
        }
    }
    /* ### filter type: fill out placeholders for Javascript, CSS, Metas and Title  ################################# */
    //now available in BE too
    if (defined("OPF_INSERT_BE") and OPF_INSERT_BE) {
        if (class_exists("I")) {
            $content = I::Filter($content);
        }
    }
    /* ### filter type: protect email addresses ################################# */
    // emailfilter not needed in BE
    /* ### filter type: change [wblinkxx] into real URLs ######################## */
    // would remove the [wblinkxxx] texts in CKE for example .. so no good idea
    /* ### filter type: short url (instead of a droplet) ########### */
    // Short url not functional in BE and not needed anyway
    /* ### filter type: full qualified URLs to relative URLs##################### */
    // would disturb BE functions
    /* ### filter type: moves css definitions from <body> into <head> ########### */
    //this one truly may stay in (lots  of old modules have inline CSS )
    // maybe we even declare having css in the module html as being just ok.
    if (defined("OPF_CSS_TO_HEAD_BE") and OPF_CSS_TO_HEAD_BE) {
        if (file_exists($sFilterDirectory . 'filterCssToHead.php')) {
            require_once $sFilterDirectory . 'filterCssToHead.php';
            $content = doFilterCssToHead($content);
        }
    }
    /* ### end of filters ####################################################### */
    return $content;
}