22// Core extension, https://github.com/annaesvensson/yellow-core
33
44class YellowCore {
5- const VERSION = "0.9.25 " ;
5+ const VERSION = "0.9.26 " ;
66 const RELEASE = "0.9 " ;
77 public $ content ; // content files
88 public $ media ; // media files
@@ -145,13 +145,6 @@ public function processRequest($scheme, $address, $base, $location, $fileName, $
145145 }
146146 if (!is_readable ($ fileName )) $ this ->page ->error (404 );
147147 }
148- if ($ this ->system ->get ("coreDebugMode " )>=1 && ($ this ->lookup ->isContentFile ($ fileName ) || $ this ->page ->isError ())) {
149- $ layout = $ this ->page ->get ("layout " );
150- $ theme = $ this ->page ->get ("theme " );
151- echo "YellowCore::processRequest file: $ fileName<br /> \n" ;
152- echo "YellowCore::processRequest layout: $ layout theme: $ theme<br /> \n" ;
153-
154- }
155148 return $ statusCode ;
156149 }
157150
@@ -160,12 +153,6 @@ public function processRequestError() {
160153 ob_clean ();
161154 $ statusCode = $ this ->sendPage ($ this ->page ->scheme , $ this ->page ->address , $ this ->page ->base ,
162155 $ this ->page ->location , $ this ->page ->fileName , false , false );
163- if ($ this ->system ->get ("coreDebugMode " )>=1 ) {
164- $ layout = $ this ->page ->get ("layout " );
165- $ theme = $ this ->page ->get ("theme " );
166- echo "YellowCore::processRequestError file: " .$ this ->page ->fileName ."<br /> \n" ;
167- echo "YellowCore::processRequestError layout: $ layout theme: $ theme<br /> \n" ;
168- }
169156 return $ statusCode ;
170157 }
171158
@@ -193,8 +180,8 @@ public function exitFatalError($errorMessage = "") {
193180 }
194181
195182 // Send page response
196- public function sendPage ($ scheme , $ address , $ base , $ location , $ fileName , $ cacheable , $ showSource ) {
197- $ rawData = $ showSource ? $ this ->toolbox ->readFile ($ fileName ) : $ this ->page ->getRawDataError ();
183+ public function sendPage ($ scheme , $ address , $ base , $ location , $ fileName , $ cacheable , $ regular ) {
184+ $ rawData = $ regular ? $ this ->toolbox ->readFile ($ fileName ) : $ this ->page ->getRawDataError ();
198185 $ statusCode = max ($ this ->page ->statusCode , 200 );
199186 $ errorMessage = $ this ->page ->errorMessage ;
200187 $ this ->page = new YellowPage ($ this );
@@ -208,6 +195,11 @@ public function sendPage($scheme, $address, $base, $location, $fileName, $cachea
208195 foreach ($ this ->page ->headerData as $ key =>$ value ) {
209196 echo "YellowCore::sendPage $ key: $ value<br /> \n" ;
210197 }
198+ $ fileNameResponse = $ regular ? $ this ->page ->fileName : $ this ->page ->getFileNameError ();
199+ $ layout = $ this ->page ->get ("layout " );
200+ $ theme = $ this ->page ->get ("theme " );
201+ echo "YellowCore::sendPage file: $ fileNameResponse<br /> \n" ;
202+ echo "YellowCore::sendPage layout: $ layout theme: $ theme<br /> \n" ;
211203 }
212204 return $ statusCode ;
213205 }
@@ -3497,9 +3489,7 @@ public function getLastModified($httpFormat = false) {
34973489 // Return raw data for error page
34983490 public function getRawDataError () {
34993491 $ statusCode = $ this ->statusCode ;
3500- $ sharedLocation = $ this ->yellow ->content ->getHomeLocation ($ this ->location )."shared/ " ;
3501- $ fileNameError = $ this ->yellow ->lookup ->findFileFromContentLocation ($ sharedLocation , true ).$ this ->yellow ->system ->get ("coreContentErrorFile " );
3502- $ fileNameError = str_replace ("(.*) " , $ statusCode , $ fileNameError );
3492+ $ fileNameError = $ this ->getFileNameError ();
35033493 $ languageError = $ this ->yellow ->lookup ->findContentLanguage ($ this ->fileName , $ this ->yellow ->system ->get ("language " ));
35043494 if (is_file ($ fileNameError )) {
35053495 $ rawData = $ this ->yellow ->toolbox ->readFile ($ fileNameError );
@@ -3513,6 +3503,13 @@ public function getRawDataError() {
35133503 return $ rawData ;
35143504 }
35153505
3506+ // Return file name for error page
3507+ public function getFileNameError () {
3508+ $ sharedLocation = $ this ->yellow ->content ->getHomeLocation ($ this ->location )."shared/ " ;
3509+ $ fileNameError = $ this ->yellow ->lookup ->findFileFromContentLocation ($ sharedLocation , true ).$ this ->yellow ->system ->get ("coreContentErrorFile " );
3510+ return str_replace ("(.*) " , $ this ->statusCode , $ fileNameError );
3511+ }
3512+
35163513 // Return page status code, number or HTTP format
35173514 public function getStatusCode ($ httpFormat = false ) {
35183515 $ statusCode = $ this ->statusCode ;
0 commit comments