summaryrefslogtreecommitdiff
path: root/includes/functions
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions')
-rw-r--r--includes/functions/functions.php1
-rw-r--r--includes/functions/functions_print.php59
-rw-r--r--includes/functions/functions_print_facts.php11
3 files changed, 19 insertions, 52 deletions
diff --git a/includes/functions/functions.php b/includes/functions/functions.php
index 01ec985f0d..0f012b4cf2 100644
--- a/includes/functions/functions.php
+++ b/includes/functions/functions.php
@@ -111,7 +111,6 @@ function load_gedcom_settings($ged_id=WT_GED_ID) {
global $CHART_BOX_TAGS; $CHART_BOX_TAGS =get_gedcom_setting($ged_id, 'CHART_BOX_TAGS');
global $CONTACT_USER_ID; $CONTACT_USER_ID =get_gedcom_setting($ged_id, 'CONTACT_USER_ID');
global $DEFAULT_PEDIGREE_GENERATIONS; $DEFAULT_PEDIGREE_GENERATIONS =get_gedcom_setting($ged_id, 'DEFAULT_PEDIGREE_GENERATIONS');
- global $EXPAND_NOTES; $EXPAND_NOTES =get_gedcom_setting($ged_id, 'EXPAND_NOTES');
global $EXPAND_RELATIVES_EVENTS; $EXPAND_RELATIVES_EVENTS =get_gedcom_setting($ged_id, 'EXPAND_RELATIVES_EVENTS');
global $EXPAND_SOURCES; $EXPAND_SOURCES =get_gedcom_setting($ged_id, 'EXPAND_SOURCES');
global $FAM_ID_PREFIX; $FAM_ID_PREFIX =get_gedcom_setting($ged_id, 'FAM_ID_PREFIX');
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 176da44824..36f7858b42 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -391,69 +391,36 @@ function contact_links($ged_id=WT_GED_ID) {
* @return boolean
*/
function print_note_record($text, $nlevel, $nrec, $textOnly=false) {
- global $EXPAND_SOURCES, $EXPAND_NOTES;
- $elementID = 'N-'.(int)(microtime()*1000000);
-
+ 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]);
+ $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())) {
- $text = GEDFact_assistant_WT_Module::formatCensusNote($note);
+ $html = GEDFact_assistant_WT_Module::formatCensusNote($note);
} else {
- $text = WT_Filter::expandUrls($note->getNote());
+ $html = WT_Filter::formatText($note->getNote(), $WT_TREE);
}
} else {
- $note = null;
- $text = WT_Filter::expandUrls($text);
+ $note = null;
+ $label = 'NOTE';
+ $html = WT_Filter::formatText($text, $WT_TREE);
}
if ($textOnly) {
return strip_tags($text);
}
- if (strpos($text, "\n") !== false) {
- list($first_line, $cont_lines) = explode("\n", $text, 2);
- } else {
- $first_line = $text;
- $cont_lines = '';
- }
-
- $data = '<div class="fact_NOTE"><span class="label">';
- if ($cont_lines) {
- if ($EXPAND_NOTES) {
- $plusminus='minus';
- } else {
- $plusminus='plus';
- }
- $data .= '<a href="#" onclick="expand_layer(\'' . $elementID . '\'); return false;"><i id="' . $elementID . '_img" class="icon-' . $plusminus . '"></i></a> ';
+ if (strpos($text, "\n") === false) {
+ // A one-line note? strip the block-level tags, so it displays inline
+ $html = strip_tags($html, '<a><strong><em>');
}
- if ($note) {
- $data .= WT_I18N::translate('Shared note').': </span> ';
- } else {
- $data .= WT_I18N::translate('Note').': </span>';
- }
-
- if ($cont_lines) {
- if ($note) {
- $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $first_line . '</a>';
- }
- $data .= '<span class="field" dir="auto">' . $first_line . '</span>';
- $data .= '<div id="' . $elementID . '" dir="auto" style="white-space:pre-wrap; display:';
- $data .= $EXPAND_NOTES ? 'block' : 'none';
- $data .= '">' . $cont_lines. '</div>';
- } else {
- if ($note) {
- $first_line = '<a href="' . $note->getHtmlUrl() . '">' . $first_line . '</a>';
- }
- $data .= '<span class="field" dir="auto">' . $first_line . '</span>';
- }
- $data .= '</div>';
-
- return $data;
+ return WT_Gedcom_Tag::getLabelValue($label, $html);
}
/**
diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php
index be5e8811d1..724bcf0cad 100644
--- a/includes/functions/functions_print_facts.php
+++ b/includes/functions/functions_print_facts.php
@@ -755,6 +755,7 @@ function print_main_sources(WT_Fact $fact, $level) {
* getSourceStructure() function.
*/
function printSourceStructure($textSOUR) {
+ global $WT_TREE;
$html = '';
if ($textSOUR['PAGE']) {
@@ -774,7 +775,7 @@ function printSourceStructure($textSOUR) {
$html .= WT_Gedcom_Tag::getLabelValue('DATA:DATE', $date->Display(false));
}
foreach ($textSOUR['TEXT'] as $text) {
- $html .= WT_Gedcom_Tag::getLabelValue('TEXT', '<span style="white-space: pre-wrap;">' . WT_Filter::expandUrls($text) . '</span>');
+ $html .= WT_Gedcom_Tag::getLabelValue('TEXT', WT_Filter::formatText($text, $WT_TREE));
}
}
@@ -838,7 +839,7 @@ function getSourceStructure($srec) {
// Print a row for the notes tab on the individual page
function print_main_notes(WT_Fact $fact, $level) {
- global $GEDCOM, $SHOW_FACT_ICONS, $TEXT_DIRECTION;
+ global $GEDCOM, $WT_TREE, $SHOW_FACT_ICONS, $TEXT_DIRECTION;
$factrec = $fact->getGedcom();
$fact_id = $fact->getFactId();
@@ -920,7 +921,7 @@ function print_main_notes(WT_Fact $fact, $level) {
if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
$text = GEDFact_assistant_WT_Module::formatCensusNote($note);
} else {
- $text = WT_Filter::expandUrls($note->getNote());
+ $text = WT_Filter::formatText($note->getNote(), $WT_TREE);
}
} else {
$text = '<span class="error">' . WT_Filter::escapeHtml($nid) . '</span>';
@@ -929,11 +930,11 @@ function print_main_notes(WT_Fact $fact, $level) {
// Inline notes
$nrec = get_sub_record($level, "$level NOTE", $factrec, $j+1);
$text = $match[$j][1] . get_cont($level+1, $nrec);
- $text = WT_Filter::expandUrls($text);
+ $text = WT_Filter::formatText($text, $WT_TREE);
}
echo '<td class="optionbox', $styleadd, ' wrap">';
- echo '<div style="white-space:pre-wrap;">', $text, '</div>';
+ echo $text;
if (!empty($noterec)) {
echo print_fact_sources($noterec, 1);