Returns alternate link HTML tags with href-lang attributes.

@param array $urls

@return string

@deprecated since 1.1 use SeoTwigExtension::renderSeoTags - sulu_seo
767492
public function getAlternateLinks($urls)
    {
        // determine default and current values
        $webspaceKey = $this->requestAnalyzer->getWebspace()->getKey();
        $currentPortal = $this->requestAnalyzer->getPortal();

        $defaultLocale = null;
        if (null !== $currentPortal && null !== ($defaultLocale = $currentPortal->getXDefaultLocalization())) {
            $defaultLocale = $defaultLocale->getLocale();
        }

        $result = [];
        foreach ($urls as $locale => $url) {
            // url = '/' means that there is no translation for this page
            // the only exception is the homepage where the requested resource-locator is '/'
            if ('/' !== $url || '/' === $this->requestAnalyzer->getResourceLocator()) {
                if ($locale === $defaultLocale) {
                    $result[] = $this->getAlternate($url, $webspaceKey, $locale, true);
                }
                $result[] = $this->getAlternate($url, $webspaceKey, $locale);
            }
        }

        return implode(PHP_EOL, $result);
    }
215764
public static function attributes(array $attributes): string
    {
        ksort($attributes);

        $html = '';
        foreach ($attributes as $attribute => $value) {
            $value = !is_scalar($value) ? json_encode($value) : (string)$value;

            $html .= sprintf('%s="%s" ', self::escape($attribute), self::escape($value));
        }

        return rtrim($html);
    }
349475
public function render(array $parameters = []): string
    {
        /** @var Location $location */
        $location = $parameters['location'];
        /** @var Content $content */
        $content = $parameters['content'];
        /** @var Language $language */
        $language = $parameters['language'];
        $versionNo = $content->getVersionInfo()->versionNo;

        // nonpublished content should use parent location instead because location doesn't exist yet
        if (!$content->contentInfo->published && null === $content->contentInfo->mainLocationId) {
            $parentLocations = $this->locationService->loadParentLocationsForDraftContent($content->getVersionInfo());
            $location = reset($parentLocations);
            $versionNo = null;
        }

        $siteaccesses = $this->siteaccessResolver->getSiteaccessesForLocation(
            $location,
            $versionNo,
            $language->languageCode
        );

        if (empty($siteaccesses)) {
            return $this->twig->render(
                '@ezdesign/content/content_edit/component/preview_unavailable.html.twig'
            );
        }

        return '';
    }
262643
protected function autolink($matches)
	{
		$href = $matches[0];

		if (substr($href, 0, 1) == '!')
		{
			return substr($href, 1);
		}

		$href = str_replace('"', '', $href);
		$href = str_replace("'", '', $href);
		$href = str_replace('&#8221', '', $href);

		$h = array('h', 'm', 'f', 'g', 'n');
		if (!in_array(substr($href, 0, 1), $h))
		{
			$href = substr($href, 1);
		}
		$name = trim($href);
		if (substr($name, 0, 7) == 'mailto:')
		{
			$name = substr($name, 7, strlen($name));
			$name = Str::obfuscate($name);

			$href = 'mailto:' . $name;
		}
		$l = sprintf(
			' <a class="ext-link" href="%s" rel="external">%s</a>', $href, $name
		);
		return $l;
	}
239960
public function getUrls(array $locales = [])
    {
        if (!is_null($this->urls)) {
            return $this->urls;
        }

        $locales = $locales ?: $this->locales;
        $this->urls = [];

        // By resource
        if ($this->resource) {
            $this->resourceHelper->getEntityManager()->refresh($this->resource);

            foreach ($locales as $locale) {
                $this->urls[$locale] = $this->resourceHelper->generatePublicUrl($this->resource, false, $locale);
            }
        } // By route and parameters
        elseif ($request = $this->requestStack->getMasterRequest()) {
            $route = $request->attributes->get('_route');
            $parameters = $request->attributes->get('_route_params');

            foreach ($locales as $locale) {
                $params = array_replace($parameters, ['_locale' => $locale]);
                $this->urls[$locale] = $this->urlGenerator->generate($route, $params,
                    UrlGeneratorInterface::ABSOLUTE_PATH);
            }
        }

        return $this->urls;
    }
868245
public function generateLinksApplications(array $applications)
    {
        $links = [];

        foreach ($applications as $application) {
            if ($this->codeApplication === $application->getCode()) {
                continue;
            }

            $links[] = [
                'href' => $application->getHref(),
                'title' => $application->getTitle(),
            ];
        }

        return $links;
    }
580594
public function prefetchUrls(array $urls)
    {
        $req = array(
            'urls' => $urls,
        );

        $url = $this->server . '/v2/tune/prefetch';
        $body = json_encode($req);
        return $this->post($url, $body);
    }
588205
public function getUri( $locales = null )
    {
        if ( empty( $locales ) )
        {
            $locales = $this->getMapper()
                            ->getLocale();
        }

        $locales = (array) $locales;
        $uri     = $this->getUriStructure( $locales );

        if ( empty( $uri ) )
        {
            $locale = null;
            $maxQ   = -1;

            foreach ( (array) $locales as $l => $q )
            {
                if ( is_numeric( $l ) )
                {
                    $l = $q;
                    $q = 1;
                }

                if ( $q > $maxQ )
                {
                    $maxQ   = $q;
                    $locale = $l;
                }
            }

            return '/app/' . $locale . '/paragraph/render/' . $this->id;
        }

        return '/' . $uri->safeUri;
    }
234967
protected function _doAutoLinks_url_callback($matches) {
		$url = $this->encodeURLAttribute($matches[1], $text);
		$link = "<a href=\"$url\">$text</a>";
		return $this->hashPart($link);
	}
202273
protected function _doAnchors_inline_callback($matches) {
		$whole_match	=  $matches[1];
		$link_text		=  $this->runSpanGamut($matches[2]);
		$url			=  $matches[3] == '' ? $matches[4] : $matches[3];
		$title			=& $matches[7];
		$attr  = $this->doExtraAttributes("a", $dummy =& $matches[8]);

		// if the URL was of the form <s p a c e s> it got caught by the HTML
		// tag parser and hashed. Need to reverse the process before using the URL.
		$unhashed = $this->unhash($url);
		if ($unhashed != $url)
			$url = preg_replace('/^<(.*)>$/', '\1', $unhashed);

		$url = $this->encodeURLAttribute($url);

		$result = "<a href=\"$url\"";
		if (isset($title)) {
			$title = $this->encodeAttribute($title);
			$result .=  " title=\"$title\"";
		}
		$result .= $attr;
		
		$link_text = $this->runSpanGamut($link_text);
		$result .= ">$link_text</a>";

		return $this->hashPart($result);
	}
1202141
public static function indexableString(array $tags) {
        $tagstr = '';

        for ($i = 0; $i < func_num_args(); $i++) {
            $tags = func_get_arg($i);

            if (is_array($tags))
                foreach($tags as $tag)
                    $tagstr .= $tag->getTagSlug().' '.$tag->getTagRoleDisplay().' '.$tag->getTagValueDisplay().' '.$tag->getTagLinkTitle().' ';
        }

        return trim($tagstr);
    }
1319244
public function linkTo($text, $urlOptions, array $attrs = [])
    {
        $url = $this->parseUrlOptions($urlOptions);
        return $this->contentTag('a', $text, array_merge(['href' => $url], $attrs));
    }
581318
private function computeUrlRegex(array $matches)
    {
        $this->names[] = $matches[1];

        if (isset($this->conditions[$matches[1]])) {
            return '(?P<' . $matches[1] . '>' . $this->conditions[$matches[1]] . ')';
        }

        if (substr($matches[0], -1) === '+') {

            $this->namesPath[$matches[1]] = 1;

            return '(?P<' . $matches[1] . '>.+)';
        }

        return '(?P<' . $matches[1] . '>[^/]+)';
    }
1054203
private function parseUrls($urls) {
        $urls = (array) $urls;
        $result = array();
        $counter = 0;

        foreach ($urls as $serverUrl) {
            if (!preg_match('|^https?://|', $serverUrl)) {
                $serverUrl = 'http://' . $serverUrl;
            }

            $parts = parse_url($serverUrl);

            // Remove the port from the server URL if it's equal to 80 when scheme is http, or if
            // it's equal to 443 when the scheme is https
            if (
                isset($parts['port']) && (
                    ($parts['scheme'] === 'http' && $parts['port'] == 80) ||
                    ($parts['scheme'] === 'https' && $parts['port'] == 443)
                )
            ) {
                if (empty($parts['path'])) {
                    $parts['path'] = '';
                }

                $serverUrl = $parts['scheme'] . '://' . $parts['host'] . $parts['path'];
            }

            $serverUrl = rtrim($serverUrl, '/');

            if (!isset($result[$serverUrl])) {
                $result[$serverUrl] = $counter++;
            }
        }

        return array_flip($result);
     }
140718
protected function decodeMatches(array $matches): string
    {
        if (1 === preg_match(static::REGEXP_PREVENTS_DECODING, $matches[0])) {
            return strtoupper($matches[0]);
        }

        return rawurldecode($matches[0]);
    }
549814
public function getShopUrlByLanguage($lang, $ssl = false)
    {
        $configParameter = $ssl ? 'aLanguageSSLURLs' : 'aLanguageURLs';
        $lang = isset($lang) ? $lang : Registry::getLang()->getBaseLanguage();
        $languageURLs = $this->getConfigParam($configParameter);
        if (isset($lang) && isset($languageURLs[$lang]) && !empty($languageURLs[$lang])) {
            $languageURLs[$lang] = Registry::getUtils()->checkUrlEndingSlash($languageURLs[$lang]);
            return $languageURLs[$lang];
        }
    }
701631
static function tagsToString( array $tags ) {

		$tags = wp_list_sort( $tags, 'tag', 'asc' );

		$str = '';
		foreach ( $tags as $tag ) {
			$str .= $tag['tag'] . ', ';
		}

		return rtrim( $str, ', ' );
	}