0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0];
$now = date('Y');
$blog = RainLab\Blog\Models\Post::where('published_at', '>', 0)->get();
foreach ($blog as $item) {
$year = substr($item->published_at, 0, 4);
if ($year == $now) {
$thisYear[(int)substr($item->published_at, 5, 2)]++;
}
else if ($year == $now - 1) {
$lastYear[(int)substr($item->published_at, 5, 2)]++;
$lastYear[0]++;
}
}
// Posts Length
$blog = RainLab\Blog\Models\Post::get();
$posts = [];
foreach ($blog as $item) {
$posts[$item->id] = strlen(strip_tags($item->excerpt.$item->content));
}
// Longest posts
arsort($posts);
$longest = '';
$index = 1;
foreach ($posts as $id => $length) {
$item = RainLab\Blog\Models\Post::whereId($id)->first();
$longest .= '
'.$index.'.
'.number_format($length, 0, '.', ' ').'
';
if ($index == 10) {
break;
}
$index++;
}
// Shortest posts
asort($posts);
$shortest = '';
$index = 1;
foreach ($posts as $id => $length) {
$item = RainLab\Blog\Models\Post::whereId($id)->first();
$shortest .= '
'.$index.'.
'.number_format($length, 0, '.', ' ').'
';
if ($index == 10) {
break;
}
$index++;
}
?>
- = e(trans('indikator.blogstat::lang.menu.statistics')) ?>
-
= RainLab\Blog\Models\Post::count() ?> = e(trans_choice('indikator.blogstat::lang.menu.posts', RainLab\Blog\Models\Post::count())) ?>
|
= RainLab\Blog\Models\Category::count() ?> = e(trans_choice('indikator.blogstat::lang.menu.categories', RainLab\Blog\Models\Category::count())) ?>
= $now ?>
0): ?>
= ($now - 1) ?>
= e(trans('indikator.blogstat::lang.stat.longest')) ?>
= $longest ?>
= e(trans('indikator.blogstat::lang.stat.shortest')) ?>
= $shortest ?>