當前位置: 首頁>>代碼示例>>PHP>>正文


PHP message_format_contexturl函數代碼示例

本文整理匯總了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;
}
開發者ID:nickbert77,項目名稱:moodle,代碼行數:40,代碼來源:lib.php

示例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>';
}
開發者ID:nfreear,項目名稱:moodle,代碼行數:39,代碼來源:lib.php

示例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;
}
開發者ID:neogic,項目名稱:moodle,代碼行數:51,代碼來源:lib.php


注:本文中的message_format_contexturl函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。