Changeset 26191 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 11/15/2013 02:45:39 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r26122 r26191 1794 1794 * @return string Converted content with text smilies replaced with images. 1795 1795 */ 1796 function convert_smilies( $text) {1796 function convert_smilies( $text ) { 1797 1797 global $wp_smiliessearch; 1798 1798 $output = ''; 1799 if ( get_option( 'use_smilies') && !empty($wp_smiliessearch) ) {1799 if ( get_option( 'use_smilies' ) && ! empty( $wp_smiliessearch ) ) { 1800 1800 // HTML loop taken from texturize function, could possible be consolidated 1801 $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between 1802 $stop = count($textarr);// loop stuff 1803 for ($i = 0; $i < $stop; $i++) { 1801 $textarr = preg_split( '/(<.*>)/U', $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between 1802 $stop = count( $textarr );// loop stuff 1803 1804 // Ignore proessing of specific tags 1805 $tags_to_ignore = 'code|pre|style|script|textarea'; 1806 $ignore_block_element = ''; 1807 1808 for ( $i = 0; $i < $stop; $i++ ) { 1804 1809 $content = $textarr[$i]; 1805 if ((strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag 1806 $content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content); 1810 1811 // If we're in an ignore block, wait until we find its closing tag 1812 if ( '' == $ignore_block_element && preg_match( '/^<(' . $tags_to_ignore . ')>/', $content, $matches ) ) { 1813 $ignore_block_element = $matches[1]; 1807 1814 } 1815 1816 // If it's not a tag and not in ignore block 1817 if ( '' == $ignore_block_element && strlen( $content ) > 0 && '<' != $content[0] ) { 1818 $content = preg_replace_callback( $wp_smiliessearch, 'translate_smiley', $content ); 1819 } 1820 1821 // did we exit ignore block 1822 if ( '' != $ignore_block_element && '</' . $ignore_block_element . '>' == $content ) { 1823 $ignore_block_element = ''; 1824 } 1825 1808 1826 $output .= $content; 1809 1827 }
Note: See TracChangeset
for help on using the changeset viewer.