preg_*
ben bezig met een script.. dus ik selecteer een tekst, nou moet ik de tekst alleen laten verder gaan als er de stukjes '< ?php .. ?>' (zonder die spatie in < ?) en '<script .. >'
en '<style .. >' niet in zitten, dus alleen als het < en > is, maar als het nou een php stukje is, dan moetie het negeren.. is dat mogelijk met de functie preg_match_all??
en zoja hoe.. ik kan ongeveer met die functie omgaan.. maar niet helemaal :P
alvast bedankt
Gewijzigd op 01/01/1970 01:00:00 door The Hosh
In dat geval zou je een preg_replace kunnen uitvoeren met een pattern als dit bijv. Hij is niet netjes of erg goed, maar hij werkt.
Code (php)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
<?php
$text = <<<HEREDOC
Hell oworld
<script>document.write('JS')</script>
en
<style type="text/css">iets</style>
jaja
HEREDOC;
echo preg_replace('/<([script|style|\?php])+[ ]*.*>(.+?)<\/[script|style|\?php]+>/i', '', $text);
?>
$text = <<<HEREDOC
Hell oworld
<script>document.write('JS')</script>
en
<style type="text/css">iets</style>
jaja
HEREDOC;
echo preg_replace('/<([script|style|\?php])+[ ]*.*>(.+?)<\/[script|style|\?php]+>/i', '', $text);
?>
en hoe voeg ik het daarna weer toe dan?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
$text = <<<HEREDOC
Hell oworld
<script>document.write('JS')</script>
en
<style type="text/css">iets</style>
jaja
HEREDOC;
$temporaryContent = array();
function saveTemporaryContent($content)
{
global $temporaryContent;
$uniqId = uniqId('placeholder', true);
$temporaryContent[$uniqId] = stripslashes($content);
return $uniqId;
}
$cleanText = strtoupper(preg_replace('/(<([script|style|\?php])+[ ]*.*>(.+?)<\/[script|style|\?php]+>)/ie', 'saveTemporaryContent("$1")', $text));
echo '<p>' . $cleanText . '</p>';
echo '<p>' . str_ireplace(array_keys($temporaryContent), $temporaryContent, $cleanText) . '</p>';
?>
$text = <<<HEREDOC
Hell oworld
<script>document.write('JS')</script>
en
<style type="text/css">iets</style>
jaja
HEREDOC;
$temporaryContent = array();
function saveTemporaryContent($content)
{
global $temporaryContent;
$uniqId = uniqId('placeholder', true);
$temporaryContent[$uniqId] = stripslashes($content);
return $uniqId;
}
$cleanText = strtoupper(preg_replace('/(<([script|style|\?php])+[ ]*.*>(.+?)<\/[script|style|\?php]+>)/ie', 'saveTemporaryContent("$1")', $text));
echo '<p>' . $cleanText . '</p>';
echo '<p>' . str_ireplace(array_keys($temporaryContent), $temporaryContent, $cleanText) . '</p>';
?>
voor nu bedankt.. maar ik zal hem ff uitprobere.. en dan zegge
greetz
In mijn testopstelling zou je dat kunnen tenietdoen door
te vervangen met
Maar ik denk dat je dat buiten mijn testje niet nodig zal hebben.
thxx :D
ff de stukje laten zien wat ik gebruik:
dit is wat ik gebruik om de text te selecteren:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
/**
* HTML
* Coding begins only with < and ends with >
*/
preg_match_all('#(<.*?'.'>)#is', $highlighted, $matches);
for ($i = 0; $i <= count($matches[0]); $i++)
{
$replacer = highlight_html($matches[0][$i]);
$highlighted = str_replace($matches[0][$i], $replacer, $highlighted);
}
?>
/**
* HTML
* Coding begins only with < and ends with >
*/
preg_match_all('#(<.*?'.'>)#is', $highlighted, $matches);
for ($i = 0; $i <= count($matches[0]); $i++)
{
$replacer = highlight_html($matches[0][$i]);
$highlighted = str_replace($matches[0][$i], $replacer, $highlighted);
}
?>
en dit is de functie, in dit functie heb ik wat van de gecodeerde dinge kleur gegeven word, maar dat kom omdat het anders de hele text verpest:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/**
* This will give html code a color ($input)
* some things aren't html. that's because we
* have encode these at the beginnen of the highlightstring()
* What the encoded string are, you have to read by the string itsel :-P
*/
function highlight_html($input)
{
/**
* These three array will make it easyer to preg_replace to colors
*/
$commands_boldblue = array
(
'#(\ba\b)#', '#(\babbr\b)#', '#(\babove\b)#', '#(\bacronym\b)#', '#(\baddress\b)#', '#(\bapplet\b)#', '#(\barea\b)#',
'#(\barray\b)#', '#(\bb\b)#', '#(\bbase\b)#', '#(\bbdo\b)#', '#(\bbgsound\b)#', '#(\bbig\b)#', '#(\bxmp\b)#',
'#(\bblink\b)#', '#(\bblockquote\b)#', '#(\bbody\b)#', '#(\bbox\b)#', '#(\bbr\b)#', '#(\bbutton\b)#', '#(\bcaption\b)#',
'#(\bcenter\b)#', '#(\bcite\b)#', '#(\bcode\b)#', '#(\bcol\b)#', '#(\bcolgroup\b)#', '#(\bcomment\b)#', '#(\bdd\b)#',
'#(\bdel\b)#', '#(\bdfn\b)#', '#(\bdir\b)#', '#(\bdiv\b)#', '#(\bdl\b)#', '#(\bdoctype\b)#', '#(\bdt\b)#', '#(\bem\b)#',
'#(\bembed\b)#', '#(\bfieldset\b)#', '#(\bfig\b)#', '#(\bform\b)#', '#(\bframe\b)#', '#(\bframeset\b)#', '#(\btfoot\b)#',
'#(\bh\b)#', '#(\bh1\b)#', '#(\bh2\b)#', '#(\bh3\b)#', '#(\bh4\b)#', '#(\bh5\b)#', '#(\bh6\b)#', '#(\bhead\b)#',
'#(\bhr\b)#', '#(\bhta\b)#', '#(\bhtml\b)#', '#(\bi\b)#', '#(\biframe\b)#', '#(\bimg\b)#', '#(\binput\b)#', '#(\bins\b)#',
'#(\bisindex\b)#', '#(\bkbd\b)#', '#(\blabel\b)#', '#(\blegend\b)#', '#(\bli\b)#', '#(\blink\b)#', '#(\blisting\b)#',
'#(\bmap\b)#', '#(\bmarquee\b)#', '#(\bmenu\b)#', '#(\bmeta\b)#', '#(\bmulticol\b)#', '#(\bnextid\b)#', '#(\bnobr\b)#',
'#(\bnoframes\b)#', '#(\bnoscript\b)#', '#(\bnote\b)#', '#(\bol\b)#', '#(\boptgroup\b)#', '#(\boption\b)#', '#(\bp\b)#',
'#(\bparam\b)#', '#(\bplaintext\b)#', '#(\bpre\b)#', '#(\bq\b)#', '#(\brange\b)#', '#(\broot\b)#', '#(\bs\b)#',
'#(\bsamp\b)#', '#(\bselect\b)#', '#(\bsmall\b)#', '#(\bsound\b)#', '#(\bspacer\b)#', '#(\btbody\b)#', '#(\btd\b)#',
'#(\bsqrt\b)#', '#(\bstrike\b)#', '#(\bstrong\b)#', '#(\bsub\b)#', '#(\bsup\b)#', '#(\btext\b)#', '#(\btextarea\b)#',
'#(\btable\b)#', '#(\btextflow\b)#', '#(\bth\b)#', '#(\bthead\b)#', '#(\btitle\b)#', '#(\btr\b)#', '#(\btt\b)#',
'#(\bu\b)#', '#(\bul\b)#', '#(\bvar\b)#', '#(\bwbr\b)#',
/**
* we replaced the text 'span' in 'c3Bhbg' by using
* the function base64_encode().
* so the next text is 'span'
*/
'#(\bc3Bhbg\b)#',
/**
* we replaced the text 'style' in 'c3R5bGU' by using
* the function base64_encode().
* so the next text is 'style'
*/
'#(\bc3R5bGU\b)#',
/**
* we replaced the text 'font' in 'Zm9udA' by using
* the function base64_encode().
* so the next two texts are
* [1] basefont
* [2] font
*/
'#(\bbaseZm9udA\b)#',
'#(\bZm9udA\b)#'
);
$commands_red = array
(
'#(\baccept\b)#', '#(\baccesskey\b)#', '#(\baction\b)#', '#(\balign\b)#', '#(\balink\b)#', '#(\balt\b)#',
'#(\bapplicationname\b)#', '#(\barchive\b)#', '#(\baxis\b)#', '#(\bbackground\b)#', '#(\bbehavior\b)#', '#(\bbelow\b)#',
'#(\bcellpadding\b)#', '#(\bbgproperties\b)#', '#(\bborder\b)#', '#(\bcellspacing\b)#', '#(\bchar\b)#',
'#(\bcharoff\b)#', '#(\bcharset\b)#', '#(\bchecked\b)#', '#(\bclass\b)#', '#(\bclassid\b)#', '#(\bclear\b)#',
'#(\bcodebase\b)#', '#(\bcodetype\b)#', '#(\bcols\b)#', '#(\bcompact\b)#', '#(\bhttp-equiv\b)#', '#(\bhttp-equiv\b)#',
'#(\bcontent\b)#', '#(\bcoords\b)#', '#(\bdata\b)#', '#(\bdatetime\b)#', '#(\bdeclare\b)#', '#(\bdefer\b)#',
'#(\bdirection\b)#', '#(\bdisabled\b)#', '#(\bdynsrc\b)#', '#(\benctype\b)#', '#(\bequiv\b)#', '#(\bface\b)#',
'#(\bfor\b)#', '#(\bframeborder\b)#', '#(\bframespacing\b)#', '#(\bgutter\b)#', '#(\bheaders\b)#', '#(\bheight\b)#',
'#(\bhref\b)#', '#(\bhreflang\b)#', '#(\bhspace\b)#', '#(\bicon\b)#', '#(\bid\b)#', '#(\bismap\b)#',
'#(\blanguage\b)#', '#(\bleftmargin\b)#', '#(\blongdesc\b)#', '#(\bloop\b)#', '#(\blowsrc\b)#', '#(\bmarginheight\b)#',
'#(\bmarginwidth\b)#', '#(\bmaximizebutton\b)#', '#(\bmaxlength\b)#', '#(\bmedia\b)#', '#(\bmethod\b)#', '#(\bmethods\b)#',
'#(\bminimizebutton\b)#', '#(\bmultiple\b)#', '#(\bname\b)#', '#(\bnohref\b)#', '#(\bnoresize\b)#', '#(\bnoshade\b)#',
'#(\bnowrap\b)#', '#(\bobject\b)#', '#(\bonabort\b)#', '#(\bonblur\b)#', '#(\bonchange\b)#', '#(\bonclick\b)#',
'#(\bondblclick\b)#', '#(\bonfocus\b)#', '#(\bonkeydown\b)#', '#(\bonkeypress\b)#', '#(\bonkeyup\b)#', '#(\bonload\b)#',
'#(\bonmousedown\b)#', '#(\bonmousemove\b)#', '#(\bonmouseout\b)#', '#(\bonmouseover\b)#', '#(\bonmouseup\b)#',
'#(\bonreset\b)#', '#(\bonselect\b)#', '#(\bonsubmit\b)#', '#(\bonunload\b)#', '#(\bprofile\b)#', '#(\bprompt\b)#',
'#(\breadonly\b)#', '#(\brel\b)#', '#(\brev\b)#', '#(\brows\b)#',
'#(\brules\b)#', '#(\brunat\b)#', '#(\bscheme\b)#', '#(\bscope\b)#', '#(\bscrollamount\b)#', '#(\bscrolldelay\b)#',
'#(\bshape\b)#', '#(\bshowintaskbar\b)#', '#(\bsingleinstance\b)#', '#(\bsize\b)#', '#(\bsrc\b)#', '#(\bstandby\b)#',
'#(\bstart\b)#', '#(\bsummary\b)#', '#(\bsysmenu\b)#', '#(\btabindex\b)#', '#(\btarget\b)#', '#(\btopmargin\b)#',
'#(\btype\b)#', '#(\burn\b)#', '#(\busemap\b)#', '#(\bvalign\b)#', '#(\bvalue\b)#', '#(\bvaluetype\b)#',
'#(\bversion\b)#', '#(\bvlink\b)#', '#(\bvrml\b)#', '#(\bvspace\b)#', '#(\bwidth\b)#', '#(\bwindowstate\b)#',
'#(\bwrap\b)#', '#(\bscrolling\b)#', '#(\bselected\b)#',
/**
* we replaced the text 'color' in 'Y29sb3I' by using
* the function base64_encode().
* So the next five texts are
* [1] bordercolor
* [2] bordercolordark
* [3] bordercolorlight
* [4] bgcolor
* [5] color
*/
'#(\bborderY29sb3I\b)#',
'#(\bborderY29sb3Idark\b)#',
'#(\bborderY29sb3Ilight\b)#',
'#(\bbgY29sb3I\b)#',
'#(\bY29sb3I\b)#',
/**
* we replaced the text 'span' in 'c3Bhbg' by using
* the function base64_encode().
* so the next two texts are
* [1] rowspan
* [2] colspan
*/
'#(\browc3Bhbg\b)#',
'#(\bcolc3Bhbg\b)#',
/**
* we replaced the text 'style' in 'c3R5bGU' by using
* the function base64_encode().
* so the next text is 'borderstyle'
*/
'#(\bborderc3R5bGU\b)#'
);
$commands_purple = array
(
'#(\b_blank\b)#', '#(\bblack\b)#', '#(\bblue\b)#', '#(\bbottom\b)#', '#(\bgreen\b)#', '#(\bhidden\b)#', '#(\bleft\b)#',
'#(\bmagenta\b)#', '#(\bmiddle\b)#', '#(\borange\b)#', '#(\bpublic\b)#', '#(\bpurple\b)#', '#(\bred\b)#', '#(\bright\b)#',
'#(\btop\b)#', '#(\bwhite\b)#', '#(\byellow\b)#'
);
/**
* First we make the < and > special html characters, otherwise it won't echo
*/
$temp = str_replace('<', '<', $input);
$temp = str_replace('>', '>', $temp);
/**
* Then we give the things in the arrays $commands_purple,
* $commands_red and $commands_boldblue their own color
*/
$temp = preg_replace($commands_purple, '<span style="color: #9C029C;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_boldblue, '<span style="color: #0000FF;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_red, '<span style="color: red;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_red, '<span style="color: red;font-weight:bold">$1</span>', $temp);
return $temp;
}
?>
/**
* This will give html code a color ($input)
* some things aren't html. that's because we
* have encode these at the beginnen of the highlightstring()
* What the encoded string are, you have to read by the string itsel :-P
*/
function highlight_html($input)
{
/**
* These three array will make it easyer to preg_replace to colors
*/
$commands_boldblue = array
(
'#(\ba\b)#', '#(\babbr\b)#', '#(\babove\b)#', '#(\bacronym\b)#', '#(\baddress\b)#', '#(\bapplet\b)#', '#(\barea\b)#',
'#(\barray\b)#', '#(\bb\b)#', '#(\bbase\b)#', '#(\bbdo\b)#', '#(\bbgsound\b)#', '#(\bbig\b)#', '#(\bxmp\b)#',
'#(\bblink\b)#', '#(\bblockquote\b)#', '#(\bbody\b)#', '#(\bbox\b)#', '#(\bbr\b)#', '#(\bbutton\b)#', '#(\bcaption\b)#',
'#(\bcenter\b)#', '#(\bcite\b)#', '#(\bcode\b)#', '#(\bcol\b)#', '#(\bcolgroup\b)#', '#(\bcomment\b)#', '#(\bdd\b)#',
'#(\bdel\b)#', '#(\bdfn\b)#', '#(\bdir\b)#', '#(\bdiv\b)#', '#(\bdl\b)#', '#(\bdoctype\b)#', '#(\bdt\b)#', '#(\bem\b)#',
'#(\bembed\b)#', '#(\bfieldset\b)#', '#(\bfig\b)#', '#(\bform\b)#', '#(\bframe\b)#', '#(\bframeset\b)#', '#(\btfoot\b)#',
'#(\bh\b)#', '#(\bh1\b)#', '#(\bh2\b)#', '#(\bh3\b)#', '#(\bh4\b)#', '#(\bh5\b)#', '#(\bh6\b)#', '#(\bhead\b)#',
'#(\bhr\b)#', '#(\bhta\b)#', '#(\bhtml\b)#', '#(\bi\b)#', '#(\biframe\b)#', '#(\bimg\b)#', '#(\binput\b)#', '#(\bins\b)#',
'#(\bisindex\b)#', '#(\bkbd\b)#', '#(\blabel\b)#', '#(\blegend\b)#', '#(\bli\b)#', '#(\blink\b)#', '#(\blisting\b)#',
'#(\bmap\b)#', '#(\bmarquee\b)#', '#(\bmenu\b)#', '#(\bmeta\b)#', '#(\bmulticol\b)#', '#(\bnextid\b)#', '#(\bnobr\b)#',
'#(\bnoframes\b)#', '#(\bnoscript\b)#', '#(\bnote\b)#', '#(\bol\b)#', '#(\boptgroup\b)#', '#(\boption\b)#', '#(\bp\b)#',
'#(\bparam\b)#', '#(\bplaintext\b)#', '#(\bpre\b)#', '#(\bq\b)#', '#(\brange\b)#', '#(\broot\b)#', '#(\bs\b)#',
'#(\bsamp\b)#', '#(\bselect\b)#', '#(\bsmall\b)#', '#(\bsound\b)#', '#(\bspacer\b)#', '#(\btbody\b)#', '#(\btd\b)#',
'#(\bsqrt\b)#', '#(\bstrike\b)#', '#(\bstrong\b)#', '#(\bsub\b)#', '#(\bsup\b)#', '#(\btext\b)#', '#(\btextarea\b)#',
'#(\btable\b)#', '#(\btextflow\b)#', '#(\bth\b)#', '#(\bthead\b)#', '#(\btitle\b)#', '#(\btr\b)#', '#(\btt\b)#',
'#(\bu\b)#', '#(\bul\b)#', '#(\bvar\b)#', '#(\bwbr\b)#',
/**
* we replaced the text 'span' in 'c3Bhbg' by using
* the function base64_encode().
* so the next text is 'span'
*/
'#(\bc3Bhbg\b)#',
/**
* we replaced the text 'style' in 'c3R5bGU' by using
* the function base64_encode().
* so the next text is 'style'
*/
'#(\bc3R5bGU\b)#',
/**
* we replaced the text 'font' in 'Zm9udA' by using
* the function base64_encode().
* so the next two texts are
* [1] basefont
* [2] font
*/
'#(\bbaseZm9udA\b)#',
'#(\bZm9udA\b)#'
);
$commands_red = array
(
'#(\baccept\b)#', '#(\baccesskey\b)#', '#(\baction\b)#', '#(\balign\b)#', '#(\balink\b)#', '#(\balt\b)#',
'#(\bapplicationname\b)#', '#(\barchive\b)#', '#(\baxis\b)#', '#(\bbackground\b)#', '#(\bbehavior\b)#', '#(\bbelow\b)#',
'#(\bcellpadding\b)#', '#(\bbgproperties\b)#', '#(\bborder\b)#', '#(\bcellspacing\b)#', '#(\bchar\b)#',
'#(\bcharoff\b)#', '#(\bcharset\b)#', '#(\bchecked\b)#', '#(\bclass\b)#', '#(\bclassid\b)#', '#(\bclear\b)#',
'#(\bcodebase\b)#', '#(\bcodetype\b)#', '#(\bcols\b)#', '#(\bcompact\b)#', '#(\bhttp-equiv\b)#', '#(\bhttp-equiv\b)#',
'#(\bcontent\b)#', '#(\bcoords\b)#', '#(\bdata\b)#', '#(\bdatetime\b)#', '#(\bdeclare\b)#', '#(\bdefer\b)#',
'#(\bdirection\b)#', '#(\bdisabled\b)#', '#(\bdynsrc\b)#', '#(\benctype\b)#', '#(\bequiv\b)#', '#(\bface\b)#',
'#(\bfor\b)#', '#(\bframeborder\b)#', '#(\bframespacing\b)#', '#(\bgutter\b)#', '#(\bheaders\b)#', '#(\bheight\b)#',
'#(\bhref\b)#', '#(\bhreflang\b)#', '#(\bhspace\b)#', '#(\bicon\b)#', '#(\bid\b)#', '#(\bismap\b)#',
'#(\blanguage\b)#', '#(\bleftmargin\b)#', '#(\blongdesc\b)#', '#(\bloop\b)#', '#(\blowsrc\b)#', '#(\bmarginheight\b)#',
'#(\bmarginwidth\b)#', '#(\bmaximizebutton\b)#', '#(\bmaxlength\b)#', '#(\bmedia\b)#', '#(\bmethod\b)#', '#(\bmethods\b)#',
'#(\bminimizebutton\b)#', '#(\bmultiple\b)#', '#(\bname\b)#', '#(\bnohref\b)#', '#(\bnoresize\b)#', '#(\bnoshade\b)#',
'#(\bnowrap\b)#', '#(\bobject\b)#', '#(\bonabort\b)#', '#(\bonblur\b)#', '#(\bonchange\b)#', '#(\bonclick\b)#',
'#(\bondblclick\b)#', '#(\bonfocus\b)#', '#(\bonkeydown\b)#', '#(\bonkeypress\b)#', '#(\bonkeyup\b)#', '#(\bonload\b)#',
'#(\bonmousedown\b)#', '#(\bonmousemove\b)#', '#(\bonmouseout\b)#', '#(\bonmouseover\b)#', '#(\bonmouseup\b)#',
'#(\bonreset\b)#', '#(\bonselect\b)#', '#(\bonsubmit\b)#', '#(\bonunload\b)#', '#(\bprofile\b)#', '#(\bprompt\b)#',
'#(\breadonly\b)#', '#(\brel\b)#', '#(\brev\b)#', '#(\brows\b)#',
'#(\brules\b)#', '#(\brunat\b)#', '#(\bscheme\b)#', '#(\bscope\b)#', '#(\bscrollamount\b)#', '#(\bscrolldelay\b)#',
'#(\bshape\b)#', '#(\bshowintaskbar\b)#', '#(\bsingleinstance\b)#', '#(\bsize\b)#', '#(\bsrc\b)#', '#(\bstandby\b)#',
'#(\bstart\b)#', '#(\bsummary\b)#', '#(\bsysmenu\b)#', '#(\btabindex\b)#', '#(\btarget\b)#', '#(\btopmargin\b)#',
'#(\btype\b)#', '#(\burn\b)#', '#(\busemap\b)#', '#(\bvalign\b)#', '#(\bvalue\b)#', '#(\bvaluetype\b)#',
'#(\bversion\b)#', '#(\bvlink\b)#', '#(\bvrml\b)#', '#(\bvspace\b)#', '#(\bwidth\b)#', '#(\bwindowstate\b)#',
'#(\bwrap\b)#', '#(\bscrolling\b)#', '#(\bselected\b)#',
/**
* we replaced the text 'color' in 'Y29sb3I' by using
* the function base64_encode().
* So the next five texts are
* [1] bordercolor
* [2] bordercolordark
* [3] bordercolorlight
* [4] bgcolor
* [5] color
*/
'#(\bborderY29sb3I\b)#',
'#(\bborderY29sb3Idark\b)#',
'#(\bborderY29sb3Ilight\b)#',
'#(\bbgY29sb3I\b)#',
'#(\bY29sb3I\b)#',
/**
* we replaced the text 'span' in 'c3Bhbg' by using
* the function base64_encode().
* so the next two texts are
* [1] rowspan
* [2] colspan
*/
'#(\browc3Bhbg\b)#',
'#(\bcolc3Bhbg\b)#',
/**
* we replaced the text 'style' in 'c3R5bGU' by using
* the function base64_encode().
* so the next text is 'borderstyle'
*/
'#(\bborderc3R5bGU\b)#'
);
$commands_purple = array
(
'#(\b_blank\b)#', '#(\bblack\b)#', '#(\bblue\b)#', '#(\bbottom\b)#', '#(\bgreen\b)#', '#(\bhidden\b)#', '#(\bleft\b)#',
'#(\bmagenta\b)#', '#(\bmiddle\b)#', '#(\borange\b)#', '#(\bpublic\b)#', '#(\bpurple\b)#', '#(\bred\b)#', '#(\bright\b)#',
'#(\btop\b)#', '#(\bwhite\b)#', '#(\byellow\b)#'
);
/**
* First we make the < and > special html characters, otherwise it won't echo
*/
$temp = str_replace('<', '<', $input);
$temp = str_replace('>', '>', $temp);
/**
* Then we give the things in the arrays $commands_purple,
* $commands_red and $commands_boldblue their own color
*/
$temp = preg_replace($commands_purple, '<span style="color: #9C029C;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_boldblue, '<span style="color: #0000FF;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_red, '<span style="color: red;font-weight:bold">$1</span>', $temp);
$temp = preg_replace($commands_red, '<span style="color: red;font-weight:bold">$1</span>', $temp);
return $temp;
}
?>
Gewijzigd op 01/01/1970 01:00:00 door The Hosh
Niemand?
Niemand??