diff --git a/bl-plugins/simple-stats/languages/en.json b/bl-plugins/simple-stats/languages/en.json
index 490d7226..36aeb21b 100644
--- a/bl-plugins/simple-stats/languages/en.json
+++ b/bl-plugins/simple-stats/languages/en.json
@@ -6,5 +6,8 @@
},
"visits": "Visits",
"visits-today": "Visits today",
- "unique-visitors-today": "Unique visitors today"
-}
\ No newline at end of file
+ "unique-visitors-today": "Unique visitors today",
+ "statistics": "Statistics",
+ "chart": "Chart",
+ "table": "Table"
+}
diff --git a/bl-plugins/simple-stats/plugin.php b/bl-plugins/simple-stats/plugin.php
index 5802cf79..fc2baaa5 100644
--- a/bl-plugins/simple-stats/plugin.php
+++ b/bl-plugins/simple-stats/plugin.php
@@ -1,6 +1,6 @@
dbFields = array(
'label'=>$L->g('Visits'),
'numberOfDays'=>7,
- 'excludeAdmins'=>false
+ 'excludeAdmins'=>false,
+ 'showContentStats'=>false
);
}
@@ -34,6 +35,14 @@ class pluginSimpleStats extends Plugin {
$html .= ''.$L->get('This title is almost always used in the sidebar of the site').'';
$html .= '';
+ $html .= '
';
+ $html .= '';
+ $html .= '';
+ $html .= '
';
+
if (defined('BLUDIT_PRO')) {
$html .= '';
$html .= '
';
@@ -73,18 +82,15 @@ class pluginSimpleStats extends Plugin {
$html = <<
-
+
{$L->get('Visits')}
-
-
-
-
{$L->g('Visits today')}: $visitsToday
-
{$L->g('Unique visitors today')}: $uniqueVisitors
-
-
+
+
{$L->g('Visits today')}: $visitsToday
+
{$L->g('Unique visitors today')}: $uniqueVisitors
EOF;
+
$numberOfDays = $this->getValue('numberOfDays');
$numberOfDays = $numberOfDays - 1;
for ($i=$numberOfDays; $i >= 0 ; $i--) {
@@ -119,6 +125,26 @@ EOF;
$this->deleteOldLogs();
+ /**
+ * Optional Content Stats Feature
+ */
+ if ($this->getValue('showContentStats')) {
+
+ global $pages, $categories, $tags;
+
+ $data['title'] = $L->get('Statistics');
+ $data['tabTitleChart'] = $L->get('Chart');
+ $data['tabTitleTable'] = $L->get('Table');
+ $data['data'][$L->get('published')] = count($pages->getPublishedDB());
+ $data['data'][$L->get('static')] = count($pages->getStaticDB());
+ $data['data'][$L->get('drafts')] = count($pages->getDraftDB());
+ $data['data'][$L->get('scheduled')] = count($pages->getScheduledDB());
+ $data['data'][$L->get('sticky')] = count($pages->getStickyDB());
+ $data['data'][$L->get('categories')]= count($categories->keys());
+ $data['data'][$L->get('tags')] = count($tags->keys());
+ $html .= $this->renderContentStatistics($data);
+ }
+
return $html.PHP_EOL.$script.PHP_EOL;
}
@@ -192,4 +218,52 @@ EOF;
return file_put_contents($logFile, $line.PHP_EOL, FILE_APPEND | LOCK_EX)!==false;
}
+ public function renderContentStatistics($data)
+ {
+ $html = '';
+ $html .= "
{$data['title']}
";
+ $html .= '
+
+
+
+
+
+ ';
+
+ foreach ($data['data'] as $th => $td) {
+ $html .= "
+
+ $th |
+ $td |
+
+ ";
+ }
+
+ $html .= '
+
+
+
+
+
+
+
+ ';
+
+ return $html;
+ }
+
}