]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
introducing html_sprintf for easier sprintf'ing with htmlspecialchars
[quix0rs-gnu-social.git] / lib / util.php
index 1ff5b13b938b0bff8cb61d482119ba275b8523e5..66847a435004815c1569deb0ee3fdc137ecf0eaf 100644 (file)
@@ -2429,3 +2429,12 @@ function common_strip_html($html, $trim=true, $save_whitespace=false)
     $text = html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8');
     return $trim ? trim($text) : $text;
 }
+
+function html_sprintf()
+{
+    $args = func_get_args();
+    for ($i=1; $i<count($args); $i++) {
+        $args[$i] = htmlspecialchars($args[$i]);
+    }
+    return call_user_func_array('sprintf', $args);
+}