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,35 @@
|
||||
namespace IPS\core\MemberACPProfile;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Member;
|
||||
use IPS\Output;
|
||||
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: Block
|
||||
*/
|
||||
abstract class _Block
|
||||
abstract class Block
|
||||
{
|
||||
/**
|
||||
* @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,11 +49,11 @@ abstract class _Block
|
||||
*
|
||||
* @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] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,15 +61,15 @@ abstract class _Block
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function output();
|
||||
abstract public function output() : string;
|
||||
|
||||
/**
|
||||
* Edit Window
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function edit()
|
||||
public function edit() : ?string
|
||||
{
|
||||
\IPS\Output::i()->error( 'node_error', '2C114/T', 404, '' );
|
||||
Output::i()->error( 'node_error', '2C114/T', 404, '' );
|
||||
}
|
||||
}
|
||||
@@ -11,25 +11,30 @@
|
||||
namespace IPS\core\MemberACPProfile;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
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: Block
|
||||
*/
|
||||
abstract class _LazyLoadingBlock extends Block
|
||||
abstract class LazyLoadingBlock extends Block
|
||||
{
|
||||
/**
|
||||
* Get Output
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output()
|
||||
public function output() : string
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('memberprofile')->lazyLoad( $this->member, \get_called_class() );
|
||||
return Theme::i()->getTemplate('memberprofile')->lazyLoad( $this->member, get_called_class() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,5 +42,5 @@ abstract class _LazyLoadingBlock extends Block
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function lazyOutput();
|
||||
abstract public function lazyOutput() : string;
|
||||
}
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
@@ -11,29 +11,34 @@
|
||||
namespace IPS\core\MemberACPProfile;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Helpers\Form;
|
||||
use IPS\Member;
|
||||
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 Member Restrictions Extension Base
|
||||
*/
|
||||
class _Restriction
|
||||
class Restriction
|
||||
{
|
||||
/**
|
||||
* @brief Member
|
||||
*/
|
||||
protected $member;
|
||||
protected ?Member $member = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \IPS\Member $member The member
|
||||
* @param Member $member The member
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( \IPS\Member $member )
|
||||
public function __construct( Member $member )
|
||||
{
|
||||
$this->member = $member;
|
||||
}
|
||||
@@ -43,7 +48,7 @@ class _Restriction
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function enabled()
|
||||
public function enabled() : bool
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -51,10 +56,10 @@ class _Restriction
|
||||
/**
|
||||
* Modify Edit Restrictions form
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form The form
|
||||
* @param Form $form The form
|
||||
* @return void
|
||||
*/
|
||||
public function form( \IPS\Helpers\Form $form )
|
||||
public function form( Form $form ): void
|
||||
{
|
||||
|
||||
}
|
||||
@@ -63,11 +68,11 @@ class _Restriction
|
||||
* Save Form
|
||||
*
|
||||
* @param array $values Values from form
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function save( $values )
|
||||
public function save( array $values ) : array
|
||||
{
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +80,7 @@ class _Restriction
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function activeRestrictions()
|
||||
public function activeRestrictions() : array
|
||||
{
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -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