Slugify a string to be used for an url

@param mixed $value

@return string
550476
public function filter($value)
    {
        // build search array
        $search = [
            '= |\(|\)|\/|\,|\'|´|\-|\_|`|\.|\@|\||&=',
            '=á|à|â|ã|ą|ă|ā|Â|Á|À|Ã|Ą|Ă|Ā=i',
            '=å|Å=i',
            '=ä|æ|Ä|Æ=i',
            '=ç|ć|č|ċ|ĉ|Ç|Ć|Č|Ċ|Ĉ=i',
            '=ď|Ď=i',
            '=ð|Ð=i',
            '=é|è|ê|ë|ę|ě|ē|ė|Ê|É|È|Ë|Ę|Ě|Ē|Ė=i',
            '=ğ|ġ|ĝ|ģ|Ğ|Ġ|Ĝ|Ģ=i',
            '=ħ|ĥ|Ħ|Ĥ=i',
            '=í|ì|î|ï|ı|ĩ|į|ï|Î|Í|Ì|Ï|İ|Ĩ|Į|Ī=i',
            '=ĵ|Ĵ=i',
            '=ķ|ĸ|Ķ=i',
            '=ł|ľ|ĺ|ļ|Ł|Ľ|Ĺ|Ļ=i',
            '=ñ|ń|ň|ņ|Ñ|Ń|Ň|Ņ=i',
            '=ó|ò|ô|õ|ő|ō|Ô|Ó|Ò|Õ|Ő|Ō=i',
            '=ö|ø|Ö|Ø=i',
            '=ŕ|ř|ŗ|Ŕ|Ř|Ŗ=i',
            '=š|ś|ş|ŝ|Š|Ś|Ş|Ŝ=i',
            '=ß=i',
            '=ť|ţ|ŧ|Ť|Ţ|Ŧ=i',
            '=Þ|þ=i',
            '=ú|ù|û|ů|ű|ŭ|ų|ũ|ū|Û|Ú|Ù|Ů|Ű|Ŭ|Ų|Ũ|Ū=i',
            '=ü|Ü=i',
            '=ý|ÿ|Ý|Ÿ=i',
            '=ź|ž|ż|Ź|Ž|Ż=i',
        ];

        // build replace array
        $replace = [
            $this->delimiter,
            'a',
            'aa',
            'ae',
            'c',
            'd',
            'dj',
            'e',
            'g',
            'h',
            'i',
            'j',
            'k',
            'l',
            'n',
            'o',
            'oe',
            'r',
            's',
            'ss',
            't',
            'th',
            'u',
            'ue',
            'y',
            'z',
        ];

        // replace special characters
        $value = preg_replace($search, $replace, (string)$value);

        // remove other characters
        $value = preg_replace(
            '=[^a-z0-9' . $this->delimiter . ']*=i', '', $value
        );

        // replace double delimiter
        $value = preg_replace(
            '=' . $this->delimiter . '+=', $this->delimiter, $value
        );

        // strip out leading and ending delimiter
        $value = preg_replace(
            '=^' . $this->delimiter . '|' . $this->delimiter . '$=', '',
            $value
        );

        // convert to lower case and return
        return strtolower($value);
    }
1150508
public function parse_value($value) {
        if (strpos($value, '$ToolProxy.custom.url') !== false) {
            $value = str_replace('$ToolProxy.custom.url', parent::get_endpoint(), $value);
        }
        return $value;

    }
981979
protected static function filterQueryOrFragment($value)
    {
        return preg_replace_callback(
            '/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\/\?]+|%(?![A-Fa-f0-9]{2}))/u',
            function (array $matches) {
                rawurlencode($matches[0]);
            },
            $value
        );
    }
1189153
public function uri($value, $ns = 'og') {
        $this->tag($ns . ':url', Router::url($value, true));

        return $this;
    }
1135924
public function transform($value)
    {
        if (null === $value) {
            return "";
        }

        if (false === $value instanceof NodeTranslation) {
            throw new TransformationFailedException("Value must be instance of NodeTranslation");
        }

        return $this->router->generate('_slug', [
            '_locale' => $value->getLang(),
            'url' => $value->getUrl(),
        ]);
    }
940440
protected function rewriteForUri($value)
    {
        $transliteration = [
            'ä' => 'ae',
            'Ä' => 'Ae',
            'ö' => 'oe',
            'Ö' => 'Oe',
            'ü' => 'ue',
            'Ü' => 'Ue',
            'ß' => 'ss',
        ];
        $value = strtr($value, $transliteration);

        $spaceCharacter = '-';
        $value = preg_replace('/[ \-+_]+/', $spaceCharacter, $value);

        $value = preg_replace('/[^-a-z0-9.\\' . $spaceCharacter . ']/i', '', $value);

        $value = preg_replace('/\\' . $spaceCharacter . '{2,}/', $spaceCharacter, $value);
        $value = trim($value, $spaceCharacter);

        return $value;
    }
677207
private function stringify($value)
    {
        if (is_bool($value)) {
            return $value ? '<TRUE>' : '<FALSE>';
        } elseif (is_scalar($value)) {
            $val = (string) $value;

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

            return $val;
        } elseif (is_array($value)) {
            return '<ARRAY>';
        } elseif (is_object($value)) {
            return sprintf('%s [%s]', get_class($value), spl_object_hash($value));
        } elseif (is_resource($value)) {
            return '<RESOURCE>';
        } elseif (is_null($value)) {
            return '<NULL>';
        } else {
            return 'unknown';
        }
    }
985683
protected function _sanitize($value)
    {
        $string = htmlentities(utf8_decode($value));
        $string = preg_replace(
            array('/&szlig;/','/&(..)lig;/', '/&([aouAOU])uml;/','/&(.)[^;]*;/'),
            array('ss',"$1","$1".'e',"$1"),
            $string
        );

        return $string;
    }
1322983
private function _validateUrl ($value)
    {
        $pattern = '/^{schemes}:\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(?::\d{1,5})?(?:$|[?\/#])/i';
        $validSchemes = ['http', 'https'];
        $pattern = str_replace('{schemes}', '(' . implode('|', $validSchemes) . ')', $pattern);
        if (!preg_match($pattern, $value)) {
            return false;
        }
        return true;
    }
153109
public function encode($value)
    {

        $createdIv = $this->createIvSizeAndIvString();
        $createdKey = $this->createSpecialKey($createdIv);

        if (false !== $encrypted = @mcrypt_encrypt($this->algorithm, $createdKey, $value, $this->mode, $createdIv)) {

            return urlencode(base64_encode(
                serialize(
                    [
                        'iv'    => base64_encode($createdIv),
                        'key'   => base64_encode($createdKey),
                        'value' => trim(base64_encode($encrypted)),
                    ]
                )
            ));
        }

        return false;
    }
1177467
public function slugify($str)
    {
        $str = mb_strtolower(trim($str));
        $str = str_replace(array('å','ä','ö'), array('a','a','o'), $str);
        $str = preg_replace('/[^a-z0-9-]/', '-', $str);
        $str = trim(preg_replace('/-+/', '-', $str), '-');
        return $str;
    }
283766
private function stringifyValue($value)
    {
        switch (true) {
            case $value === null:
                $value = 'NULL';
                break;
            case ($value instanceof \DateTime):
                $value = $value->format(DATE_RFC822);
                break;
            case ($value instanceof StringableInterface):
                $value = $value->toString();
                break;
            case ($value instanceof ArrayableInterface):
                $value = sprintf('Arrayable::%s (%s)', (new \ReflectionObject($value))->getShortName(),
                    $this->stringifyValue($value->toArray()));
                break;
            case is_scalar($value):
            case method_exists($value, '__toString'):
                $value = (string) $value;
                break;
            case is_object($value):
                $value = sprintf('Object (%s)', get_class($value));
                break;
            case is_array($value):
                $value = sprintf('Array (%s)', implode(', ', array_map([$this, 'stringifyValue'], $value)));
                break;
        }
        
        return $value;
    }
1198751
public function filter($value)
    {
        $lowerFilter = new \Zend_Filter_StringToLower();
        $value = $lowerFilter->filter(parent::filter($value));
        preg_match_all(self::SLUG_PATTERN, $value, $return);
        
        return implode($this->getWordSeparator(), $return[0]);
    }
370668
protected function _validate_url($value)
    {
        if ($value === '') {
            return '';
        }

        if (strpos($value, '://') === false) {
            $value = 'http://' . $value;
        }

        return filter_var($value, FILTER_VALIDATE_URL) !== false ? $value : null;
    }
570158
public function stringify($value): string
    {
        if ($value instanceof \DateTimeInterface) {
            return $value->format('Y-m-d');
        }

        if (is_array($value)) {
            return self::ARRAY_VALUE;
        }

        if (is_object($value) && !method_exists($value, '__tostring')) {
            return self::OBJECT_VALUE;
        }

        return (string)$value;
    }
252954
public static function url(string $value): bool
    {
        $result = filter_var($value, FILTER_VALIDATE_URL);
        return is_string($result) && $value === $result;
    }
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;
    }