当前位置: 首页>>代码示例>>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;未经允许,请勿转载。