Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
suckless web
tantum.
Commits
41d96197
Commit
41d96197
authored
Oct 20, 2022
by
Michael Ochmann
Browse files
minor fixes complementing php 8 support
parent
32cbe08a
Changes
4
Hide whitespace changes
Inline
Side-by-side
plugins/BlogRoll/BlogRoll.php
View file @
41d96197
...
...
@@ -13,8 +13,8 @@ class BlogRoll extends \tantum\plugins\Plugin {
}
public
function
init
()
:
void
{
$this
->
utils
->
registerCo
mplexPlaceholder
(
"roleTitle"
,
[
$this
,
"rollTitle"
]);
$this
->
utils
->
registerCo
mplexPlaceholder
(
"blognav"
,
[
$this
,
"blognav"
]);
$this
->
utils
->
registerCo
ntextAwareTag
(
"roleTitle"
,
[
$this
,
"rollTitle"
]);
$this
->
utils
->
registerCo
ntextAwareTag
(
"blognav"
,
[
$this
,
"blognav"
]);
$this
->
middleware
->
use
(
function
(
\
tantum\models\Page
$context
,
string
$lastResult
)
{
if
(
$this
->
isBlogPage
(
$context
))
{
return
"blog"
;
...
...
@@ -73,7 +73,7 @@ class BlogRoll extends \tantum\plugins\Plugin {
$parent
=
false
;
if
(
is_numeric
(
\
tantum\Std
::
getToplevelFromPath
(
$context
->
path
)))
$this
->
currentPage
=
\
tantum\Std
::
getToplevelFromPath
(
$context
->
path
);
$this
->
currentPage
=
intval
(
\
tantum\Std
::
getToplevelFromPath
(
$context
->
path
)
)
;
$dir
=
__DIR__
.
"/../../webcontent/
$context->path
/.."
;
if
(
!
file_exists
(
$dir
))
...
...
plugins/DynamicTitle/DynamicTitle.php
View file @
41d96197
...
...
@@ -3,14 +3,15 @@
namespace
DynamicTitle
;
use
tantum\models\Model
;
use
tantum\models\Page
;
use
tantum\plugins\Plugin
;
class
DynamicTitle
extends
Plugin
{
const
DEFAULT_TITLE
=
"CMS"
;
protected
function
init
()
:
void
{
$this
->
utils
->
register
SimplePlaceholder
(
"title"
,
$this
->
title
());
$this
->
utils
->
registerCo
mplexPlaceholder
(
"subtitle"
,
[
$this
,
"subtitle"
]);
$this
->
utils
->
register
Tag
(
"title"
,
$this
->
title
());
$this
->
utils
->
registerCo
ntextAwareTag
(
"subtitle"
,
[
$this
,
"subtitle"
]);
}
private
function
title
()
:
string
{
...
...
src/Application.php
View file @
41d96197
...
...
@@ -16,14 +16,14 @@ use tantum\plugins\Utils;
* @autor Michael Ochmann
*/
class
Application
{
private
Utils
$utils
;
private
PluginManager
$pluginManager
;
private
Tree
$dirTree
;
private
Renderer
$renderer
;
private
Page
$page
;
private
TemplateMiddleware
$templateMiddleware
;
private
float
$startTime
;
private
string
$locale
;
private
Utils
$utils
;
private
PluginManager
$pluginManager
;
private
Tree
$dirTree
;
private
Renderer
$renderer
;
private
Page
$page
;
private
?
TemplateMiddleware
$templateMiddleware
;
private
float
$startTime
;
private
string
$locale
;
// builds the frame and puts out the time which was needed for
public
function
__construct
()
{
...
...
@@ -34,8 +34,9 @@ class Application {
$this
->
startTime
=
microtime
(
true
);
// sets startTime on current Time
$this
->
utils
=
new
plugins\Utils
()
;
$this
->
templateMiddleware
=
null
;
$this
->
dirTree
=
new
models\Tree
(
"/"
.
$_GET
[
"path"
],
$this
->
retrieveMenuOrder
());
$this
->
utils
=
new
plugins\Utils
();
$this
->
page
=
new
Page
(
$this
,
$_GET
[
"path"
],
$this
->
dirTree
,
$this
->
utils
);
$this
->
templateMiddleware
=
new
\
tantum\TemplateMiddleware
(
$this
->
page
);
$this
->
templateMiddleware
->
use
(
function
(
Page
$context
,
string
$lastResult
)
:
string
{
...
...
src/plugins/Utils.php
View file @
41d96197
...
...
@@ -19,7 +19,7 @@ namespace tantum\plugins {
return
$this
->
placeholders
;
}
public
function
register
SimplePlaceholder
(
string
$identifier
,
mixed
$value
)
:
bool
{
public
function
register
Tag
(
string
$identifier
,
mixed
$value
)
:
bool
{
if
(
array_key_exists
(
$identifier
,
$this
->
simplePlaceholders
)
||
array_key_exists
(
$identifier
,
$this
->
placeholders
))
return
false
;
$this
->
simplePlaceholders
[
$identifier
]
=
$value
;
...
...
@@ -27,7 +27,7 @@ namespace tantum\plugins {
return
true
;
}
public
function
registerCo
mplexPlaceholder
(
string
$identifier
,
callable
$callback
)
:
bool
{
public
function
registerCo
ntextAwareTag
(
string
$identifier
,
callable
$callback
)
:
bool
{
if
(
array_key_exists
(
$identifier
,
$this
->
simplePlaceholders
)
||
array_key_exists
(
$identifier
,
$this
->
placeholders
))
return
false
;
$this
->
placeholders
[
$identifier
]
=
$callback
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment