Version 5.0.0 beta 1

This commit is contained in:
Neo committed 2025-12-19 16:27:35 -08:00
1 parent 25ddeb65d6
commit 15c7beabc5
6736 files changed
+627902 -497943

No files matched your search

+25 -20
View File
@@ -11,38 +11,43 @@
namespace IPS\Theme\System;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
use IPS\Dispatcher;
use function defined;
use const IPS\DEFAULT_THEME_ID;
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;
}
/**
* Basic themes
*/
class _Theme extends \IPS\Theme\Dev\Theme
class Theme extends \IPS\Theme\Dev\Theme
{
/**
* @brief Template Classes
*/
protected $templates;
protected array $templates = array();
/**
* Get currently logged in member's theme
*
* @return \IPS\Theme
* @return Theme
*/
public static function i()
public static function i(): Theme
{
if ( static::$memberTheme === null )
{
static::themes();
static::$memberTheme = new self;
if ( \IPS\Dispatcher::i()->controllerLocation === 'front' )
if ( Dispatcher::i()->controllerLocation === 'front' )
{
/* Add in the default theme properties (_data array, etc) */
foreach( static::$multitons[ \IPS\DEFAULT_THEME_ID ] as $k => $v )
foreach( static::$multitons[ DEFAULT_THEME_ID ] as $k => $v )
{
static::$memberTheme->$k = $v;
}
@@ -55,30 +60,30 @@ class _Theme extends \IPS\Theme\Dev\Theme
/**
* Get a template
*
* @param string $group Template Group
* @param string $app Application key (NULL for current application)
* @param string $location Template Location (NULL for current template location)
* @return \IPS\Theme\Template
* @param string $group Template Group
* @param string|null $app Application key (NULL for current application)
* @param string|null $location Template Location (NULL for current template location)
* @return Template
*/
public function getTemplate( $group, $app=NULL, $location=NULL )
public function getTemplate( string $group, string $app=NULL, string $location=NULL ): Template
{
/* Do we have an application? */
if ( $app === NULL )
{
$app = \IPS\Dispatcher::i()->application->directory;
$app = Dispatcher::i()->application->directory;
}
return new \IPS\Theme\System\Template( $app, $location, $group );
return new Template( $app, $location, $group );
}
/**
* Returns the path for the IN_DEV .phtml files
* @param string $app Application Key
* @param string|null $location Location
* @param string|null $path Path or Filename
* @param string $app Application Key
* @param string|null $location Location
* @param string|null $path Path or Filename
* @return string
*/
protected static function _getHtmlPath( $app, $location=null, $path=null )
protected static function _getHtmlPath( string $app, string $location=null, string $path=null ): string
{
return rtrim( \IPS\ROOT_PATH . "/applications/{$app}/data/html/{$location}/{$path}", '/' ) . '/';
}
@@ -87,7 +92,7 @@ class _Theme extends \IPS\Theme\Dev\Theme
* Returns the namespace for the template class
* @return string
*/
protected static function _getTemplateNamespace()
protected static function _getTemplateNamespace(): string
{
return 'IPS\\Theme\\Basic\\';
}