1- <?php use RootStudio \Base ;
1+ <?php
2+
3+ use RootStudio \Base ;
4+ use RootStudio \BaseLayout ;
25
36/**
47 * Return path to document root
1013if (!function_exists ('base_public_path ' )) {
1114 function base_public_path ($ path = '' )
1215 {
13- $ basePath = realpath (__DIR__ . '/../../../ ' );
14- $ userPath = realpath ($ basePath . ($ path ? '/ ' . trim ($ path , '/ ' ) : $ path ));
16+ $ Base = new Base (realpath (__DIR__ . '/../../../ ' ));
17+
18+ $ userPath = $ Base ->getPublicPath () . ($ path ? '/ ' . trim ($ path , '/ ' ) : $ path );
1519
1620 return $ userPath ;
1721 }
@@ -74,8 +78,8 @@ function base_asset($path, $manifestDirectory = '')
7478if (!function_exists ('base_layout ' )) {
7579 function base_layout ($ file , array $ data = [], $ return = false )
7680 {
77- $ Base = Base ::fetch ();
78- $ Base ->setLayoutVars ($ data );
81+ $ BaseLayout = BaseLayout ::fetch ();
82+ $ BaseLayout ->setLayoutVars ($ data );
7983
8084 $ path = base_public_path ('layouts/ ' . ltrim ($ file , '/ ' ) . '.php ' );
8185
@@ -88,11 +92,11 @@ function base_layout($file, array $data = [], $return = false)
8892 ob_start ();
8993 }
9094
91- $ Base ->incrementLayoutDepth ();
95+ $ BaseLayout ->incrementLayoutDepth ();
9296
9397 include $ path ;
9498
95- $ Base ->decrementLayoutDepth ();
99+ $ BaseLayout ->decrementLayoutDepth ();
96100
97101 if ($ return ) {
98102 return ob_get_clean ();
@@ -113,9 +117,9 @@ function base_layout($file, array $data = [], $return = false)
113117if (!function_exists ('base_layout_var ' )) {
114118 function base_layout_var ($ key , $ return = false )
115119 {
116- $ Base = Base ::fetch ();
120+ $ BaseLayout = BaseLayout ::fetch ();
117121
118- $ value = $ Base ->getLayoutVar ($ key );
122+ $ value = $ BaseLayout ->getLayoutVar ($ key );
119123
120124 if ($ return ) return $ value ;
121125
@@ -133,9 +137,9 @@ function base_layout_var($key, $return = false)
133137if (!function_exists ('base_layout_has ' )) {
134138 function base_layout_has ($ key )
135139 {
136- $ Base = Base ::fetch ();
140+ $ BaseLayout = BaseLayout ::fetch ();
137141
138- $ value = $ Base ->getLayoutVar ($ key );
142+ $ value = $ BaseLayout ->getLayoutVar ($ key );
139143
140144 if ($ value ) return true ;
141145
0 commit comments