Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,21 +12,28 @@
|
||||
namespace IPS\blog\extensions\core\OverviewStatistics;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Extensions\OverviewStatisticsAbstract;
|
||||
use IPS\Member;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Overview statistics extension: Blogs
|
||||
*/
|
||||
class _Blogs
|
||||
class Blogs extends OverviewStatisticsAbstract
|
||||
{
|
||||
/**
|
||||
* @brief Which statistics page (activity or user)
|
||||
*/
|
||||
public $page = 'activity';
|
||||
public string $page = 'activity';
|
||||
|
||||
/**
|
||||
* Return the sub-block keys
|
||||
@@ -34,7 +41,7 @@ class _Blogs
|
||||
* @note This is designed to allow one class to support multiple blocks, for instance using the ContentRouter to generate blocks.
|
||||
* @return array
|
||||
*/
|
||||
public function getBlocks()
|
||||
public function getBlocks(): array
|
||||
{
|
||||
return array( 'blogs' );
|
||||
}
|
||||
@@ -42,26 +49,26 @@ class _Blogs
|
||||
/**
|
||||
* Return block details (title and description)
|
||||
*
|
||||
* @param string|NULL $subBlock The subblock we are loading as returned by getBlocks()
|
||||
* @param string|null $subBlock The subblock we are loading as returned by getBlocks()
|
||||
* @return array
|
||||
*/
|
||||
public function getBlockDetails( $subBlock = NULL )
|
||||
public function getBlockDetails( string $subBlock = NULL ): array
|
||||
{
|
||||
/* Description can be null and will not be shown if so */
|
||||
return array( 'app' => 'blog', 'title' => 'stats_overview_blogs', 'description' => \IPS\Member::loggedIn()->language()->addToStack( 'stats_overview_blogs_desc' ), 'refresh' => 120 );
|
||||
return array( 'app' => 'blog', 'title' => 'stats_overview_blogs', 'description' => Member::loggedIn()->language()->addToStack( 'stats_overview_blogs_desc' ), 'refresh' => 120 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block HTML to show
|
||||
*
|
||||
* @param array|NULL $dateRange NULL for all time, or an array with 'start' and 'end' \IPS\DateTime objects to restrict to
|
||||
* @param string|NULL $subBlock The subblock we are loading as returned by getBlocks()
|
||||
* @param array|string|null $dateRange NULL for all time, or an array with 'start' and 'end' \IPS\DateTime objects to restrict to
|
||||
* @param string|null $subBlock The subblock we are loading as returned by getBlocks()
|
||||
* @return string
|
||||
*/
|
||||
public function getBlock( $dateRange = NULL, $subBlock = NULL )
|
||||
public function getBlock( array|string|null $dateRange = NULL, string $subBlock = NULL ): string
|
||||
{
|
||||
$total = \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first();
|
||||
$total = Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first();
|
||||
|
||||
return \IPS\Theme::i()->getTemplate( 'stats' )->overviewComparisonCount( $total, NULL, NULL );
|
||||
return Theme::i()->getTemplate( 'stats' )->overviewComparisonCount( $total, NULL, NULL );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user