1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-12 09:44:38 +02:00

Various minor updates

This commit is contained in:
Ryan Cramer
2020-09-10 09:34:37 -04:00
parent df16ad5ae4
commit 7d71eac1bc
5 changed files with 20 additions and 9 deletions

View File

@@ -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;

View File

@@ -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;
}