1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-07 07:16:51 +02:00
This commit is contained in:
Ryan Cramer
2024-07-05 09:50:01 -04:00
parent 98968d796f
commit 2690115966
9 changed files with 15 additions and 13 deletions

View File

@@ -376,7 +376,7 @@ class Debug {
$obj = null;
$class = '';
$type = '';
$args = $trace['args'];
$args = isset($trace['args']) ? $trace['args'] : array();
$argStr = '';
$file = $trace['file'];
$basename = basename($file);

View File

@@ -837,7 +837,7 @@ class PagesRawFinder extends Wire {
if(!isset($templatesById[$templateId])) $templatesById[$templateId] = $templates->get($templateId);
$template = $templatesById[$templateId]; /** @var Template $template */
$slash = $template->slashUrls ? '/' : '';
$path = strlen($value) && $value !== '/' ? "$value$slash" : '';
$path = strlen("$value") && $value !== '/' ? "$value$slash" : '';
if(isset($this->runtimeFields['url'])) {
$this->values[$id]['url'] = $rootUrl . $path;
}

View File

@@ -8,7 +8,7 @@
* For documentation about the fields used in this class, please see:
* /wire/core/Fieldtype.php
*
* ProcessWire 3.x, Copyright 2022 by Ryan Cramer
* ProcessWire 3.x, Copyright 2024 by Ryan Cramer
* https://processwire.com
*
*/
@@ -115,17 +115,18 @@ class FieldtypeFloat extends Fieldtype {
*
* @param Page $page
* @param Field $field
* @param string|float|int
* @param string|float|int|null $value
* @return string
*
*/
public function ___sleepValue(Page $page, Field $field, $value) {
if($value === null) return ''; // blank value
$precision = $field->get('precision');
if(is_null($precision) || $precision === '' || $precision < 0) {
$precision = self::getPrecision($value);
}
if(!is_string($value)) {
$value = number_format($value, $precision, '.', '');
$value = number_format((float) $value, $precision, '.', '');
}
return $value;
}
@@ -238,4 +239,3 @@ class FieldtypeFloat extends Fieldtype {
}

View File

@@ -47,7 +47,7 @@ class InputfieldDatetimeText extends InputfieldDatetimeType {
'showAnim' => 'fade',
'changeMonth' => true,
'changeYear' => true,
'showButtonPane' => false,
'showButtonPanel' => false,
'numberOfMonths' => 1,
'showMonthAfterYear' => false,
'showOtherMonths' => false,
@@ -483,7 +483,7 @@ class InputfieldDatetimeText extends InputfieldDatetimeType {
$f = $inputfields->InputfieldToggle;
$f->attr('name', 'showButtonPanel');
$f->label = $this->_('Display “Today” and “Done” buttons under calendar?');
$f->val($module->get('showButtonPane'));
$f->val($module->get('showButtonPanel'));
$f->columnWidth = 50;
$fieldset->add($f);

View File

@@ -85,7 +85,7 @@ class InputfieldMarkup extends InputfieldWrapper {
$markupFunction = $this->getSetting('markupFunction');
$markupText = $this->getSetting('markupText');
$textformatters = $this->getSetting('textformatters');
$description = $this->getSetting('description');
$description = (string) $this->getSetting('description');
if($markupFunction !== null & is_callable($markupFunction)) {
$out .= "\n" . call_user_func($markupFunction, $this);
@@ -181,4 +181,3 @@ class InputfieldMarkup extends InputfieldWrapper {
}
}

View File

@@ -166,7 +166,7 @@ class InputfieldText extends Inputfield {
if(!empty($attrs['placeholder']) && $this->wire()->languages) {
$language = $this->wire()->user->language;
if($language && $language->id && !$language->isDefault()) {
$placeholder = parent::get("placeholder$language->id");
$placeholder = (string) parent::get("placeholder$language->id");
if(strlen($placeholder)) $attrs['placeholder'] = $placeholder;
}
}
@@ -229,6 +229,7 @@ class InputfieldText extends Inputfield {
*
*/
protected function getValueLength($value, $countWords = false) {
$value = (string) $value;
if($countWords) {
return str_word_count($value);
} else {

View File

@@ -547,7 +547,7 @@ class MarkupPagerNav extends Wire implements Module {
}
} else {
$queryString .= "$key=" . urlencode($value) . "&";
$queryString .= "$key=" . urlencode("$value") . "&";
}
}
$this->queryString = htmlspecialchars(rtrim($queryString, "?&"));

View File

@@ -375,6 +375,8 @@ class ProcessLogger extends Process {
'text' => $this->_x('Text', 'th'),
);
if(!is_array($templateItem)) $templateItem = $headers;
if(empty($templateItem['user']) && empty($templateItem['url'])) {
unset($templateItem['user'], $templateItem['url']);
$table->headerRow(array(

View File

@@ -258,7 +258,7 @@ class ProcessPageClone extends Process implements ConfigurableModule {
$titleField->set("value$language->id", $value);
}
if($nameUseLanguages) {
$value = $page->get("name$language->id");
$value = (string) $page->get("name$language->id");
if(strlen($value)) {
if(!empty($suggested["name$language"])) {
$nameLang = $suggested["name$language"];