aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStefan Parviainen <saparvia@caterva.eu>2014-12-21 09:50:47 +0100
committerStefan Parviainen <saparvia@caterva.eu>2014-12-21 09:50:47 +0100
commit4e5118650225fe0e194ac8164c47916575e898b3 (patch)
tree22e1676a173167b6f340fa8826a184d9efe9479b /include
parentd1f53511921afce820d73eb2d2924e2a4aa8ba14 (diff)
parent148f0eb4aed6fdbec62f50d87e6db0c8df35fe28 (diff)
downloadvolse-hubzilla-4e5118650225fe0e194ac8164c47916575e898b3.tar.gz
volse-hubzilla-4e5118650225fe0e194ac8164c47916575e898b3.tar.bz2
volse-hubzilla-4e5118650225fe0e194ac8164c47916575e898b3.zip
Merge remote-tracking branch 'upstream/master' into autocomplete
Diffstat (limited to 'include')
-rw-r--r--include/text.php69
1 files changed, 38 insertions, 31 deletions
diff --git a/include/text.php b/include/text.php
index ee0fef262..6516d734d 100644
--- a/include/text.php
+++ b/include/text.php
@@ -958,37 +958,10 @@ function get_mood_verbs() {
return $arr;
}
-
-/**
- *
- * Function: smilies
- *
- * Description:
- * Replaces text emoticons with graphical images
- *
- * @Parameter: string $s
- *
- * Returns string
- *
- * It is expected that this function will be called using HTML text.
- * We will escape text between HTML pre and code blocks, and HTML attributes
- * (such as urls) from being processed.
- *
- * At a higher level, the bbcode [nosmile] tag can be used to prevent this
- * function from being executed by the prepare_text() routine when preparing
- * bbcode source for HTML display
- *
- */
-function smilies($s, $sample = false) {
+// Function to list all smilies, both internal and from addons
+// Returns array with keys 'texts' and 'icons'
+function list_smilies() {
$a = get_app();
-
- if(intval(get_config('system','no_smilies'))
- || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
- return $s;
-
- $s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism','smile_shield',$s);
- $s = preg_replace_callback('/<[a-z]+ .*?>/ism','smile_shield',$s);
-
$texts = array(
'&lt;3',
'&lt;/3',
@@ -1066,8 +1039,42 @@ function smilies($s, $sample = false) {
);
- $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
+ $params = array('texts' => $texts, 'icons' => $icons);
call_hooks('smilie', $params);
+ return $params;
+}
+/**
+ *
+ * Function: smilies
+ *
+ * Description:
+ * Replaces text emoticons with graphical images
+ *
+ * @Parameter: string $s
+ *
+ * Returns string
+ *
+ * It is expected that this function will be called using HTML text.
+ * We will escape text between HTML pre and code blocks, and HTML attributes
+ * (such as urls) from being processed.
+ *
+ * At a higher level, the bbcode [nosmile] tag can be used to prevent this
+ * function from being executed by the prepare_text() routine when preparing
+ * bbcode source for HTML display
+ *
+ */
+function smilies($s, $sample = false) {
+ $a = get_app();
+
+ if(intval(get_config('system','no_smilies'))
+ || (local_user() && intval(get_pconfig(local_user(),'system','no_smilies'))))
+ return $s;
+
+ $s = preg_replace_callback('{<(pre|code)>.*?</\1>}ism','smile_shield',$s);
+ $s = preg_replace_callback('/<[a-z]+ .*?>/ism','smile_shield',$s);
+
+ $params = list_smilies();
+ $params['string'] = $s;
if($sample) {
$s = '<div class="smiley-sample">';