From f2e50a8402466aa86659088439a470b1a36afe4f Mon Sep 17 00:00:00 2001 From: Oldperl <44996956+oldperl@users.noreply.github.com> Date: Sat, 17 Dec 2011 16:52:15 +0000 Subject: [PATCH] i18n standard entries --- semmelstatzR-history.php | 103 ++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 40 deletions(-) diff --git a/semmelstatzR-history.php b/semmelstatzR-history.php index ec6282b..cc4f2a4 100644 --- a/semmelstatzR-history.php +++ b/semmelstatzR-history.php @@ -53,18 +53,28 @@ include_once plugin_dir_path(__FILE__).'includes/pChart/class/pData.class.php'; include_once plugin_dir_path(__FILE__).'includes/pChart/class/pDraw.class.php'; include_once plugin_dir_path(__FILE__).'includes/pChart/class/pImage.class.php'; +/** + * chart for last 30 days + * + * @uses pChart + * @since 1.0.0 + * @todo use own semR chart class + * + * @global wpdb $wpdb + * @return void + */ function sem_drawLast30DaysGoo() { global $wpdb; //$sql = $wpdb->get_results("ALTER TABLE ".$wpdb->statzhist." ORDER BY date ASC"); $results = $wpdb->get_results("SELECT DAY(date) as days, visitors FROM ".$wpdb->statzhist." WHERE date >= NOW() - INTERVAL 31 DAY ORDER BY date ASC"); - print "
Besucher: Die letzten 30 Tage
"; + print "
".semr_i18n("Visitors: Last 30 days")."
"; print "
"; if (empty($results)) { - print "... noch keine Einträge
"; - return; + print "... ".semr_i18n("no entries").""; + return; } foreach ($results as $result) { @@ -107,19 +117,26 @@ function sem_drawLast30DaysGoo() { print "
"; } -### HISTORY Monatsgrafik GOOGLE-API - - function sem_drawAllMonthGoo() { +/** + * chart of all month + * + * @global wpdb $wpdb + * @return void + */ +function sem_drawAllMonthGoo() { global $wpdb; $nummonths = $wpdb->get_var("SELECT MONTH(date) FROM ".$wpdb->statzhist); $results = $wpdb->get_results("SELECT MONTH(date) as months, SUM(visitors) as visitors FROM ".$wpdb->statzhist." GROUP BY months ORDER BY date ASC"); - print "
Besucher: Die letzten ".$nummonths." Monate
"; - print "
"; + print "
"; + printf(semr_i18np("Visitors: Last %s month", "Visitors: Last %s month", $nummonths), $nummonths); + print "
"; + + print "
"; if (empty($results)) { - print "... noch keine Einträge
"; + print "... ".semr_i18n("no entries")."
"; return; } @@ -163,10 +180,12 @@ function sem_drawLast30DaysGoo() { print "
"; } -### HISTORY ALLE historischen Tage - +/** + * + * @global wpdb $wpdb + * @return void + */ function sem_drawAllDaysGoo() { - /* @var $wpdb wpdb */ global $wpdb; $numdays = $wpdb->get_var("SELECT COUNT(date) FROM ".$wpdb->statzhist); @@ -175,12 +194,14 @@ function sem_drawAllDaysGoo() { FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date ASC"); - print "
Besucher: ".$numdays." Tage zurück
"; + print "
"; + printf(semr_i18np("Visitors: %s day back", "Visitors: %s days back", $numdays), $numdays); + print "
"; print "
"; if (empty($results)) { - print "... noch keine Einträge
"; - return; + print "... ".semr_i18n("no entries").""; + return; } foreach($results as $result) { @@ -230,18 +251,20 @@ function sem_drawAllDaysGoo() { $results = $wpdb->get_results("SELECT referers, visitors, hits, substring(date,1,10) AS date FROM ".$wpdb->statzhist." GROUP BY date ORDER BY date DESC"); - print "
Die letzten ".$numdays." Tage
"; + print "
"; + printf(semr_i18np("Last %s day", "Last %s days", $numdays), $numdays); + print "
"; if (empty($results)) { - print "... noch keine Einträge"; + print "... ".semr_i18n("no entries").""; return; } print ""; print ""; print ""; - print ""; - print ""; - print ""; - print ""; + print ""; + print ""; + print ""; + print ""; print ""; print ""; print ""; @@ -249,32 +272,32 @@ function sem_drawAllDaysGoo() { $sum_visitors = 0; $sum_hits = 0; $sum_referers = 0; - foreach($results as $key=>$result) { - $date = mysql2date('d.m.Y',$result->date); - $visitors = $result->visitors; - $sum_visitors += $visitors; - $hits = $result->hits; - $sum_hits += $hits; - $referers = $result->referers; - $sum_referers += $referers; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - } + foreach($results as $key=>$result) { + $date = mysql2date('d.m.Y',$result->date); + $visitors = $result->visitors; + $sum_visitors += $visitors; + $hits = $result->hits; + $sum_hits += $hits; + $referers = $result->referers; + $sum_referers += $referers; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + } print ""; print ""; - print ""; + print ""; print ""; print ""; print ""; print ""; print ""; - print ""; + print ""; print ""; print ""; print ""; @@ -289,7 +312,7 @@ function sem_drawAllDaysGoo() { print "
"; print "

"; - print "

SemmelstatzR › Historie

"; + print "

SemmelstatzR > ".semr_i18n("History")."

"; sem_drawLast30DaysGoo(); sem_drawAllMonthGoo();
DatumBesucherHitsReferer".semr_i18n("Date")."".semr_i18n("Visitors")."".semr_i18n("Hits")."".semr_i18n("Referrer")." 
".$date."".$visitors."".$hits."".$referers." 
".$date."".$visitors."".$hits."".$referers." 
 
Gesamt".semr_i18n("Total")."".$sum_visitors."".$sum_hits."".$sum_referers."
Durchschnitt".semr_i18n("Average")."".ceil($sum_visitors / $numdays)."".ceil($sum_hits / $numdays)."".ceil($sum_referers / $numdays)."