Skip to content

Commit

Permalink
Now we just use a simple Filter to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
NorHei committed Sep 2, 2017
1 parent 5da0a1c commit ab2eec8
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 25 deletions.
20 changes: 16 additions & 4 deletions wbce/modules/output_filter/filter_routines.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,17 @@ function executeFrontendOutputFilter($content) {
}
}



/* ### filter type: full qualified URLs to relative URLs##################### */
if(OPF_REMOVE_SYSTEM_PH){
if (file_exists($sFilterDirectory.'filterRemoveSystemPh.php ')) {
require_once($sFilterDirectory.'filterRemoveSystemPh.php ');
$content = doFilterRemoveSystemPh($content);
}
}







Expand Down Expand Up @@ -172,8 +179,13 @@ function executeBackendOutputFilter($content) {
}
}



/* ### filter type: full qualified URLs to relative URLs##################### */
if(OPF_REMOVE_SYSTEM_PH_BE){
if (file_exists($sFilterDirectory.'filterRemoveSystemPh.php ')) {
require_once($sFilterDirectory.'filterRemoveSystemPh.php ');
$content = doFilterRemoveSystemPh($content);
}
}


/* ### filter type: protect email addresses ################################# */
Expand Down
5 changes: 5 additions & 0 deletions wbce/modules/output_filter/filters/filterRemoveSystemPh.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
function doFilterRemoveSystemPh($content) {
$content=preg_replace("/<!--\(PH\).*?-->/s" ,"", $content);
return $content;
}
2 changes: 2 additions & 0 deletions wbce/modules/output_filter/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
Settings::Set('opf_wblink',1, false);
Settings::Set('opf_short_url',0, false);
Settings::Set('opf_sys_rel',1, false);
Settings::Set("opf_remove_system_ph", 1, false) ;

//backend
Settings::Set('opf_droplets_be',1, false);
Settings::Set('opf_auto_placeholder_be',1, false);
Settings::Set('opf_move_stuff_be',1, false);
Settings::Set('opf_replace_stuff_be',1, false);
Settings::Set('opf_css_to_head_be',1);
Settings::Set("opf_remove_system_ph_be", 1, false) ;

//Setting version
include ("info.php");
Expand Down
1 change: 1 addition & 0 deletions wbce/modules/output_filter/languages/DE.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@
$OPF['JS_MAILTO'] = 'Javascript für Mailto-Filter';
$OPF['SHORT_URL'] = 'ShortUrl-Filter (kein /pages/, kein .php; htaccess-Anpassung erforderlich!)';
$OPF['CSS_TO_HEAD'] = 'CSS in den Head transferieren';
$OPF['REMOVE_SYSTEM_PH'] = 'Vom Core automatisch generierte Kommentare löschen.';
1 change: 1 addition & 0 deletions wbce/modules/output_filter/languages/EN.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
$OPF['JS_MAILTO'] = 'Use Javascript on mailto-filter';
$OPF['SHORT_URL'] = 'Use short url filter (no /pages, no .php - htaccess has to be prepared for that)';
$OPF['CSS_TO_HEAD'] = 'Move CSS to head';
$OPF['REMOVE_SYSTEM_PH'] = 'Remove placesholders(PH) generated by core filters.';


21 changes: 20 additions & 1 deletion wbce/modules/output_filter/templates/output_filter.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@
name="sys_rel" value="0"><?php echo $OPF['DISABLED'];?>
</td>
</tr>
<tr>
<td width="35%"><?php echo $OPF['REMOVE_SYSTEM_PH'];?>:</td>
<td>
<input type="radio" <?php echo ($data['remove_system_ph']=='1') ? 'checked="checked"' :'';?>
name="remove_system_ph" value="1"><?php echo $OPF['ENABLED'];?>
<input type="radio" <?php echo (($data['remove_system_ph'])=='0') ? 'checked="checked"' :'';?>
name="remove_system_ph" value="0"><?php echo $OPF['DISABLED'];?>
</td>
</tr>


<!-- BACKEND -->
Expand Down Expand Up @@ -161,7 +170,17 @@
name="css_to_head_be" value="0"><?php echo $OPF['DISABLED'];?>
</td>
</tr>

<tr>
<td width="35%"><?php echo $OPF['REMOVE_SYSTEM_PH'];?>:</td>
<td>
<input type="radio" <?php echo ($data['remove_system_ph_be']=='1') ? 'checked="checked"' :'';?>
name="remove_system_ph_be" value="1"><?php echo $OPF['ENABLED'];?>
<input type="radio" <?php echo (($data['remove_system_ph_be'])=='0') ? 'checked="checked"' :'';?>
name="remove_system_ph_be" value="0"><?php echo $OPF['DISABLED'];?>
</td>
</tr>


<!-- REPLACEMENTS -->

<tr><td colspan="2"><br /><strong><?php echo $OPF['REPLACEMENT_CONF'];?>:</strong></td></tr>
Expand Down
9 changes: 8 additions & 1 deletion wbce/modules/output_filter/tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,17 @@
$data['wblink'] = (int)(intval(isset($_POST['wblink']) ? $_POST['wblink'] : 0) != 0);
$data['short_url'] = (int)(intval(isset($_POST['short_url']) ? $_POST['short_url'] : 0) != 0);
$data['sys_rel'] = (int)(intval(isset($_POST['sys_rel']) ? $_POST['sys_rel'] : 0) != 0);

$data['remove_system_ph'] = (int)(intval(isset($_POST['remove_system_ph']) ? $_POST['remove_system_ph'] : 0) != 0);

//backend
$data['droplets_be'] = (int)(intval(isset($_POST['droplets_be']) ? $_POST['droplets_be'] : 0) != 0);
$data['auto_placeholder_be'] = (int)(intval(isset($_POST['auto_placeholder_be']) ? $_POST['auto_placeholder_be'] : 0) != 0);
$data['move_stuff_be'] = (int)(intval(isset($_POST['move_stuff_be']) ? $_POST['move_stuff_be'] : 0) != 0);
$data['replace_stuff_be'] = (int)(intval(isset($_POST['replace_stuff_be']) ? $_POST['replace_stuff_be'] : 0) != 0);
$data['css_to_head_be'] = (int)(intval(isset($_POST['css_to_head_be']) ? $_POST['css_to_head_be'] : 0) != 0);
$data['remove_system_ph_be'] = (int)(intval(isset($_POST['remove_system_ph_be']) ? $_POST['remove_system_ph_be'] : 0) != 0);


// dont use JAvascript Mailto if no mailto filter active.
if ($data['js_mailto'] and !$data['mailto_filter']) $data['js_mailto']=0;

Expand Down Expand Up @@ -71,13 +74,15 @@
$errmsg.=(string)Settings::Set("opf_wblink", $data['wblink']);
$errmsg.=(string)Settings::Set("opf_short_url", $data['short_url']);
$errmsg.=(string)Settings::Set("opf_sys_rel", $data['sys_rel']);
$errmsg.=(string)Settings::Set("opf_remove_system_ph", $data['remove_system_ph']);

//backend
$errmsg.=(string)Settings::Set("opf_droplets_be", $data['droplets_be']);
$errmsg.=(string)Settings::Set("opf_auto_placeholder_be", $data['auto_placeholder_be']);
$errmsg.=(string)Settings::Set("opf_move_stuff_be", $data['move_stuff_be']);
$errmsg.=(string)Settings::Set("opf_replace_stuff_be", $data['replace_stuff_be']);
$errmsg.=(string)Settings::Set("opf_css_to_head_be", $data['css_to_head_be']);
$errmsg.=(string)Settings::Set("opf_remove_system_ph_be", $data['remove_system_ph_be']);

if($errmsg=="") {
//anything ok
Expand Down Expand Up @@ -114,13 +119,15 @@
$data['wblink'] = Settings::Get('opf_wblink',1);
$data['short_url'] = Settings::Get('opf_short_url',0);
$data['sys_rel'] = Settings::Get('opf_sys_rel',1);
$data['remove_system_ph'] = Settings::Get('opf_remove_system_ph',1);

//backend
$data['droplets_be'] = Settings::Get('opf_droplets_be',1);
$data['auto_placeholder_be']= Settings::Get('opf_auto_placeholder_be',1);
$data['move_stuff_be'] = Settings::Get('opf_move_stuff_be',1);
$data['replace_stuff_be'] = Settings::Get('opf_replace_stuff_be',1);
$data['css_to_head_be'] = Settings::Get('opf_css_to_head_be',1);
$data['remove_system_ph_be'] = Settings::Get('opf_remove_system_ph_be',1);


}
Expand Down
38 changes: 20 additions & 18 deletions wbce/modules/output_filter/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,28 @@
// Commented out , cause of new OPF dashboard still needs those settings.
Settings::Del('wb_suppress_old_opf');
//frontend
Settings::Del('opf_droplets',1, false);
Settings::Del('opf_auto_placeholder',1, false);
Settings::Del('opf_move_stuff',1, false);
Settings::Del('opf_replace_stuff',1, false);
Settings::Del('opf_css_to_head',1, false);
Settings::Del('opf_email_filter',1, false);
Settings::Del('opf_mailto_filter',1, false);
Settings::Del('opf_js_mailto',1, false);
Settings::Del('opf_at_replacement',"(at)", false);
Settings::Del('opf_dot_replacement',"(dot)", false);
Settings::Del('opf_wblink',1, false);
Settings::Del('opf_short_url',0, false);
Settings::Del('opf_sys_rel',1, false);
Settings::Del('opf_droplets');
Settings::Del('opf_auto_placeholder');
Settings::Del('opf_move_stuff');
Settings::Del('opf_replace_stuff');
Settings::Del('opf_css_to_head');
Settings::Del('opf_email_filter');
Settings::Del('opf_mailto_filter');
Settings::Del('opf_js_mailto');
Settings::Del('opf_at_replacement',"(at)");
Settings::Del('opf_dot_replacement',"(dot)");
Settings::Del('opf_wblink');
Settings::Del('opf_short_url');
Settings::Del('opf_sys_rel');
Settings::Set("opf_remove_system_ph") ;

//backend
Settings::Del('opf_droplets_be',1, false);
Settings::Del('opf_auto_placeholder_be',1, false);
Settings::Del('opf_move_stuff_be',1, false);
Settings::Del('opf_replace_stuff_be',1, false);
Settings::Del('opf_css_to_head_be',1);
Settings::Del('opf_droplets_be');
Settings::Del('opf_auto_placeholder_be');
Settings::Del('opf_move_stuff_be');
Settings::Del('opf_replace_stuff_be');
Settings::Del('opf_css_to_head_be');
Settings::Set("opf_remove_system_ph_be") ;

// deleting version too
Settings::Del("opf_version") ;
4 changes: 3 additions & 1 deletion wbce/modules/output_filter/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ function getOutputFilterSettings() {
Settings::Set('opf_wblink',1, false);
Settings::Set('opf_short_url',0, false);
Settings::Set('opf_sys_rel',1, false);

Settings::Set("opf_remove_system_ph", 1, false) ;

//backend
Settings::Set('opf_droplets_be',1, false);
Settings::Set('opf_auto_placeholder_be',1, false);
Settings::Set('opf_move_stuff_be',1, false);
Settings::Set('opf_replace_stuff_be',1, false);
Settings::Set('opf_css_to_head_be',1);
Settings::Set("opf_remove_system_ph_be", 1, false) ;

// Override based on old WBCE settings
if (isset($data["sys_rel"])) Settings::Set('opf_sys_rel',$data["sys_rel"], false);
Expand Down

0 comments on commit ab2eec8

Please sign in to comment.