当前位置: 首页>>代码示例>>PHP>>正文


PHP Functions::getCont方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\Functions\Functions::getCont方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::getCont方法的具体用法?PHP Functions::getCont怎么用?PHP Functions::getCont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\Functions\Functions的用法示例。


在下文中一共展示了Functions::getCont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: printNoteRecord

 /**
  * 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 string
  */
 public static function printNoteRecord($text, $nlevel, $nrec, $textOnly = false)
 {
     global $WT_TREE;
     $text .= Functions::getCont($nlevel, $nrec);
     // Check if shared note (we have already checked that it exists)
     if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ NOTE/', $nrec, $match)) {
         $note = Note::getInstance($match[1], $WT_TREE);
         $label = 'SHARED_NOTE';
         // If Census assistant installed, allow it to format the note
         if (Module::getModuleByName('GEDFact_assistant')) {
             $html = CensusAssistantModule::formatCensusNote($note);
         } else {
             $html = Filter::formatText($note->getNote(), $WT_TREE);
         }
     } else {
         $note = null;
         $label = 'NOTE';
         $html = 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 GedcomTag::getLabelValue($label, strip_tags($html, '<a><strong><em>'));
     } elseif ($WT_TREE->getPreference('EXPAND_NOTES')) {
         // A multi-line note, and we're expanding notes by default
         return GedcomTag::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 {
             list($text) = explode("\n", strip_tags($html));
             $first_line = strlen($text) > 100 ? mb_substr($text, 0, 100) . 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> ' . GedcomTag::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:jflash,项目名称:webtrees,代码行数:51,代码来源:FunctionsPrint.php

示例2: foreach

$sourceDATE = '';
$sourceQUAY = '';
if (!empty($gedrec)) {
    preg_match_all('/\\n(1 (?!FILE|FORM|TYPE|TITL|_PRIM|_THUM|CHAN|DATA).*(\\n[2-9] .*)*)/', $gedrec, $matches);
    foreach ($matches[1] as $subrec) {
        $pieces = explode("\n", $subrec);
        foreach ($pieces as $piece) {
            $ft = preg_match("/(\\d) (\\w+)(.*)/", $piece, $match);
            if ($ft == 0) {
                continue;
            }
            $subLevel = $match[1];
            $fact = trim($match[2]);
            $event = trim($match[3]);
            if ($fact === 'NOTE' || $fact === 'TEXT') {
                $event .= Functions::getCont($subLevel + 1, $subrec);
            }
            if ($sourceSOUR !== '' && $subLevel <= $sourceLevel) {
                // Get rid of all saved Source data
                FunctionsEdit::addSimpleTag($sourceLevel . ' SOUR ' . $sourceSOUR);
                FunctionsEdit::addSimpleTag($sourceLevel + 1 . ' PAGE ' . $sourcePAGE);
                FunctionsEdit::addSimpleTag($sourceLevel + 2 . ' TEXT ' . $sourceTEXT);
                FunctionsEdit::addSimpleTag($sourceLevel + 2 . ' DATE ' . $sourceDATE, '', GedcomTag::getLabel('DATA:DATE'));
                FunctionsEdit::addSimpleTag($sourceLevel + 1 . ' QUAY ' . $sourceQUAY);
                $sourceSOUR = '';
            }
            if ($fact === 'SOUR') {
                $sourceLevel = $subLevel;
                $sourceSOUR = $event;
                $sourcePAGE = '';
                $sourceTEXT = '';
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:addmedia.php

示例3: printMainNotes


//.........这里部分代码省略.........
                 }
                 if ($note) {
                     echo GedcomTag::getLabel('SHARED_NOTE');
                 } else {
                     echo GedcomTag::getLabel('NOTE');
                 }
                 echo '</a>';
                 echo '<div class="editfacts">';
                 echo "<div class=\"editlink\"><a class=\"editicon\" onclick=\"return edit_record('{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . I18N::translate('Edit') . "\"><span class=\"link_text\">" . I18N::translate('Edit') . "</span></a></div>";
                 echo '<div class="copylink"><a class="copyicon" href="#" onclick="return copy_fact(\'', $pid, '\', \'', $fact_id, '\');" title="' . I18N::translate('Copy') . '"><span class="link_text">' . I18N::translate('Copy') . '</span></a></div>';
                 echo "<div class=\"deletelink\"><a class=\"deleteicon\" onclick=\"return delete_fact('" . I18N::translate('Are you sure you want to delete this fact?') . "', '{$pid}', '{$fact_id}');\" href=\"#\" title=\"" . I18N::translate('Delete') . "\"><span class=\"link_text\">" . I18N::translate('Delete') . "</span></a></div>";
                 if ($note) {
                     echo '<a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . I18N::translate('View') . '"><span class="link_text">' . I18N::translate('View') . '</span></a>';
                 }
                 echo '</div>';
             }
         } else {
             if ($level < 2) {
                 if ($fact->getParent()->getTree()->getPreference('SHOW_FACT_ICONS')) {
                     echo '<i class="icon-note"></i> ';
                 }
                 if ($note) {
                     echo GedcomTag::getLabel('SHARED_NOTE');
                 } else {
                     echo GedcomTag::getLabel('NOTE');
                 }
             }
             $factlines = explode("\n", $factrec);
             // 1 BIRT Y\n2 NOTE ...
             $factwords = explode(" ", $factlines[0]);
             // 1 BIRT Y
             $factname = $factwords[1];
             // BIRT
             $parent = GedcomRecord::getInstance($pid, $fact->getParent()->getTree());
             if ($factname == 'EVEN' || $factname == 'FACT') {
                 // Add ' EVEN' to provide sensible output for an event with an empty TYPE record
                 $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch);
                 if ($ct > 0) {
                     $factname = trim($ematch[1]);
                     echo $factname;
                 } else {
                     echo GedcomTag::getLabel($factname, $parent);
                 }
             } elseif ($factname != 'NOTE') {
                 // Note is already printed
                 echo GedcomTag::getLabel($factname, $parent);
                 if ($note) {
                     echo '<div class="editfacts"><a class="icon-note" href="', $note->getHtmlUrl(), '" title="' . I18N::translate('View') . '"><span class="link_text">' . I18N::translate('View') . '</span></a></div>';
                 }
             }
         }
         echo '</td>';
         if ($note) {
             // Note objects
             if (Module::getModuleByName('GEDFact_assistant')) {
                 // If Census assistant installed, allow it to format the note
                 $text = CensusAssistantModule::formatCensusNote($note);
             } else {
                 $text = Filter::formatText($note->getNote(), $fact->getParent()->getTree());
             }
         } else {
             // Inline notes
             $nrec = Functions::getSubRecord($level, "{$level} NOTE", $factrec, $j + 1);
             $text = $match[$j][1] . Functions::getCont($level + 1, $nrec);
             $text = Filter::formatText($text, $fact->getParent()->getTree());
         }
         echo '<td class="optionbox', $styleadd, ' wrap">';
         echo $text;
         if (!empty($noterec)) {
             echo self::printFactSources($noterec, 1);
         }
         // 2 RESN tags.  Note, there can be more than one, such as "privacy" and "locked"
         if (preg_match_all("/\n2 RESN (.+)/", $factrec, $matches)) {
             foreach ($matches[1] as $match) {
                 echo '<br><span class="label">', GedcomTag::getLabel('RESN'), ':</span> <span class="field">';
                 switch ($match) {
                     case 'none':
                         // Note: "2 RESN none" is not valid gedcom, and the GUI will not let you add it.
                         // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public".
                         echo '<i class="icon-resn-none"></i> ', I18N::translate('Show to visitors');
                         break;
                     case 'privacy':
                         echo '<i class="icon-resn-privacy"></i> ', I18N::translate('Show to members');
                         break;
                     case 'confidential':
                         echo '<i class="icon-resn-confidential"></i> ', I18N::translate('Show to managers');
                         break;
                     case 'locked':
                         echo '<i class="icon-resn-locked"></i> ', I18N::translate('Only managers can edit');
                         break;
                     default:
                         echo $match;
                         break;
                 }
                 echo '</span>';
             }
         }
         echo '</td></tr>';
     }
 }
开发者ID:jflash,项目名称:webtrees,代码行数:101,代码来源:FunctionsPrintFacts.php

示例4: getGedcomValue

 /**
  * get gedcom tag value
  *
  * @param string  $tag    The tag to find, use : to delineate subtags
  * @param int $level  The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record
  * @param string  $gedrec The gedcom record to get the value from
  *
  * @return string the value of a gedcom tag from the given gedcom record
  */
 private function getGedcomValue($tag, $level, $gedrec)
 {
     global $WT_TREE;
     if (empty($gedrec)) {
         return '';
     }
     $tags = explode(':', $tag);
     $origlevel = $level;
     if ($level == 0) {
         $level = $gedrec[0] + 1;
     }
     $subrec = $gedrec;
     foreach ($tags as $t) {
         $lastsubrec = $subrec;
         $subrec = Functions::getSubRecord($level, "{$level} {$t}", $subrec);
         if (empty($subrec) && $origlevel == 0) {
             $level--;
             $subrec = Functions::getSubRecord($level, "{$level} {$t}", $lastsubrec);
         }
         if (empty($subrec)) {
             if ($t == "TITL") {
                 $subrec = Functions::getSubRecord($level, "{$level} ABBR", $lastsubrec);
                 if (!empty($subrec)) {
                     $t = "ABBR";
                 }
             }
             if (empty($subrec)) {
                 if ($level > 0) {
                     $level--;
                 }
                 $subrec = Functions::getSubRecord($level, "@ {$t}", $gedrec);
                 if (empty($subrec)) {
                     return '';
                 }
             }
         }
         $level++;
     }
     $level--;
     $ct = preg_match("/{$level} {$t}(.*)/", $subrec, $match);
     if ($ct == 0) {
         $ct = preg_match("/{$level} @.+@ (.+)/", $subrec, $match);
     }
     if ($ct == 0) {
         $ct = preg_match("/@ {$t} (.+)/", $subrec, $match);
     }
     if ($ct > 0) {
         $value = trim($match[1]);
         if ($t == 'NOTE' && preg_match('/^@(.+)@$/', $value, $match)) {
             $note = Note::getInstance($match[1], $WT_TREE);
             if ($note) {
                 $value = $note->getNote();
             } else {
                 //-- set the value to the id without the @
                 $value = $match[1];
             }
         }
         if ($level != 0 || $t != "NOTE") {
             $value .= Functions::getCont($level + 1, $subrec);
         }
         return $value;
     }
     return "";
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:73,代码来源:ReportParserGenerate.php


注:本文中的Fisharebest\Webtrees\Functions\Functions::getCont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。