Skip to content

Commit 4a926a2

Browse files
committed
Refactored code
1 parent d9817f5 commit 4a926a2

File tree

3 files changed

+20
-23
lines changed

3 files changed

+20
-23
lines changed

system/extensions/update-available.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,14 @@ system/themes/copenhagen.css: copenhagen.css, create, update, careful
149149
system/themes/copenhagen.png: copenhagen.png, create
150150

151151
Extension: Core
152-
Version: 0.9.25
152+
Version: 0.9.26
153153
Description: Core functionality of your website.
154154
Developer: Anna Svensson
155155
Tag: feature
156156
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
157157
DocumentationUrl: https://github.com/annaesvensson/yellow-core
158158
DocumentationLanguage: en, de, sv
159-
Published: 2026-03-19 23:52:59
159+
Published: 2026-03-20 10:32:34
160160
Status: available
161161
system/workers/core.php: core.php, create, update
162162
system/extensions/core.php: corepatch.txt, update

system/extensions/update-installed.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Datenstrom Yellow update settings for installed extensions
22

33
Extension: Core
4-
Version: 0.9.25
4+
Version: 0.9.26
55
Description: Core functionality of your website.
66
Developer: Anna Svensson
77
Tag: feature
88
DownloadUrl: https://github.com/annaesvensson/yellow-core/archive/refs/heads/main.zip
99
DocumentationUrl: https://github.com/annaesvensson/yellow-core
1010
DocumentationLanguage: en, de, sv
11-
Published: 2026-03-19 23:52:59
11+
Published: 2026-03-20 10:32:34
1212
Status: available
1313
system/workers/core.php: core.php, create, update
1414
system/extensions/core.php: corepatch.txt, update

system/workers/core.php

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Core extension, https://github.com/annaesvensson/yellow-core
33

44
class 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

Comments
 (0)