1
1
Fork 0

Fixed...merged with mainline THEN added beards.

This commit is contained in:
Thomas 2012-03-06 20:50:38 +00:00
parent a265afe7eb
commit 67456bad06

View file

@ -14,7 +14,13 @@ if(! function_exists('replace_macros')) {
function replace_macros($s,$r) { function replace_macros($s,$r) {
global $t; global $t;
return $t->replace($s,$r); //$ts = microtime();
$r = $t->replace($s,$r);
//$tt = microtime() - $ts;
//$a = get_app();
//$a->page['debug'] .= "$tt <br>\n";
return $r;
}} }}
@ -731,9 +737,10 @@ function smilies($s, $sample = false) {
':headdesk', ':headdesk',
'~friendika', '~friendika',
'~friendica', '~friendica',
'Diaspora*', // 'Diaspora*'
':beard', ':beard',
':whitebeard' ':whitebeard'
); );
$icons = array( $icons = array(
@ -774,10 +781,9 @@ function smilies($s, $sample = false) {
'<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />', '<img src="' . $a->get_baseurl() . '/images/smiley-bangheaddesk.gif" alt=":headdesk" />',
'<a href="http://project.friendika.com">~friendika <img src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>', '<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/friendica-16.png" alt="~friendica" /></a>', '<a href="http://friendica.com">~friendica <img src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>',
'<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>', // '<a href="http://diasporafoundation.org">Diaspora<img src="' . $a->get_baseurl() . '/images/diaspora.png" alt="Diaspora*" /></a>',
'<img src="' . $a->get_baseurl() . '/images/beard.jpg" alt=":beard" />', '<img src="' . $a->get_baseurl() . '/images/beard.jpg" alt=":beard" />',
'<img src="' . $a->get_baseurl() . '/images/whitebeard.jpg" alt=":whitebeard" />' '<img src="' . $a->get_baseurl() . '/images/whitebeard.jpg" alt=":whitebeard" />'
); );
$params = array('texts' => $texts, 'icons' => $icons, 'string' => $s); $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
@ -790,6 +796,7 @@ function smilies($s, $sample = false) {
} }
} }
else { else {
$params['string'] = preg_replace_callback('/&lt;(3+)/','preg_heart',$params['string']);
$s = str_replace($params['texts'],$params['icons'],$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])); 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 .= '<img src="' . $a->get_baseurl() . '/images/smiley-heart.gif" alt="<3" />';
$r = str_replace($x[0],$t,$x[0]);
return $r;
}
if(! function_exists('day_translate')) { if(! function_exists('day_translate')) {
@ -1000,7 +1018,7 @@ function lang_selector() {
} }
$ll = substr($l,5); $ll = substr($l,5);
$ll = substr($ll,0,strrpos($ll,'/')); $ll = substr($ll,0,strrpos($ll,'/'));
$selected = (($ll === $lang && (x($_SESSION['language']))) ? ' selected="selected" ' : ''); $selected = (($ll === $lang && (x($_SESSION, 'language'))) ? ' selected="selected" ' : '');
$o .= '<option value="' . $ll . '"' . $selected . '>' . $ll . '</option>'; $o .= '<option value="' . $ll . '"' . $selected . '>' . $ll . '</option>';
} }
} }
@ -1205,3 +1223,16 @@ function reltoabs($text, $base)
return $text; 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');
}