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


PHP WT_Filter::markdown方法代碼示例

本文整理匯總了PHP中WT_Filter::markdown方法的典型用法代碼示例。如果您正苦於以下問題:PHP WT_Filter::markdown方法的具體用法?PHP WT_Filter::markdown怎麽用?PHP WT_Filter::markdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WT_Filter的用法示例。


在下文中一共展示了WT_Filter::markdown方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: extractNames

 /**
  * Create a name for this note - apply (and remove) markup, then take
  * a maximum of 100 characters from the first line.
  */
 public function extractNames()
 {
     global $WT_TREE;
     $text = $this->getNote();
     switch ($WT_TREE->preference('FORMAT_TEXT')) {
         case 'markdown':
             $text = WT_Filter::markdown($text);
             $text = strip_tags($text);
             break;
     }
     list($text) = explode("\n", $text);
     $this->_addName('NOTE', strlen($text) > 100 ? mb_substr($text, 0, 100) . WT_I18N::translate('…') : $text, $this->getGedcom());
 }
開發者ID:brambravo,項目名稱:webtrees,代碼行數:17,代碼來源:Note.php

示例2: formatText

 public static function formatText($text, WT_Tree $WT_TREE)
 {
     switch ($WT_TREE->preference('FORMAT_TEXT')) {
         case 'markdown':
             return '<div class="markdown" dir="auto">' . WT_Filter::markdown($text) . '</div>';
             break;
         case '':
         default:
             return '<div style="white-space: pre-wrap;" dir="auto">' . WT_Filter::expandUrls($text) . '</div>';
             break;
     }
 }
開發者ID:sadr110,項目名稱:webtrees,代碼行數:12,代碼來源:Filter.php

示例3: print_note_record

/**
 * print a note record
 *
 * @param string $text
 * @param int    $nlevel   the level of the note record
 * @param string $nrec     the note record to print
 * @param bool   $textOnly Don't print the "Note: " introduction
 *
 * @return boolean
 */
function print_note_record($text, $nlevel, $nrec, $textOnly = false)
{
    global $WT_TREE;
    $text .= get_cont($nlevel, $nrec);
    // Check if shared note (we have already checked that it exists)
    if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) {
        $note = WT_Note::getInstance($match[1]);
        $label = 'SHARED_NOTE';
        // If Census assistant installed, allow it to format the note
        if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
            $html = GEDFact_assistant_WT_Module::formatCensusNote($note);
        } else {
            $html = WT_Filter::formatText($note->getNote(), $WT_TREE);
        }
    } else {
        $note = null;
        $label = 'NOTE';
        $html = WT_Filter::formatText($text, $WT_TREE);
    }
    if ($textOnly) {
        return strip_tags($text);
    }
    if (strpos($text, "\n") === false) {
        // A one-line note? strip the block-level tags, so it displays inline
        return WT_Gedcom_Tag::getLabelValue($label, strip_tags($html, '<a><strong><em>'));
    } elseif ($WT_TREE->preference('EXPAND_NOTES')) {
        // A multi-line note, and we're expanding notes by default
        return WT_Gedcom_Tag::getLabelValue($label, $html);
    } else {
        // A multi-line note, with an expand/collapse option
        $element_id = Uuid::uuid4();
        // NOTE: class "note-details" is (currently) used only by some third-party themes
        if ($note) {
            $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $note->getFullName() . '</a>';
        } else {
            switch ($WT_TREE->preference('FORMAT_TEXT')) {
                case 'markdown':
                    $text = WT_Filter::markdown($text);
                    $text = html_entity_decode(strip_tags($text, '<a><strong><em>'), ENT_QUOTES | ENT_HTML5, 'UTF-8');
                    break;
            }
            list($text) = explode("\n", $text);
            $first_line = strlen($text) > 100 ? mb_substr($text, 0, 100) . WT_I18N::translate('…') : $text;
        }
        return '<div class="fact_NOTE"><span class="label">' . '<a href="#" onclick="expand_layer(\'' . $element_id . '\'); return false;"><i id="' . $element_id . '_img" class="icon-plus"></i></a> ' . WT_Gedcom_Tag::getLabel($label) . ':</span> ' . '<span id="' . $element_id . '-alt">' . $first_line . '</span>' . '</div>' . '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>';
    }
}
開發者ID:jacoline,項目名稱:webtrees,代碼行數:57,代碼來源:functions_print.php


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