Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




convert_smilies [ WordPress Function ]

convert_smilies ( $text )
Parameters:
  • (string) $text Content to convert smilies from text.
Uses:
  • $wp_smiliessearch
Returns:
  • (string) Converted content with text smilies replaced with images.
Defined at:



Convert text equivalent of smilies to images.

Will only convert smilies if the option 'use_smilies' is true and the global used in the function isn't empty.

Source


<?php
function convert_smilies($text) {
    global 
$wp_smiliessearch;
    
$output '';
    if ( 
get_option('use_smilies') && !empty($wp_smiliessearch) ) {
        
// HTML loop taken from texturize function, could possible be consolidated
        
$textarr preg_split("/(<.*>)/U"$text, -1PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between
        
$stop count($textarr);// loop stuff
        
for ($i 0$i $stop$i++) {
            
$content $textarr[$i];
            if ((
strlen($content) > 0) && ('<' != $content[0])) { // If it's not a tag
                
$content preg_replace_callback($wp_smiliessearch'translate_smiley'$content);
            }
            
$output .= $content;
        }
    } else {
        
// return default text.
        
$output $text;
    }
    return 
$output;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics