Formats the value as HTML-encoded trimmed text with full text in title attribute.
@param string $value the value to be formatted.
@return string the formatted result.
161973
public function asShortText($value)
    {
        if ($value === null) {
            return $this->nullDisplay;
        }
        return Html::tag('span',
            Html::encode(mb_strimwidth($value, 0, 30, "…", 'UTF-8')),
            ['title' => Html::encode($value), 'data-toggle' => 'tooltip']
        );
    }
1025757
public function getFullnameAttribute($value)
    {
        if (!strlen($this->firstname) and ! strlen($this->lastname)) {
            return '---';
        }
        return $this->firstname . ' ' . $this->lastname;
    }
744668
public function format($value)
    {
        if ($value instanceOf Percentage) {
            $value = $value->toPercent();
        }

        return $value->int().'%';
    }
868734
private static function encodeHtmlAttributeString($value) {
        if ($value === null) {
            return '';
        }

        $result = $value;

        $result = str_replace('&', '&amp;', $result);
        $result = str_replace('<', '&lt;', $result);
        $result = str_replace('"', '&quot;', $result);
        $result = str_replace('\'', '&#39;', $result);

        return $result;
    }
963875
public function getLabelForValue($value) {
    $settings = $this->getFieldSettings();
    $allowed_values = $settings['allowed_values'];

    foreach ($allowed_values as $allowed_value) {
      if (isset($allowed_value['value']) && $allowed_value['value'] === $value) {
        $label = $allowed_value['label'];
        return Html::escape($label);
      }
    }
  }
1272434
public function asNtext($value)
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return nl2br(Html::encode($value));
    }
1370830
protected function wrapValue($value)
    {
        $value = Str::upper($value);

        return $this->isReserved($value) ? '"' . $value . '"' : $value;
    }
652736
public function format($value): string
    {
        $value = $value->rate();

        if ($value instanceof PercentageDiscount) {
            return (new PercentFormatter($value))->format($value);
        }

        if ($value instanceof ValueDiscount) {
            return (new MoneyFormatter())->format($value);
        }
    }
407307
public function filter($value)
    {
        $chars = ' ';
        if ($this->getExtras()) {
            $chars .= $this->getExtras();
        }
        return trim($value, $chars);
    }
149473
public static function format($value)
    {
        $value = Utils::toString($value);
        $value = mb_strtolower($value);

        if (Utils::isZeroPrefixed($value)) {
            return $value;
        } else {
            $value = Utils::toHex($value, true);
        }
        return $value;
    }
850700
public static function encodeForMaria($value)
    {
        return is_string($value)
        && (!mb_check_encoding($value, 'UTF-8') || strpos($value, self::DATA_URI_PREFIX) === 0)
            ? self::DATA_URI_PREFIX . base64_encode($value)
            : $value;
    }
410139
public function markEmpty($value)
    {
        if (empty($value)) {
            $em = \MUtil_Html::create('em');
            $em->raw($this->_('&laquo;empty&raquo;'));

            return $em;
        }

        return $value;
    }
513511
public function transform($value)
    {
        if ( $value ) {
            $from = '';
            if ( $value->getFrom() ) {
                $from = $value->getFrom()->format('Y-m-d');
            }
            $to = '';
            if ( $value->getTo() ) {
                $to = $value->getTo()->format('Y-m-d');
            }
            return sprintf(
                '%s%s%s',
                $from,
                $this->dateSeparator,
                $to
            );
        }
    }
1087381
protected function formatValue($value): string {
        if (is_string($value) && mb_strlen($value) > 20) {
            $value = mb_substr($value, 0, 20).'…';
        }

        if (is_scalar($value)) {
            return json_encode($value);
        } else {
            return $this->translate('value');
        }
    }
785997
private function richTextDecode(string $value): string
    {
        $value = $this->decodeNonTranslatableCharacters($value);
        foreach (array_reverse($this->nonTranslatableTags) as $tag) {
            $value = preg_replace_callback(
                '#<' . $tag . '>(.*)</' . $tag . '>#Uuim',
                function ($matches) {
                    return $this->placeHolderMap[trim($matches[1])];
                },
                $value
            );
        }
        foreach ($this->nonValidAttributeTags as $tag) {
            $value = preg_replace_callback(
                '#<fake' . $tag . '(.[^>]*)>#Uuim',
                function ($matches) {
                    return $this->placeHolderMap[trim($matches[1])];
                },
                $value
            );
            $value = str_replace("</fake{$tag}>", "</{$tag}>", $value);
        }
        $value = $this->decodeNonTranslatableCharacters($value);

        return $value;
    }
696172
static public function keywords($value=null)
    {
        if ($value) {
            $value = StringHelper::str_cut(strip_tags($value), 100);
        }
        
        return static::input(trim($value));
    }
18693
protected function _setName($value)
    {
        $value = strip_tags($value);
        $value = str_replace(["\n", "\r"], '', $value);

        return trim($value);
    }