aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-08-31 17:31:44 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-08-31 17:31:44 +0200
commit8b615133d528eb074a23746afef6201f474a4e3f (patch)
tree1e42e60dcc683ac6a08333e1001759aa0d0e0fcc
parent54f0685a038d87706ec4ecc15edc55ee171b6079 (diff)
downloadvolse-hubzilla-8b615133d528eb074a23746afef6201f474a4e3f.tar.gz
volse-hubzilla-8b615133d528eb074a23746afef6201f474a4e3f.tar.bz2
volse-hubzilla-8b615133d528eb074a23746afef6201f474a4e3f.zip
remove html from profile vcard code
-rw-r--r--boot.php122
-rw-r--r--include/text.php36
-rw-r--r--view/contact_block.tpl9
-rw-r--r--view/diaspora_vcard.tpl44
-rw-r--r--view/profile_vcard.tpl40
5 files changed, 131 insertions, 120 deletions
diff --git a/boot.php b/boot.php
index 42a0f7207..edad6e70f 100644
--- a/boot.php
+++ b/boot.php
@@ -808,8 +808,8 @@ function profile_load(&$a, $nickname, $profile = 0) {
$a->page['aside'] .= profile_sidebar($a->profile, $block);
- if(! $block)
- $a->page['aside'] .= contact_block();
+ /*if(! $block)
+ $a->page['aside'] .= contact_block();*/
return;
}}
@@ -837,132 +837,68 @@ function profile_sidebar($profile, $block = 0) {
$a = get_app();
$o = '';
- $location = '';
+ $location = false;
$address = false;
+ $pdesc = true;
if((! is_array($profile)) && (! count($profile)))
return $o;
call_hooks('profile_sidebar_enter', $profile);
- $fullname = '<div class="fn">' . $profile['name'] . '</div>';
-
- $pdesc = '<div class="title">' . $profile['pdesc'] . '</div>';
-
- $tabs = '';
-
- $photo = '<div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="' . $profile['photo'] . '" alt="' . $profile['name'] . '" /></div>';
-
+
// don't show connect link to yourself
- $connect = (($profile['uid'] != local_user()) ? '<li><a id="dfrn-request-link" href="dfrn_request/' . $profile['nickname'] . '">' . t('Connect') . '</a></li>' : '');
+ $connect = (($profile['uid'] != local_user()) ? t('Connect') : False);
// don't show connect link to authenticated visitors either
if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid']))
- $connect = '';
+ $connect = False;
+
if((x($profile,'address') == 1)
|| (x($profile,'locality') == 1)
|| (x($profile,'region') == 1)
|| (x($profile,'postal-code') == 1)
|| (x($profile,'country-name') == 1))
- $address = true;
-
- if($address) {
- $location .= '<div class="location"><span class="location-label">' . t('Location:') . '</span> <div class="adr">';
- $location .= ((x($profile,'address') == 1) ? '<div class="street-address">' . $profile['address'] . '</div>' : '');
- $location .= (((x($profile,'locality') == 1) || (x($profile,'region') == 1) || (x($profile,'postal-code') == 1))
- ? '<span class="city-state-zip"><span class="locality">' . $profile['locality'] . '</span>'
- . ((x($profile['locality']) == 1) ? t(', ') : '')
- . '<span class="region">' . $profile['region'] . '</span>'
- . ' <span class="postal-code">' . $profile['postal-code'] . '</span></span>' : '');
- $location .= ((x($profile,'country-name') == 1) ? ' <span class="country-name">' . $profile['country-name'] . '</span>' : '');
- $location .= '</div></div><div class="profile-clear"></div>';
+ $location = t('Location:');
- }
-
-
- $gender = ((x($profile,'gender') == 1) ? '<div class="mf"><span class="gender-label">' . t('Gender:') . '</span> <span class="x-gender">' . $profile['gender'] . '</span></div><div class="profile-clear"></div>' : '');
+ $gender = ((x($profile,'gender') == 1) ? t('Gender:') : False);
- $pubkey = ((x($profile,'pubkey') == 1) ? '<div class="key" style="display:none;">' . $profile['pubkey'] . '</div>' : '');
- $marital = ((x($profile,'marital') == 1) ? '<div class="marital"><span class="marital-label"><span class="heart">&hearts;</span> ' . t('Status:') . ' </span><span class="marital-text">' . $profile['marital'] . '</span></div><div class="profile-clear"></div>' : '');
+ $marital = ((x($profile,'marital') == 1) ? t('Status:') : False);
- $homepage = ((x($profile,'homepage') == 1) ? '<div class="homepage"><span class="homepage-label">' . t('Homepage:') . ' </span><span class="homepage-url">' . linkify($profile['homepage']) . '</span></div><div class="profile-clear"></div>' : '');
+ $homepage = ((x($profile,'homepage') == 1) ? t('Homepage:') : False);
if(($profile['hidewall'] || $block) && (! local_user()) && (! remote_user())) {
- $location = $pdesc = $connect = $gender = $marital = $homepage = '';
+ $location = $pdesc = $connect = $gender = $marital = $homepage = False;
}
- $podloc = $a->get_baseurl();
- $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' );
- $nickname = $profile['nickname'];
- $photo300 = $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg';
- $photo100 = $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg';
- $photo50 = $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg';
-
- $diaspora_vcard = <<< EOT
-
-<div style="display:none;">
-<dl class='entity_nickname'>
-<dt>Nickname</dt>
-<dd>
-<a class="nickname url uid" href="$podloc/" rel="me">$nickname</a>
-</dd>
-</dl>
-<dl class='entity_fn'>
-<dt>Full name</dt>
-<dd>
-<span class='fn'>$fullname</span>
-</dd>
-</dl>
-<dl class="entity_url">
-<dt>URL</dt>
-<dd>
-<a class="url" href="$podloc/" id="pod_location" rel="me">$podloc/</a>
-</dd>
-</dl>
-<dl class="entity_photo">
-<dt>Photo</dt>
-<dd>
-<img class="photo avatar" height="300px" width="300px" src="$photo300">
-</dd>
-</dl>
-<dl class="entity_photo_medium">
-<dt>Photo</dt>
-<dd>
-<img class="photo avatar" height="100px" width="100px" src="$photo100">
-</dd>
-</dl>
-<dl class="entity_photo_small">
-<dt>Photo</dt>
-<dd>
-<img class="photo avatar" height="50px" width="50px" src="$photo50">
-</dd>
-</dl>
-<dl class="entity_searchable">
-<dt>Searchable</dt>
-<dd>
-<span class="searchable">$searchable</span>
-</dd>
-</dl>
-</div>
-EOT;
+ $diaspora = array(
+ 'podloc' => $a->get_baseurl(),
+ 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false' ),
+ 'nickname ' => $profile['nickname'],
+ 'photo300 ' => $a->get_baseurl() . '/photo/custom/300/' . $profile['uid'] . '.jpg',
+ 'photo100 ' => $a->get_baseurl() . '/photo/custom/100/' . $profile['uid'] . '.jpg',
+ 'photo50 ' => $a->get_baseurl() . '/photo/custom/50/' . $profile['uid'] . '.jpg',
+ );
+
+ if (!$block){
+ $contact_block = contact_block();
+ }
$tpl = get_markup_template('profile_vcard.tpl');
$o .= replace_macros($tpl, array(
- '$fullname' => $fullname,
- '$pdesc' => $pdesc,
- '$tabs' => $tabs,
- '$photo' => $photo,
+ '$profile' => $profile,
'$connect' => $connect,
'$location' => $location,
'$gender' => $gender,
- '$pubkey' => $pubkey,
+ '$pdesc' => $pdesc,
'$marital' => $marital,
'$homepage' => $homepage,
- '$diaspora' => $diaspora_vcard
+ '$diaspora' => $diaspora,
+ '$contact_block' => $contact_block,
));
diff --git a/include/text.php b/include/text.php
index 66447069e..075caee00 100644
--- a/include/text.php
+++ b/include/text.php
@@ -539,22 +539,30 @@ function contact_block() {
$total = intval($r[0]['total']);
}
if(! $total) {
- $o .= '<h4 class="contact-h4">' . t('No contacts') . '</h4>';
- return $o;
- }
- $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d",
- intval($a->profile['uid']),
- intval($shown)
- );
- if(count($r)) {
- $o .= '<h4 class="contact-h4">' . sprintf( tt('%d Contact','%d Contacts', $total),$total) . '</h4><div id="contact-block">';
- foreach($r as $rr) {
- $o .= micropro($rr,true,'mpfriend');
- }
- $o .= '</div><div id="contact-block-end"></div>';
- $o .= '<div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/' . $a->profile['nickname'] . '">' . t('View Contacts') . '</a></div>';
+ $contacts = t('No contacts');
+ $micropro = Null;
+ } else {
+ $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 and `pending` = 0 ORDER BY RAND() LIMIT %d",
+ intval($a->profile['uid']),
+ intval($shown)
+ );
+ if(count($r)) {
+ $contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
+ $micropro = Array();
+ foreach($r as $rr) {
+ $micropro[] = micropro($rr,true,'mpfriend');
+ }
+ }
}
+
+ $tpl = get_markup_template('contact_block.tpl');
+ $o = replace_macros($tpl, array(
+ '$contacts' => $contacts,
+ '$nickname' => $a->profile['nickname'],
+ '$viewcontacts' => t('View Contacts'),
+ '$micropro' => $micropro,
+ ));
$arr = array('contacts' => $r, 'output' => $o);
diff --git a/view/contact_block.tpl b/view/contact_block.tpl
new file mode 100644
index 000000000..00b97a6d8
--- /dev/null
+++ b/view/contact_block.tpl
@@ -0,0 +1,9 @@
+<h4 class="contact-h4">$contacts</h4>
+{{ if $micropro }}
+ <div id="contact-block">
+ {{ for $micropro as $m }}
+ $m
+ {{ endfor }}
+ </div>
+ <div id="viewcontacts"><a id="viewcontacts-link" href="viewcontacts/$nickname">$viewcontacts</a></div>
+{{ endif }}
diff --git a/view/diaspora_vcard.tpl b/view/diaspora_vcard.tpl
new file mode 100644
index 000000000..aa2c9eded
--- /dev/null
+++ b/view/diaspora_vcard.tpl
@@ -0,0 +1,44 @@
+<div style="display:none;">
+ <dl class='entity_nickname'>
+ <dt>Nickname</dt>
+ <dd>
+ <a class="nickname url uid" href="$podloc/" rel="me">$diaspora.nickname</a>
+ </dd>
+ </dl>
+ <dl class='entity_fn'>
+ <dt>Full name</dt>
+ <dd>
+ <span class='fn'>$diaspora.fullname</span>
+ </dd>
+ </dl>
+ <dl class="entity_url">
+ <dt>URL</dt>
+ <dd>
+ <a class="url" href="$diaspora.podloc/" id="pod_location" rel="me">$diaspora.podloc/</a>
+ </dd>
+ </dl>
+ <dl class="entity_photo">
+ <dt>Photo</dt>
+ <dd>
+ <img class="photo avatar" height="300px" width="300px" src="$diaspora.photo300">
+ </dd>
+ </dl>
+ <dl class="entity_photo_medium">
+ <dt>Photo</dt>
+ <dd>
+ <img class="photo avatar" height="100px" width="100px" src="$diaspora.photo100">
+ </dd>
+ </dl>
+ <dl class="entity_photo_small">
+ <dt>Photo</dt>
+ <dd>
+ <img class="photo avatar" height="50px" width="50px" src="$diaspora.photo50">
+ </dd>
+ </dl>
+ <dl class="entity_searchable">
+ <dt>Searchable</dt>
+ <dd>
+ <span class="searchable">$diaspora.searchable</span>
+ </dd>
+ </dl>
+</div>
diff --git a/view/profile_vcard.tpl b/view/profile_vcard.tpl
index 34f265ee6..01238ed5a 100644
--- a/view/profile_vcard.tpl
+++ b/view/profile_vcard.tpl
@@ -1,29 +1,43 @@
<div class="vcard">
- $fullname
- $pdesc
- $tabs
-
- $photo
+ <div class="fn">$profile.name</div>
+ {{ if $pdesc }}<div class="title">$profile.pdesc</div>{{ endif }}
+ <div id="profile-photo-wrapper"><img class="photo" width="175" height="175" src="$profile.photo" alt="$profile.name"></div>
<div id="profile-extra-links">
<ul>
- $connect
+ {{ if $connect }}
+ <li><a id="dfrn-request-link" href="dfrn_request/$profile['nickname']">$connect</a></li>
+ {{ endif }}
</ul>
</div>
- $location
+ {{ if $location }}
+ <div class="location"><span class="location-label">$location</span>
+ <div class="adr">
+ {{ if $profile.address }}<div class="street-address">$profile.address</div>{{ endif }}
+ <span class="city-state-zip">
+ <span class="locality">$profile.locality</span>{{ if $profile.locality }}, {{ endif }}
+ <span class="region">$profile.region</span>
+ <span class="postal-code">$profile.postal-code</span>
+ </span>
+ {{ if $profile.country-name }}<span class="country-name">$profile.country-name</span>{{ endif }}
+ </div>
+
+ {{ endif }}
- $gender
+ {{ if $gender }}<div class="mf"><span class="gender-label">$gender</span> <span class="x-gender">$profile.gender</span></div>{{ endif }}
+
+ {{ if $profile.pubkey }}<div class="key" style="display:none;">$profile.pubkey</div>{{ endif }}
- $pubkey
+ {{ if $marital }}<div class="marital"><span class="marital-label"><span class="heart">&hearts;</span>$marital</span><span class="marital-text">$profile.marital</span></div>{{ endif }}
-$diaspora
+ {{ if $homepage }}<div class="homepage"><span class="homepage-label">$homepage</span><span class="homepage-url"><a href="$profile.homepage" target="external-link">$profile.homepage</a></span></div>{{ endif }}
-</div>
+ {{ inc diaspora_vcard.tpl }}{{ endinc }}
-$marital
+</div>
-$homepage
+$contact_block