Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: sanitize_html_class

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
1080      //Strip out any % encoded octets
1081      $sanitized = preg_replace( '|%[a-fA-F0-9][a-fA-F0-9]|', '', $class );
1082
1083      //Limit to A-Z,a-z,0-9,_,-
1084      $sanitized = preg_replace( '/[^A-Za-z0-9_-]/', '', $sanitized );
1085
1086      if ( '' == $sanitized )
1087           $sanitized = $fallback;
1088
1089      return apply_filters( 'sanitize_html_class', $sanitized, $class, $fallback );
1090 }
1091
1092 /**
1093  * Converts a number of characters from a string.
1094  *
1095  * Metadata tags <<title>> and <<category>> are removed, <<br>> and <<hr>> are
1096  * converted into correct XHTML and Unicode characters are converted to the
1097  * valid range.
1098  *