diff --git a/wire/core/LanguageFunctions.php b/wire/core/LanguageFunctions.php index cc25e128..00e62b75 100644 --- a/wire/core/LanguageFunctions.php +++ b/wire/core/LanguageFunctions.php @@ -119,7 +119,7 @@ function __($text, $textdomain = null, $context = '') { // multiple translations accepted for text, with 1st being newest $textArray = $text; $text = reset($textArray); - } else if($text === true) { + } else if($text === true && $textdomain !== null) { // setting (or getting) custom option list($option, $values) = array($textdomain, $context); if($option === 'replacements' || $option === 'translations') { @@ -135,8 +135,10 @@ function __($text, $textdomain = null, $context = '') { return __(true, 'translations', $option); } else { // set and get other options - if($context !== '') $options[$option] = $values; - return isset($options[$option]) ? $options[$option] : null; + if($option === 'encode') $option = 'entityEncode'; // supported alias + $currentValue = isset($options[$option]) ? $options[$option] : null; // existing value is returned even when setting + if($values !== '' && $values !== $currentValue) $options[$option] = $values; + return $currentValue; } } else if(is_object($text)) { $text = (string) $text; diff --git a/wire/core/WireShutdown.php b/wire/core/WireShutdown.php index 230a6241..9e643de4 100644 --- a/wire/core/WireShutdown.php +++ b/wire/core/WireShutdown.php @@ -303,7 +303,7 @@ class WireShutdown extends Wire { $codes = $http->getHttpCodes(); $code = (int) ($this->config ? $this->config->fatalErrorCode : 500); if(!isset($codes[$code])) $code = 500; - header("HTTP/1.1 $code " . $codes[$code]); + $http->sendStatusHeader($code); return $code; } diff --git a/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module b/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module index da686e48..d83f2e43 100644 --- a/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module +++ b/wire/modules/Markup/MarkupAdminDataTable/MarkupAdminDataTable.module @@ -126,7 +126,11 @@ class MarkupAdminDataTable extends ModuleJS { /** * Set the header row for the table * - * @param array $a Array of header row labels (strings) + * Given $a array may be either array of labels (strings) or any of the array items may + * be an array, in which case index 0 is the label and index 1 is a class attribute to use + * for the th element. + * + * @param array $a Array of header row labels * @return $this * */ diff --git a/wire/modules/Page/PageFrontEdit/PageFrontEdit.module b/wire/modules/Page/PageFrontEdit/PageFrontEdit.module index 3ba2e789..dedc4898 100644 --- a/wire/modules/Page/PageFrontEdit/PageFrontEdit.module +++ b/wire/modules/Page/PageFrontEdit/PageFrontEdit.module @@ -993,9 +993,11 @@ class PageFrontEdit extends WireData implements Module { $data['error'] = "Failed CSRF check"; } } - - header("Content-type: application/json"); - header("HTTP/1.1 200 OK"); + + $http = new WireHttp(); + $this->wire($http); + $http->sendHeader("Content-type: application/json"); + $http->sendStatusHeader(200); echo json_encode($data); exit; } diff --git a/wire/modules/Process/ProcessPageView.module b/wire/modules/Process/ProcessPageView.module index ebaca3dd..b2fc34cd 100644 --- a/wire/modules/Process/ProcessPageView.module +++ b/wire/modules/Process/ProcessPageView.module @@ -939,7 +939,10 @@ class ProcessPageView extends Process { */ protected function header404() { static $n = 0; - if(!$n) header("HTTP/1.1 404 Page Not Found"); + if($n) return; + $http = new WireHttp(); + $this->wire($http); + $http->sendStatusHeader(404); $n++; }