Skip to content

Commit

Permalink
Rework text string in sidebar_online #748
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasse committed Apr 22, 2018
1 parent a450802 commit d24cc5c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 53 deletions.
47 changes: 22 additions & 25 deletions adm_plugins/sidebar_online/config.php
@@ -1,50 +1,47 @@
<?php
/**
***********************************************************************************************
* Konfigurationsdatei fuer Admidio-Plugin Sidebar-Online
* Configuration file for Admidio plugin Sidebar-Online
*
* @copyright 2004-2018 The Admidio Team
* @see https://www.admidio.org/
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
***********************************************************************************************
*/

// Zeit in der die User noch als Aktiv gelten (Default = 10)
// Time in minutes in which the users are still active (Default = 10)
$plg_time_online = 10;

// Sollen Besucher (nicht eingeloggte Benutzer) auch angezeigt werden
// 0 = nur eingeloggte Mitglieder werden angezeigt
// 1 = (Default) Anzahl der Besucher wird aufgelistet
// Should visitors (users who are not logged in) also be displayed
// 0 = only logged in members will be shown
// 1 = (Default) Number of visitors is listed
$plg_show_visitors = 1;

// Sollen für Besucher (nicht eingeloggte Benutzer) eingloggte Mitglieder angezeigt werden
// 0 = eingeloggte Mitglieder werden nicht angezeigt
// 1 = (Default) die eingeloggten Mitglieder werden angezeigt
// 2 = nur Anzahl der eingeloggten Mitglieder wird angezeigt
// Should logged in members be displayed to visitors (users who are not logged in)
// 0 = logged in members are not displayed
// 1 = logged in members are displayed
// 2 = (Default) only number of logged in members is displayed
$plg_show_members = 2;

// soll das eigene Login angezeigt werden
// 0 = das eigene Login (auch ausgeloggt) wird nicht angezeigt
// 1 = (Default) das eigene Login (auch ausgeloggt) wird angezeigt
// The own login should be displayed
// 0 = the own login (also logged out) will not be displayed
// 1 = (Default) the own login (also logged out) will be displayed
$plg_show_self = 1;

// Anzeige der Benutzernamen untereinander bzw. nebeneinander
// 0 = (Default) Benutzernamen untereinander auflisten (1 Name pro Zeile)
// 1 = Benutzernamen nebeneinander auflisten
// Display of user names with each other or side by side
// 0 = (Default) List user names (1 name per line)
// 1 = List user names side by side
$plg_show_users_side_by_side = 0;

// Name einer CSS-Klasse fuer Links
// Nur noetig, falls die Links ein anderes Aussehen bekommen sollen
// Name of a CSS class for links
// Only necessary, if the links should get a different look
$plg_link_class = '';

// Angabe des Ziels (target) in dem die Inhalte der Links geöffnet werden sollen
// Hier koennen die ueblichen targets (_self, _top ...) oder Framenamen angegeben werden
// Specification of the target in which the contents of the links are to be opened
// You can insert specified values of the html target attribut
$plg_link_target = '_self';

// Text der über den angezeigten Benutzern steht (Default = "Online sind:<br />"
$plg_online_text = 'Online sind:<br />';

// Soll die Überschrift des Plugins angezeigt werden
// 1 = (Default) Überschrift wird angezeigt
// 0 = Überschrift wird nicht angezeigt
// Should the header of the plugin be displayed
// 1 = (Default) Headline is displayed
// 0 = Headline is not displayed
$plg_show_headline = 1;
4 changes: 3 additions & 1 deletion adm_plugins/sidebar_online/languages/de.xml
@@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="PLG_ONLINE_HEADLINE">Online</string>
<string name="PLG_ONLINE_HEADLINE">Wer ist Online?</string>
<string name="PLG_ONLINE_NO_VISITORS_ON_WEBSITE">Zur Zeit sind keine Besucher auf der Webseite.</string>
<string name="PLG_ONLINE_VAR_NUM_VISITORS">#VAR1# Besucher</string>
<string name="PLG_ONLINE_VAR_NUM_MEMBER">#VAR1# Mitglied</string>
<string name="PLG_ONLINE_VAR_NUM_MEMBERS">#VAR1# Mitglieder</string>
<string name="PLG_ONLINE_VAR_ONLINE_ARE">Online sind #VAR1#</string>
<string name="PLG_ONLINE_VAR_ONLINE_IS">Online ist #VAR1#</string>
</resources>
52 changes: 25 additions & 27 deletions adm_plugins/sidebar_online/sidebar_online.php
Expand Up @@ -3,10 +3,9 @@
***********************************************************************************************
* Sidebar Online
*
* Version 1.7.0
* Plugin shows visitors and registered members of the homepage
*
* Compatible with Admidio version 3.2
* Compatible with Admidio version 3.3
*
* @copyright 2004-2018 The Admidio Team
* @see https://www.admidio.org/
Expand Down Expand Up @@ -101,11 +100,11 @@

if($onlineUsersStatement->rowCount() > 0)
{
echo $plg_online_text;

$usrIdMerker = 0;
$countMembers = 0;
$countVisitors = 0;
$allVisibleOnlineUsers = array();
$textOnlineVisitors = '';

while($row = $onlineUsersStatement->fetch())
{
Expand All @@ -114,18 +113,8 @@
if(((int) $row['ses_usr_id'] !== $usrIdMerker)
&& ($plg_show_members == 1 || $gValidLogin))
{
echo '<strong><a class="'. $plg_link_class. '" target="'. $plg_link_target. '" title="'.$gL10n->get('SYS_SHOW_PROFILE').'"
$allVisibleOnlineUsers[] = '<strong><a class="'. $plg_link_class. '" target="'. $plg_link_target. '" title="'.$gL10n->get('SYS_SHOW_PROFILE').'"
href="'. safeUrl(ADMIDIO_URL. FOLDER_MODULES. '/profile/profile.php', array('user_id' => $row['ses_usr_id'])). '">'. $row['usr_login_name']. '</a></strong>';

// User neben-/untereinander anzeigen
if($plg_show_users_side_by_side)
{
echo ', ';
}
else
{
echo '<br />';
}
$usrIdMerker = (int) $row['ses_usr_id'];
}
++$countMembers;
Expand All @@ -140,28 +129,37 @@
{
if($countMembers > 1)
{
echo $gL10n->get('PLG_ONLINE_VAR_NUM_MEMBERS', $countMembers);
$allVisibleOnlineUsers[] = $gL10n->get('PLG_ONLINE_VAR_NUM_MEMBERS', $countMembers);
}
else
{
echo $gL10n->get('PLG_ONLINE_VAR_NUM_MEMBER', $countMembers);
}

if($plg_show_users_side_by_side)
{
echo ', ';
}
else
{
echo '<br />';
$allVisibleOnlineUsers[] = $gL10n->get('PLG_ONLINE_VAR_NUM_MEMBER', $countMembers);
}

$usrIdMerker = (int) $row['ses_usr_id'];
}

if($plg_show_visitors && $countVisitors > 0)
{
echo $gL10n->get('PLG_ONLINE_VAR_NUM_VISITORS', array($countVisitors));
$allVisibleOnlineUsers[] = $gL10n->get('PLG_ONLINE_VAR_NUM_VISITORS', array($countVisitors));
}

if($plg_show_users_side_by_side)
{
$textOnlineVisitors = implode(', ', $allVisibleOnlineUsers);
}
else
{
$textOnlineVisitors = '<br />'. implode('<br />', $allVisibleOnlineUsers);
}

if($onlineUsersStatement->rowCount() === 1)
{
echo $gL10n->get('PLG_ONLINE_VAR_ONLINE_IS', array($textOnlineVisitors));
}
else
{
echo $gL10n->get('PLG_ONLINE_VAR_ONLINE_ARE', array($textOnlineVisitors));
}
}
else
Expand Down

0 comments on commit d24cc5c

Please sign in to comment.