make all themes have a Page class, to simplify loading

This commit is contained in:
Shish 2020-01-27 18:35:36 +00:00
parent 903679dc53
commit dba89e9d13
10 changed files with 15 additions and 12 deletions

View file

@ -38,7 +38,7 @@ require_all(zglob("ext/{".Extension::get_enabled_extensions_as_string()."}/main.
// load the theme parts
require_all(_get_themelet_files(get_theme()));
$page = class_exists("CustomPage") ? new CustomPage() : new Page();
$page = new Page();
// hook up event handlers
_load_event_listeners();

View file

@ -1,4 +1,6 @@
<?php declare(strict_types=1);
require_once "core/event.php";
/**
* \page themes Themes
*
@ -42,7 +44,7 @@ abstract class PageMode
* The various extensions all add whatever they want to this structure,
* then Layout turns it into HTML.
*/
class Page
class BasePage
{
/** @var string */
public $mode = PageMode::PAGE;

View file

@ -528,9 +528,7 @@ function _sanitise_environment(): void
function _get_themelet_files(string $_theme): array
{
$base_themelets = [];
if (file_exists('themes/'.$_theme.'/custompage.class.php')) {
$base_themelets[] = 'themes/'.$_theme.'/custompage.class.php';
}
$base_themelets[] = 'themes/'.$_theme.'/page.class.php';
$base_themelets[] = 'themes/'.$_theme.'/layout.class.php';
$base_themelets[] = 'themes/'.$_theme.'/themelet.class.php';

View file

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
class CustomPage extends Page
class Page extends BasePage
{
/** @var bool */
public $left_enabled = true;

View file

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
class CustomPage extends Page
class Page extends BasePage
{
public $left_enabled = true;
public function disable_left()

View file

@ -0,0 +1,2 @@
<?php declare(strict_types=1);
class Page extends BasePage {}

View file

@ -1,6 +1,6 @@
<?php declare(strict_types=1);
class CustomPage extends Page
class Page extends BasePage
{
public $left_enabled = true;
public function disable_left()

View file

@ -1,9 +1,6 @@
<?php declare(strict_types=1);
/**
* Class CustomPage
*/
class CustomPage extends Page
class Page extends BasePage
{
/** @var bool */
public $left_enabled = true;

View file

@ -0,0 +1,2 @@
<?php declare(strict_types=1);
class Page extends BasePage {}

View file

@ -0,0 +1,2 @@
<?php declare(strict_types=1);
class Page extends BasePage {}