1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 07:47:00 +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; $obj = null;
$class = ''; $class = '';
$type = ''; $type = '';
$args = $trace['args']; $args = isset($trace['args']) ? $trace['args'] : array();
$argStr = ''; $argStr = '';
$file = $trace['file']; $file = $trace['file'];
$basename = basename($file); $basename = basename($file);

View File

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

View File

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

View File

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

View File

@@ -85,7 +85,7 @@ class InputfieldMarkup extends InputfieldWrapper {
$markupFunction = $this->getSetting('markupFunction'); $markupFunction = $this->getSetting('markupFunction');
$markupText = $this->getSetting('markupText'); $markupText = $this->getSetting('markupText');
$textformatters = $this->getSetting('textformatters'); $textformatters = $this->getSetting('textformatters');
$description = $this->getSetting('description'); $description = (string) $this->getSetting('description');
if($markupFunction !== null & is_callable($markupFunction)) { if($markupFunction !== null & is_callable($markupFunction)) {
$out .= "\n" . call_user_func($markupFunction, $this); $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) { if(!empty($attrs['placeholder']) && $this->wire()->languages) {
$language = $this->wire()->user->language; $language = $this->wire()->user->language;
if($language && $language->id && !$language->isDefault()) { 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; if(strlen($placeholder)) $attrs['placeholder'] = $placeholder;
} }
} }
@@ -229,6 +229,7 @@ class InputfieldText extends Inputfield {
* *
*/ */
protected function getValueLength($value, $countWords = false) { protected function getValueLength($value, $countWords = false) {
$value = (string) $value;
if($countWords) { if($countWords) {
return str_word_count($value); return str_word_count($value);
} else { } else {

View File

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

View File

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

View File

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