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
@@ -11,29 +11,36 @@
|
||||
namespace IPS\core\MemberACPProfile;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Application;
|
||||
use IPS\Member;
|
||||
use IPS\Theme;
|
||||
use function defined;
|
||||
use function get_called_class;
|
||||
|
||||
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 ACP Member Profile: Main Tab
|
||||
*/
|
||||
abstract class _MainTab
|
||||
abstract class MainTab
|
||||
{
|
||||
/**
|
||||
* @brief Member
|
||||
*/
|
||||
protected $member;
|
||||
protected ?Member $member = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Member $member Member
|
||||
* @param Member $member Member
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Member $member )
|
||||
public function __construct( Member $member )
|
||||
{
|
||||
$this->member = $member;
|
||||
}
|
||||
@@ -43,7 +50,7 @@ abstract class _MainTab
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canView()
|
||||
public function canView() : bool
|
||||
{
|
||||
/* Extensions can override */
|
||||
return TRUE;
|
||||
@@ -54,11 +61,11 @@ abstract class _MainTab
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function title()
|
||||
public static function title() : string
|
||||
{
|
||||
$class = \get_called_class();
|
||||
$class = get_called_class();
|
||||
$exploded = explode( '\\', $class );
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'memberACPProfileTitle_' . $exploded[1] . '_' . $exploded[5] );
|
||||
return Member::loggedIn()->language()->addToStack( 'memberACPProfileTitle_' . $exploded[1] . '_' . $exploded[5] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +73,7 @@ abstract class _MainTab
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function leftColumnBlocks()
|
||||
public function leftColumnBlocks() : array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
@@ -76,7 +83,7 @@ abstract class _MainTab
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function mainColumnBlocks()
|
||||
public function mainColumnBlocks() : array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
@@ -86,20 +93,54 @@ abstract class _MainTab
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output()
|
||||
public function output() : string
|
||||
{
|
||||
$seenBlocks = array();
|
||||
$leftColumnBlocks = array();
|
||||
foreach ( $this->leftColumnBlocks() as $class )
|
||||
{
|
||||
$seenBlocks[] = $class;
|
||||
$leftColumnBlocks[] = new $class( $this->member );
|
||||
}
|
||||
|
||||
$mainColumnBlocks = array();
|
||||
foreach ( $this->mainColumnBlocks() as $class )
|
||||
{
|
||||
$seenBlocks[] = $class;
|
||||
$mainColumnBlocks[] = new $class( $this->member );
|
||||
}
|
||||
|
||||
$class = get_called_class();
|
||||
$exploded = explode( '\\', $class );
|
||||
$thisTab = $exploded[1] . '_' . $exploded[5];
|
||||
|
||||
/* Check other applications for possible blocks that should show on this tab */
|
||||
foreach( Application::allExtensions( 'core', 'MemberACPProfileBlocks', TRUE, 'core', 'Main', FALSE ) AS $key => $ext )
|
||||
{
|
||||
/* If we are already displaying this class, skip it */
|
||||
if( in_array( $ext, $seenBlocks ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( isset( $ext::$displayTab ) AND $ext::$displayTab == $thisTab )
|
||||
{
|
||||
$class = new $ext( $this->member );
|
||||
if( isset( $ext::$displayColumn ) )
|
||||
{
|
||||
switch( $ext::$displayColumn )
|
||||
{
|
||||
case 'left':
|
||||
$leftColumnBlocks[] = $class;
|
||||
break;
|
||||
case 'main':
|
||||
$mainColumnBlocks[] = $class;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return \IPS\Theme::i()->getTemplate('memberprofile')->tabTemplate( $leftColumnBlocks, $mainColumnBlocks );
|
||||
return Theme::i()->getTemplate('memberprofile')->tabTemplate( $leftColumnBlocks, $mainColumnBlocks );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user