WordPressを読む 25-12 /blog/wp-includes/formatting.php 12
2014/12/10
目次
/blog/wp-includes/formatting.php 12
関数 capital_P_dangit()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function capital_P_dangit( $text ) { // Simple replacement for titles $current_filter = current_filter(); if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) return str_replace( 'Wordpress', 'WordPress', $text ); // Still here? Use the more judicious replacement static $dblq = false; if ( false === $dblq ) $dblq = _x( '“', 'opening curly double quote' ); return str_replace( array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ), array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ), $text ); } |
関数 sanitize_mime_type()
1 2 3 4 | function sanitize_mime_type( $mime_type ) { $sani_mime_type = preg_replace( '/[^-+*.a-zA-Z0-9\/]/', '', $mime_type ); return apply_filters( 'sanitize_mime_type', $sani_mime_type, $mime_type ); } |
関数 sanitize_trackback_urls()
1 2 3 4 5 6 7 8 9 10 | function sanitize_trackback_urls( $to_ping ) { $urls_to_ping = preg_split( '/[\r\n\t ]/', trim( $to_ping ), -1, PREG_SPLIT_NO_EMPTY ); foreach ( $urls_to_ping as $k => $url ) { if ( !preg_match( '#^https?://.#i', $url ) ) unset( $urls_to_ping[$k] ); } $urls_to_ping = array_map( 'esc_url_raw', $urls_to_ping ); $urls_to_ping = implode( "\n", $urls_to_ping ); return apply_filters( 'sanitize_trackback_urls', $urls_to_ping, $to_ping ); } |
関数 wp_slash()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function wp_slash( $value ) { if ( is_array( $value ) ) { foreach ( $value as $k => $v ) { if ( is_array( $v ) ) { $value[$k] = wp_slash( $v ); } else { $value[$k] = addslashes( $v ); } } } else { $value = addslashes( $value ); } return $value; } |
関数 wp_unslash()
1 2 3 | function wp_unslash( $value ) { return stripslashes_deep( $value ); } |
関数 get_url_in_content()
1 2 3 4 5 6 7 8 9 10 | function get_url_in_content( $content ) { if ( empty( $content ) ) { return false; } if ( preg_match( '/<a\s[^>]*?href=([\'"])(.+?)\1/is', $content, $matches ) ) { return esc_url_raw( $matches[2] ); } return false; } |
関数 wp_spaces_regexp()
1 2 3 4 5 6 7 8 9 | function wp_spaces_regexp() { static $spaces; if ( empty( $spaces ) ) { $spaces = apply_filters( 'wp_spaces_regexp', '[\r\n\t ]|\xC2\xA0| ' ); } return $spaces; } |