WordPress.org

Make WordPress Core

Ticket #5689: smilies-nowrap-20081212.patch

File smilies-nowrap-20081212.patch, 1.9 KB (added by gpoul, 9 years ago)
  • wp-includes/functions.php

     
    23962396function smilies_init() {
    23972397        global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace;
    23982398
    2399         // don't bother setting up smilies if they are disabled
    2400         if ( !get_option( 'use_smilies' ) )
    2401                 return;
    2402 
    24032399        if ( !isset( $wpsmiliestrans ) ) {
    24042400                $wpsmiliestrans = array(
    24052401                ':mrgreen:' => 'icon_mrgreen.gif',
  • wp-includes/formatting.php

     
    10791079}
    10801080
    10811081/**
    1082  * Convert text equivalent of smilies to images.
     1082 * Convert text equivalent of smilies to images and make sure text smilies are not wrapped
    10831083 *
    1084  * Will only convert smilies if the option 'use_smilies' is true and the globals
     1084 * Will only convert smilies to images if the option 'use_smilies' is true and the globals
    10851085 * used in the function aren't empty.
    10861086 *
    10871087 * @since 0.71
    10881088 * @uses $wp_smiliessearch, $wp_smiliesreplace Smiley replacement arrays.
    10891089 *
    10901090 * @param string $text Content to convert smilies from text.
    1091  * @return string Converted content with text smilies replaced with images.
     1091 * @return string Converted content with text smilies replaced.
    10921092 */
    10931093function convert_smilies($text) {
    10941094        global $wp_smiliessearch, $wp_smiliesreplace;
     
    11051105                        $output .= $content;
    11061106                }
    11071107        } else {
    1108                 // return default text.
    1109                 $output = $text;
     1108                // If smilies are not converted to images, make sure they're not wrapped
     1109                $output = preg_replace_callback(
     1110                        $wp_smiliessearch,
     1111                        create_function(
     1112                                '$matches',
     1113                                'return "<span style=\"white-space:nowrap\">$matches[0]</span>";'
     1114                        ),
     1115                        $text
     1116                );
    11101117        }
    11111118        return $output;
    11121119}