Project

General

Profile

« Previous | Next » 

Revision 1656

Added by darkviper over 12 years ago

fixed filter to serve malformed/nested HTML also.

View differences:

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

  
14
02 Apr-2012 Build 1656 Werner v.d.Decken(DarkViper)
15
# fixed filter to serve malformed/nested HTML also.
14 16
01 Apr-2012 Build 1655 Dietmar Woellbrink (Luisehahne)
15 17
+ add replyto to form module (see DEVINFOS)
16 18
01 Apr-2012 Build 1654 Dietmar Woellbrink (Luisehahne)
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.3');
54
if(!defined('REVISION')) define('REVISION', '1655');
54
if(!defined('REVISION')) define('REVISION', '1656');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/modules/output_filter/filters/filterCssToHead.php
4 4
 * @param string $content
5 5
 * @return string
6 6
 */
7
	function doFilterCssToHead($content) {
7
	function doFilterCssToHead($sContent) {
8 8
		// move css definitions into head section
9
		$pattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si';
10
		$pattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]*?>.*?<\/style>)/si';
11
		while(preg_match($pattern1, $content, $matches)==1) {
12
		// loop through all linked CSS
13
			$insert = $matches[1];
14
			$content = str_replace($insert, '', $content);
15
			$insert = "\n".$insert."\n</head>\n<body";
16
			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
9

  
10
		$sPattern1 = '/(?:<body.*?)(<link[^>]*?\"text\/css\".*?\/>)/si';
11
		$sPattern2 = '/(?:<body.*?)(<style[^>]*?\"text\/css\"[^>]*?>.*?<\/style>)/si';
12
		$aInsert = array();
13
		while(preg_match($sPattern1, $sContent, $aMatches)) {
14
			$aInsert[] = $aMatches[1];
15
			$sContent = str_replace($aMatches[1], '', $sContent); 
17 16
		}
18
		while(preg_match($pattern2, $content, $matches)==1) {
19
		// loop through all inline CSS
20
			$insert = $matches[1];
21
			$content = str_replace($insert, '', $content);
22
			$insert = "\n".$insert."\n</head>\n<body";
23
			$content = preg_replace('/<\/head>.*?<body/si', $insert, $content);
17
		while(preg_match($sPattern2, $sContent, $aMatches)) {
18
			$aInsert[] = $aMatches[1];
19
			$sContent = str_replace($aMatches[1], '', $sContent);
24 20
		}
25
		return $content;
21
		$aInsert = array_unique($aInsert);
22
		if(sizeof($aInsert) > 0) {
23
			$sInsert = "\n".implode("\n", $aInsert)."\n</head>\n<body";
24
			$sContent = preg_replace('/<\/head>.*?<body/si', $sInsert, $sContent, 1);
25
		}
26
		return $sContent;
26 27
	}

Also available in: Unified diff