From 435836b224adac299d7c6868279b014010e70d29 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 6 Dec 2012 18:17:43 -0800 Subject: templatise micropro --- include/text.php | 67 +++++++++++++++++++++++--------------------------------- 1 file changed, 28 insertions(+), 39 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index fcfadec96..5dff3c9a3 100644 --- a/include/text.php +++ b/include/text.php @@ -545,7 +545,7 @@ function contact_block() { $total = intval($r[0]['total']); } if(! $total) { - $contacts = t('No contacts'); + $contacts = t('No connnections'); $micropro = Null; } else { @@ -556,7 +556,7 @@ function contact_block() { ); if(count($r)) { - $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total); + $contacts = sprintf( tt('%d Connection','%d Connections', $total),$total); $micropro = Array(); foreach($r as $rr) { $micropro[] = micropro($rr,true,'mpfriend'); @@ -568,7 +568,7 @@ function contact_block() { $o = replace_macros($tpl, array( '$contacts' => $contacts, '$nickname' => $a->profile['nickname'], - '$viewcontacts' => t('View Contacts'), + '$viewcontacts' => t('View Connnections'), '$micropro' => $micropro, )); @@ -579,46 +579,35 @@ function contact_block() { }} + +function chanlink_hash($s) { + return z_root() . '/chanview?f=&hash=' . urlencode($s); +} + +function chanlink_url($s) { + return z_root() . '/chanview?f=&url=' . urlencode($s); +} + + +function chanlink_cid($d) { + return z_root() . '/chanview?f=&cid=' . intval($d); +} + + + if(! function_exists('micropro')) { function micropro($contact, $redirect = false, $class = '', $textmode = false) { - if($class) - $class = ' ' . $class; - - $url = $contact['xchan_url']; - $sparkle = ''; - $redir = false; + $url = chanlink_hash($contact['xchan_hash']); - if($redirect) { - $a = get_app(); - $redirect_url = $a->get_baseurl() . '/magic/' . $contact['abook_id']; - if(local_user() && ($contact['abook_channel'] == local_user()) && ($contact['xchan_network'] === NETWORK_ZOT)) { - $redir = true; - $url = $redirect_url; - $sparkle = ' sparkle'; - } - else - $url = zid($url); - } - $click = ((x($contact,'click')) ? ' onclick="' . $contact['click'] . '" ' : ''); - if($click) - $url = ''; - if($textmode) { - return '
'. $contact['xchan_name'] . '
' . "\r\n"; - } - else { - return '
' . $contact['xchan_name'] 
-			. '
' . "\r\n"; - } + return replace_macros(get_markup_template(($textmode)?'micropro_txt.tpl':'micropro_img.tpl'),array( + '$click' => $click, + '$class' => $class, + '$url' => $url, + '$photo' => $contact['xchan_photo_s'], + '$name' => $contact['xchan_name'], + '$title' => $contact['xchan_name'] . ' [' . $contact['xchan_addr'] . ']', + )); }} -- cgit v1.2.3