various bugfixes
This commit is contained in:
@ -151,14 +151,14 @@ function sideLoad() {
|
||||
// Canary Autoloader (Debugging)
|
||||
if ( ! defined( 'CANARY_AUTOLOADED' ) ) {
|
||||
if ( defined( 'CANARY_ROOT_DIRECTORY' ) ) {
|
||||
require_once CANARY_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
require_once CANARY_ROOT_DIRECTORY . 'Bin' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
// Bedrock Autoloader (Core Functionality)
|
||||
if ( ! defined( 'BEDROCK_AUTOLOADED' ) ) {
|
||||
if ( defined( 'BEDROCK_ROOT_DIRECTORY' ) ) {
|
||||
require_once BEDROCK_ROOT_DIRECTORY . 'bin' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
require_once BEDROCK_ROOT_DIRECTORY . 'Bin' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,4 +172,4 @@ function sideLoad() {
|
||||
define( 'VENDOR_AUTOLOADED', false );
|
||||
}
|
||||
|
||||
require_once 'bin/tempus_project.php';
|
||||
require_once 'tempus_project.php';
|
||||
|
@ -19,6 +19,7 @@ use TheTempusProject\Bedrock\Functions\Input;
|
||||
use TheTempusProject\Bedrock\Functions\Session;
|
||||
use TheTempusProject\Bedrock\Functions\Cookie;
|
||||
use TheTempusProject\Bedrock\Functions\Check;
|
||||
use TheTempusProject\Bedrock\Functions\Date;
|
||||
use TheTempusProject\Canary\Bin\Canary as Debug;
|
||||
|
||||
use TheTempusProject\Hermes\Functions\Redirect;
|
||||
@ -241,13 +242,85 @@ class TheTempusProject extends Bedrock {
|
||||
'example' => '(?)',
|
||||
],
|
||||
];
|
||||
public $configMatrix = [
|
||||
"main" => [
|
||||
"logo" => [
|
||||
"type" => "file",
|
||||
"pretty" => "Site Logo (Used mostly in emails)",
|
||||
"default" => "images/logo.png"
|
||||
],
|
||||
"name" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Site Name",
|
||||
"default" => "TTP Example"
|
||||
],
|
||||
"template" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Default Site Template",
|
||||
"default" => "default"
|
||||
],
|
||||
"tokenEnabled" => [
|
||||
"type" => "radio",
|
||||
"pretty" => "Enable CSRF Token for all forms.",
|
||||
"default" => true
|
||||
],
|
||||
"loginLimit" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Maximum Login Attempts per hour",
|
||||
"default" => 5
|
||||
]
|
||||
],
|
||||
"database" => [
|
||||
"dbEnabled" => [
|
||||
"type" => "radio",
|
||||
"pretty" => "Database Enabled",
|
||||
"default" => true,
|
||||
"protected" => true
|
||||
],
|
||||
"dbHost" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Database Host (IE: http://localhost:3306)",
|
||||
"default" => "127.0.0.1",
|
||||
"protected" => true
|
||||
],
|
||||
"dbMaxQuery" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Maximum results per query",
|
||||
"default" => 100,
|
||||
"protected" => true
|
||||
],
|
||||
"dbName" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Database Name",
|
||||
"default" => "ttp-example",
|
||||
"protected" => true
|
||||
],
|
||||
"dbPassword" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Database Password",
|
||||
"default" => "",
|
||||
"protected" => true
|
||||
],
|
||||
"dbPrefix" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Database table Prefix",
|
||||
"default" => "TTP_",
|
||||
"protected" => true
|
||||
],
|
||||
"dbUsername" => [
|
||||
"type" => "text",
|
||||
"pretty" => "Database Username",
|
||||
"default" => "root",
|
||||
"protected" => true
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* The constructor takes care of everything that we will need before
|
||||
* finally calling appload to instantiate the appropriate controller/method.
|
||||
*/
|
||||
public function __construct() {
|
||||
|
||||
// Initialize the parent app
|
||||
parent::__construct();
|
||||
Debug::info( 'Requested URL: ' . $this->getCurrentUrl() );
|
||||
@ -289,9 +362,6 @@ class TheTempusProject extends Bedrock {
|
||||
}
|
||||
}
|
||||
|
||||
// echo '<pre>'.var_export( $plugins, true ).'</pre>';
|
||||
// exit();
|
||||
|
||||
Debug::gend();
|
||||
}
|
||||
|
||||
@ -329,6 +399,13 @@ class TheTempusProject extends Bedrock {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function dateTimeCallback( $data ) {
|
||||
if ( empty( $data[2] ) ) {
|
||||
return '';
|
||||
}
|
||||
return Date::formatTimestamp( $data[1], $data[2] );
|
||||
}
|
||||
|
||||
public function loadFilters() {
|
||||
// These Filter have to be loaded here because they have calculated values
|
||||
$this->filters[] = [
|
||||
@ -359,9 +436,17 @@ class TheTempusProject extends Bedrock {
|
||||
'enabled' => true,
|
||||
'example' => '{LOGGEDIN}Only visible to users who are logged-in{LOGGEDIN}',
|
||||
];
|
||||
if ( !empty( $this->filters ) ) {
|
||||
$this->filters[] = [
|
||||
'name' => 'dtc',
|
||||
'find' => '#{DTC(.*?)}(.*?){/DTC}#is',
|
||||
'replace' => [ __CLASS__, 'dateTimeCallback' ],
|
||||
'enabled' => true,
|
||||
'callback' => true,
|
||||
'example' => '{DTC=date}000000000{DTC}',
|
||||
];
|
||||
if ( ! empty( $this->filters ) ) {
|
||||
foreach( $this->filters as $filter ) {
|
||||
Filters::add( $filter['name'], $filter['find'], $filter['replace'], $filter['enabled'] );
|
||||
Filters::add( $filter['name'], $filter['find'], $filter['replace'], $filter['enabled'], ( $filter['callback'] ?? false ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user