| | 2832 | /** |
| | 2833 | * Apply capital_P_dangit() to just regular content. |
| | 2834 | * |
| | 2835 | * @since 3.0.1 |
| | 2836 | * @uses wp_filter_cdata_content(), capital_P_dangit() |
| | 2837 | */ |
| | 2838 | function wp_capital_P_content( $str ) { |
| | 2839 | return wp_filter_cdata_content( $str, 'capital_P_dangit' ); |
| | 2840 | } |
| | 2841 | |
| | 2842 | /** |
| | 2843 | * Callback function which will only filter content *between* HTML tags, and |
| | 2844 | * should ignore data in attributes (such as URLs) |
| | 2845 | * |
| | 2846 | * @since 3.0.1 |
| | 2847 | */ |
| | 2848 | function wp_filter_cdata_content( $content, $filter = null ) { |
| | 2849 | if ( function_exists( $filter ) ) { |
| | 2850 | // Yes, this is ugly. For the sake of being reusable. |
| | 2851 | $content = preg_replace_callback( '/(?(?<=>)|\A)([^<>]+)(?(?=<)|\Z)/s', create_function( '$matches', 'return call_user_func('."'$filter'".', $matches[1]);' ), $content ); |
| | 2852 | } |
| | 2853 | |
| | 2854 | return $content; |
| | 2855 | } |
| | 2856 | |
| | 2857 | |
| | 2858 | |