WordPress.org

Make WordPress Core

Ticket #5689: 5689.diff

File 5689.diff, 1.8 KB (added by wojtek.szkutnik, 8 years ago)
  • wp-includes/formatting.php

     
    14361436}
    14371437
    14381438/**
    1439  * Convert text equivalent of smilies to images.
     1439 * Convert text equivalent of smilies to images and make sure text smilies are not wrapped.
    14401440 *
    1441  * Will only convert smilies if the option 'use_smilies' is true and the global
     1441 * Will only convert smilies to images if the option 'use_smilies' is true and the globals
    14421442 * used in the function isn't empty.
    14431443 *
    14441444 * @since 0.71
    14451445 * @uses $wp_smiliessearch
    14461446 *
    14471447 * @param string $text Content to convert smilies from text.
    1448  * @return string Converted content with text smilies replaced with images.
     1448 * @return string Converted content with text smilies replaced.
    14491449 */
    14501450function convert_smilies($text) {
    14511451        global $wp_smiliessearch;
     
    14621462                        $output .= $content;
    14631463                }
    14641464        } else {
    1465                 // return default text.
    1466                 $output = $text;
     1465                // If smilies are not converted to images, make sure they're not wrapped
     1466                $output = preg_replace_callback(
     1467                                $wp_smiliessearch,
     1468                                create_function(
     1469                                                '$matches',
     1470                                                'return "<span style=\"white-space:nowrap\">$matches[0]</span>";'
     1471                                ),
     1472                                $text
     1473                );
    14671474        }
    14681475        return $output;
    14691476}
  • wp-includes/functions.php

     
    28492849function smilies_init() {
    28502850        global $wpsmiliestrans, $wp_smiliessearch;
    28512851
    2852         // don't bother setting up smilies if they are disabled
    2853         if ( !get_option( 'use_smilies' ) )
    2854                 return;
    2855 
    28562852        if ( !isset( $wpsmiliestrans ) ) {
    28572853                $wpsmiliestrans = array(
    28582854                ':mrgreen:' => 'icon_mrgreen.gif',