From ea7ea1286c9b1d80e0b390e7091b29f6ab737acc Mon Sep 17 00:00:00 2001 From: Joey Kimsey Date: Tue, 20 Aug 2024 06:29:45 -0400 Subject: [PATCH] remove custom DTC setup and fixes for customexception --- classes/template.php | 26 ++++---------------------- classes/views.php | 5 +++-- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/classes/template.php b/classes/template.php index 35dee17..4e806a4 100644 --- a/classes/template.php +++ b/classes/template.php @@ -15,9 +15,8 @@ namespace TheTempusProject\Houdini\Classes; use TheTempusProject\Canary\Bin\Canary as Debug; +use TheTempusProject\Canary\Classes\CustomException; 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\Forms; use TheTempusProject\Houdini\Classes\Filters; @@ -108,7 +107,7 @@ class Template { return self::loadTemplate( $location, $name ); } } - // new CustomException( 'template', $docLocation ); + new CustomException( 'template', $docLocation ); } /** @@ -126,7 +125,7 @@ class Template { $fullPath = $path . $name . '.inc.php'; $className = APP_SPACE . '\\Templates\\' . ucfirst( $name ) . 'Loader'; if ( !file_exists( $fullPath ) ) { - // new CustomException( 'templateLoader', $fullPath ); + new CustomException( 'templateLoader', $fullPath ); } else { Debug::log( 'Requiring template loader: ' . $name ); require_once $fullPath; @@ -202,7 +201,7 @@ class Template { self::buildRobot(); self::buildHeaders(); if ( empty( self::$templateLocation ) ) { - // throw an error here @todo + new CustomException( 'templateLocation', self::$templateLocation ); return; } if ( !Debug::status( 'render' ) ) { @@ -315,7 +314,6 @@ class Template { * be used as components for the provided html. * @return string - The fully parsed html output. */ - public static function parse( $template, $data = null, $flags = null ) { if ( empty( $template ) ) { return $template; @@ -330,22 +328,6 @@ class 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. $template = Filters::apply( $template ); diff --git a/classes/views.php b/classes/views.php index c4485eb..1e32e74 100644 --- a/classes/views.php +++ b/classes/views.php @@ -12,6 +12,7 @@ namespace TheTempusProject\Houdini\Classes; use TheTempusProject\Canary\Bin\Canary as Debug; +use TheTempusProject\Canary\Classes\CustomException; class Views extends Template { public static $additionalLocations = []; @@ -34,7 +35,7 @@ class Views extends Template { if ( !empty( $out ) ) { self::$content .= $out; } 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 :/ - // throw new CustomException('simpleView', $path); + new CustomException('simpleView', $path); return false; }