aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/Utils.php
diff options
context:
space:
mode:
authorArthur <arthur@hoa.ro>2016-03-25 19:20:55 +0100
committerArthur <arthur@hoa.ro>2016-03-25 19:20:55 +0100
commitf66a1990e5d93a6f302ce594968e5e717b93da72 (patch)
tree22e5da81979bc7ee596fcd5c9c56d4c01c599aa4 /application/Utils.php
parentb2764886c7b52ed98debb90b2ebf075dec5ae2e8 (diff)
parent528a6f8a232c060faf024008e4f8a09b4aa8dabc (diff)
downloadShaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.tar.gz
Shaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.tar.zst
Shaarli-f66a1990e5d93a6f302ce594968e5e717b93da72.zip
Merge pull request #515 from ArthurHoaro/template-feeds
Refactor RSS feeds generation, and do it through templates
Diffstat (limited to 'application/Utils.php')
-rw-r--r--application/Utils.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/application/Utils.php b/application/Utils.php
index 3d819716..5b8ca508 100644
--- a/application/Utils.php
+++ b/application/Utils.php
@@ -63,14 +63,22 @@ function endsWith($haystack, $needle, $case=true)
63 63
64/** 64/**
65 * Htmlspecialchars wrapper 65 * Htmlspecialchars wrapper
66 * Support multidimensional array of strings.
66 * 67 *
67 * @param string $str the string to escape. 68 * @param mixed $input Data to escape: a single string or an array of strings.
68 * 69 *
69 * @return string escaped. 70 * @return string escaped.
70 */ 71 */
71function escape($str) 72function escape($input)
72{ 73{
73 return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); 74 if (is_array($input)) {
75 $out = array();
76 foreach($input as $key => $value) {
77 $out[$key] = escape($value);
78 }
79 return $out;
80 }
81 return htmlspecialchars($input, ENT_COMPAT, 'UTF-8', false);
74} 82}
75 83
76/** 84/**
@@ -226,7 +234,7 @@ function space2nbsp($text)
226 * 234 *
227 * @return string formatted description. 235 * @return string formatted description.
228 */ 236 */
229function format_description($description, $redirector) { 237function format_description($description, $redirector = false) {
230 return nl2br(space2nbsp(text2clickable($description, $redirector))); 238 return nl2br(space2nbsp(text2clickable($description, $redirector)));
231} 239}
232 240