]> git.mxchange.org Git - friendica.git/commitdiff
remove html from profile vcard code
authorFabio Comuni <fabrix.xm@gmail.com>
Wed, 31 Aug 2011 15:31:44 +0000 (17:31 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Wed, 31 Aug 2011 15:31:44 +0000 (17:31 +0200)
boot.php
include/text.php
view/contact_block.tpl [new file with mode: 0644]
view/diaspora_vcard.tpl [new file with mode: 0644]
view/profile_vcard.tpl

index 42a0f72077e9bed3c93aa57e67ae9d9f234d53d3..edad6e70f3a6b52445e175cd1fa2d120280550e6 100644 (file)
--- 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,
        ));
 
 
index 66447069e455ad6c53a9cd90a9514d14bd0361ba..075caee00087079ccb76289338a38dcb10e0b97f 100644 (file)
@@ -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 (file)
index 0000000..00b97a6
--- /dev/null
@@ -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 (file)
index 0000000..aa2c9ed
--- /dev/null
@@ -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>
index 34f265ee671ed1ffe8d8559b76afccbed4f4162b..01238ed5af023dcb334c85cc8b0146add58e4712 100644 (file)
@@ -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