simple html filter
This commit is contained in:
parent
25cf5b6078
commit
7641b372ef
131
string.php
131
string.php
@ -125,5 +125,136 @@ function markUp($text) {
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
function onlySimpleHTML($s) {
|
||||
$s = str_replace ( array (
|
||||
'<',
|
||||
'>'
|
||||
), array (
|
||||
'{{|-<-|}}',
|
||||
'{{|->-|}}'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}b{{|->-|}}',
|
||||
'{{|-<-|}}b/{{|->-|}}'
|
||||
), array (
|
||||
'<b>',
|
||||
'<b/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}u{{|->-|}}',
|
||||
'{{|-<-|}}u/{{|->-|}}'
|
||||
), array (
|
||||
'<u>',
|
||||
'<u/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}i{{|->-|}}',
|
||||
'{{|-<-|}}i/{{|->-|}}'
|
||||
), array (
|
||||
'<i>',
|
||||
'<i/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}span{{|->-|}}',
|
||||
'{{|-<-|}}span/{{|->-|}}'
|
||||
), array (
|
||||
'<span>',
|
||||
'<span/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}b{{|->-|}}',
|
||||
'{{|-<-|}}b/{{|->-|}}'
|
||||
), array (
|
||||
'<b>',
|
||||
'<b/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}br{{|->-|}}',
|
||||
'{{|-<-|}}br/{{|->-|}}'
|
||||
), array (
|
||||
'<br>',
|
||||
'<br/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h1{{|->-|}}',
|
||||
'{{|-<-|}}h1/{{|->-|}}'
|
||||
), array (
|
||||
'<h1>',
|
||||
'<h1/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h2{{|->-|}}',
|
||||
'{{|-<-|}}h2/{{|->-|}}'
|
||||
), array (
|
||||
'<h2>',
|
||||
'<h2/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h3{{|->-|}}',
|
||||
'{{|-<-|}}h3/{{|->-|}}'
|
||||
), array (
|
||||
'<h3>',
|
||||
'<h3/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h4{{|->-|}}',
|
||||
'{{|-<-|}}h4/{{|->-|}}'
|
||||
), array (
|
||||
'<h4>',
|
||||
'<h4/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h5{{|->-|}}',
|
||||
'{{|-<-|}}h5/{{|->-|}}'
|
||||
), array (
|
||||
'<h5>',
|
||||
'<h5/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}h6{{|->-|}}',
|
||||
'{{|-<-|}}h6/{{|->-|}}'
|
||||
), array (
|
||||
'<h6>',
|
||||
'<h6/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}li{{|->-|}}',
|
||||
'{{|-<-|}}li/{{|->-|}}'
|
||||
), array (
|
||||
'<li>',
|
||||
'<li/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}ul{{|->-|}}',
|
||||
'{{|-<-|}}ul/{{|->-|}}'
|
||||
), array (
|
||||
'<ul>',
|
||||
'<ul/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}ol{{|->-|}}',
|
||||
'{{|-<-|}}ol/{{|->-|}}'
|
||||
), array (
|
||||
'<ol>',
|
||||
'<ol/>'
|
||||
), $s );
|
||||
$s = str_replace ( array (
|
||||
'{{|-<-|}}pre{{|->-|}}',
|
||||
'{{|-<-|}}pre/{{|->-|}}'
|
||||
), array (
|
||||
'<pre>',
|
||||
'<pre/>'
|
||||
), $s );
|
||||
|
||||
// cleanup
|
||||
$s = str_replace ( array (
|
||||
'{{|-',
|
||||
'-|}}'
|
||||
), array (
|
||||
'',
|
||||
''
|
||||
), $s );
|
||||
|
||||
return $s;
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user