forumdirectory: some polishing
authorrabuzarus <trebor@central-unit>
Mon, 18 Feb 2019 12:03:21 +0000 (13:03 +0100)
committerrabuzarus <trebor@central-unit>
Mon, 18 Feb 2019 12:03:21 +0000 (13:03 +0100)
mod/directory.php
view/templates/directory_header.tpl
view/theme/frio/templates/directory_header.tpl

index a1e37d6..a3fc965 100644 (file)
@@ -144,87 +144,87 @@ function directory_content(App $a)
  * Format contact/profile/user data from the database into an usable
  * array for displaying directory entries.
  * 
- * @param type $r The directory entry from the database.
+ * @param type $arr The directory entry from the database.
  * @param string $photo_size Avatar size (thumb, photo or micro).
  * 
  * @return array
  */
-function format_directory_entry($arr, $photo_size = 'photo')
+function format_directory_entry(array $arr, $photo_size = 'photo')
 {
-                       $itemurl = (($arr['addr'] != "") ? $arr['addr'] : $arr['profile_url']);
-
-                       $profile_link = $arr['profile_url'];
-
-                       $pdesc = (($arr['pdesc']) ? $arr['pdesc'] . '<br />' : '');
-
-                       $details = '';
-                       if (strlen($arr['locality'])) {
-                               $details .= $arr['locality'];
-                       }
-                       if (strlen($arr['region'])) {
-                               if (strlen($arr['locality'])) {
-                                       $details .= ', ';
-                               }
-                               $details .= $arr['region'];
-                       }
-                       if (strlen($arr['country-name'])) {
-                               if (strlen($details)) {
-                                       $details .= ', ';
-                               }
-                               $details .= $arr['country-name'];
-                       }
-
-                       $profile = $arr;
-
-                       if (!empty($profile['address'])
-                               || !empty($profile['locality'])
-                               || !empty($profile['region'])
-                               || !empty($profile['postal-code'])
-                               || !empty($profile['country-name'])
-                       ) {
-                               $location = L10n::t('Location:');
-                       } else {
-                               $location = '';
-                       }
-
-                       $gender   = (!empty($profile['gender'])   ? L10n::t('Gender:')   : false);
-                       $marital  = (!empty($profile['marital'])  ? L10n::t('Status:')   : false);
-                       $homepage = (!empty($profile['homepage']) ? L10n::t('Homepage:') : false);
-                       $about    = (!empty($profile['about'])    ? L10n::t('About:')    : false);
-
-                       $location_e = $location;
-
-                       $photo_menu = [
-                               'profile' => [L10n::t("View Profile"), Contact::magicLink($profile_link)]
-                       ];
-
-                       $entry = [
-                               'id'           => $arr['id'],
-                               'url'          => Contact::magicLInk($profile_link),
-                               'itemurl'      => $itemurl,
-                               'thumb'        => ProxyUtils::proxifyUrl($arr[$photo_size], false, ProxyUtils::SIZE_THUMB),
-                               'img_hover'    => $arr['name'],
-                               'name'         => $arr['name'],
-                               'details'      => $details,
-                               'account_type' => Contact::getAccountType($arr),
-                               'profile'      => $profile,
-                               'location'     => $location_e,
-                               'tags'         => $arr['pub_keywords'],
-                               'gender'       => $gender,
-                               'pdesc'        => $pdesc,
-                               'marital'      => $marital,
-                               'homepage'     => $homepage,
-                               'about'        => $about,
-                               'photo_menu'   => $photo_menu,
-
-                       ];
-
-                       $hook = ['contact' => $arr, 'entry' => $entry];
-
-                       Hook::callAll('directory_item', $hook);
-
-                       unset($profile);
-                       unset($location);
-
-                       return $hook['entry'];
-}
\ No newline at end of file
+       $itemurl = (($arr['addr'] != "") ? $arr['addr'] : $arr['profile_url']);
+
+       $profile_link = $arr['profile_url'];
+
+       $pdesc = (($arr['pdesc']) ? $arr['pdesc'] . '<br />' : '');
+
+       $details = '';
+       if (strlen($arr['locality'])) {
+               $details .= $arr['locality'];
+       }
+       if (strlen($arr['region'])) {
+               if (strlen($arr['locality'])) {
+                       $details .= ', ';
+               }
+               $details .= $arr['region'];
+       }
+       if (strlen($arr['country-name'])) {
+               if (strlen($details)) {
+                       $details .= ', ';
+               }
+               $details .= $arr['country-name'];
+       }
+
+       $profile = $arr;
+
+       if (!empty($profile['address'])
+               || !empty($profile['locality'])
+               || !empty($profile['region'])
+               || !empty($profile['postal-code'])
+               || !empty($profile['country-name'])
+       ) {
+               $location = L10n::t('Location:');
+       } else {
+               $location = '';
+       }
+
+       $gender   = (!empty($profile['gender'])   ? L10n::t('Gender:')   : false);
+       $marital  = (!empty($profile['marital'])  ? L10n::t('Status:')   : false);
+       $homepage = (!empty($profile['homepage']) ? L10n::t('Homepage:') : false);
+       $about    = (!empty($profile['about'])    ? L10n::t('About:')    : false);
+
+       $location_e = $location;
+
+       $photo_menu = [
+               'profile' => [L10n::t("View Profile"), Contact::magicLink($profile_link)]
+       ];
+
+       $entry = [
+               'id'           => $arr['id'],
+               'url'          => Contact::magicLInk($profile_link),
+               'itemurl'      => $itemurl,
+               'thumb'        => ProxyUtils::proxifyUrl($arr[$photo_size], false, ProxyUtils::SIZE_THUMB),
+               'img_hover'    => $arr['name'],
+               'name'         => $arr['name'],
+               'details'      => $details,
+               'account_type' => Contact::getAccountType($arr),
+               'profile'      => $profile,
+               'location'     => $location_e,
+               'tags'         => $arr['pub_keywords'],
+               'gender'       => $gender,
+               'pdesc'        => $pdesc,
+               'marital'      => $marital,
+               'homepage'     => $homepage,
+               'about'        => $about,
+               'photo_menu'   => $photo_menu,
+
+       ];
+
+       $hook = ['contact' => $arr, 'entry' => $entry];
+
+       Hook::callAll('directory_item', $hook);
+
+       unset($profile);
+       unset($location);
+
+       return $hook['entry'];
+}
index 06776aa..14b1074 100644 (file)
@@ -7,7 +7,6 @@
        </ul>
 {{/if}}
 
-
 <div id="directory-search-wrapper">
        <form id="directory-search-form" action="{{$search_mod}}" method="get" >
                <span class="dirsearch-desc">{{$desc nofilter}}</span>
index 087614b..3681291 100644 (file)
@@ -8,7 +8,6 @@
 
        {{include file="section_title.tpl"}}
 
-
        {{* The search input field to search for contacts *}}
        <div id="directory-search-wrapper">
                <form id="directory-search-form" class="navbar-form" role="search" action="{{$search_mod}}" method="get" >
@@ -39,4 +38,4 @@
        <div class="directory-end" ></div>
 
        {{$paginate nofilter}}
-</div>
\ No newline at end of file
+</div>