BBCode::Internal_ProcessSmileys( $string )

Description

Source

File: bp-forums/admin/parser.php

function Internal_ProcessSmileys($string) {
if (!$this->enable_smileys || $this->plain_mode) {
$output = $this->HTMLEncode($string);
}
else {
if ($this->smiley_regex === false) {
$this->Internal_RebuildSmileys();
}
$tokens = preg_split($this->smiley_regex, $string, -1, PREG_SPLIT_DELIM_CAPTURE);
if (count($tokens) <= 1) {
$output = $this->HTMLEncode($string);
}
else {
$output = "";
$is_a_smiley = false;
foreach ($tokens as $token) {
if (!$is_a_smiley) {
$output .= $this->HTMLEncode($token);
}
else {
if (isset($this->smiley_info[$token])) {
$info = $this->smiley_info[$token];
}
else {
$info = @getimagesize($this->smiley_dir . '/' . $this->smileys[$token]);
$this->smiley_info[$token] = $info;
}
$alt = htmlspecialchars($token);
$output .= "<img src=\"" . htmlspecialchars($this->smiley_url . '/' . $this->smileys[$token])
. "\" width=\"{$info[0]}\" height=\"{$info[1]}\""
. " alt=\"$alt\" title=\"$alt\" class=\"bbcode_smiley\" />";
}
$is_a_smiley = !$is_a_smiley;
}
}
}
return $output;
}

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.