]> git.sur5r.net Git - contagged/commitdiff
added missing smarty files
authorAndreas Gohr <gohr@cosmocode.de>
Tue, 19 Jun 2007 14:18:47 +0000 (16:18 +0200)
committerAndreas Gohr <gohr@cosmocode.de>
Tue, 19 Jun 2007 14:18:47 +0000 (16:18 +0200)
darcs-hash:20070619141847-6e07b-379989e17df92f7f977ce78d7eac9755eac7e1e7.gz

inc/smarty/plugins/modifier.h.php [new file with mode: 0644]
inc/smarty/plugins/modifier.http.php [new file with mode: 0644]

diff --git a/inc/smarty/plugins/modifier.h.php b/inc/smarty/plugins/modifier.h.php
new file mode 100644 (file)
index 0000000..84274bf
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Shortcut to the Smarty escape modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     h<br>
+ */
+function smarty_modifier_h($string, $esc_type = 'html', $char_set = 'ISO-8859-1')
+{
+    return smarty_modifier_escape($string,'html','UTF-8');
+}
+
+/* vim: set expandtab: */
+
+?>
diff --git a/inc/smarty/plugins/modifier.http.php b/inc/smarty/plugins/modifier.http.php
new file mode 100644 (file)
index 0000000..a3fffbc
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+
+/**
+ * Smarty plugin
+ *
+ * Type:     modifier
+ * Name:     noteparser
+ * Date:     2007-06-19
+ * Purpose:  Add the http:// protocol if missing
+ * Example:  {$foo|http}
+ * @author   Andreas Gohr <gohr@cosmocode.de>
+ * @param string
+ * @return string
+ */
+function smarty_modifier_http($string){
+    if(!$string) return '';
+
+    if(!preg_match('#^\w+://#',$string)){
+        $string = 'http://'.$string;
+    }
+
+    return $string;
+}
+
+/* vim: set expandtab: */
+
+?>