image
@param  string $value
@return string
14500
static public function image($value=null)
    {
        if ($value) {
            $value = Config::getUploadFileRelativePath($value);
            return DataHelper::formatPath($value);
        }
        
        return '';
    }
266638
protected static function getValueAsINI($value)
    {
        $string = '';

        switch (gettype($value)) {
            case 'integer':
            case 'double':
                $string = $value;
                break;

            case 'boolean':
                $string = $value ? 'true' : 'false';
                break;

            case 'string':
                // Sanitize any CRLF characters..
                $string = '"' . str_replace(["\r\n", "\n"], '\\n', $value) . '"';
                break;
        }

        return $string;
    }
1133948
protected function formatValue($value)
    {
        $defaultValue = array('id' => '', 'format' => '', 'alt' => '', 'legend' => '');
        if ('' === $value|| null === $value) {
            return $defaultValue;
        }

        if (is_array($value)) {
            return array_merge($defaultValue, $value);
        }

        return $value;
    }
318886
public function asParagraphs($value)
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return str_replace('<p></p>', '', '<p>' . preg_replace('/\R{2,}/u', "</p>\n<p>", Html::encode($value)) . '</p>');
    }
804906
protected function wrapValue($value)
    {
        if ($value === '*') {
            return $value;
        }

        $value = Str::upper($value);

        return '"' . str_replace('"', '""', $value) . '"';
    }
145736
public static function path($value): string
    {
        $pattern = '#^[A-Za-z0-9_\/-]+[A-Za-z0-9_\.-]*([\\\\\/][A-Za-z0-9_-]+[A-Za-z0-9_\.-]*)*$#';
        preg_match($pattern, $value, $matches);
        return isset($matches[0]) ? (string)$matches[0] : '';
    }
50895
protected function encode($value)
    {
        $key = (string) $value;
        if (!isset(static::$cacheEncode[$key])) {
            $isAngularVar = false;
            if (\mb_substr($value, 0, 2) == '{{' && \mb_substr($value, -2) == '}}') {
                $isAngularVar = true;
                $value = \trim(\mb_substr($value, 2, -2));
            }
            static::$cacheEncode[$key] = \rawurlencode($value);
            static::$cacheEncode[$key] = \strtr(static::$cacheEncode[$key], static::$urlencodeCorrectionMap);
            if ($isAngularVar === true) {
                static::$cacheEncode[$key] = '{{ ' . static::$cacheEncode[$key] . ' }}';
            }
        }

        return static::$cacheEncode[$key];
    }
1257460
protected function setImage($value)
    {
        if (count($this->metas['image']) >= $this->config['image_limit']) {
            return '';
        }

        $this->metas['image'][] = $value;

        return $value;
    }
759657
private function serialize($value) : string
    {
        if ($this->packer !== null) {
            $value = $this->packer->pack($value);
        }

        return serialize($value);
    }
1295096
public function serialize($value) : string
    {
        if (!is_float($value)) {
            throw InvalidValueException::valueDoesNotMatchType($this, $value);
        }

        return (string) $value;
    }
827080
private function formatValue($value)
    {
        if ($value === '') {
            return '';
        }

        if ($value === null) {
            return '<comment>Null</comment>';
        }

        if (is_bool($value)) {
            return '<comment>' . ($value ? 'True' : 'False') . '</comment>';
        }

        if (empty($value)) {
            return '<comment>Empty</comment>';
        }

        if (is_array($value)) {
            return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }

        if (is_object($value)) {
            return sprintf('<%s>', get_class($value));
        }

        if (is_scalar($value)) {
            return $value;
        }

        throw new InvalidArgumentException(sprintf('Do not know how to format value "%s"', print_r($value, true)));
    }
422314
public function asImage($value, $options = [])
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return Html::img($value, $options);
    }
112942
public function parse($value)
    {
        switch (true) {

            case is_string($value):
                $this->initFromString($value);
                break;

            case is_int($value):
                $this->initFromInteger($value);
                break;

            case is_array($value):
                $this->initFromArray($value);
                break;

            case is_object($value):
                $this->initFromObject($value);
                break;

            case is_null($value):
                $this->initFromArray([255, 255, 255, 0]);
                break;

            default:
                throw new \Intervention\Image\Exception\NotReadableException(
                    "Color format ({$value}) cannot be read."
                );
        }

        return $this;
    }
637695
protected function dumpValue($value): string
    {
        if (null === $value) {
            return 'null';
        }

        if (false === $value) {
            return 'false';
        }
        if (true === $value) {
            return 'true';
        }

        if (\is_int($value) || \is_float($value)) {
            return (string)$value;
        }

        if (\is_string($value)) {
            return StringHelper::dumpString($value);
        }

        throw new \InvalidArgumentException('Unsupported data type:' . gettype($value));
    }
1316276
static public function urldecode($value)
    {
        if (is_string($value)) {
            return urldecode($value);
        } elseif (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = static::urldecode($v);
            }
        }
        return $value;
    }
29701
static private function stringify($value)
        {
            if (is_bool($value)) {
                return $value ? '<TRUE>' : '<FALSE>';
            }

            if (is_scalar($value)) {
                $val = (string) $value;

                if (strlen($val) > 100) {
                    $val = substr($val, 0, 97) . '...';
                }

                return $val;
            }

            if (Arrays::is($value)) {
                return '<ARRAY>';
            }

            if (is_object($value)) {
                return get_class($value);
            }

            if (is_resource($value)) {
                return '<RESOURCE>';
            }

            if ($value === null) {
                return '<NULL>';
            }

            return 'unknown';
        }
1287499
private function getEscape($value = '$value')
    {
        if ($this->customEscape) {
            return sprintf(self::CUSTOM_ESCAPE, $value);
        }

        return sprintf(self::DEFAULT_ESCAPE, $value, var_export($this->entityFlags, true), var_export($this->charset, true));
    }