• hello wordpress community,

    i try to make it work:

    <?php
    ### formatting.php in wp-includes
    function clean_url( $url, $protocols = null, $context = 'display' ) {
    	$original_url = $url;
    
    	if ('' == $url) return $url;
    	$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    	$strip = array('%0d', '%0a', '%0D', '%0A');
    	$url = _deep_replace($strip, $url);
    	$url = str_replace(';//', '://', $url);
    	/* If the URL doesn't appear to contain a scheme, we
    	 * presume it needs http:// appended (unless a relative
    	 * link starting with / or a php file).
    	 */
    	if ( strpos($url, ':') === false &&
    		substr( $url, 0, 1 ) != '/' && substr( $url, 0, 1 ) != '#' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
    		$url = 'http://' . $url;
    
    	// Replace ampersands and single quotes only when displaying.
    	if ( 'display' == $context ) {
    		$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
    		$url = str_replace( "'", ''', $url );
    	}
    
    	if ( !is_array($protocols) )
    		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
    	if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
    		return '';
    		$compare_url = strpos($url, 'mycamfrog.de');
    	if ($compare_url === false)
    		$redirect_url = 'http://blog.mycamfrog.de/redirect/?url=' . $url;
    	else
    		$redirect_url = $url;
    	return apply_filters('clean_url', $url, $original_url, $context);
    }
    ?>

    but is that the right file to be changed?
    coz, i just want if any post a link in the comment: the link sould be a format like:
    <a href="http://blog.mycamfrog.de/redirect/?url=http://www.test.me" rel="nofollow">http://www.test.me</a>
    but now i get:
    <a href="http://blog.mycamfrog.de/redirect/?url=http://www.test.me" rel="nofollow">http://blog.mycamfrog.de/redirect/?url=http://www.test.me</a>

    hope someone can help me, thx for help and nice regards from germany 😉

  • The topic ‘how to format url?’ is closed to new replies.