本文整理汇总了PHP中BBCode::receive_event方法的典型用法代码示例。如果您正苦于以下问题:PHP BBCode::receive_event方法的具体用法?PHP BBCode::receive_event怎么用?PHP BBCode::receive_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BBCode
的用法示例。
在下文中一共展示了BBCode::receive_event方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strip
private function strip($in)
{
$bb = new BBCode();
$tfe = new TextFormattingEvent($in);
$bb->receive_event($tfe);
return $tfe->stripped;
}
示例2: comment_to_html
protected function comment_to_html($comment, $trim = false)
{
global $user;
$tfe = new TextFormattingEvent($comment->comment);
// sending this event to all ~50 exts has a lot of overhead
if (SPEED_HAX) {
$bb = new BBCode();
$bb->receive_event($tfe);
} else {
send_event($tfe);
}
$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
$h_poster_ip = html_escape($comment->poster_ip);
$h_timestamp = autodate($comment->posted);
$h_comment = $trim ? substr($tfe->stripped, 0, 50) . "..." : $tfe->formatted;
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
$anoncode = "";
if ($h_name == "Anonymous" && $this->anon_id >= 0) {
$anoncode = "<sup>{$this->anon_id}</sup>";
$this->anon_id++;
}
$h_userlink = "<a href='" . make_link("user/{$h_name}") . "'>{$h_name}</a>{$anoncode}";
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
$h_dellink = $user->is_admin() ? "<br>({$h_poster_ip}, {$h_timestamp}, <a " . "onclick=\"return confirm('Delete comment by {$h_name}:\\n{$stripped_nonl}');\" " . "href='" . make_link("comment/delete/{$i_comment_id}/{$i_image_id}") . "'>Del</a>)" : "";
if ($trim) {
return "\n\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t<a href='" . make_link("post/view/{$i_image_id}") . "'>>>></a>\n\t\t\t\t{$h_dellink}\n\t\t\t";
} else {
//$avatar = "";
//if(!empty($comment->owner->email)) {
// $hash = md5(strtolower($comment->owner->email));
// $avatar = "<img src=\"http://www.gravatar.com/avatar/$hash.jpg\"><br>";
//}
$oe = $this->comments_shown++ % 2 == 0 ? "even" : "odd";
return "\n\t\t\t\t<a name='{$i_comment_id}'></a>\n\t\t\t\t<div class='{$oe} comment'>\n\t\t\t\t<!--<span class='timeago' style='float: right;'>{$h_timestamp}</span>-->\n\t\t\t\t{$h_userlink}: {$h_comment}\n\t\t\t\t{$h_dellink}\n\t\t\t\t</div>\n\t\t\t";
}
}