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,36 +11,44 @@
|
||||
namespace IPS\core\MemberACPProfile;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Http\Url;
|
||||
use IPS\Request;
|
||||
use IPS\Theme;
|
||||
use function count;
|
||||
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: Tabbed Block
|
||||
*/
|
||||
abstract class _TabbedBlock extends Block
|
||||
abstract class TabbedBlock extends Block
|
||||
{
|
||||
/**
|
||||
* Get Output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output()
|
||||
public function output() : string
|
||||
{
|
||||
$tabs = $this->tabs();
|
||||
if ( !\count( $tabs ) )
|
||||
if ( !count( $tabs ) )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
$tabKeys = array_keys( $tabs );
|
||||
|
||||
$exploded = explode( '\\', \get_called_class() );
|
||||
$exploded = explode( '\\', get_called_class() );
|
||||
$tabParam = $exploded[1] . '_' . $exploded[5];
|
||||
$activeTabKey = ( isset( \IPS\Request::i()->block[$tabParam] ) and array_key_exists( \IPS\Request::i()->block[$tabParam], $tabs ) ) ? \IPS\Request::i()->block[$tabParam] : array_shift( $tabKeys );
|
||||
$activeTabKey = ( isset( Request::i()->block[$tabParam] ) and array_key_exists( Request::i()->block[$tabParam], $tabs ) ) ? Request::i()->block[$tabParam] : array_shift( $tabKeys );
|
||||
|
||||
return \IPS\Theme::i()->getTemplate('memberprofile')->tabbedBlock( $this->member, $tabParam, $this->blockTitle(), $tabs, $activeTabKey, $this->tabOutput( $activeTabKey ), $this->showEditLink() ? $this->editLink() : NULL );
|
||||
return Theme::i()->getTemplate('memberprofile')->tabbedBlock( $this->member, $tabParam, $this->blockTitle(), $tabs, $activeTabKey, $this->tabOutput( $activeTabKey ), $this->showEditLink() ? $this->editLink() : NULL );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +56,7 @@ abstract class _TabbedBlock extends Block
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function showEditLink()
|
||||
protected function showEditLink() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -56,12 +64,12 @@ abstract class _TabbedBlock extends Block
|
||||
/**
|
||||
* Edit Link
|
||||
*
|
||||
* @return bool
|
||||
* @return Url
|
||||
*/
|
||||
protected function editLink()
|
||||
protected function editLink() : Url
|
||||
{
|
||||
return \IPS\Http\Url::internal("app=core&module=members&controller=members&do=editBlock")->setQueryString( array(
|
||||
'block' => \get_called_class(),
|
||||
return Url::internal("app=core&module=members&controller=members&do=editBlock")->setQueryString( array(
|
||||
'block' => get_called_class(),
|
||||
'id' => $this->member->member_id
|
||||
) );
|
||||
}
|
||||
@@ -69,9 +77,9 @@ abstract class _TabbedBlock extends Block
|
||||
/**
|
||||
* Get Block Title
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function blockTitle()
|
||||
public function blockTitle() : ?string
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@@ -79,14 +87,15 @@ abstract class _TabbedBlock extends Block
|
||||
/**
|
||||
* Get Tab Names
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
abstract public function tabs();
|
||||
abstract public function tabs() : array;
|
||||
|
||||
/**
|
||||
* Get output
|
||||
*
|
||||
* @return string
|
||||
* @param string $tab
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function tabOutput( $tab );
|
||||
abstract public function tabOutput(string $tab ): mixed;
|
||||
}
|
||||
Reference in new issue
Block a user