Skip to content

Commit

Permalink
Outsourcing of the fixed statistics panel in a plugin
Browse files Browse the repository at this point in the history
continue with #363
  • Loading branch information
Fraenkiman authored Apr 12, 2024
2 parents cd91ab6 + 67db5ee commit 4bacfaf
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 27 deletions.
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.cs-cz.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistiky';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistiky';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiky',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.da-dk.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistik';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistik';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistik',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.de-de.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistiken';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistiken';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiken',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.el-gr.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Στατιστική';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Στατιστική';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Στατιστική',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.en-us.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Stats';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Stats';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Stats',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.es-es.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Estadísticas';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Estadísticas';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Estadísticas',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.fr-fr.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistiques';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistiques';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiques',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.it-it.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistiche';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistiche';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistiche',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.ja-jp.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = '統計情報';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = '統計情報';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => '統計情報',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.nl-nl.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistieken';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistieken';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistieken',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.pt-br.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Estatísticas';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Estatísticas';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Estatísticas',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.ru-ru.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Статистика';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Статистика';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Статистика',
Expand Down
2 changes: 1 addition & 1 deletion fp-plugins/stats/lang/lang.sl-si.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
$lang ['admin'] ['entry'] ['submenu'] = 'Statistika';
$lang ['admin'] ['entry'] ['submenu'] ['stats'] = 'Statistika';

$lang ['admin'] ['entry'] ['stats'] = array(
'head' => 'Statistika',
Expand Down
23 changes: 9 additions & 14 deletions fp-plugins/stats/plugin.stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
* Author: FlatPress
* Author URI: https://flatpress.org
*/
require_once ABS_PATH . 'defaults.php';
require_once INCLUDES_DIR . 'includes.php';

if (class_exists('AdminPanelAction')) {


class admin_entry_stats extends AdminPanelAction {

var $lang = 'plugin:stats';


function format_number($num, $sep) {
$ss = $sep * $sep;
$i = 0;
Expand All @@ -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,
Expand All @@ -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']);

Expand Down

0 comments on commit 4bacfaf

Please sign in to comment.