From: Roland Häder Date: Sun, 14 Aug 2011 03:57:13 +0000 (+0000) Subject: Extension ext-beg improved, better EL code used: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b4042713447d2eb3777a49f24523511dbba8970f;p=mailer.git Extension ext-beg improved, better EL code used: - Two language strings merged together (ext-beg) - Template call-back function {%template,DisplayUsername=$fooUserid%} introduced for encapsulated displaying of userid / nickname --- diff --git a/inc/language/beg_de.php b/inc/language/beg_de.php index 336a598aa9..dd543f951c 100644 --- a/inc/language/beg_de.php +++ b/inc/language/beg_de.php @@ -48,16 +48,14 @@ addMessages(array( 'ADMIN_CONFIG_BEG_USERID_TIMEOUT' => "Zeitsperre gegen eine Mitglied-Id", 'ADMIN_CONFIG_BEG_REMOTE_IP_TIMEOUT' => "Zeitsperre gegen eine IP-Nummer", 'BEG_LINK_BY' => "Bettel-Link bei {?MAIN_TITLE?}", - 'BEG_LINK_USERID' => "Unser Mitglied %s hat {?POINTS?} gebettelt.", + 'BEG_LINK_USERID' => "Unser Mitglied %s hat gerade {?POINTS?} gebettelt.", 'BEG_USERID_STEAL_1' => "Das Mitglied ", - 'BEG_USERID_STEAL_2' => " hat soeben ", - 'BEG_USERID_STEAL_3' => " {?POINTS?} bei Ihnen erbettelt.", - 'BEG_CLICKS' => "Dies war insgesamt der %s. Klick auf sein Bettel-Link.", + 'BEG_USERID_STEAL_2' => " hat soeben {%%pipe,translateComma=%s%%} {?POINTS?} bei Ihnen erbettelt.", + 'BEG_CLICKS' => "Dies war insgesamt der {%%pipe,translateComma=%s%%}. Klick auf sein Bettel-Link.", 'BEG_THANKS_FOR_CLICK' => "Danke für Ihre Spende.", 'BEG_CONTINUE_REGISTER' => "Und weiter geht es zur Anmeldung bei {?MAIN_TITLE?} ...", 'BEG_SORRY_ANOTHER_WAS_HERE_1' => "Oh, schade! Es war vor kurzem schon einer hier! Das Mitglied ", - 'BEG_SORRY_ANOTHER_WAS_HERE_2' => " hat von Ihnen auch keine ", - 'BEG_SORRY_ANOTHER_WAS_HERE_3' => " {?POINTS?} erhalten.", + 'BEG_SORRY_ANOTHER_WAS_HERE_2' => " hat von Ihnen auch keine {%%pipe,translateComma=%s%%} {?POINTS?} erhalten.", 'BEG_THANKS_FOR_CLICK_AGAIN' => "Danke dennoch für den erneuten Klick.", 'BEG_POINTS_MIN_MAX' => "zwischen {%config,translateComma=beg_points%} und {%config,translateComma=beg_points_max%} {?POINTS?}", 'BEG_POINTS_FIXED' => "{%config,translateComma=beg_points%} {?POINTS?}", diff --git a/inc/libs/user_functions.php b/inc/libs/user_functions.php index 71b180ee8f..1241a8748b 100644 --- a/inc/libs/user_functions.php +++ b/inc/libs/user_functions.php @@ -777,5 +777,23 @@ function doTemplateAdminListUserTitle ($template, $clear = false) { return $code; } +// Template call-back function for displaying "username" +function doTemplateDisplayUsername ($template, $clear = false, $userid = NULL) { + // Is a userid set? + if (!isValidUserId($userid)) { + // Please don't call this without a valid userid + debug_report_bug(__FUNCTION__, __LINE__, 'template=' . $template . ',clear=' . intval($clear) . ',userid[' . gettype($userid) . ']=' . intval($userid) . ' - Invalid userid provided.'); + } // END - if + + // Do we have cache? + if (!isset($GLOBALS[__FUNCTION__][$userid])) { + // Generate code + $GLOBALS[__FUNCTION__][$userid] = $userid . ' ({%user,nickname,fixEmptyContentToDashes=' . $userid . '%})'; + } // END - if + + // Return cache + return $GLOBALS[__FUNCTION__][$userid]; +} + // [EOF] ?> diff --git a/inc/modules/member/what-transfer.php b/inc/modules/member/what-transfer.php index da1c7888aa..e9bd50bb2e 100644 --- a/inc/modules/member/what-transfer.php +++ b/inc/modules/member/what-transfer.php @@ -225,7 +225,7 @@ switch ($mode) { if ((isPostRequestElementSet('to_userid')) && (postRequestElement('to_userid') == $userid)) { $OUT .= ' selected="selected"'; } // END - if - $OUT .= '>' . $userid . ' ({%user,nickname,fixEmptyContentToDashes=' . $userid . '%})'; + $OUT .= '>{%template,DisplayUsername=' . $userid . '%}'; } // END - while $OUT .= ''; $content['to_disabled'] = ''; diff --git a/templates/de/html/beg/beg_done.tpl b/templates/de/html/beg/beg_done.tpl index 82596b3cb0..49d6581db8 100644 --- a/templates/de/html/beg/beg_done.tpl +++ b/templates/de/html/beg/beg_done.tpl @@ -1,5 +1,7 @@
- {--BEG_USERID_STEAL_1--}$content[userid]{--BEG_USERID_STEAL_2--}{%pipe,translateComma=$content[points]%}{--BEG_USERID_STEAL_3--} + {--BEG_USERID_STEAL_1--} + $content[userid] + {%message,BEG_USERID_STEAL_2=$content[points]%}
diff --git a/templates/de/html/beg/beg_failed.tpl b/templates/de/html/beg/beg_failed.tpl index a1324991b1..66af407c72 100644 --- a/templates/de/html/beg/beg_failed.tpl +++ b/templates/de/html/beg/beg_failed.tpl @@ -1,5 +1,7 @@
- {--BEG_SORRY_ANOTHER_WAS_HERE_1--}$content[userid]{--BEG_SORRY_ANOTHER_WAS_HERE_2--}{%pipe,translateComma=$content[points]%}{--BEG_SORRY_ANOTHER_WAS_HERE_3--} + {--BEG_SORRY_ANOTHER_WAS_HERE_1--} + $content[userid] + {%message,BEG_SORRY_ANOTHER_WAS_HERE_2=$content[points]%}
diff --git a/templates/de/html/guest/guest_list_active_row.tpl b/templates/de/html/guest/guest_list_active_row.tpl index be39d2aa9a..bd4275db13 100644 --- a/templates/de/html/guest/guest_list_active_row.tpl +++ b/templates/de/html/guest/guest_list_active_row.tpl @@ -1,5 +1,5 @@ - $content[userid] ({%user,nickname,fixEmptyContentToDashes=$content[userid]%}) + {%template,DisplayUsername=$content[userid]%} {%pipe,getTotalPoints,translateComma=$content[userid]%} $content[last_online] diff --git a/templates/de/html/guest/guest_top10_row_earner.tpl b/templates/de/html/guest/guest_top10_row_earner.tpl index f1a7600d35..f4f1ff7065 100644 --- a/templates/de/html/guest/guest_top10_row_earner.tpl +++ b/templates/de/html/guest/guest_top10_row_earner.tpl @@ -1,6 +1,6 @@ {%pipe,translateComma=$content[count]%} - $content[userid] ({%user,nickname,fixEmptyContentToDashes=$content[userid]%}) + {%template,DisplayUsername=$content[userid]%} {%pipe,translateComma=$content[points]%} $content[last_online] diff --git a/templates/de/html/guest/guest_top10_row_login.tpl b/templates/de/html/guest/guest_top10_row_login.tpl index e2ba4d604e..8cdac7ad70 100644 --- a/templates/de/html/guest/guest_top10_row_login.tpl +++ b/templates/de/html/guest/guest_top10_row_login.tpl @@ -1,6 +1,6 @@ {%pipe,translateComma=$content[count]%} - $content[userid] ({%user,nickname,fixEmptyContentToDashes=$content[userid]%}) + {%template,DisplayUsername=$content[userid]%} {%user,total_logins,translateComma=$content[userid]%} {%pipe,getTotalPoints,translateComma=$content[userid]%} $content[last_online] diff --git a/templates/de/html/guest/guest_top10_row_refs.tpl b/templates/de/html/guest/guest_top10_row_refs.tpl index 0eba04a28a..b0ef1d9205 100644 --- a/templates/de/html/guest/guest_top10_row_refs.tpl +++ b/templates/de/html/guest/guest_top10_row_refs.tpl @@ -1,6 +1,6 @@ {%pipe,translateComma=$content[count]%} - $content[userid] ({%user,nickname,fixEmptyContentToDashes=$content[userid]%}) + {%template,DisplayUsername=$content[userid]%} {%pipe,translateComma=$content[refs]%} {%pipe,getTotalPoints,translateComma=$content[userid]%} $content[last_online] diff --git a/templates/de/html/member/member_bonus_turbo_row.tpl b/templates/de/html/member/member_bonus_turbo_row.tpl index efab5bbf4e..cf50294fc9 100644 --- a/templates/de/html/member/member_bonus_turbo_row.tpl +++ b/templates/de/html/member/member_bonus_turbo_row.tpl @@ -3,7 +3,7 @@ {%pipe,translateComma=$content[rank]%}. - $content[userid] ({%user,nickname,fixEmptyContentToDashes=$content[userid]%}) + {%template,DisplayUsername=$content[userid]%} {%pipe,translateComma=$content[points]%} diff --git a/templates/de/html/member/member_list_refback_row.tpl b/templates/de/html/member/member_list_refback_row.tpl index 9248d47e26..e2fb30b378 100644 --- a/templates/de/html/member/member_list_refback_row.tpl +++ b/templates/de/html/member/member_list_refback_row.tpl @@ -1,6 +1,6 @@ - $content[refid] ({%user,nickname,fixEmptyContentToDashes=$content[refid]%}) + {%template,DisplayUsername=$content[refid]%} $content[level_refid] diff --git a/templates/de/html/member/member_list_referral_row.tpl b/templates/de/html/member/member_list_referral_row.tpl index b825ffcf8d..556b7579ac 100644 --- a/templates/de/html/member/member_list_referral_row.tpl +++ b/templates/de/html/member/member_list_referral_row.tpl @@ -1,6 +1,6 @@ - $content[refid] ({%user,nickname,fixEmptyContentToDashes=$content[refid]%}) + {%template,DisplayUsername=$content[refid]%} {%user,status,translateUserStatus=$content[refid]%}