From a265afe7eb43bfe494669ee245c97bd7460fb671 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 6 Mar 2012 20:44:53 +0000 Subject: added beard smileys --- include/text.php | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) mode change 100755 => 100644 include/text.php (limited to 'include') diff --git a/include/text.php b/include/text.php old mode 100755 new mode 100644 index c8c03174e..2667ddddc --- a/include/text.php +++ b/include/text.php @@ -14,13 +14,7 @@ if(! function_exists('replace_macros')) { function replace_macros($s,$r) { global $t; - //$ts = microtime(); - $r = $t->replace($s,$r); - //$tt = microtime() - $ts; - - //$a = get_app(); - //$a->page['debug'] .= "$tt
\n"; - return $r; + return $t->replace($s,$r); }} @@ -737,7 +731,9 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika', '~friendica', -// 'Diaspora*' + 'Diaspora*', + ':beard', + ':whitebeard' ); $icons = array( @@ -778,7 +774,9 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika ~friendika', '~friendica ~friendica', -// 'DiasporaDiaspora*', + 'DiasporaDiaspora*', + ':beard', + ':whitebeard' ); @@ -792,7 +790,6 @@ function smilies($s, $sample = false) { } } else { - $params['string'] = preg_replace_callback('/<(3+)/','preg_heart',$params['string']); $s = str_replace($params['texts'],$params['icons'],$params['string']); } @@ -811,18 +808,7 @@ function smile_decode($m) { return(str_replace($m[1],base64url_decode($m[1]),$m[0])); } -// expand <3333 to the correct number of hearts -function preg_heart($x) { - $a = get_app(); - if(strlen($x[1]) == 1) - return $x[0]; - $t = ''; - for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) - $t .= '<3'; - $r = str_replace($x[0],$t,$x[0]); - return $r; -} if(! function_exists('day_translate')) { @@ -1014,7 +1000,7 @@ function lang_selector() { } $ll = substr($l,5); $ll = substr($ll,0,strrpos($ll,'/')); - $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : ''); + $selected = (($ll === $lang && (x($_SESSION['language']))) ? ' selected="selected" ' : ''); $o .= ''; } } @@ -1219,16 +1205,3 @@ function reltoabs($text, $base) return $text; } -function item_post_type($item) { - if(intval($item['event-id'])) - return t('event'); - if(strlen($item['resource-id'])) - return t('photo'); - if(strlen($item['verb']) && $item['verb'] !== ACTIVITY_POST) - return t('activity'); - if($item['id'] != $item['parent']) - return t('comment'); - return t('post'); -} - - -- cgit v1.2.3 From 67456bad067dd06c5775979c07c25c767164da36 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 6 Mar 2012 20:50:38 +0000 Subject: Fixed...merged with mainline THEN added beards. --- include/text.php | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/text.php b/include/text.php index 2667ddddc..e7c95d35c 100644 --- a/include/text.php +++ b/include/text.php @@ -14,7 +14,13 @@ if(! function_exists('replace_macros')) { function replace_macros($s,$r) { global $t; - return $t->replace($s,$r); + //$ts = microtime(); + $r = $t->replace($s,$r); + //$tt = microtime() - $ts; + + //$a = get_app(); + //$a->page['debug'] .= "$tt
\n"; + return $r; }} @@ -731,9 +737,10 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika', '~friendica', - 'Diaspora*', +// 'Diaspora*' ':beard', ':whitebeard' + ); $icons = array( @@ -774,10 +781,9 @@ function smilies($s, $sample = false) { ':headdesk', '~friendika ~friendika', '~friendica ~friendica', - 'DiasporaDiaspora*', +// 'DiasporaDiaspora*', ':beard', ':whitebeard' - ); $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); @@ -790,6 +796,7 @@ function smilies($s, $sample = false) { } } else { + $params['string'] = preg_replace_callback('/<(3+)/','preg_heart',$params['string']); $s = str_replace($params['texts'],$params['icons'],$params['string']); } @@ -808,7 +815,18 @@ function smile_decode($m) { return(str_replace($m[1],base64url_decode($m[1]),$m[0])); } +// expand <3333 to the correct number of hearts +function preg_heart($x) { + $a = get_app(); + if(strlen($x[1]) == 1) + return $x[0]; + $t = ''; + for($cnt = 0; $cnt < strlen($x[1]); $cnt ++) + $t .= '<3'; + $r = str_replace($x[0],$t,$x[0]); + return $r; +} if(! function_exists('day_translate')) { @@ -1000,7 +1018,7 @@ function lang_selector() { } $ll = substr($l,5); $ll = substr($ll,0,strrpos($ll,'/')); - $selected = (($ll === $lang && (x($_SESSION['language']))) ? ' selected="selected" ' : ''); + $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : ''); $o .= ''; } } @@ -1205,3 +1223,16 @@ function reltoabs($text, $base) return $text; } +function item_post_type($item) { + if(intval($item['event-id'])) + return t('event'); + if(strlen($item['resource-id'])) + return t('photo'); + if(strlen($item['verb']) && $item['verb'] !== ACTIVITY_POST) + return t('activity'); + if($item['id'] != $item['parent']) + return t('comment'); + return t('post'); +} + + -- cgit v1.2.3