本文整理汇总了PHP中postParser::text_parse_message方法的典型用法代码示例。如果您正苦于以下问题:PHP postParser::text_parse_message方法的具体用法?PHP postParser::text_parse_message怎么用?PHP postParser::text_parse_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类postParser
的用法示例。
在下文中一共展示了postParser::text_parse_message方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Verifies a post message.
*
* @param string The message content.
*/
function verify_message()
{
global $mybb;
$post =& $this->data;
$post['message'] = trim_blank_chrs($post['message']);
// Do we even have a message at all?
if (my_strlen($post['message']) == 0) {
$this->set_error("missing_message");
return false;
} else {
if (strlen($post['message']) > $mybb->settings['maxmessagelength'] && $mybb->settings['maxmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid'])) {
$this->set_error("message_too_long", array($mybb->settings['maxmessagelength'], strlen($post['message'])));
return false;
} else {
if (!isset($post['fid'])) {
$post['fid'] = 0;
}
if (!$mybb->settings['mycodemessagelength']) {
// Check to see of the text is full of MyCode
require_once MYBB_ROOT . "inc/class_parser.php";
$parser = new postParser();
$message = $parser->text_parse_message($post['message']);
if (my_strlen($message) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid'])) {
$this->set_error("message_too_short", array($mybb->settings['minmessagelength']));
return false;
}
} else {
if (my_strlen($post['message']) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid'])) {
$this->set_error("message_too_short", array($mybb->settings['minmessagelength']));
return false;
}
}
}
}
return true;
}
示例2:
$parser_options['allow_imgcode'] = 0;
}
$parsed_sig = $parser->parse_message($mybb->get_input('signature'), $parser_options);
if ($mybb->settings['sigimgcode'] == 0 && $mybb->settings['sigsmilies'] != 1 && substr_count($parsed_sig, "<img") > 0 || ($mybb->settings['sigimgcode'] == 1 || $mybb->settings['sigsmilies'] == 1) && substr_count($parsed_sig, "<img") > $mybb->settings['maxsigimages']) {
if ($mybb->settings['sigimgcode'] == 1) {
$imgsallowed = $mybb->settings['maxsigimages'];
} else {
$imgsallowed = 0;
}
$lang->too_many_sig_images2 = $lang->sprintf($lang->too_many_sig_images2, $imgsallowed);
$error = inline_error($lang->too_many_sig_images . " " . $lang->too_many_sig_images2);
$mybb->input['preview'] = 1;
} else {
if ($mybb->settings['siglength'] > 0) {
if ($mybb->settings['sigcountmycode'] == 0) {
$parsed_sig = $parser->text_parse_message($mybb->get_input('signature'));
} else {
$parsed_sig = $mybb->get_input('signature');
}
$parsed_sig = preg_replace("#\\s#", "", $parsed_sig);
$sig_length = my_strlen($parsed_sig);
if ($sig_length > $mybb->settings['siglength']) {
$lang->sig_too_long = $lang->sprintf($lang->sig_too_long, $mybb->settings['siglength']);
if ($sig_length - $mybb->settings['siglength'] > 1) {
$lang->sig_too_long .= $lang->sprintf($lang->sig_remove_chars_plural, $sig_length - $mybb->settings['siglength']);
} else {
$lang->sig_too_long .= $lang->sig_remove_chars_singular;
}
$error = inline_error($lang->sig_too_long);
}
}
示例3: array
if ($mybb->input['action'] == "do_editsig" && $mybb->request_method == "post") {
$parser_options = array('allow_html' => $mybb->settings['sightml'], 'filter_badwords' => 1, 'allow_mycode' => $mybb->settings['sigmycode'], 'allow_smilies' => $mybb->settings['sigsmilies'], 'allow_imgcode' => $mybb->settings['sigimgcode'], "filter_badwords" => 1);
$parsed_sig = $parser->parse_message($mybb->input['signature'], $parser_options);
if ($mybb->settings['sigimgcode'] == 0 && $mybb->settings['sigsmilies'] != 1 && substr_count($parsed_sig, "<img") > 0 || ($mybb->settings['sigimgcode'] == 1 || $mybb->settings['sigsmilies'] == 1) && substr_count($parsed_sig, "<img") > $mybb->settings['maxsigimages']) {
if ($mybb->settings['sigimgcode'] == 1) {
$imgsallowed = $mybb->settings['maxsigimages'];
} else {
$imgsallowed = 0;
}
$lang->too_many_sig_images2 = $lang->sprintf($lang->too_many_sig_images2, $imgsallowed);
$error = inline_error($lang->too_many_sig_images . " " . $lang->too_many_sig_images2);
$mybb->input['preview'] = 1;
} else {
if ($mybb->settings['siglength'] > 0) {
if ($mybb->settings['sigcountmycode'] == 0) {
$parsed_sig = $parser->text_parse_message($mybb->input['signature']);
} else {
$parsed_sig = $mybb->input['signature'];
}
$parsed_sig = preg_replace("#\\s#", "", $parsed_sig);
$sig_length = my_strlen($parsed_sig);
if ($sig_length > $mybb->settings['siglength']) {
$lang->sig_too_long = $lang->sprintf($lang->sig_too_long, $mybb->settings['siglength']);
if ($sig_length - $mybb->settings['siglength'] > 1) {
$lang->sig_too_long .= $lang->sprintf($lang->sig_remove_chars_plural, $sig_length - $mybb->settings['siglength']);
} else {
$lang->sig_too_long .= $lang->sig_remove_chars_singular;
}
$error = inline_error($lang->sig_too_long);
}
}