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,23 +12,29 @@
|
||||
namespace IPS\blog\extensions\core\Dashboard;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Extensions\DashboardAbstract;
|
||||
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 Dashboard extension: Overview
|
||||
*/
|
||||
class _Overview
|
||||
class Overview extends DashboardAbstract
|
||||
{
|
||||
/**
|
||||
* Can the current user view this dashboard item?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canView()
|
||||
public function canView(): bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -38,26 +44,16 @@ class _Overview
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlock()
|
||||
public function getBlock(): string
|
||||
{
|
||||
/* Basic stats */
|
||||
$data = array(
|
||||
'total_blogs' => (int) \IPS\Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first(),
|
||||
'total_entries' => (int) \IPS\Db::i()->select( 'COUNT(*)', 'blog_entries' )->first(),
|
||||
'total_comments' => (int) \IPS\Db::i()->select( 'COUNT(*)', 'blog_comments' )->first(),
|
||||
'total_blogs' => (int) Db::i()->select( 'COUNT(*)', 'blog_blogs' )->first(),
|
||||
'total_entries' => (int) Db::i()->select( 'COUNT(*)', 'blog_entries' )->first(),
|
||||
'total_comments' => (int) Db::i()->select( 'COUNT(*)', 'blog_comments' )->first(),
|
||||
);
|
||||
|
||||
/* Display */
|
||||
return \IPS\Theme::i()->getTemplate( 'dashboard', 'blog' )->overview( $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the block information
|
||||
*
|
||||
* @return array array( 'name' => 'Block title', 'key' => 'unique_key', 'size' => [1,2,3], 'by' => 'Author name' )
|
||||
*/
|
||||
public function getInfo()
|
||||
{
|
||||
return array();
|
||||
return Theme::i()->getTemplate( 'dashboard', 'blog' )->overview( $data );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user