author | Dan |
Mon, 30 Jun 2008 12:36:13 -0400 | |
changeset 21 | 74edc873234f |
parent 0 | c63de9eb7045 |
permissions | -rw-r--r-- |
0
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
1 |
<?php |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
2 |
/** |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
3 |
* Smarty shared plugin |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
4 |
* @package Smarty |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
5 |
* @subpackage plugins |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
6 |
*/ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
7 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
8 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
9 |
/** |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
10 |
* escape_special_chars common function |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
11 |
* |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
12 |
* Function: smarty_function_escape_special_chars<br> |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
13 |
* Purpose: used by other smarty functions to escape |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
14 |
* special chars except for already escaped ones |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
15 |
* @author Monte Ohrt <monte at ohrt dot com> |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
16 |
* @param string |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
17 |
* @return string |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
18 |
*/ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
19 |
function smarty_function_escape_special_chars($string) |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
20 |
{ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
21 |
if(!is_array($string)) { |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
22 |
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
23 |
$string = htmlspecialchars($string); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
24 |
$string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string); |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
25 |
} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
26 |
return $string; |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
27 |
} |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
28 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
29 |
/* vim: set expandtab: */ |
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
30 |
|
c63de9eb7045
First commit. Basic things are working and implemented (webserver, templating, DCOP interface)
Dan
parents:
diff
changeset
|
31 |
?> |