remove custom DTC setup and fixes for customexception

This commit is contained in:
Joey Kimsey
2024-08-20 06:29:45 -04:00
parent 1d71b4fd13
commit ea7ea1286c
2 changed files with 7 additions and 24 deletions

View File

@ -15,9 +15,8 @@
namespace TheTempusProject\Houdini\Classes; namespace TheTempusProject\Houdini\Classes;
use TheTempusProject\Canary\Bin\Canary as Debug; use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Canary\Classes\CustomException;
use TheTempusProject\Hermes\Functions\Route as Routes; use TheTempusProject\Hermes\Functions\Route as Routes;
// use TheTempusProject\Bedrock\Functions\Date;
// use TheTempusProject\Bedrock\Classes\CustomException;
use TheTempusProject\Houdini\Classes\Components; use TheTempusProject\Houdini\Classes\Components;
use TheTempusProject\Houdini\Classes\Forms; use TheTempusProject\Houdini\Classes\Forms;
use TheTempusProject\Houdini\Classes\Filters; use TheTempusProject\Houdini\Classes\Filters;
@ -108,7 +107,7 @@ class Template {
return self::loadTemplate( $location, $name ); return self::loadTemplate( $location, $name );
} }
} }
// new CustomException( 'template', $docLocation ); new CustomException( 'template', $docLocation );
} }
/** /**
@ -126,7 +125,7 @@ class Template {
$fullPath = $path . $name . '.inc.php'; $fullPath = $path . $name . '.inc.php';
$className = APP_SPACE . '\\Templates\\' . ucfirst( $name ) . 'Loader'; $className = APP_SPACE . '\\Templates\\' . ucfirst( $name ) . 'Loader';
if ( !file_exists( $fullPath ) ) { if ( !file_exists( $fullPath ) ) {
// new CustomException( 'templateLoader', $fullPath ); new CustomException( 'templateLoader', $fullPath );
} else { } else {
Debug::log( 'Requiring template loader: ' . $name ); Debug::log( 'Requiring template loader: ' . $name );
require_once $fullPath; require_once $fullPath;
@ -202,7 +201,7 @@ class Template {
self::buildRobot(); self::buildRobot();
self::buildHeaders(); self::buildHeaders();
if ( empty( self::$templateLocation ) ) { if ( empty( self::$templateLocation ) ) {
// throw an error here @todo new CustomException( 'templateLocation', self::$templateLocation );
return; return;
} }
if ( !Debug::status( 'render' ) ) { if ( !Debug::status( 'render' ) ) {
@ -315,7 +314,6 @@ class Template {
* be used as components for the provided html. * be used as components for the provided html.
* @return string - The fully parsed html output. * @return string - The fully parsed html output.
*/ */
public static function parse( $template, $data = null, $flags = null ) { public static function parse( $template, $data = null, $flags = null ) {
if ( empty( $template ) ) { if ( empty( $template ) ) {
return $template; return $template;
@ -330,22 +328,6 @@ class Template {
$template = preg_replace( '#\{OPTION\=(.*?)\}#is', '', $template ); $template = preg_replace( '#\{OPTION\=(.*?)\}#is', '', $template );
} }
//Convert any dates into preferred Date/Time format. User preference will be applied her in the future.
// @todo - there must be something to migrate this ability from the top to the bottom when a user has a pref
$dtc = '#{DTC(.*?)}(.*?){/DTC}#is';
$template = preg_replace_callback(
$dtc,
function ( $data ) {
if ( empty( $data[2] ) ) {
return '';
}
return $data[2]; // @todo need a way to decouple this from houdini to bedrock
// return Date::formatTimestamp( $data[1], $data[2] );
},
$template
);
//Run through our full list of generated filters. //Run through our full list of generated filters.
$template = Filters::apply( $template ); $template = Filters::apply( $template );

View File

@ -12,6 +12,7 @@
namespace TheTempusProject\Houdini\Classes; namespace TheTempusProject\Houdini\Classes;
use TheTempusProject\Canary\Bin\Canary as Debug; use TheTempusProject\Canary\Bin\Canary as Debug;
use TheTempusProject\Canary\Classes\CustomException;
class Views extends Template { class Views extends Template {
public static $additionalLocations = []; public static $additionalLocations = [];
@ -34,7 +35,7 @@ class Views extends Template {
if ( !empty( $out ) ) { if ( !empty( $out ) ) {
self::$content .= $out; self::$content .= $out;
} else { } else {
// new CustomException( 'view', $viewName ); new CustomException( 'view', $viewName );
} }
} }
@ -96,7 +97,7 @@ class Views extends Template {
} }
} }
// @todo - this would be awesome, if i actually caught the exception anywhere :/ // @todo - this would be awesome, if i actually caught the exception anywhere :/
// throw new CustomException('simpleView', $path); new CustomException('simpleView', $path);
return false; return false;
} }