本文整理汇总了PHP中message_format_contexturl函数的典型用法代码示例。如果您正苦于以下问题:PHP message_format_contexturl函数的具体用法?PHP message_format_contexturl怎么用?PHP message_format_contexturl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了message_format_contexturl函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: message_format_message
/**
* Format a message for display in the message history
*
* @param object $message the message object
* @param string $format optional date format
* @param string $keywords keywords to highlight
* @param string $class CSS class to apply to the div around the message
* @return string the formatted message
*/
function message_format_message($message, $format='', $keywords='', $class='other') {
static $dateformat;
//if we haven't previously set the date format or they've supplied a new one
if ( empty($dateformat) || (!empty($format) && $dateformat != $format) ) {
if ($format) {
$dateformat = $format;
} else {
$dateformat = get_string('strftimedatetimeshort');
}
}
$time = userdate($message->timecreated, $dateformat);
$messagetext = message_format_message_text($message, false);
if ($keywords) {
$messagetext = highlight($keywords, $messagetext);
}
$messagetext .= message_format_contexturl($message);
$messagetext = clean_text($messagetext, FORMAT_HTML);
return <<<TEMPLATE
<div class='message $class'>
<a name="m{$message->id}"></a>
<span class="message-meta"><span class="time">$time</span></span>: <span class="text">$messagetext</span>
</div>
TEMPLATE;
}
示例2: message_format_message
/**
* Format a message for display in the message history
* @param object $message the message object
* @param string $format optional date format
* @param string $keywords keywords to highlight
* @param string $class CSS class to apply to the div around the message
* @return string the formatted message
*/
function message_format_message($message, $format='', $keywords='', $class='other') {
static $dateformat;
//if we haven't previously set the date format or they've supplied a new one
if ( empty($dateformat) || (!empty($format) && $dateformat != $format) ) {
if ($format) {
$dateformat = $format;
} else {
$dateformat = get_string('strftimedatetimeshort');
}
}
$time = userdate($message->timecreated, $dateformat);
$options = new stdClass();
$options->para = false;
//if supplied display small messages as fullmessage may contain boilerplate text that shouldnt appear in the messaging UI
if (!empty($message->smallmessage)) {
$messagetext = format_text(s($message->smallmessage), FORMAT_MOODLE, $options);
} else {
$messagetext = format_text(s($message->fullmessage), $message->fullmessageformat, $options);
}
$messagetext .= message_format_contexturl($message);
if ($keywords) {
$messagetext = highlight($keywords, $messagetext);
}
return '<div class="message '.$class.'"><a name="m'.$message->id.'"></a> <span class="time">'.$time.'</span>: <span class="content">'.$messagetext.'</span></div>';
}
示例3: message_format_message
/**
* Format a message for display in the message history
*
* @param object $message the message object
* @param string $format optional date format
* @param string $keywords keywords to highlight
* @param string $class CSS class to apply to the div around the message
* @return string the formatted message
*/
function message_format_message($message, $format='', $keywords='', $class='other') {
static $dateformat;
//if we haven't previously set the date format or they've supplied a new one
if ( empty($dateformat) || (!empty($format) && $dateformat != $format) ) {
if ($format) {
$dateformat = $format;
} else {
$dateformat = get_string('strftimedatetimeshort');
}
}
$time = userdate($message->timecreated, $dateformat);
$options = new stdClass();
$options->para = false;
//if supplied display small messages as fullmessage may contain boilerplate text that shouldnt appear in the messaging UI
if (!empty($message->smallmessage)) {
$messagetext = $message->smallmessage;
} else {
$messagetext = $message->fullmessage;
}
if ($message->fullmessageformat == FORMAT_HTML) {
//dont escape html tags by calling s() if html format or they will display in the UI
$messagetext = html_to_text(format_text($messagetext, $message->fullmessageformat, $options));
} else {
$messagetext = format_text(s($messagetext), $message->fullmessageformat, $options);
}
$messagetext .= message_format_contexturl($message);
if ($keywords) {
$messagetext = highlight($keywords, $messagetext);
}
return <<<TEMPLATE
<div class='message $class'>
<a name="m'.{$message->id}.'"></a>
<span class="message-meta"><span class="time">$time</span></span>: <span class="text">$messagetext</span>
</div>
TEMPLATE;
}