@@ -903,59 +903,49 @@ final class view extends Controller
903
903
{
904
904
905
905
/**
906
- * --------------------------------------------------------------
907
- *
908
- * | This method is used in rendering views and parsing public URL in views.
909
- *
910
- * @param string $view
911
- * @return string return the file gotten from the view parameters
912
- *
913
- * --------------------------------------------------------------
914
- */
915
- final public static function render (string $ view ): mixed
916
- {
917
- try
918
- {
919
- /**
920
- * Retrieves the charset from the configuration file.
921
- *
922
- * The above code is retrieving the value of the 'charset' key from the 'config_file' array.
923
- * The 'config_file' array is obtained using the 'config_file' method of the current class.
924
- *
925
- * @return string The charset value.
926
- */
927
- $ config_file = self ::config_file ();
928
- $ charset = $ config_file ['charset ' ];
929
-
930
- // split :: into array and extract the folder and files
931
- $ file = preg_replace ('/(::)|::/ ' , '/ ' , $ view );
932
- $ view_path = '/views/ ' . $ file ;
933
-
934
- $ file_uri = Route::$ root_dir . $ view_path ;
935
-
936
- if (is_file ($ file_uri . '.view.php ' ) && !preg_match ('/(..\/)/ ' , $ view ))
937
- {
938
- $ file_type = Route::file_type ($ file_uri . '.view.php ' );
939
- header ("Content-Type: $ file_type; charset= $ charset " );
940
-
941
- return self ::slides_include ($ file_uri . '.view.php ' );
942
- }
943
- elseif (is_file ($ file_uri ) && !preg_match ('/(..\/)/ ' , $ view ))
944
- {
945
- $ file_type = Route::file_type ($ file_uri );
946
- header ("Content-Type: $ file_type; charset= $ charset " );
947
-
948
- return self ::slides_include ($ file_uri );
949
- }
950
- else
951
- {
952
- throw new Exception ("No view controller path found called ` $ view` " );
953
- }
954
- }
955
- catch ( Exception $ e )
956
- {
957
- print $ e ->getMessage ();
958
- return 'null ' ;
959
- }
960
- }
961
- }
906
+ * --------------------------------------------------------------
907
+ *
908
+ * | Render views and parse public URL in views
909
+ *
910
+ * @param string $view
911
+ * @return mixed return the file gotten from the view parameters
912
+ *
913
+ * --------------------------------------------------------------
914
+ */
915
+ final public static function render (string $ view ): mixed
916
+ {
917
+ try
918
+ {
919
+ // split :: into array and extract the folder and files
920
+ $ file = preg_replace ('/(::)|::/ ' , '/ ' , $ view );
921
+ $ file = strtolower (trim ($ file , '\/\/ ' ));
922
+ $ view_path = '/views/ ' . $ file ;
923
+
924
+ $ file_uri = Route::$ root_dir . $ view_path ;
925
+
926
+ if (is_file ($ file_uri . '.view.php ' ) && !preg_match ('/(..\/)/ ' , $ view ))
927
+ {
928
+ $ file_type = Route::file_type ($ file_uri . '.view.php ' );
929
+ header ("Content-Type: $ file_type " );
930
+
931
+ return self ::slides_include ($ file_uri . '.view.php ' );
932
+ }
933
+ elseif (is_file ($ file_uri ) && !preg_match ('/(..\/)/ ' , $ view ))
934
+ {
935
+ $ file_type = Route::file_type ($ file_uri );
936
+ header ("Content-Type: $ file_type " );
937
+
938
+ return self ::slides_include ($ file_uri );
939
+ }
940
+ else
941
+ {
942
+ throw new Exception ("No view controller path found called ` $ view` " );
943
+ }
944
+ }
945
+ catch ( Exception $ e )
946
+ {
947
+ print $ e ->getMessage ();
948
+ return 'null ' ;
949
+ }
950
+ }
951
+ }
0 commit comments