summaryrefslogtreecommitdiff
path: root/includes/functions/functions_print.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/functions/functions_print.php')
-rw-r--r--includes/functions/functions_print.php91
1 files changed, 34 insertions, 57 deletions
diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php
index 176da44824..444699ad75 100644
--- a/includes/functions/functions_print.php
+++ b/includes/functions/functions_print.php
@@ -4,7 +4,7 @@
// Various printing functions used by all scripts and included by the functions.php file.
//
// webtrees: Web based Family History software
-// Copyright (C) 2013 webtrees development team.
+// Copyright (C) 2014 webtrees development team.
//
// Derived from PhpGedView
// Copyright (C) 2002 to 2010 PGV Development Team. All rights reserved.
@@ -21,7 +21,7 @@
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
if (!defined('WT_WEBTREES')) {
header('HTTP/1.0 403 Forbidden');
@@ -37,7 +37,7 @@ if (!defined('WT_WEBTREES')) {
* @param int $count on some charts it is important to keep a count of how many boxes were printed
*/
function print_pedigree_person($person, $style=1, $count=0, $personcount="1") {
- global $HIDE_LIVE_PEOPLE, $SHOW_LIVING_NAMES, $GEDCOM;
+ global $GEDCOM;
global $SHOW_HIGHLIGHT_IMAGES, $bwidth, $bheight, $PEDIGREE_FULL_DETAILS, $SHOW_PEDIGREE_PLACES;
global $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT;
global $chart_style, $box_width, $generations, $show_spouse, $show_full;
@@ -227,16 +227,16 @@ function print_pedigree_person($person, $style=1, $count=0, $personcount="1") {
// now added as a function here.
function header_links($META_DESCRIPTION, $META_ROBOTS, $META_GENERATOR, $LINK_CANONICAL) {
- $header_links='';
- if (!empty($LINK_CANONICAL)) {
- $header_links.= '<link rel="canonical" href="'. $LINK_CANONICAL. '">';
+ $header_links = '';
+ if ($LINK_CANONICAL) {
+ $header_links .= '<link rel="canonical" href="' . $LINK_CANONICAL . '">';
}
- if (!empty($META_DESCRIPTION)) {
- $header_links.= '<meta name="description" content="'. WT_Filter::escapeHtml($META_DESCRIPTION). '">';
+ if ($META_DESCRIPTION) {
+ $header_links .= '<meta name="description" content="' . $META_DESCRIPTION . '">';
}
- $header_links.= '<meta name="robots" content="'. $META_ROBOTS. '">';
- if (!empty($META_GENERATOR)) {
- $header_links.= '<meta name="generator" content="'. $META_GENERATOR. '">';
+ $header_links .= '<meta name="robots" content="' . $META_ROBOTS . '">';
+ if ($META_GENERATOR) {
+ $header_links .= '<meta name="generator" content="' . $META_GENERATOR . '">';
}
return $header_links;
}
@@ -391,69 +391,46 @@ 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 ($note) {
- $data .= WT_I18N::translate('Shared note').': </span> ';
+ 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 {
- $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>';
+ // A multi-line note, with an expand/collapse option
+ $element_id = uniqid('n-');
+ // NOTE: class "note-details" is (currently) used only by some third-party themes
+ 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) . ': ' .
+ '</div>' .
+ '<div class="note-details" id="' . $element_id . '" style="display:none">' . $html . '</div>';
}
- $data .= '</div>';
-
- return $data;
}
/**