]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
:coffee extended smilie
[friendica.git] / include / text.php
old mode 100644 (file)
new mode 100755 (executable)
index d6b3cee..9aca145
@@ -426,6 +426,10 @@ function attribute_contains($attr,$s) {
 
 if(! function_exists('logger')) {
 function logger($msg,$level = 0) {
+       // turn off logger in install mode
+       global $a;
+       if ($a->module == 'install') return;
+       
        $debugging = get_config('system','debugging');
        $loglevel  = intval(get_config('system','loglevel'));
        $logfile   = get_config('system','logfile');
@@ -674,7 +678,8 @@ function smilies($s) {
        $a = get_app();
 
        $s = str_replace(
-       array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/',
+       array( '<3', '</3', '<\\3', ':-)', ':)', ';-)', ':-(', ':(', ':-P', ':P', ':-"', ':-x', ':-X', ':-D', '8-|', '8-O', '\\o/', 'o.O', 'O.o', '\\.../', '\\ooo/', 
+ ':beer', ':homebrew', ':coffee', 
                '~friendika', '~friendica', 'Diaspora*' ),
        array(
                '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />',
@@ -694,6 +699,14 @@ function smilies($s) {
                '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-|" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-surprised.gif" alt="8-O" />',
                '<img src="' . $a->get_baseurl() . '/images/smiley-thumbsup.gif" alt="\\o/" />',
+               '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="o.O" />',
+               '<img src="' . $a->get_baseurl() . '/images/smiley-Oo.gif" alt="O.o" />',
+               '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\.../" />',
+               '<img src="' . $a->get_baseurl() . '/images/smiley-shaka.gif" alt="\\ooo/" />',
+               '<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":beer" />',
+               '<img src="' . $a->get_baseurl() . '/images/beer_mug.gif" alt=":homebrew" />',
+               '<img src="' . $a->get_baseurl() . '/images/coffee.gif" alt=":coffee" />',
+
                '<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>',
                '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendica" /></a>',
                '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
@@ -940,6 +953,11 @@ function base64url_encode($s, $strip_padding = false) {
 
 function base64url_decode($s) {
 
+       if(is_array($s)) {
+               logger('base64url_decode: illegal input: ' . print_r(debug_backtrace(), true));
+               return $s;
+       }
+
 /*
  *  // Placeholder for new rev of salmon which strips base64 padding.
  *  // PHP base64_decode handles the un-padded input without requiring this step
@@ -1059,3 +1077,37 @@ function array_xmlify($val){
        if (is_array($val)) return array_map('array_xmlify', $val);
        return xmlify((string) $val);
 }
+
+
+function reltoabs($text, $base)
+{
+  if (empty($base))
+    return $text;
+
+  $base = rtrim($base,'/');
+
+  $base2 = $base . "/";
+       
+  // Replace links
+  $pattern = "/<a([^>]*) href=\"(?!http|https|\/)([^\"]*)\"/";
+  $replace = "<a\${1} href=\"" . $base2 . "\${2}\"";
+  $text = preg_replace($pattern, $replace, $text);
+
+  $pattern = "/<a([^>]*) href=\"(?!http|https)([^\"]*)\"/";
+  $replace = "<a\${1} href=\"" . $base . "\${2}\"";
+  $text = preg_replace($pattern, $replace, $text);
+
+  // Replace images
+  $pattern = "/<img([^>]*) src=\"(?!http|https|\/)([^\"]*)\"/";
+  $replace = "<img\${1} src=\"" . $base2 . "\${2}\"";
+  $text = preg_replace($pattern, $replace, $text); 
+
+  $pattern = "/<img([^>]*) src=\"(?!http|https)([^\"]*)\"/";
+  $replace = "<img\${1} src=\"" . $base . "\${2}\"";
+  $text = preg_replace($pattern, $replace, $text); 
+
+
+  // Done
+  return $text;
+}
+