Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: clean_url

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1103           substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
1104           $url = 'http://' . $url;
1105
1106      $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
1107      if ( !is_array($protocols) )
1108           $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
1109      if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
1110           return '';
1111
1112      return apply_filters('clean_url', $url, $original_url);
1113 }
1114
1115 // Borrowed from the PHP Manual user notes. Convert entities, while
1116 // preserving already-encoded entities:
1117 function htmlentities2($myHTML) {
1118      $translation_table=get_html_translation_table (HTML_ENTITIES,ENT_QUOTES);
1119      $translation_table[chr(38)] = '&';
1120      return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&" , strtr($myHTML, $translation_table));
1121 }