Project

General

Profile

« Previous | Next » 

Revision 2074

Added by darkviper almost 11 years ago

+ added new outputfilter to use OutputFilterDashboard

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
06 Jan-2014 Build 2074 Manuela v.d.Decken(DarkViper)
15
+ added new outputfilter to use OutputFilterDashboard
16
06 Jan-2014 Build 2073 Manuela v.d.Decken(DarkViper)
17
recall tagging of WebsiteBaker 2.8.4 release
18
03 Jan-2014 Build 2072 Manuela v.d.Decken(DarkViper)
19
Tagging WebsiteBaker 2.8.4 release
14 20
03 Jan-2014 Build 2071 Manuela v.d.Decken(DarkViper)
15 21
+ include/Sensio/Twig added Version 1.15.0
16 22
03 Jan-2014 Build 2070 Manuela v.d.Decken(DarkViper)
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.4');
54
if(!defined('REVISION')) define('REVISION', '2071');
54
if(!defined('REVISION')) define('REVISION', '2073');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/output_filter/filters/filterOpF.php
1
<?php
2

  
3
/*
4
 * make use of Thorn's OutputFilter Dashboard (OpF Dashboard)
5
 * @param string &$content : reference to global $content
6
 * @return void
7
 */
8
function doFilterOpF($content)
9
{
10
	// Load OutputFilter functions
11
	$sOpfFile = WbAdaptor::getInstance()->AppPath.'modules/outputfilter_dashboard/functions.php';
12
	if (is_readable($sOpfFile)) {
13
		require_once($sOpfFile);
14
	   // apply outputfilter
15
		if (function_exists('opf_apply_filters')) {
16
			// use 'cache' instead of 'nocache' to enable page-cache.
17
			// Do not use 'cache' in case you use dynamic contents (e.g. snippets)!
18
			opf_controller('init', 'nocache');
19
			$content = opf_controller('page', $content);
20
		}
21
	}
22
	return $content;
23
}
branches/2.8.x/wb/modules/output_filter/index.php
23 23
/* ************************************************************************** */
24 24
/**
25 25
 * execute the frontend output filter to modify email addresses
26
 * @param string actual content
26
 * @param string $sContent actual content
27 27
 * @return string modified content
28 28
 */
29
	function executeFrontendOutputFilter($content) {
29
	function executeFrontendOutputFilter($sContent) {
30 30
		// get output filter settings from database
31 31
		$filter_settings = getOutputFilterSettings();
32
		$sFilterDirectory = str_replace('\\', '/', dirname(__FILE__)).'/filters/';
32
		$sFilterDirectory = str_replace('\\', '/', __DIR__).'/filters/';
33 33
		$output_filter_mode = 0;
34 34
		$output_filter_mode |= ($filter_settings['email_filter'] * pow(2, 0));  // n | 2^0
35 35
		$output_filter_mode |= ($filter_settings['mailto_filter'] * pow(2, 1)); // n | 2^1
36 36
		define('OUTPUT_FILTER_AT_REPLACEMENT', $filter_settings['at_replacement']);
37 37
		define('OUTPUT_FILTER_DOT_REPLACEMENT', $filter_settings['dot_replacement']);
38
        if (!function_exists('OutputFilterApi')) {
39
            require (__DIR__.'/OutputFilterApi.php');
40
        }
41
/* ### fixed default filters ################################################ */
42
        $sContent = OutputFilterApi('ReplaceSysvar', $sContent);
43
        $sContent = OutputFilterApi('WbLink', $sContent);
44
/* ************************************************************************** */
45
/* *** from here insert requests of individual variable filter ************** */
38 46

  
39
/* ### filter type: replace Sysvar placeholder ############################## */
40
		if (file_exists($sFilterDirectory.'filterReplaceSysvar.php')) {
41
			require_once($sFilterDirectory.'filterReplaceSysvar.php');
42
			$content = doFilterReplaceSysvar($content);
43
		}
44
/* ### filter type: change [wblinkxx] into real URLs ######################## */
45
		if (file_exists($sFilterDirectory.'filterWbLink.php')) {
46
			require_once($sFilterDirectory.'filterWbLink.php');
47
			$content = doFilterWbLink($content);
48
		}
49 47
/* ### filter type: execute droplets filter ################################# */
50
		if (file_exists($sFilterDirectory.'filterDroplets.php')) {
51
			require_once($sFilterDirectory.'filterDroplets.php');
52
			$content = doFilterDroplets($content);
53
		}
48
        $sContent = OutputFilterApi('Droplets', $sContent);
54 49
/* ### filter type: protect email addresses ################################# */
55 50
		if( ($output_filter_mode & pow(2, 0)) || ($output_filter_mode & pow(2, 1)) ) {
56 51
			if (file_exists($sFilterDirectory.'filterEmail.php')) {
57 52
				require_once($sFilterDirectory.'filterEmail.php');
58
				$content = doFilterEmail($content, $output_filter_mode);
53
				$sContent = doFilterEmail($sContent, $output_filter_mode);
59 54
			}
60 55
		}
61
/* ### filter type: replace Sysvar placeholder ############################## */
62
		if (file_exists($sFilterDirectory.'filterReplaceSysvar.php')) {
63
			require_once($sFilterDirectory.'filterReplaceSysvar.php');
64
			$content = doFilterReplaceSysvar($content);
65
		}
66
/* ### filter type: change [wblinkxx] into real URLs ######################## */
67
		if (file_exists($sFilterDirectory.'filterWbLink.php')) {
68
			require_once($sFilterDirectory.'filterWbLink.php');
69
			$content = doFilterWbLink($content);
70
		}
71
/* ### filter type: full qualified URLs to relative URLs##################### */
56
/* ### filter type: make use of Thorn's OutputFilterDashboard ############### */
57
        if($filter_settings['opf'] == 1){
58
            $sContent = OutputFilterApi('OpF', $sContent);
59
        }
60

  
61
/* *** end of individual variable filter ************************************ */
62
/* ************************************************************************** */
63
/* ### fixed default filters ################################################ */
64
        $sContent = OutputFilterApi('ReplaceSysvar', $sContent);
65
        $sContent = OutputFilterApi('WbLink', $sContent);
72 66
        if($filter_settings['sys_rel'] == 1){
73
			if (file_exists($sFilterDirectory.'filterRelUrl.php')) {
74
				require_once($sFilterDirectory.'filterRelUrl.php');
75
				$content = doFilterRelUrl($content);
76
			}
67
            $sContent = OutputFilterApi('RelUrl', $sContent);
77 68
		}
78
/* ### filter type: moves css definitions from <body> into <head> ########### */
79
		if (file_exists($sFilterDirectory.'filterCssToHead.php')) {
80
			require_once($sFilterDirectory.'filterCssToHead.php');
81
			$content = doFilterCssToHead($content);
82
		}
83

  
69
        $sContent = OutputFilterApi('CssToHead', $sContent);
84 70
/* ### end of filters ####################################################### */
85
		return $content;
71
		return $sContent;
86 72
	}
87 73
/* ************************************************************************** */
88 74
/**
......
93 79
 * @return array contains all settings
94 80
 */
95 81
	function getOutputFilterSettings() {
96
		global $database, $admin;
82
        $oDb = WbDatabase::getInstance();
97 83
	// set default values
98 84
		$settings = array(
99 85
			'sys_rel'         => 0,
86
            'opf'             => 0,
100 87
			'email_filter'    => 0,
101 88
			'mailto_filter'   => 0,
102 89
			'at_replacement'  => '(at)',
103 90
			'dot_replacement' => '(dot)'
104 91
		);
105 92
	// be sure field 'sys_rel' is in table
106
		$database->field_add( TABLE_PREFIX.'mod_output_filter', 'sys_rel', 'INT NOT NULL DEFAULT \'0\' FIRST');
93
		$oDb->field_add( $oDb->TablePrefix.'mod_output_filter', 'sys_rel', 'INT NOT NULL DEFAULT \'0\' FIRST');
107 94
	// request settings from database
108
		$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_output_filter` ';
109
		if(($res = $database->query($sql))) {
110
			if(($rec = $res->fetchRow())) {
95
		$sql = 'SELECT * FROM `'.$oDb->TablePrefix.'mod_output_filter` ';
96
		if(($res = $oDb->doQuery($sql))) {
97
			if(($rec = $res->fetchRow(MYSQL_ASSOC))) {
111 98
				$settings = $rec;
112
				$settings['at_replacement']  = $admin->strip_slashes($settings['at_replacement']);
113
				$settings['dot_replacement'] = $admin->strip_slashes($settings['dot_replacement']);
114 99
			}
115 100
		}
116 101
	// return array with filter settings
branches/2.8.x/wb/modules/output_filter/upgrade.php
57 57
					$msg[] = $database->get_error();
58 58
				}
59 59
			}
60
// change table structure
60 61
			$table_name = $database->TablePrefix.'mod_output_filter';
61 62
			$field_name = 'sys_rel';
62 63
			$description = 'INT(11) NOT NULL DEFAULT \'0\' FIRST';
63
			if(!$database->field_exists($table_name,$field_name)) {
64
				$database->field_add($table_name, $field_name, $description);
65
				$msg[] = 'Add field `sys_rel` FIRST'." $OK";
64
			if(!$database->isField($table_name,$field_name)) {
65
				$database->addField($table_name, $field_name, $description);
66
				$msg[] = 'Add field `'.$field_name.'` FIRST'." $OK";
66 67
			} else {
67
				$msg[] = 'Field `sys_rel` already exists'." $OK";
68
				$msg[] = 'Field `'.$field_name.'` already exists'." $OK";
68 69
			}
69
// change table structure
70
			$field_name = 'opf';
71
			if(!$database->isField($table_name,$field_name)) {
72
				$database->addField($table_name, $field_name, $description);
73
				$msg[] = 'Add field `'.$field_name.'` FIRST'." $OK";
74
			} else {
75
				$msg[] = 'Field `'.$field_name.'` already exists'." $OK";
76
			}
70 77
			$sTable = $database->TablePrefix.'mod_output_filter';
71 78
			$sDescription = 'int(11) NOT NULL DEFAULT \'0\'';
72 79
			$sFieldName = 'sys_rel';

Also available in: Unified diff