1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00
This commit is contained in:
Ryan Cramer
2024-11-22 10:57:01 -05:00
parent 3bd27723b2
commit cf0abe538a
5 changed files with 8 additions and 8 deletions

View File

@@ -905,7 +905,7 @@ class WireTextTools extends Wire {
* - `has` (bool): Specify true to only return true or false if it has tags (default=false). * - `has` (bool): Specify true to only return true or false if it has tags (default=false).
* - `tagOpen` (string): The required opening tag character(s), default is '{' * - `tagOpen` (string): The required opening tag character(s), default is '{'
* - `tagClose` (string): The required closing tag character(s), default is '}' * - `tagClose` (string): The required closing tag character(s), default is '}'
* @return array|bool * @return array|bool Always returns array unless you specify the `has` option as true.
* @since 3.0.126 * @since 3.0.126
* *
*/ */
@@ -918,6 +918,7 @@ class WireTextTools extends Wire {
); );
$options = array_merge($defaults, $options); $options = array_merge($defaults, $options);
$str = (string) $str;
$tags = array(); $tags = array();
$pos1 = strpos($str, $options['tagOpen']); $pos1 = strpos($str, $options['tagOpen']);

View File

@@ -300,12 +300,12 @@ class FieldtypeComments extends FieldtypeMulti {
// assign code and subcode // assign code and subcode
if(!$comment->code || !$comment->subcode) { if(!$comment->code || !$comment->subcode) {
$rand = new WireRandom(); $rand = new WireRandom();
if(!strlen($comment->code)) { if(!strlen("$comment->code")) {
// code: visible to admin only // code: visible to admin only
$code = $rand->alphanumeric(128); $code = $rand->alphanumeric(128);
$comment->code = $code; $comment->code = $code;
} }
if(!strlen($comment->subcode)) { if(!strlen("$comment->subcode")) {
// subcode: may be visible to commenter // subcode: may be visible to commenter
$subcode = $rand->alphanumeric(40); $subcode = $rand->alphanumeric(40);
$comment->subcode = $subcode; $comment->subcode = $subcode;
@@ -2555,4 +2555,3 @@ class FieldtypeComments extends FieldtypeMulti {
} }
} }

View File

@@ -263,7 +263,7 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$fields = $this->wire()->fields; $fields = $this->wire()->fields;
$items = $this->attr('value'); $items = $this->attr('value');
$item = count($items) ? $items->first() : null; $item = wireCount($items) ? $items->first() : null;
$templateId = $this->field ? (int) $this->field->get('template_id') : 0; $templateId = $this->field ? (int) $this->field->get('template_id') : 0;
$template = $templateId ? $this->wire()->templates->get($templateId) : null; $template = $templateId ? $this->wire()->templates->get($templateId) : null;

View File

@@ -518,7 +518,7 @@ class InputfieldPageTable extends Inputfield {
$value = (string) $object; $value = (string) $object;
} }
$value = $this->wire()->sanitizer->entities(strip_tags($value)); $value = $this->wire()->sanitizer->entities(strip_tags("$value"));
$value = nl2br($value); $value = nl2br($value);
return $value; return $value;

View File

@@ -26,9 +26,9 @@ class TextformatterEntities extends Textformatter {
public function format(&$str) { public function format(&$str) {
if($this->charset === '') $this->charset = $this->wire()->config->dbCharset; if($this->charset === '') $this->charset = $this->wire()->config->dbCharset;
if(stripos($this->charset, 'utf8') === 0) { if(stripos($this->charset, 'utf8') === 0) {
$str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); $str = htmlspecialchars("$str", ENT_QUOTES, 'UTF-8');
} else { } else {
$str = htmlspecialchars($str, ENT_QUOTES); $str = htmlspecialchars("$str", ENT_QUOTES);
} }
} }
} }