From 67db5eec09ade7ea35f674ac9e6b350d73a6ea89 Mon Sep 17 00:00:00 2001 From: Fraenkiman Date: Fri, 12 Apr 2024 03:25:09 +0200 Subject: [PATCH] Outsourcing of the fixed statistics panel in a plugin continue with #363 --- fp-plugins/stats/lang/lang.cs-cz.php | 2 +- fp-plugins/stats/lang/lang.da-dk.php | 2 +- fp-plugins/stats/lang/lang.de-de.php | 2 +- fp-plugins/stats/lang/lang.el-gr.php | 2 +- fp-plugins/stats/lang/lang.en-us.php | 2 +- fp-plugins/stats/lang/lang.es-es.php | 2 +- fp-plugins/stats/lang/lang.fr-fr.php | 2 +- fp-plugins/stats/lang/lang.it-it.php | 2 +- fp-plugins/stats/lang/lang.ja-jp.php | 2 +- fp-plugins/stats/lang/lang.nl-nl.php | 2 +- fp-plugins/stats/lang/lang.pt-br.php | 2 +- fp-plugins/stats/lang/lang.ru-ru.php | 2 +- fp-plugins/stats/lang/lang.sl-si.php | 2 +- fp-plugins/stats/plugin.stats.php | 23 +++++++++-------------- 14 files changed, 22 insertions(+), 27 deletions(-) diff --git a/fp-plugins/stats/lang/lang.cs-cz.php b/fp-plugins/stats/lang/lang.cs-cz.php index 5bb46e73..72b49a78 100644 --- a/fp-plugins/stats/lang/lang.cs-cz.php +++ b/fp-plugins/stats/lang/lang.cs-cz.php @@ -1,5 +1,5 @@ 'Statistiky', diff --git a/fp-plugins/stats/lang/lang.da-dk.php b/fp-plugins/stats/lang/lang.da-dk.php index 6003176d..2ff74019 100644 --- a/fp-plugins/stats/lang/lang.da-dk.php +++ b/fp-plugins/stats/lang/lang.da-dk.php @@ -1,5 +1,5 @@ 'Statistik', diff --git a/fp-plugins/stats/lang/lang.de-de.php b/fp-plugins/stats/lang/lang.de-de.php index 7161173e..253c1f6e 100644 --- a/fp-plugins/stats/lang/lang.de-de.php +++ b/fp-plugins/stats/lang/lang.de-de.php @@ -1,5 +1,5 @@ 'Statistiken', diff --git a/fp-plugins/stats/lang/lang.el-gr.php b/fp-plugins/stats/lang/lang.el-gr.php index 767a9588..e741b27e 100644 --- a/fp-plugins/stats/lang/lang.el-gr.php +++ b/fp-plugins/stats/lang/lang.el-gr.php @@ -1,5 +1,5 @@ 'Στατιστική', diff --git a/fp-plugins/stats/lang/lang.en-us.php b/fp-plugins/stats/lang/lang.en-us.php index db3fd33d..b289a833 100644 --- a/fp-plugins/stats/lang/lang.en-us.php +++ b/fp-plugins/stats/lang/lang.en-us.php @@ -1,5 +1,5 @@ 'Stats', diff --git a/fp-plugins/stats/lang/lang.es-es.php b/fp-plugins/stats/lang/lang.es-es.php index 410db2e0..bd374fdb 100644 --- a/fp-plugins/stats/lang/lang.es-es.php +++ b/fp-plugins/stats/lang/lang.es-es.php @@ -1,5 +1,5 @@ 'Estadísticas', diff --git a/fp-plugins/stats/lang/lang.fr-fr.php b/fp-plugins/stats/lang/lang.fr-fr.php index 595f8851..7296457e 100644 --- a/fp-plugins/stats/lang/lang.fr-fr.php +++ b/fp-plugins/stats/lang/lang.fr-fr.php @@ -1,5 +1,5 @@ 'Statistiques', diff --git a/fp-plugins/stats/lang/lang.it-it.php b/fp-plugins/stats/lang/lang.it-it.php index c8c6688b..6b43f6f2 100644 --- a/fp-plugins/stats/lang/lang.it-it.php +++ b/fp-plugins/stats/lang/lang.it-it.php @@ -1,5 +1,5 @@ 'Statistiche', diff --git a/fp-plugins/stats/lang/lang.ja-jp.php b/fp-plugins/stats/lang/lang.ja-jp.php index ad06a7f7..dbda3921 100644 --- a/fp-plugins/stats/lang/lang.ja-jp.php +++ b/fp-plugins/stats/lang/lang.ja-jp.php @@ -1,5 +1,5 @@ '統計情報', diff --git a/fp-plugins/stats/lang/lang.nl-nl.php b/fp-plugins/stats/lang/lang.nl-nl.php index cdfe87f4..3a77c1e6 100644 --- a/fp-plugins/stats/lang/lang.nl-nl.php +++ b/fp-plugins/stats/lang/lang.nl-nl.php @@ -1,5 +1,5 @@ 'Statistieken', diff --git a/fp-plugins/stats/lang/lang.pt-br.php b/fp-plugins/stats/lang/lang.pt-br.php index 415ef6d6..6761eb05 100644 --- a/fp-plugins/stats/lang/lang.pt-br.php +++ b/fp-plugins/stats/lang/lang.pt-br.php @@ -1,5 +1,5 @@ 'Estatísticas', diff --git a/fp-plugins/stats/lang/lang.ru-ru.php b/fp-plugins/stats/lang/lang.ru-ru.php index 14ffa590..489e7cb6 100644 --- a/fp-plugins/stats/lang/lang.ru-ru.php +++ b/fp-plugins/stats/lang/lang.ru-ru.php @@ -1,5 +1,5 @@ 'Статистика', diff --git a/fp-plugins/stats/lang/lang.sl-si.php b/fp-plugins/stats/lang/lang.sl-si.php index d2941829..8f44bd92 100644 --- a/fp-plugins/stats/lang/lang.sl-si.php +++ b/fp-plugins/stats/lang/lang.sl-si.php @@ -1,5 +1,5 @@ 'Statistika', diff --git a/fp-plugins/stats/plugin.stats.php b/fp-plugins/stats/plugin.stats.php index e6d67927..14139e1d 100644 --- a/fp-plugins/stats/plugin.stats.php +++ b/fp-plugins/stats/plugin.stats.php @@ -7,9 +7,6 @@ * Author: FlatPress * Author URI: https://flatpress.org */ -require_once ABS_PATH . 'defaults.php'; -require_once INCLUDES_DIR . 'includes.php'; - if (class_exists('AdminPanelAction')) { @@ -17,7 +14,6 @@ class admin_entry_stats extends AdminPanelAction { var $lang = 'plugin:stats'; - function format_number($num, $sep) { $ss = $sep * $sep; $i = 0; @@ -34,22 +30,21 @@ function setup() { global $lang; $lang = lang_load('plugin:stats'); - $lang ['admin'] ['entry'] ['stats'] = array(); $this->smarty->assign('admin_resource', 'plugin:stats/admin.plugin.stats'); } function main() { - global $fpdb; + global $fpdb, $lang; $lang = lang_load('plugin:stats'); - + $fpdb->query(array( 'count' => -1, // show all 'fullparse' => true )); - + $q = $fpdb->getQuery(); - + $comments = $entries = array( 'count' => 0, @@ -58,15 +53,15 @@ function main() { 'size' => 0, 'topten' => array() ); - + $entries ['comments'] = 0; - + $toplist = array(); - + while ($q->hasMore()) { - + list($id, $e) = $q->getEntry(); - + $entries ['count'] ++; $entries ['words'] += str_word_count($e ['subject']) + str_word_count($e ['content']);