diff options
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/classes/class_reportbase.php | 152 | ||||
| -rw-r--r-- | includes/functions/functions.php | 100 | ||||
| -rw-r--r-- | includes/functions/functions_charts.php | 13 | ||||
| -rw-r--r-- | includes/functions/functions_db.php | 9 | ||||
| -rw-r--r-- | includes/functions/functions_edit.php | 15 | ||||
| -rw-r--r-- | includes/functions/functions_export.php | 40 | ||||
| -rw-r--r-- | includes/functions/functions_media_reorder.php | 10 | ||||
| -rw-r--r-- | includes/functions/functions_mediadb.php | 12 | ||||
| -rw-r--r-- | includes/functions/functions_name.php | 46 | ||||
| -rw-r--r-- | includes/functions/functions_places.php | 11 | ||||
| -rw-r--r-- | includes/functions/functions_print.php | 6 | ||||
| -rw-r--r-- | includes/functions/functions_print_facts.php | 76 | ||||
| -rw-r--r-- | includes/functions/functions_print_lists.php | 15 | ||||
| -rw-r--r-- | includes/functions/functions_rtl.php | 168 | ||||
| -rw-r--r-- | includes/functions/functions_tools.php | 12 |
15 files changed, 327 insertions, 358 deletions
diff --git a/includes/classes/class_reportbase.php b/includes/classes/class_reportbase.php index 25991a14de..5232e9e4b2 100644 --- a/includes/classes/class_reportbase.php +++ b/includes/classes/class_reportbase.php @@ -1244,59 +1244,59 @@ class Line extends Element { * @global array $elementHandler */ $elementHandler = array(); -$elementHandler["br"]["start"] = "brSHandler"; -$elementHandler["Body"]["start"] = "BodySHandler"; -$elementHandler["Cell"]["end"] = "CellEHandler"; -$elementHandler["Cell"]["start"] = "CellSHandler"; -$elementHandler["Description"]["end"] = "DescriptionEHandler"; -$elementHandler["Description"]["start"] = "DescriptionSHandler"; -$elementHandler["Doc"]["end"] = "DocEHandler"; -$elementHandler["Doc"]["start"] = "DocSHandler"; -$elementHandler["Report"]["end"] = ""; -$elementHandler["Report"]["start"] = ""; -$elementHandler["Facts"]["end"] = "FactsEHandler"; -$elementHandler["Facts"]["start"] = "FactsSHandler"; -$elementHandler["Footer"]["start"] = "FooterSHandler"; -$elementHandler["Footnote"]["end"] = "FootnoteEHandler"; -$elementHandler["Footnote"]["start"] = "FootnoteSHandler"; -$elementHandler["FootnoteTexts"]["start"] = "FootnoteTextsSHandler"; -$elementHandler["Gedcom"]["end"] = "GedcomEHandler"; -$elementHandler["Gedcom"]["start"] = "GedcomSHandler"; -$elementHandler["GedcomValue"]["start"] = "GedcomValueSHandler"; -$elementHandler["Generation"]["start"] = "GenerationSHandler"; -$elementHandler["GetPersonName"]["start"] = "GetPersonNameSHandler"; -$elementHandler["Header"]["start"] = "HeaderSHandler"; -$elementHandler["HighlightedImage"]["start"]= "HighlightedImageSHandler"; -$elementHandler["if"]["end"] = "ifEHandler"; -$elementHandler["if"]["start"] = "ifSHandler"; -$elementHandler["Image"]["start"] = "ImageSHandler"; -$elementHandler["Input"]["end"] = ""; -$elementHandler["Input"]["start"] = ""; -$elementHandler["Line"]["start"] = "LineSHandler"; -$elementHandler["List"]["end"] = "ListEHandler"; -$elementHandler["List"]["start"] = "ListSHandler"; -$elementHandler["ListTotal"]["start"] = "ListTotalSHandler"; -$elementHandler["NewPage"]["start"] = "NewPageSHandler"; -$elementHandler["Now"]["start"] = "NowSHandler"; -$elementHandler["PageHeader"]["end"] = "PageHeaderEHandler"; -$elementHandler["PageHeader"]["start"] = "PageHeaderSHandler"; -$elementHandler["PageNum"]["start"] = "PageNumSHandler"; -$elementHandler["Relatives"]["end"] = "RelativesEHandler"; -$elementHandler["Relatives"]["start"] = "RelativesSHandler"; -$elementHandler["RepeatTag"]["end"] = "RepeatTagEHandler"; -$elementHandler["RepeatTag"]["start"] = "RepeatTagSHandler"; -$elementHandler["SetVar"]["start"] = "SetVarSHandler"; -$elementHandler["Style"]["start"] = "StyleSHandler"; -$elementHandler["Text"]["end"] = "TextEHandler"; -$elementHandler["Text"]["start"] = "TextSHandler"; -$elementHandler["TextBox"]["end"] = "TextBoxEHandler"; -$elementHandler["TextBox"]["start"] = "TextBoxSHandler"; -$elementHandler["Title"]["end"] = "TitleEHandler"; -$elementHandler["Title"]["start"] = "TitleSHandler"; -$elementHandler["TotalPages"]["start"] = "TotalPagesSHandler"; -$elementHandler["var"]["start"] = "varSHandler"; -$elementHandler["varLetter"]["start"] = "varLetterSHandler"; -$elementHandler["sp"]["start"] = "spSHandler"; +$elementHandler["br"]["start"] = "brSHandler"; +$elementHandler["Body"]["start"] = "BodySHandler"; +$elementHandler["Cell"]["end"] = "CellEHandler"; +$elementHandler["Cell"]["start"] = "CellSHandler"; +$elementHandler["Description"]["end"] = "DescriptionEHandler"; +$elementHandler["Description"]["start"] = "DescriptionSHandler"; +$elementHandler["Doc"]["end"] = "DocEHandler"; +$elementHandler["Doc"]["start"] = "DocSHandler"; +$elementHandler["Report"]["end"] = ""; +$elementHandler["Report"]["start"] = ""; +$elementHandler["Facts"]["end"] = "FactsEHandler"; +$elementHandler["Facts"]["start"] = "FactsSHandler"; +$elementHandler["Footer"]["start"] = "FooterSHandler"; +$elementHandler["Footnote"]["end"] = "FootnoteEHandler"; +$elementHandler["Footnote"]["start"] = "FootnoteSHandler"; +$elementHandler["FootnoteTexts"]["start"] = "FootnoteTextsSHandler"; +$elementHandler["Gedcom"]["end"] = "GedcomEHandler"; +$elementHandler["Gedcom"]["start"] = "GedcomSHandler"; +$elementHandler["GedcomValue"]["start"] = "GedcomValueSHandler"; +$elementHandler["Generation"]["start"] = "GenerationSHandler"; +$elementHandler["GetPersonName"]["start"] = "GetPersonNameSHandler"; +$elementHandler["Header"]["start"] = "HeaderSHandler"; +$elementHandler["HighlightedImage"]["start"] = "HighlightedImageSHandler"; +$elementHandler["if"]["end"] = "ifEHandler"; +$elementHandler["if"]["start"] = "ifSHandler"; +$elementHandler["Image"]["start"] = "ImageSHandler"; +$elementHandler["Input"]["end"] = ""; +$elementHandler["Input"]["start"] = ""; +$elementHandler["Line"]["start"] = "LineSHandler"; +$elementHandler["List"]["end"] = "ListEHandler"; +$elementHandler["List"]["start"] = "ListSHandler"; +$elementHandler["ListTotal"]["start"] = "ListTotalSHandler"; +$elementHandler["NewPage"]["start"] = "NewPageSHandler"; +$elementHandler["Now"]["start"] = "NowSHandler"; +$elementHandler["PageHeader"]["end"] = "PageHeaderEHandler"; +$elementHandler["PageHeader"]["start"] = "PageHeaderSHandler"; +$elementHandler["PageNum"]["start"] = "PageNumSHandler"; +$elementHandler["Relatives"]["end"] = "RelativesEHandler"; +$elementHandler["Relatives"]["start"] = "RelativesSHandler"; +$elementHandler["RepeatTag"]["end"] = "RepeatTagEHandler"; +$elementHandler["RepeatTag"]["start"] = "RepeatTagSHandler"; +$elementHandler["SetVar"]["start"] = "SetVarSHandler"; +$elementHandler["Style"]["start"] = "StyleSHandler"; +$elementHandler["Text"]["end"] = "TextEHandler"; +$elementHandler["Text"]["start"] = "TextSHandler"; +$elementHandler["TextBox"]["end"] = "TextBoxEHandler"; +$elementHandler["TextBox"]["start"] = "TextBoxSHandler"; +$elementHandler["Title"]["end"] = "TitleEHandler"; +$elementHandler["Title"]["start"] = "TitleSHandler"; +$elementHandler["TotalPages"]["start"] = "TotalPagesSHandler"; +$elementHandler["var"]["start"] = "varSHandler"; +$elementHandler["varLetter"]["start"] = "varLetterSHandler"; +$elementHandler["sp"]["start"] = "spSHandler"; /** * A new object of the currently used element class @@ -1484,7 +1484,6 @@ function endElement($parser, $name) { */ function characterData($parser, $data) { global $printData, $currentElement, $processGedcoms, $processIfs, $processRepeats, $reportTitle, $wt_report, $reportDescription; -// global $processFootnote; if ($printData && ($processGedcoms==0) && ($processIfs==0)&&($processRepeats==0)) { $currentElement->addText($data); @@ -1523,7 +1522,7 @@ function StyleSHandler($attrs) { // int The size of the font in points $s["size"] = $wt_report->defaultFontSize; - if (!empty($attrs["size"])) $s["size"] = (int)$attrs["size"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + if (!empty($attrs["size"])) $s["size"] = (int)$attrs["size"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) // string B: bold, I: italic, U: underline, D: line trough, The default value is regular. $s["style"] = ""; @@ -1547,50 +1546,50 @@ function DocSHandler($attrs) { $parser = $xml_parser; // Custom page width - if (!empty($attrs["customwidth"])) $wt_report->pagew = (int)$attrs["customwidth"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + if (!empty($attrs["customwidth"])) $wt_report->pagew = (int)$attrs["customwidth"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) // Custom Page height - if (!empty($attrs["customheight"])) $wt_report->pageh = (int)$attrs["customheight"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + if (!empty($attrs["customheight"])) $wt_report->pageh = (int)$attrs["customheight"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) // Left Margin if (isset($attrs["leftmargin"])) { if ($attrs["leftmargin"] === "0") $wt_report->leftmargin = 0; elseif (!empty($attrs["leftmargin"])) { - $wt_report->leftmargin = (int)$attrs["leftmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->leftmargin = (int)$attrs["leftmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } // Right Margin if (isset($attrs["rightmargin"])) { if ($attrs["rightmargin"] === "0") $wt_report->rightmargin = 0; elseif (!empty($attrs["rightmargin"])) { - $wt_report->rightmargin = (int)$attrs["rightmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->rightmargin = (int)$attrs["rightmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } // Top Margin if (isset($attrs["topmargin"])) { if ($attrs["topmargin"] === "0") $wt_report->topmargin = 0; elseif (!empty($attrs["topmargin"])) { - $wt_report->topmargin = (int)$attrs["topmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->topmargin = (int)$attrs["topmargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } // Bottom Margin if (isset($attrs["bottommargin"])) { if ($attrs["bottommargin"] === "0") $wt_report->bottommargin = 0; elseif (!empty($attrs["bottommargin"])) { - $wt_report->bottommargin = (int)$attrs["bottommargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->bottommargin = (int)$attrs["bottommargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } // Header Margin if (isset($attrs["headermargin"])) { if ($attrs["headermargin"] === "0") $wt_report->headermargin = 0; elseif (!empty($attrs["headermargin"])) { - $wt_report->headermargin = (int)$attrs["headermargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->headermargin = (int)$attrs["headermargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } // Footer Margin if (isset($attrs["footermargin"])) { if ($attrs["footermargin"] === "0") $wt_report->footermargin = 0; elseif (!empty($attrs["footermargin"])) { - $wt_report->footermargin = (int)$attrs["footermargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) + $wt_report->footermargin = (int)$attrs["footermargin"]; // Get it as int to ignore all decimal points or text (if any text then int(0)) } } @@ -1729,7 +1728,7 @@ function CellSHandler($attrs) { } $reseth = true; - // boolean if true reset the last cell height (default true) + // boolean if true reset the last cell height (default true) if (isset($attrs["reseth"])) { if ($attrs["reseth"] === "0") { $reseth = false; @@ -1742,7 +1741,7 @@ function CellSHandler($attrs) { $border = 0; if (!empty($attrs["border"])) $border = $attrs["border"]; // @test Print all borders for testing -// $border = 1; + // $border = 1; // string Border color in HTML code $bocolor = ""; if (!empty($attrs["bocolor"])) $bocolor = $attrs["bocolor"]; @@ -1987,7 +1986,7 @@ function TextBoxSHandler($attrs) { } } // @test Print all borders for testing -// $border = true; + // $border = true; /** * Border style of rectangle. Array with keys among the following @@ -2068,7 +2067,7 @@ function TextBoxSHandler($attrs) { // string Style of rendering $style = ""; // fill and border is enought for now for user input -// if (!empty($attrs["style"])) $style = $attrs["style"]; + //if (!empty($attrs["style"])) $style = $attrs["style"]; array_push($printDataStack, $printData); $printData = false; @@ -2276,7 +2275,6 @@ function GedcomValueSHandler($attrs) { */ function RepeatTagSHandler($attrs) { // @deprecated -// global $repeats, $repeatsStack, $gedrec, $repeatBytes, $parser, $parserStack, $processRepeats, $fact, $desc; global $repeats, $repeatsStack, $gedrec, $repeatBytes, $parser, $processRepeats, $fact, $desc; $processRepeats++; @@ -2360,8 +2358,8 @@ function RepeatTagEHandler() { if (count($repeats)>0) { // No need to load them if not used... global $parser, $parserStack, $report, $gedrec; -// @deprecated -// $line = xml_get_current_line_number($parser)-1; + // @deprecated + //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; foreach($repeatsStack as $rep) { $lineoffset += $rep[1]; @@ -2393,7 +2391,7 @@ function RepeatTagEHandler() { // Save original values array_push($parserStack, $parser); $oldgedrec = $gedrec; -// PHP 5.2.3 has a bug with foreach(), so don't use that here, while 5.2.3 is on the market + // PHP 5.2.3 has a bug with foreach(), so don't use that here, while 5.2.3 is on the market // while() has the fastest execution speed $count = count($repeats); $i = 0; @@ -2430,9 +2428,9 @@ function RepeatTagEHandler() { * Variable lookup * * Retrieve predefined variables : -* @ desc GEDCOM fact description, example: -* 1 EVEN This is a description -* @ fact GEDCOM fact tag, such as BIRT, DEAT etc. +* @ desc GEDCOM fact description, example: +* 1 EVEN This is a description +* @ fact GEDCOM fact tag, such as BIRT, DEAT etc. * $ i18n::translate('....') * $ language_settings[] * @@ -2509,7 +2507,6 @@ function varLetterSHandler($attrs) { */ function FactsSHandler($attrs) { // @deprecated -// global $repeats, $repeatsStack, $gedrec, $parser, $parserStack, $repeatBytes, $processRepeats, $vars; global $repeats, $repeatsStack, $gedrec, $parser, $repeatBytes, $processRepeats, $vars; $processRepeats++; @@ -2850,7 +2847,6 @@ function FootnoteSHandler($attrs) { */ function FootnoteEHandler() { // @deprecated -// global $printData, $printDataStack, $currentElement, $footnoteElement, $processFootnote, $gedrec, $wt_report; global $printData, $printDataStack, $currentElement, $footnoteElement, $processFootnote, $wt_report; if ($processFootnote) { @@ -3478,7 +3474,7 @@ function ListEHandler() { // Check if there is any list if (count($list) > 0) { // @deprecated -// $line = xml_get_current_line_number($parser)-1; + //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; foreach($repeatsStack as $rep) { $lineoffset += $rep[1]; @@ -3719,7 +3715,7 @@ function RelativesEHandler() { if (count($list) > 0) { // @deprecated -// $line = xml_get_current_line_number($parser)-1; + //$line = xml_get_current_line_number($parser)-1; $lineoffset = 0; foreach($repeatsStack as $rep) { $lineoffset += $rep[1]; diff --git a/includes/functions/functions.php b/includes/functions/functions.php index ec3c536b98..4180432fdd 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -297,7 +297,7 @@ function load_gedcom_settings($ged_id=WT_GED_ID) { } else { $person_privacy[$row->xref]=(int)$row->resn; } - } else { + } else { $global_facts[$row->tag_type]=(int)$row->resn; } } @@ -519,11 +519,11 @@ function get_all_subrecords($gedrec, $ignore="", $families=true, $ApplyPriv=true * get gedcom tag value * * returns the value of a gedcom tag from the given gedcom record - * @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 - * @param int $truncate Should the value be truncated to a certain number of characters - * @param boolean $convert Should data like dates be converted using the configuration settings + * @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 + * @param int $truncate Should the value be truncated to a certain number of characters + * @param boolean $convert Should data like dates be converted using the configuration settings * @return string */ function get_gedcom_value($tag, $level, $gedrec, $truncate='', $convert=true) { @@ -625,7 +625,7 @@ function get_gedcom_value($tag, $level, $gedrec, $truncate='', $convert=true) { if (utf8_strlen($value)>$truncate) { $value = preg_replace("/\(.+\)/", "", $value); //if (utf8_strlen($value)>$truncate) { - // $value = preg_replace_callback("/([a-zśź]+)/ui", create_function('$matches', 'return utf8_substr($matches[1], 0, 3);'), $value); + //$value = preg_replace_callback("/([a-zśź]+)/ui", create_function('$matches', 'return utf8_substr($matches[1], 0, 3);'), $value); //} } } @@ -702,8 +702,8 @@ function get_gedcom_value($tag, $level, $gedrec, $truncate='', $convert=true) { * word wrapped Notes option. Routine also avoids splitting UTF-8 encoded * characters between lines. * - * @param string $newline Input GEDCOM subrecord to be worked on - * @return string $newged Output string with all necessary CONC and CONT lines + * @param string $newline Input GEDCOM subrecord to be worked on + * @return string $newged Output string with all necessary CONC and CONT lines */ function breakConts($newline) { global $WORD_WRAPPED_NOTES; @@ -813,7 +813,7 @@ function find_parents_in_record($famrec) { * find and return an array containing the children of the given family record * @author John Finlay (yalnifj) * @param string $famid the gedcom xref id for the family - * @param string $me an xref id of a child to ignore, useful when you want to get a person's + * @param string $me an xref id of a child to ignore, useful when you want to get a person's * siblings but do want to include them as well * @return array */ @@ -831,7 +831,7 @@ function find_children($famid, $me='') { * find and return an array containing the children of the given family record * @author John Finlay (yalnifj) * @param string $famrec the gedcom record of the family to search in - * @param string $me an xref id of a child to ignore, useful when you want to get a person's + * @param string $me an xref id of a child to ignore, useful when you want to get a person's * siblings but do want to include them as well * @return array */ @@ -882,7 +882,7 @@ function find_sfamily_ids($pid) { * * searches an individual gedcom record and returns an array of the FAMS|C ids * @param string $indirec the gedcom record for the person to look in - * @param string $tag The family tag to look for + * @param string $tag The family tag to look for * @return array array of family ids */ function find_families_in_record($indirec, $tag) { @@ -895,7 +895,7 @@ function find_families_in_record($indirec, $tag) { * * searches an individual gedcom record and returns an array of the FAMS|C ids that are visible * @param string $indirec the gedcom record for the person to look in - * @param string $tag The family tag to look for, FAMS or FAMC + * @param string $tag The family tag to look for, FAMS or FAMC * @return array array of family ids */ function find_visible_families_in_record($indirec, $tag) { @@ -975,7 +975,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { $prim = get_gedcom_value('_PRIM', 1, $row[2]); } - if ($prim=='N') continue; // Skip _PRIM N objects + if ($prim=='N') continue; // Skip _PRIM N objects $file = check_media_depth($row[1]); $thumb = thumbnail_file($row[1], true, false, $pid); if ($level == 1) { @@ -983,7 +983,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { if (empty($objectA)) { $objectA['file'] = $file; $objectA['thumb'] = $thumb; - $objectA['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option + $objectA['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option $objectA['level'] = $level; $objectA['mid'] = $row[0]; } @@ -991,7 +991,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { if (empty($objectB)) { $objectB['file'] = $file; $objectB['thumb'] = $thumb; - $objectB['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option + $objectB['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option $objectB['level'] = $level; $objectB['mid'] = $row[0]; } @@ -1001,7 +1001,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { if (empty($objectC)) { $objectC['file'] = $file; $objectC['thumb'] = $thumb; - $objectC['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option + $objectC['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option $objectC['level'] = $level; $objectC['mid'] = $row[0]; } @@ -1009,7 +1009,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { if (empty($objectD)) { $objectD['file'] = $file; $objectD['thumb'] = $thumb; - $objectD['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option + $objectD['_THUM'] = $thum; // This overrides GEDCOM's "Use main image as thumbnail" option $objectD['level'] = $level; $objectD['mid'] = $row[0]; } @@ -1021,7 +1021,7 @@ function find_highlighted_object($pid, $ged_id, $indirec) { if (!empty($objectA)) return $objectA; if (!empty($objectB)) return $objectB; if (!empty($objectC)) return $objectC; -// if (!empty($objectD)) return $objectD; + //if (!empty($objectD)) return $objectD; return array(); } @@ -1192,7 +1192,7 @@ function mediasort($a, $b) { } } } - return utf8_strcasecmp($aKey, $bKey, true); // Case-insensitive compare + return utf8_strcasecmp($aKey, $bKey, true); // Case-insensitive compare } /** * sort an array according to the file name @@ -1213,7 +1213,7 @@ function filesort($a, $b) { } else if (!empty($b["file"])) { $bKey = basename($b["file"]); } - return utf8_strcasecmp($aKey, $bKey, true); // Case-insensitive compare + return utf8_strcasecmp($aKey, $bKey, true); // Case-insensitive compare } // Helper function to sort facts. @@ -1974,7 +1974,7 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 'chichi': return i18n::translate_c('child\'s child', 'grandchild'); case 'chidau': return i18n::translate_c('child\'s daughter', 'granddaughter'); case 'chihus': return i18n::translate_c('child\'s husband', 'son-in-law'); - case 'chison': return i18n::translate_c('child\'s son', 'grandson'); + case 'chison': return i18n::translate_c('child\'s son', 'grandson'); case 'chispo': return i18n::translate_c('child\'s spouse', 'son/daughter-in-law'); case 'chiwif': return i18n::translate_c('child\'s wife', 'daughter-in-law'); case 'dauchi': return i18n::translate_c('daughter\'s child', 'grandchild'); @@ -2275,7 +2275,7 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 'parparsishus': return i18n::translate_c('parent\'s parent\'s sister\'s husband', 'great-uncle'); case 'fatfatbrodau': return i18n::translate_c('father\'s father\'s brother\'s daughter','first cousin once removed ascending'); case 'fatfatbroson': return i18n::translate_c('father\'s father\'s brother\'s son', 'first cousin once removed ascending'); - case 'fatfatbrochi': return i18n::translate_c('father\'s father\'s brother\'s child', 'first cousin once removed ascending'); + case 'fatfatbrochi': return i18n::translate_c('father\'s father\'s brother\'s child', 'first cousin once removed ascending'); case 'fatfatsisdau': return i18n::translate_c('father\'s father\'s sister\'s daughter', 'first cousin once removed ascending'); case 'fatfatsisson': return i18n::translate_c('father\'s father\'s sister\'s son', 'first cousin once removed ascending'); case 'fatfatsischi': return i18n::translate_c('father\'s father\'s sister\'s child', 'first cousin once removed ascending'); @@ -2371,9 +2371,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 3: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great-grandfather\'s brother', 'great-great-uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great-grandmother\'s brother', 'great-great-uncle'); - else return i18n::translate_c('great-grandparent\'s brother', 'great-great-uncle'); + if ($bef_last=='fat') return i18n::translate_c('great-grandfather\'s brother', 'great-great-uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great-grandmother\'s brother', 'great-great-uncle'); + else return i18n::translate_c('great-grandparent\'s brother', 'great-great-uncle'); case 'sis': return i18n::translate('great-great-aunt'); case 'sib': return i18n::translate('great-great-aunt/uncle'); } @@ -2381,9 +2381,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 4: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great-great-grandfather\'s brother', 'great-great-great-uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great-great-grandmother\'s brother', 'great-great-great-uncle'); - else return i18n::translate_c('great-great-grandparent\'s brother', 'great-great-great-uncle'); + if ($bef_last=='fat') return i18n::translate_c('great-great-grandfather\'s brother', 'great-great-great-uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great-great-grandmother\'s brother', 'great-great-great-uncle'); + else return i18n::translate_c('great-great-grandparent\'s brother', 'great-great-great-uncle'); case 'sis': return i18n::translate('great-great-great-aunt'); case 'sib': return i18n::translate('great-great-great-aunt/uncle'); } @@ -2391,9 +2391,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 5: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great-great-great-grandfather\'s brother', 'great x4 uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great-great-great-grandmother\'s brother', 'great x4 uncle'); - else return i18n::translate_c('great-great-great-grandparent\'s brother', 'great x4 uncle'); + if ($bef_last=='fat') return i18n::translate_c('great-great-great-grandfather\'s brother', 'great x4 uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great-great-great-grandmother\'s brother', 'great x4 uncle'); + else return i18n::translate_c('great-great-great-grandparent\'s brother', 'great x4 uncle'); case 'sis': return i18n::translate('great x4 aunt'); case 'sib': return i18n::translate('great x4 aunt/uncle'); } @@ -2401,9 +2401,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 6: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great x4 grandfather\'s brother', 'great x5 uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great x4 grandmother\'s brother', 'great x5 uncle'); - else return i18n::translate_c('great x4 grandparent\'s brother', 'great x5 uncle'); + if ($bef_last=='fat') return i18n::translate_c('great x4 grandfather\'s brother', 'great x5 uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great x4 grandmother\'s brother', 'great x5 uncle'); + else return i18n::translate_c('great x4 grandparent\'s brother', 'great x5 uncle'); case 'sis': return i18n::translate('great x5 aunt'); case 'sib': return i18n::translate('great x5 aunt/uncle'); } @@ -2411,9 +2411,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 7: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great x5 grandfather\'s brother', 'great x6 uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great x5 grandmother\'s brother', 'great x6 uncle'); - else return i18n::translate_c('great x5 grandparent\'s brother', 'great x6 uncle'); + if ($bef_last=='fat') return i18n::translate_c('great x5 grandfather\'s brother', 'great x6 uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great x5 grandmother\'s brother', 'great x6 uncle'); + else return i18n::translate_c('great x5 grandparent\'s brother', 'great x6 uncle'); case 'sis': return i18n::translate('great x6 aunt'); case 'sib': return i18n::translate('great x6 aunt/uncle'); } @@ -2421,9 +2421,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 8: switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great x6 grandfather\'s brother', 'great x7 uncle'); - else if ($bef_last=='mot') return i18n::translate_c('great x6 grandmother\'s brother', 'great x7 uncle'); - else return i18n::translate_c('great x6 grandparent\'s brother', 'great x7 uncle'); + if ($bef_last=='fat') return i18n::translate_c('great x6 grandfather\'s brother', 'great x7 uncle'); + else if ($bef_last=='mot') return i18n::translate_c('great x6 grandmother\'s brother', 'great x7 uncle'); + else return i18n::translate_c('great x6 grandparent\'s brother', 'great x7 uncle'); case 'sis': return i18n::translate('great x7 aunt'); case 'sib': return i18n::translate('great x7 aunt/uncle'); } @@ -2443,9 +2443,9 @@ function get_relationship_name_from_path($path, $pid1, $pid2) { case 'pl': switch ($last) { case 'bro': - if ($bef_last=='fat') return i18n::translate_c('great x(%d-1) grandfather\'s brother', 'great x%d uncle', $up-2); - else if ($bef_last=='mot') return i18n::translate_c('great x(%d-1) grandmother\'s brother', 'great x%d uncle', $up-2); - else return i18n::translate_c('great x(%d-1) grandparent\'s brother', 'great x%d uncle', $up-2); + if ($bef_last=='fat') return i18n::translate_c('great x(%d-1) grandfather\'s brother', 'great x%d uncle', $up-2); + else if ($bef_last=='mot') return i18n::translate_c('great x(%d-1) grandmother\'s brother', 'great x%d uncle', $up-2); + else return i18n::translate_c('great x(%d-1) grandparent\'s brother', 'great x%d uncle', $up-2); case 'sis': return i18n::translate('great x%d aunt', $up-2); case 'sib': return i18n::translate('great x%d aunt/uncle', $up-2); } @@ -3111,7 +3111,7 @@ function get_query_string() { } } } - $qstring = rtrim($qstring, "&"); // Remove trailing "&" + $qstring = rtrim($qstring, "&"); // Remove trailing "&" return encode_url($qstring); } @@ -3244,7 +3244,7 @@ function add_descendancy(&$list, $pid, $parents=false, $generations=-1) { } if ($generations == -1 || $list[$pid]->generation+1 < $generations) { foreach($children as $child) { - add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family + add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family } } } @@ -3255,7 +3255,7 @@ function add_descendancy(&$list, $pid, $parents=false, $generations=-1) { /** * get the next available xref * calculates the next available XREF id for the given type of record - * @param string $type the type of record, defaults to 'INDI' + * @param string $type the type of record, defaults to 'INDI' * @return string */ function get_new_xref($type='INDI', $ged_id=WT_GED_ID) { @@ -3368,7 +3368,7 @@ function mediaFileInfo($fileName, $thumbName, $mid, $name='', $notes='', $obeyVi $result['type'] = $type; // -- Determine the correct URL to open this media file - while (true) { + while (true) { if (WT_USE_LIGHTBOX) { // Lightbox is installed require_once WT_ROOT.'modules/lightbox/lb_defaultconfig.php'; @@ -3548,8 +3548,8 @@ function pathinfo_utf($path) { $basename=end($tmp); $dirname=substr($path, 0, strlen($path) - strlen($basename) - 1); } else { - $basename=$path; // We have just a file name - $dirname='.'; // For compatibility with pathinfo() + $basename=$path; // We have just a file name + $dirname='.'; // For compatibility with pathinfo() } if (strpos($basename, '.')!==false) { diff --git a/includes/functions/functions_charts.php b/includes/functions/functions_charts.php index 9549e9bcc9..1e628c0acc 100644 --- a/includes/functions/functions_charts.php +++ b/includes/functions/functions_charts.php @@ -66,11 +66,10 @@ function print_sosa_number($sosa, $pid = "", $arrowDirection = "up") { } elseif ($arrowDirection== "down") { $dir = 3; } else { - $dir = 2; // either "blank" or "up" + $dir = 2; // either "blank" or "up" } echo "<br />"; print_url_arrow($pid, "#$pid", "$pid", $dir); -// print " "; } echo "</td>"; } @@ -376,8 +375,8 @@ function print_family_children($famid, $childid = "", $sosa = 0, $label="", $per } print "<td class=\"details1\" valign=\"middle\" align=\"center\">"; $famrec = find_family_record($famid, $ged_id); - $marrec = get_sub_record(1, "1 MARR", $famrec); - $divrec = get_sub_record(1, "1 DIV", $famrec); + $marrec = get_sub_record(1, "1 MARR", $famrec); + $divrec = get_sub_record(1, "1 DIV", $famrec); if (canDisplayFact($famid, $ged_id, $marrec)) { // marriage date $ct = preg_match("/2 DATE.*(\d\d\d\d)/", $marrec, $match); @@ -441,7 +440,7 @@ function print_family_children($famid, $childid = "", $sosa = 0, $label="", $per if ($ct>0) $nchi = $match[1]; } if ($nchi=="0") print "<img src=\"images/small/childless.gif\" alt=\"".i18n::translate('This family remained childless')."\" title=\"".i18n::translate('This family remained childless')."\" /> ".i18n::translate('This family remained childless'); -// else print i18n::translate('No children'); + //else print i18n::translate('No children'); print "</td></tr>"; } else { @@ -470,7 +469,7 @@ function print_family_facts(&$family, $sosa = 0) { $famid=$family->getXref(); // -- if both parents are displayable then print the marriage facts if ($family->canDisplayDetails()) { - $linkToID = $famid; // -- Tell addmedia.php what to link to + $linkToID = $famid; // -- Tell addmedia.php what to link to // -- array of GEDCOM elements that will be found but should not be displayed $nonfacts = array("FAMS", "FAMC", "MAY", "BLOB", "HUSB", "WIFE", "CHIL", ""); @@ -679,7 +678,7 @@ function print_url_arrow($id, $url, $label, $dir=2) { if ($TEXT_DIRECTION=="rtl" and $dir==0) $adir=1; if ($TEXT_DIRECTION=="rtl" and $dir==1) $adir=0; - // arrow style 0 1 2 3 + // arrow style 0 1 2 3 $array_style=array("larrow", "rarrow", "uarrow", "darrow"); $astyle=$array_style[$adir]; diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php index 183e98b760..16a984f6f7 100644 --- a/includes/functions/functions_db.php +++ b/includes/functions/functions_db.php @@ -858,8 +858,8 @@ function find_gedcom_record($xref, $ged_id, $pending=false) { /** * find and return an updated gedcom record - * @param string $gid the id of the record to find - * @param string $gedfile the gedcom file to get the record from.. defaults to currently active gedcom + * @param string $gid the id of the record to find + * @param string $gedfile the gedcom file to get the record from.. defaults to currently active gedcom */ function find_updated_record($xref, $ged_id) { static $statement=null; @@ -1660,8 +1660,8 @@ function delete_gedcom($ged_id) { /** * get the top surnames -* @param int $ged_id fetch surnames from this gedcom -* @param int $min only fetch surnames occuring this many times +* @param int $ged_id fetch surnames from this gedcom +* @param int $min only fetch surnames occuring this many times * @param int $max only fetch this number of surnames (0=all) * @return array */ @@ -2497,4 +2497,3 @@ function update_favorites($xref_from, $xref_to, $ged_id=WT_GED_ID) { ->execute(array($xref_to, $xref_from, $ged_name)) ->rowCount(); } - diff --git a/includes/functions/functions_edit.php b/includes/functions/functions_edit.php index 38e782fb52..5f94cff2a7 100644 --- a/includes/functions/functions_edit.php +++ b/includes/functions/functions_edit.php @@ -93,7 +93,7 @@ function edit_field_yes_no($name, $selected=false, $extra='') { $name, array(false=>i18n::translate('no'),true=>i18n::translate('yes')), $selected, $extra ); //return select_edit_control( - // $name, array(true=>i18n::translate('yes'), false=>i18n::translate('no')), null, $selected, $extra + //$name, array(true=>i18n::translate('yes'), false=>i18n::translate('no')), null, $selected, $extra //); } @@ -779,7 +779,7 @@ function print_indi_form($nextaction, $famid, $linenum='', $namerec='', $famtag= add_simple_tag("0 SEX M"); } elseif ($famtag=="WIFE" || $sextag=="F") { add_simple_tag("0 SEX F"); - } else { + } else { add_simple_tag("0 SEX"); } $bdm = "BD"; @@ -1348,8 +1348,8 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= echo translate_fact('SHARED_NOTE'); /* if (file_exists(WT_ROOT.'modules/GEDFact_assistant/_CENS/census_1_ctrl.php') && $pid && $label=="GEDFact Assistant") { - // use $label (GEDFact Assistant); - }else{ + // use $label (GEDFact Assistant); + } else { echo i18n::translate('Shared note'); } */ @@ -1442,7 +1442,7 @@ function add_simple_tag($tag, $upperlevel='', $label='', $readOnly='', $noClose= } else if ($fact=="TEMP") { echo select_edit_control($element_name, $TEMPLE_CODES, i18n::translate('No Temple - Living Ordinance'), $value); - } else if ($fact=="ADOP") { + } else if ($fact=="ADOP") { switch ($gender) { case 'M': echo edit_field_adop_m($element_name, $value); break; case 'F': echo edit_field_adop_f($element_name, $value); break; @@ -2378,11 +2378,6 @@ function create_edit_form($gedrec, $linenum, $level0type) { $i++; } - // Shared Note ------------- - //if (eregi("/@N.*@/i", $type)) { - // $type="note"; - //} - if ($type=="SOUR") { $inSource = true; $levelSource = $level; diff --git a/includes/functions/functions_export.php b/includes/functions/functions_export.php index 7b3bf376bc..2c53974747 100644 --- a/includes/functions/functions_export.php +++ b/includes/functions/functions_export.php @@ -189,10 +189,10 @@ function createTempUser($userID, $rights, $gedcom) { AddToLog("created dummy user -> {$userID} <- with level {$rights} to GEDCOM {$gedcom}", 'auth'); // Save things in cache - $_SESSION["pgv_GED_ID"] = $ged_id; - $_SESSION["pgv_USER_ID"] = $userID; - $_SESSION["pgv_USER_ACCESS_LEVEL"] = getUserAccessLevel($_SESSION["pgv_USER_ID"], $_SESSION["pgv_GED_ID"]); - $_SESSION["pgv_USER_GEDCOM_ID"] = get_user_gedcom_setting($_SESSION["pgv_USER_ID"], $_SESSION["pgv_GED_ID"], 'gedcomid'); + $_SESSION["pgv_GED_ID"] =$ged_id; + $_SESSION["pgv_USER_ID"] =$userID; + $_SESSION["pgv_USER_ACCESS_LEVEL"]=getUserAccessLevel($_SESSION["pgv_USER_ID"], $_SESSION["pgv_GED_ID"]); + $_SESSION["pgv_USER_GEDCOM_ID"] =get_user_gedcom_setting($_SESSION["pgv_USER_ID"], $_SESSION["pgv_GED_ID"], 'gedcomid'); return $tempUserID; } @@ -200,8 +200,8 @@ function createTempUser($userID, $rights, $gedcom) { /** * remove any custom webtrees tags from the given gedcom record * custom tags include _WT_USER and _THUM - * @param string $gedrec the raw gedcom record - * @return string the updated gedcom record + * @param string $gedrec the raw gedcom record + * @return string the updated gedcom record */ function remove_custom_tags($gedrec, $remove="no") { if ($remove=="yes") { @@ -219,15 +219,15 @@ function remove_custom_tags($gedrec, $remove="no") { /** * Convert media path by: - * - removing current media directory - * - adding a new prefix - * - making directory name separators consistent + * - removing current media directory + * - adding a new prefix + * - making directory name separators consistent */ function convert_media_path($rec, $path, $slashes) { global $MEDIA_DIRECTORY; $file = get_gedcom_value("FILE", 1, $rec); - if (preg_match("~^https?://~i", $file)) return $rec; // don't modify URLs + if (preg_match("~^https?://~i", $file)) return $rec; // don't modify URLs $rec = str_replace('FILE '.$MEDIA_DIRECTORY, 'FILE '.trim($path).'/', $rec); $rec = str_replace('\\', '/', $rec); @@ -237,17 +237,17 @@ function convert_media_path($rec, $path, $slashes) { } /* - * Export the database in GEDCOM format + * Export the database in GEDCOM format * * input parameters: - * $gedcom: GEDCOM to be exported - * $gedout: Handle of output file - * $exportOptions: array of options for this Export operation as follows: - * 'privatize': which Privacy rules apply? (none, visitor, user, GEDCOM admin, site admin) - * 'toANSI': should the output be produced in ANSI instead of UTF-8? (yes, no) - * 'noCustomTags': should custom tags be removed? (yes, no) - * 'path': what constant should prefix all media file paths? (eg: media/ or c:\my pictures\my family - * 'slashes': what folder separators apply to media file paths? (forward, backward) + * $gedcom: GEDCOM to be exported + * $gedout: Handle of output file + * $exportOptions: array of options for this Export operation as follows: + * 'privatize': which Privacy rules apply? (none, visitor, user, GEDCOM admin, site admin) + * 'toANSI': should the output be produced in ANSI instead of UTF-8? (yes, no) + * 'noCustomTags': should custom tags be removed? (yes, no) + * 'path': what constant should prefix all media file paths? (eg: media/ or c:\my pictures\my family + * 'slashes': what folder separators apply to media file paths? (forward, backward) */ function export_gedcom($gedcom, $gedout, $exportOptions) { global $GEDCOM; @@ -260,7 +260,7 @@ function export_gedcom($gedcom, $gedout, $exportOptions) { $tempUserID = '#ExPoRt#'; if ($exportOptions['privatize']!='none') { // Create a temporary userid - $export_user_id = createTempUser($tempUserID, $exportOptions['privatize'], $gedcom); // Create a temporary userid + $export_user_id = createTempUser($tempUserID, $exportOptions['privatize'], $gedcom); // Create a temporary userid // Temporarily become this user $_SESSION["org_user"]=$_SESSION["wt_user"]; diff --git a/includes/functions/functions_media_reorder.php b/includes/functions/functions_media_reorder.php index fe0fc4c75f..e352b2643b 100644 --- a/includes/functions/functions_media_reorder.php +++ b/includes/functions/functions_media_reorder.php @@ -118,7 +118,7 @@ function media_reorder_row($rtype, $rowm, $pid) { print " " . $mediaType; print "</b>"; - print "<br>" . "\n"; + print "<br>" . "\n"; print $mediaTitle . "\n"; print "</td>" . "\n"; @@ -132,9 +132,7 @@ function media_reorder_row($rtype, $rowm, $pid) { $media_data = $rowm['m_media']; echo "<input type=\"hidden\" name=\"order1[", $media_data, "]\" value=\"", $j, "\" />"; - echo "</li>"; - echo "\n\n"; - return true; - + echo "</li>"; + echo "\n\n"; + return true; } -?> diff --git a/includes/functions/functions_mediadb.php b/includes/functions/functions_mediadb.php index fa4f906d7a..e7abbbd271 100644 --- a/includes/functions/functions_mediadb.php +++ b/includes/functions/functions_mediadb.php @@ -1319,12 +1319,12 @@ function show_media_form($pid, $action = "newentry", $filename = "", $linktoid = // 3 TYPE if ($gedrec == "") - $gedtype = "TYPE photo"; // default to "Photo" unless told otherwise + $gedtype = "TYPE photo"; // default to "Photo" unless told otherwise else { $temp = str_replace("\r\n", "\n", $gedrec) . "\n"; $types = preg_match("/3 TYPE(.*)\n/", $temp, $matches); if (empty($matches[0])) - $gedtype = "TYPE photo"; // default to "Photo" unless told otherwise + $gedtype = "TYPE photo"; // default to "Photo" unless told otherwise else $gedtype = "TYPE " . trim($matches[1]); } @@ -1367,7 +1367,7 @@ function show_media_form($pid, $action = "newentry", $filename = "", $linktoid = } //-- don't show _PRIM option to regular users -// if (WT_USER_GEDCOM_ADMIN) { + //if (WT_USER_GEDCOM_ADMIN) { // 2 _PRIM if ($gedrec == "") $gedprim = "_PRIM"; @@ -1378,10 +1378,10 @@ function show_media_form($pid, $action = "newentry", $filename = "", $linktoid = $gedprim = "_PRIM"; } add_simple_tag("1 $gedprim"); -// } + //} //-- don't show _THUM option to regular users -// if (WT_USER_GEDCOM_ADMIN) { + //if (WT_USER_GEDCOM_ADMIN) { // 2 _THUM if ($gedrec == "") $gedthum = "_THUM N"; @@ -1392,7 +1392,7 @@ function show_media_form($pid, $action = "newentry", $filename = "", $linktoid = $gedthum = "_THUM N"; } add_simple_tag("1 $gedthum"); -// } + //} //-- print out editing fields for any other data in the media record $sourceSOUR = ""; diff --git a/includes/functions/functions_name.php b/includes/functions/functions_name.php index 151da5597e..c368439767 100644 --- a/includes/functions/functions_name.php +++ b/includes/functions/functions_name.php @@ -72,8 +72,8 @@ function get_common_surnames($min) { * this function strips the prefixes of lastnames * get rid of jr. Jr. Sr. sr. II, III and van, van der, de lowercase surname prefixes * a . and space must be behind a-z to ensure shortened prefixes and multiple prefixes are removed - * @param string $lastname The name to strip - * @return string The updated name + * @param string $lastname The name to strip + * @return string The updated name */ function strip_prefix($lastname){ $name = preg_replace(array('/ [jJsS][rR]\.?,/', '/ I+,/', '/^([a-z]{1,4}[\. \_\-\(\[])+/'), array(',',',',''), $lastname); @@ -84,7 +84,7 @@ function strip_prefix($lastname){ /** * This function replaces @N.N. and @P.N. with the language specific translations - * @param mixed $names $names could be an array of name parts or it could be a string of the name + * @param mixed $names $names could be an array of name parts or it could be a string of the name * @return string */ function check_NN($names) { @@ -155,8 +155,8 @@ function is_utf8($string) { /** * determine the Daitch-Mokotoff Soundex code for a word - * @param string $name The name - * @return array The array of codes + * @param string $name The name + * @return array The array of codes * @author G. Kroll (canajun2eh), after a previous implementation by Boudewijn Sjouke */ function DMSoundex($name) { @@ -179,23 +179,23 @@ function DMSoundex($name) { else $noVowels = false; $lastPos = strlen($name) - 1; $currPos = 0; - $state = 1; // 1: start of input string, 2: before vowel, 3: other - $result = array(); // accumulate complete 6-digit D-M codes here - $partialResult = array(); // accumulate incomplete D-M codes here - $partialResult[] = array('!'); // initialize 1st partial result ('!' stops "duplicate sound" check) + $state = 1; // 1: start of input string, 2: before vowel, 3: other + $result = array(); // accumulate complete 6-digit D-M codes here + $partialResult = array(); // accumulate incomplete D-M codes here + $partialResult[] = array('!'); // initialize 1st partial result ('!' stops "duplicate sound" check) // Loop through the input string. // Stop when the string is exhausted or when no more partial results remain while (count($partialResult) !=0 && $currPos <= $lastPos) { // Find the DM coding table entry for the chunk at the current position - $thisEntry = substr($name, $currPos, $maxchar); // Get maximum length chunk + $thisEntry = substr($name, $currPos, $maxchar); // Get maximum length chunk while ($thisEntry != '') { if (isset($dmsounds[$thisEntry])) break; - $thisEntry = substr($thisEntry, 0, -1); // Not in table: try a shorter chunk + $thisEntry = substr($thisEntry, 0, -1); // Not in table: try a shorter chunk } if ($thisEntry == '') { - $currPos ++; // Not in table: advance pointer to next byte - continue; // and try again + $currPos ++; // Not in table: advance pointer to next byte + continue; // and try again } $soundTableEntry = $dmsounds[$thisEntry]; @@ -203,24 +203,24 @@ function DMSoundex($name) { $partialResult = array(); $currPos += strlen($thisEntry); - if ($state != 1) { // Not at beginning of input string + if ($state != 1) { // Not at beginning of input string if ($currPos <= $lastPos) { // Determine whether the next chunk is a vowel - $nextEntry = substr($name, $currPos, $maxchar); // Get maximum length chunk + $nextEntry = substr($name, $currPos, $maxchar); // Get maximum length chunk while ($nextEntry != '') { if (isset($dmsounds[$nextEntry])) break; - $nextEntry = substr($nextEntry, 0, -1); // Not in table: try a shorter chunk + $nextEntry = substr($nextEntry, 0, -1); // Not in table: try a shorter chunk } } else $nextEntry = ''; - if ($nextEntry != '' && $dmsounds[$nextEntry][0] != '0') $state = 2; // Next chunk is a vowel + if ($nextEntry != '' && $dmsounds[$nextEntry][0] != '0') $state = 2; // Next chunk is a vowel else $state = 3; } while ($state < count($soundTableEntry)) { - if ($soundTableEntry[$state] == '') { // empty means 'ignore this sound in this state' + if ($soundTableEntry[$state] == '') { // empty means 'ignore this sound in this state' foreach($workingResult as $workingEntry) { $tempEntry = $workingEntry; - $tempEntry[count($tempEntry)-1] .= '!'; // Prevent false 'doubles' + $tempEntry[count($tempEntry)-1] .= '!'; // Prevent false 'doubles' $partialResult[] = $tempEntry; } } else { @@ -234,7 +234,7 @@ function DMSoundex($name) { // one of the pair with only a single occurrence of the duplicate sound, // the other with both occurrences if ($noVowels) { -// $partialResult[] = $workingEntry; + //$partialResult[] = $workingEntry; $workingEntry[] = $soundTableEntry[$state]; } } @@ -247,7 +247,7 @@ function DMSoundex($name) { } } } - $state = $state + 3; // Advance to next triplet while keeping the same basic state + $state = $state + 3; // Advance to next triplet while keeping the same basic state } } @@ -257,7 +257,7 @@ function DMSoundex($name) { $result[] = substr($tempResult, 0, 6); } - $result = array_flip(array_flip($result)); // Kill the double results in the array + $result = array_flip(array_flip($result)); // Kill the double results in the array // We're done. All that's left is to sort the result sort($result); @@ -300,5 +300,3 @@ function soundex_dm($text) { $soundex_array=array_slice($soundex_array, 0, 36); return implode(':', array_unique($soundex_array)); } - -?> diff --git a/includes/functions/functions_places.php b/includes/functions/functions_places.php index c0549388d6..85f57bcb29 100644 --- a/includes/functions/functions_places.php +++ b/includes/functions/functions_places.php @@ -278,7 +278,7 @@ function setup_place_subfields($element_id) { * * data split/copy is done locally by javascript functions * - * @param string $element_id id of PLAC input element in the form + * @param string $element_id id of PLAC input element in the form */ function print_place_subfields($element_id) { global $iso3166, $WT_IMAGES; @@ -371,8 +371,8 @@ function get_place_url($gedcom_place) { /** * get the first part of a place record - * @param string $gedcom_place The original place to shorten - * @return string a shortened version of the place + * @param string $gedcom_place The original place to shorten + * @return string a shortened version of the place */ function get_place_short($gedcom_place) { global $GEDCOM, $SHOW_LIST_PLACES; @@ -391,8 +391,8 @@ function get_place_short($gedcom_place) { /** * get the last part of a place record - * @param string $gedcom_place The original place to country - * @return string a country version of the place + * @param string $gedcom_place The original place to country + * @return string a country version of the place */ function getPlaceCountry($gedcom_place) { global $GEDCOM; @@ -401,4 +401,3 @@ function getPlaceCountry($gedcom_place) { $place = trim($exp[count($exp)-1]); return $place; } -?> diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index 598330e716..4603eb2c5b 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -250,7 +250,7 @@ function print_pedigree_person($pid, $style=1, $count=0, $personcount="1") { if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) { $object = $person->findHighlightedMedia(); if (!empty($object)) { - $whichFile = thumb_or_main($object); // Do we send the main image or a thumbnail? + $whichFile = thumb_or_main($object); // Do we send the main image or a thumbnail? $size = findImageSize($whichFile); $class = "pedigree_image_portrait"; if ($size[0]>$size[1]) $class = "pedigree_image_landscape"; @@ -2254,10 +2254,10 @@ function DumpString($input) { break; } } -// $thisLine .= WT_UTF8_LRM; + //$thisLine .= WT_UTF8_LRM; $thisLine .= $thisChar; } -// echo ' UTF8 ', $thisLine, '<br />'; + //echo ' UTF8 ', $thisLine, '<br />'; echo ' UTF8 ', WT_UTF8_LRO, $thisLine, WT_UTF8_PDF, '<br />'; // Line 3: First hexadecimal byte diff --git a/includes/functions/functions_print_facts.php b/includes/functions/functions_print_facts.php index db707b970e..3dfc5ce1c9 100644 --- a/includes/functions/functions_print_facts.php +++ b/includes/functions/functions_print_facts.php @@ -44,8 +44,8 @@ require_once WT_ROOT.'includes/classes/class_person.php'; * Turn URLs in text into HTML links. Insert breaks into long URLs * so that the browser can word-wrap. * - * @param string $text Text that may or may not contain URLs - * @return string The text with URLs replaced by HTML links + * @param string $text Text that may or may not contain URLs + * @return string The text with URLs replaced by HTML links */ function expand_urls($text) { // Some versions of RFC3987 have an appendix B which gives the following regex @@ -68,8 +68,8 @@ function expand_urls($text) { * print a fact record * * prints a fact record designed for the personal facts and details page - * @param Event $eventObj The Event object to print - * @param boolean $noedit Hide or show edit links + * @param Event $eventObj The Event object to print + * @param boolean $noedit Hide or show edit links */ function print_fact(&$eventObj, $noedit=false) { global $nonfacts, $GEDCOM, $RESN_CODES, $WORD_WRAPPED_NOTES; @@ -431,9 +431,9 @@ function print_repository_record($xref) { * * this function is called by the print_fact function and other functions to * print any source information attached to the fact - * @param string $factrec The fact record to look for sources in - * @param int $level The level to look for sources at - * @param boolean $return whether to return the data or print the data + * @param string $factrec The fact record to look for sources in + * @param int $level The level to look for sources at + * @param boolean $return whether to return the data or print the data */ function print_fact_sources($factrec, $level, $return=false) { global $WT_IMAGES, $EXPAND_SOURCES; @@ -664,8 +664,8 @@ function print_media_links($factrec, $level, $pid='') { * print an address structure * * takes a gedcom ADDR structure and prints out a human readable version of it. - * @param string $factrec The ADDR subrecord - * @param int $level The gedcom line level of the main ADDR record + * @param string $factrec The ADDR subrecord + * @param int $level The gedcom line level of the main ADDR record */ function print_address_structure($factrec, $level) { global $POSTAL_CODE; @@ -883,20 +883,20 @@ function print_main_sources($factrec, $level, $pid, $linenum, $noedit=false) { } /** - * Print SOUR structure + * Print SOUR structure * * This function prints the input array of SOUR sub-records built by the * getSourceStructure() function. * * The input array is defined as follows: - * $textSOUR["PAGE"] = +1 Source citation - * $textSOUR["EVEN"] = +1 Event type - * $textSOUR["ROLE"] = +2 Role in event - * $textSOUR["DATA"] = +1 place holder (no text in this sub-record) - * $textSOUR["DATE"] = +2 Entry recording date - * $textSOUR["TEXT"] = +2 (array) Text from source - * $textSOUR["QUAY"] = +1 Certainty assessment - * $textSOUR["TEXT2"] = +1 (array) Text from source + * $textSOUR["PAGE"] = +1 Source citation + * $textSOUR["EVEN"] = +1 Event type + * $textSOUR["ROLE"] = +2 Role in event + * $textSOUR["DATA"] = +1 place holder (no text in this sub-record) + * $textSOUR["DATE"] = +2 Entry recording date + * $textSOUR["TEXT"] = +2 (array) Text from source + * $textSOUR["QUAY"] = +1 Certainty assessment + * $textSOUR["TEXT2"] = +1 (array) Text from source */ function printSourceStructure($textSOUR) { global $GEDCOM; @@ -953,16 +953,16 @@ function printSourceStructure($textSOUR) { /** * Extract SOUR structure from the incoming Source sub-record * - * The output array is defined as follows: - * $textSOUR["PAGE"] = +1 Source citation - * $textSOUR["EVEN"] = +1 Event type - * $textSOUR["ROLE"] = +2 Role in event - * $textSOUR["DATA"] = +1 place holder (no text in this sub-record) - * $textSOUR["DATE"] = +2 Entry recording date - * $textSOUR["TEXT"] = +2 (array) Text from source - $textSOUR["NOTE"] = +1 Note - * $textSOUR["QUAY"] = +1 Certainty assessment - * $textSOUR["TEXT2"] = +1 (array) Text from source + * The output array is defined as follows: + * $textSOUR["PAGE"] = +1 Source citation + * $textSOUR["EVEN"] = +1 Event type + * $textSOUR["ROLE"] = +2 Role in event + * $textSOUR["DATA"] = +1 place holder (no text in this sub-record) + * $textSOUR["DATE"] = +2 Entry recording date + * $textSOUR["TEXT"] = +2 (array) Text from source + * $textSOUR["NOTE"] = +1 Note + * $textSOUR["QUAY"] = +1 Certainty assessment + * $textSOUR["TEXT2"] = +1 (array) Text from source */ function getSourceStructure($srec) { global $WORD_WRAPPED_NOTES; @@ -1015,11 +1015,11 @@ function getSourceStructure($srec) { * print main note row * * this function will print a table row for a fact table for a level 1 note in the main record - * @param string $factrec the raw gedcom sub record for this note - * @param int $level The start level for this note, usually 1 - * @param string $pid The gedcom XREF id for the level 0 record that this note is a part of - * @param int $linenum The line number in the level 0 record where this record was found. This is used for online editing. - * @param boolean $noedit Whether or not to allow this fact to be edited + * @param string $factrec the raw gedcom sub record for this note + * @param int $level The start level for this note, usually 1 + * @param string $pid The gedcom XREF id for the level 0 record that this note is a part of + * @param int $linenum The line number in the level 0 record where this record was found. This is used for online editing. + * @param boolean $noedit Whether or not to allow this fact to be edited */ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { global $GEDCOM, $RESN_CODES, $WT_IMAGES, $TEXT_DIRECTION; @@ -1150,9 +1150,9 @@ function print_main_notes($factrec, $level, $pid, $linenum, $noedit=false) { /** * Print the links to multi-media objects - * @param string $pid The the xref id of the object to find media records related to - * @param int $level The level of media object to find - * @param boolean $related Whether or not to grab media from related records + * @param string $pid The the xref id of the object to find media records related to + * @param int $level The level of media object to find + * @param boolean $related Whether or not to grab media from related records */ function print_main_media($pid, $level=1, $related=false, $noedit=false) { global $GEDCOM, $MEDIATYPE; @@ -1351,8 +1351,8 @@ function print_main_media($pid, $level=1, $related=false, $noedit=false) { /** * print a media row in a table * @param string $rtype whether this is a 'new', 'old', or 'normal' media row... this is used to determine if the rows should be printed with an outline color - * @param array $rowm An array with the details about this media item - * @param string $pid The record id this media item was attached to + * @param array $rowm An array with the details about this media item + * @param string $pid The record id this media item was attached to */ function print_main_media_row($rtype, $rowm, $pid) { global $WT_IMAGES, $TEXT_DIRECTION, $GEDCOM, $THUMBNAIL_WIDTH, $USE_MEDIA_VIEWER, $SEARCH_SPIDER, $MEDIA_TYPES; diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index 3311a851d7..b9d7cf583f 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -1158,19 +1158,6 @@ function format_surname_table($surnames, $type) { $html.='<tr><td class="list_value_wrap rela list_item">'.$row_num.'</td>'; // Surname $html.='<td class="list_value_wrap" align="'.get_align($surn).'">'; - // Uncomment this block if you want SMITH/Smith/smith merged. Note that when - // such case variants exist, the actual one displayed is undefined. - //$first_spfxsurn=null; - //foreach ($surns as $spfxsurn=>$indis) { - // if ($first_spfxsurn) { - // if (utf8_strtoupper($spfxsurn)==utf8_strtoupper($first_spfxsurn)) { - // $surns[$first_spfxsurn]=array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]); - // unset ($surns[$spfxsurn]); - // } - // } else { - // $first_spfxsurn=$spfxsurn; - // } - //} if (count($surns)==1) { // Single surname variant foreach ($surns as $spfxsurn=>$indis) { @@ -1252,7 +1239,7 @@ function format_surname_tagcloud($surnames, $type, $totals) { foreach ($surnames as $surn=>$surns) { foreach ($surns as $spfxsurn=>$indis) { $cloud->appendTag(array( - 'title'=>$totals ? i18n::translate('%1$s (%2$d)', $spfxsurn, count($indis)) : $spfxsurn, + 'title'=>$totals ? i18n::translate('%1$s (%2$d)', $spfxsurn, count($indis)) : $spfxsurn, 'weight'=>count($indis), 'params'=>array( 'url'=>$surn ? diff --git a/includes/functions/functions_rtl.php b/includes/functions/functions_rtl.php index 1efe7f6eef..35c33a86dd 100644 --- a/includes/functions/functions_rtl.php +++ b/includes/functions/functions_rtl.php @@ -45,8 +45,8 @@ $RTLOrd = array(215,216,217,218,219); $openPar = '([{'; $closePar = ')]}'; $numbers = '0123456789'; -$numberPrefix = '+-'; // Treat these like numbers when at beginning or end of numeric strings -$numberPunctuation = '- ,.:/'; // Treat these like numbers when inside numeric strings +$numberPrefix = '+-'; // Treat these like numbers when at beginning or end of numeric strings +$numberPunctuation = '- ,.:/'; // Treat these like numbers when inside numeric strings $punctuation = ',.:;?!'; function getLRM(){ @@ -62,8 +62,8 @@ function getRLM(){ * text that has been passed through the PrintReady() function before that text is stored * in the database. The database should NEVER contain these characters. * - * @param string The string from which the ‎ and ‏ characters should be stripped - * @return string The input string, with ‎ and ‏ stripped + * @param string The string from which the ‎ and ‏ characters should be stripped + * @return string The input string, with ‎ and ‏ stripped */ function stripLRMRLM($inputText) { return str_replace(array(WT_UTF8_LRM, WT_UTF8_RLM, WT_UTF8_LRO, WT_UTF8_RLO, WT_UTF8_LRE, WT_UTF8_RLE, WT_UTF8_PDF, "‎", "‏", "&LRM;", "&RLM;"), "", $inputText); @@ -73,10 +73,10 @@ function stripLRMRLM($inputText) { * This function encapsulates all texts in the input with <span dir='xxx'> and </span> * according to the directionality specified. * - * @param string Raw input - * @param string Directionality (LTR, BOTH, RTL) default BOTH - * @param string Additional text to insert into output <span dir="xxx"> (such as 'class="yyy"') - * @return string The string with all texts encapsulated as required + * @param string Raw input + * @param string Directionality (LTR, BOTH, RTL) default BOTH + * @param string Additional text to insert into output <span dir="xxx"> (such as 'class="yyy"') + * @return string The string with all texts encapsulated as required */ function spanLTRRTL($inputText, $direction='BOTH', $class='') { global $TEXT_DIRECTION; @@ -86,29 +86,29 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { global $startLTR, $endLTR, $startRTL, $endRTL, $lenStart, $lenEnd; static $spanNumber = 0; - if ($inputText == '') return ''; // Nothing to do + if ($inputText == '') return ''; // Nothing to do - $debug = false; // false for normal operation (no calls of the DumpString function) + $debug = false; // false for normal operation (no calls of the DumpString function) $spanNumber ++; if ($debug) {echo '<br /><b>Input ', $spanNumber, ':</b>'; DumpString($inputText);} $workingText = str_replace("\n", '<br />', $inputText); - $workingText = str_replace(array('<span class="starredname"><br />', '<span<br />class="starredname">'), '<br /><span class="starredname">',$workingText); // Reposition some incorrectly placed line breaks - $workingText = stripLRMRLM($workingText); // Get rid of any existing UTF8 control codes + $workingText = str_replace(array('<span class="starredname"><br />', '<span<br />class="starredname">'), '<br /><span class="starredname">',$workingText); // Reposition some incorrectly placed line breaks + $workingText = stripLRMRLM($workingText); // Get rid of any existing UTF8 control codes - $nothing = '‌'; // Zero Width Non-Joiner (not sure whether this is still needed to work around a TCPDF bug) + $nothing = '‌'; // Zero Width Non-Joiner (not sure whether this is still needed to work around a TCPDF bug) - $startLTR = '<LTR>'; // This will become '<span dir="ltr">' at the end - $endLTR = '</LTR>'; // This will become '</span>' at the end - $startRTL = '<RTL>'; // This will become '<span dir="rtl">' at the end - $endRTL = '</RTL>'; // This will become '</span>' at the end - $lenStart = strlen($startLTR); // RTL version MUST have same length - $lenEnd = strlen($endLTR); // RTL version MUST have same length + $startLTR = '<LTR>'; // This will become '<span dir="ltr">' at the end + $endLTR = '</LTR>'; // This will become '</span>' at the end + $startRTL = '<RTL>'; // This will become '<span dir="rtl">' at the end + $endRTL = '</RTL>'; // This will become '</span>' at the end + $lenStart = strlen($startLTR); // RTL version MUST have same length + $lenEnd = strlen($endLTR); // RTL version MUST have same length $previousState = ''; $currentState = strtoupper($TEXT_DIRECTION); - $numberState = false; // Set when we're inside a numeric string + $numberState = false; // Set when we're inside a numeric string $result = ''; $waitingText = ''; $openParDirection = array(); @@ -116,22 +116,22 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { beginCurrentSpan($result); while ($workingText != '') { - $charArray = getChar($workingText, 0); // Get the next ASCII or UTF-8 character + $charArray = getChar($workingText, 0); // Get the next ASCII or UTF-8 character $currentLetter = $charArray['letter']; $currentLen = $charArray['length']; - $openParIndex = strpos($openPar, $currentLetter); // Which opening parenthesis is this? - $closeParIndex = strpos($closePar, $currentLetter); // Which closing parenthesis is this? + $openParIndex = strpos($openPar, $currentLetter); // Which opening parenthesis is this? + $closeParIndex = strpos($closePar, $currentLetter); // Which closing parenthesis is this? switch ($currentLetter) { case '<': // Assume this '<' starts an HTML element - $endPos = strpos($workingText, '>'); // look for the terminating '>' + $endPos = strpos($workingText, '>'); // look for the terminating '>' if ($endPos === false) $endPos = 0; $currentLen += $endPos; $element = substr($workingText, 0, $currentLen); $temp = strtolower(substr($element, 0, 3)); - if (strlen($element < 7) && $temp == '<br') { // assume we have '<br />' or a variant thereof + if (strlen($element < 7) && $temp == '<br') { // assume we have '<br />' or a variant thereof if ($numberState) { $numberState = false; $waitingText .= WT_UTF8_PDF; @@ -146,7 +146,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { break; case '&': // Assume this '&' starts an HTML entity - $endPos = strpos($workingText, ';'); // look for the terminating ';' + $endPos = strpos($workingText, ';'); // look for the terminating ';' if ($endPos === false) $endPos = 0; $currentLen += $endPos; $entity = substr($workingText, 0, $currentLen); @@ -170,7 +170,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { } } else { if (strtolower($entity) == ' ') { - $entity .= ' '; // Ensure consistent case for this entity + $entity .= ' '; // Ensure consistent case for this entity } if ($waitingText == '') { $result .= $entity; @@ -183,7 +183,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { case '{': if (substr($workingText, 1, 1) == '{') { // Assume this '{{' starts a TCPDF directive - $endPos = strpos($workingText, '}}'); // look for the terminating '}}' + $endPos = strpos($workingText, '}}'); // look for the terminating '}}' if ($endPos === false) $endPos = 0; $currentLen = $endPos + 2; $directive = substr($workingText, 0, $currentLen); @@ -197,14 +197,14 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { // and with optional embedded numeric punctuation if ($numberState) { // If we're inside a numeric string, look for reasons to end it - $offset = 0; // Be sure to look at the current character first + $offset = 0; // Be sure to look at the current character first $charArray = getChar($workingText."\n", $offset); if (strpos($numbers, $charArray['letter']) === false) { // This is not a digit. Is it numeric punctuation? if (substr($workingText."\n", $offset, 6) == ' ') { - $offset += 6; // This could be numeric punctuation + $offset += 6; // This could be numeric punctuation } else if (strpos($numberPunctuation, $charArray['letter']) !== false) { - $offset += $charArray['length']; // This could be numeric punctuation + $offset += $charArray['length']; // This could be numeric punctuation } // If the next character is a digit, the current character is numeric punctuation $charArray = getChar($workingText."\n", $offset); @@ -214,7 +214,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { if (strpos($numberPrefix, $currentLetter) === false) { $currentLetter = WT_UTF8_PDF . $currentLetter; } else { - $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run + $currentLetter = $currentLetter . WT_UTF8_PDF; // Include a trailing + or - in the run } } } @@ -225,11 +225,11 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { $offset = $currentLen; $nextChar = substr($workingText."\n", $offset, 1); if (strpos($numbers, $nextChar) !== false) { - $numberState = true; // We found a digit: the lead-in is therefore numeric + $numberState = true; // We found a digit: the lead-in is therefore numeric $currentLetter = WT_UTF8_LRE . $currentLetter; } } else if (strpos($numbers, $currentLetter) !== false) { - $numberState = true; // The current letter is a digit + $numberState = true; // The current letter is a digit $currentLetter = WT_UTF8_LRE . $currentLetter; } } @@ -308,7 +308,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { break; } $openParDirection[$openParIndex] = '?'; - break 2; // double break because we're waiting for more information + break 2; // double break because we're waiting for more information } // We have a digit or a "normal" special character. @@ -324,7 +324,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { $result .= $waitingText; $waitingText = ''; } - break 2; // double break because we're waiting for more information + break 2; // double break because we're waiting for more information } if ($newState != $currentState) { // A direction change has occurred @@ -416,7 +416,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { $result = str_replace(' <br />', '<br />', $result); continue; } - break; // Neither space nor : we're done + break; // Neither space nor : we're done } // Trim trailing blanks preceding <br /> in RTL text @@ -429,7 +429,7 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { $result = str_replace(' <RTLbr />', '<RTLbr />', $result); continue; } - break; // Neither space nor : we're done + break; // Neither space nor : we're done } // Convert '<LTRbr />' and '<RTLbr /' @@ -465,29 +465,29 @@ function spanLTRRTL($inputText, $direction='BOTH', $class='') { case 'both': // LTR text: <span dir="ltr"> text </span> // RTL text: <span dir="rtl"> text </span> - $sLTR = '<span dir="ltr" '.$class.'>'.$nothing; - $eLTR = $nothing.'</span>'; - $sRTL = '<span dir="rtl" '.$class.'>'.$nothing; - $eRTL = $nothing.'</span>'; + $sLTR = '<span dir="ltr" '.$class.'>'.$nothing; + $eLTR = $nothing.'</span>'; + $sRTL = '<span dir="rtl" '.$class.'>'.$nothing; + $eRTL = $nothing.'</span>'; break; case 'LTR': case 'ltr': // LTR text: <span dir="ltr"> text </span> // RTL text: text - $sLTR = '<span dir="ltr" '.$class.'>'.$nothing; - $eLTR = $nothing.'</span>'; - $sRTL = ''; - $eRTL = ''; + $sLTR = '<span dir="ltr" '.$class.'>'.$nothing; + $eLTR = $nothing.'</span>'; + $sRTL = ''; + $eRTL = ''; break; case 'RTL': case 'rtl': default: // LTR text: text // RTL text: <span dir="rtl"> text </span> - $sLTR = ''; - $eLTR = ''; - $sRTL = '<span dir="rtl" '.$class.'>'.$nothing; - $eRTL = $nothing.'</span>'; + $sLTR = ''; + $eLTR = ''; + $sRTL = '<span dir="rtl" '.$class.'>'.$nothing; + $eRTL = $nothing.'</span>'; break; } $result = str_replace(array($startLTR, $endLTR, $startRTL, $endRTL), array($sLTR, $eLTR, $sRTL, $eRTL), $result); @@ -510,7 +510,7 @@ function starredName($textSpan, $direction) { if ($starPos === false) break; $trailingText = substr($textSpan, $starPos+1); $textSpan = substr($textSpan, 0, $starPos); - $wordStart = strrpos($textSpan, ' '); // Find the start of the word + $wordStart = strrpos($textSpan, ' '); // Find the start of the word if ($wordStart !== false) { $leadingText = substr($textSpan, 0, $wordStart+1); $wordText = substr($textSpan, $wordStart+1); @@ -541,9 +541,9 @@ function getChar($text, $offset) { $char = substr($text, $offset, 1); $length = 1; - if ((ord($char) & 0xE0) == 0xC0) $length = 2; // 2-byte sequence - if ((ord($char) & 0xF0) == 0xE0) $length = 3; // 3-byte sequence - if ((ord($char) & 0xF8) == 0xF0) $length = 4; // 4-byte sequence + if ((ord($char) & 0xE0) == 0xC0) $length = 2; // 2-byte sequence + if ((ord($char) & 0xF0) == 0xE0) $length = 3; // 3-byte sequence + if ((ord($char) & 0xF8) == 0xF0) $length = 4; // 4-byte sequence $letter = substr($text, $offset, $length); return array('letter'=>$letter, 'length'=>$length); @@ -597,14 +597,14 @@ function finishCurrentSpan(&$result, $theEnd=false) { $tempResult = ''; while ($textSpan != '') { $posColon = strpos($textSpan, ':'); - if ($posColon === false) break; // No more possible time strings + if ($posColon === false) break; // No more possible time strings $posLRE = strpos($textSpan, WT_UTF8_LRE); - if ($posLRE === false) break; // No more numeric strings + if ($posLRE === false) break; // No more numeric strings $posPDF = strpos($textSpan, WT_UTF8_PDF, $posLRE); - if ($posPDF === false) break; // No more numeric strings + if ($posPDF === false) break; // No more numeric strings - $tempResult .= substr($textSpan, 0, $posLRE+3); // Copy everything preceding the numeric string - $numericString = substr($textSpan, $posLRE+3, $posPDF-$posLRE); // Separate the entire numeric string + $tempResult .= substr($textSpan, 0, $posLRE+3); // Copy everything preceding the numeric string + $numericString = substr($textSpan, $posLRE+3, $posPDF-$posLRE); // Separate the entire numeric string $textSpan = substr($textSpan, $posPDF+3); $posColon = strpos($numericString, ':'); if ($posColon === false) { @@ -730,7 +730,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { break; } while (substr($textSpan, -9) == '<LTRbr />') { - $trailingBreaks = '<br />' . $trailingBreaks; // Plain <br /> because it's outside a span + $trailingBreaks = '<br />' . $trailingBreaks; // Plain <br /> because it's outside a span $textSpan = substr($textSpan, 0, -9); } if ($trailingBreaks != '') { @@ -747,7 +747,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { } break; } - $waitingText = $trailingBlanks . $waitingText; // Put those trailing blanks inside the following span + $waitingText = $trailingBlanks . $waitingText; // Put those trailing blanks inside the following span } else { $textSpan = $savedSpan; } @@ -786,18 +786,18 @@ function finishCurrentSpan(&$result, $theEnd=false) { // Remove trailing ID numbers that look like "(xnnn)" for inclusion in a separate LTR span while (true) { - if (substr($textSpan, -1) != ')') break; // There is no trailing ')' + if (substr($textSpan, -1) != ')') break; // There is no trailing ')' $posLeftParen = strrpos($textSpan, '('); - if ($posLeftParen === false) break; // There is no leading '(' - $temp = stripLRMRLM(substr($textSpan, $posLeftParen)); // Get rid of UTF8 control codes + if ($posLeftParen === false) break; // There is no leading '(' + $temp = stripLRMRLM(substr($textSpan, $posLeftParen)); // Get rid of UTF8 control codes // If the parenthesized text doesn't look like an ID number, // we don't want to touch it. // This check won't work if somebody uses ID numbers with an unusual format. $offset = 1; - $charArray = getchar($temp, $offset); // Get 1st character of parenthesized text + $charArray = getchar($temp, $offset); // Get 1st character of parenthesized text if (strpos($numbers, $charArray['letter']) !== false) break; - $offset += $charArray['length']; // Point at 2nd character of parenthesized text + $offset += $charArray['length']; // Point at 2nd character of parenthesized text if (strpos($numbers, substr($temp, $offset, 1)) === false) break; // 1st character of parenthesized text is alpha, 2nd character is a digit; last has to be a digit too if (strpos($numbers, substr($temp, -2, 1)) === false) break; @@ -860,7 +860,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { } // We're done: finish the span - $textSpan = starredName($textSpan, 'LTR'); // Wrap starred name in <u> and </u> tags + $textSpan = starredName($textSpan, 'LTR'); // Wrap starred name in <u> and </u> tags while (true) { // Remove blanks that precede <LTRbr /> if (strpos($textSpan, ' <LTRbr />') !== false) { @@ -901,11 +901,11 @@ function finishCurrentSpan(&$result, $theEnd=false) { break; } while (substr($textSpan, -9) == '<RTLbr />') { - $trailingBreaks = '<br />' . $trailingBreaks; // Plain <br /> because it's outside a span + $trailingBreaks = '<br />' . $trailingBreaks; // Plain <br /> because it's outside a span $textSpan = substr($textSpan, 0, -9); } if ($trailingBreaks != '') { - $waitingText = $trailingBlanks . $waitingText; // Put those trailing blanks inside the following span + $waitingText = $trailingBlanks . $waitingText; // Put those trailing blanks inside the following span } else { $textSpan = $savedSpan; } @@ -970,7 +970,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { if ($posDashString === false) break; $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr />'); if ($posStringStart === false) $posStringStart = 0; - else $posStringStart += 9; // Point to the first char following the last <RTLbr /> + else $posStringStart += 9; // Point to the first char following the last <RTLbr /> $textSpan = substr($textSpan, 0, $posStringStart) . ' - ' . substr($textSpan, $posStringStart, $posDashString-$posStringStart) . substr($textSpan, $posDashString+3); } @@ -1012,7 +1012,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { $posDashString = strlen($textSpan) - 2; $posStringStart = strrpos(substr($textSpan, 0, $posDashString), '<RTLbr />'); if ($posStringStart === false) $posStringStart = 0; - else $posStringStart += 9; // Point to the first char following the last <RTLbr /> + else $posStringStart += 9; // Point to the first char following the last <RTLbr /> $textSpan = substr($textSpan, 0, $posStringStart) . '- ' . substr($textSpan, $posStringStart, $posDashString-$posStringStart) . substr($textSpan, $posDashString+2); } @@ -1035,7 +1035,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { } // We're done: finish the span - $textSpan = starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags + $textSpan = starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags $result = $result . $textSpan . $endRTL; } @@ -1043,7 +1043,7 @@ function finishCurrentSpan(&$result, $theEnd=false) { $result = $result . $textSpan; } - $result .= $trailingBreaks; // Get rid of any waiting <br /> + $result .= $trailingBreaks; // Get rid of any waiting <br /> return; } @@ -1053,8 +1053,8 @@ function finishCurrentSpan(&$result, $theEnd=false) { * * original found at http://www.php.net/manual/en/function.get-html-translation-table.php * @see http://www.php.net/manual/en/function.get-html-translation-table.php - * @param string $string the string to remove the entities from - * @return string the string with entities converted + * @param string $string the string to remove the entities from + * @return string the string with entities converted */ function unhtmlentities($string) { $trans_tbl=array_flip(get_html_translation_table (HTML_ENTITIES)); @@ -1068,8 +1068,8 @@ function unhtmlentities($string) { * * this function will take a text string and reverse it for RTL languages * according to bidi rules. - * @param string $text String to change - * @return string the new bidi string + * @param string $text String to change + * @return string the new bidi string * @todo add other RTL langauges */ function bidi_text($text) { @@ -1081,7 +1081,7 @@ function bidi_text($text) { $found = false; foreach($RTLOrd as $indexval => $ord) { - if (strpos($text, chr($ord))!==false) $found=true; + if (strpos($text, chr($ord))!==false) $found=true; } if (!$found) return $text; @@ -1273,16 +1273,16 @@ function reverseText($text) { while ($text!='') { $charLen = 1; $letter = substr($text, 0, 1); - if ((ord($letter) & 0xE0) == 0xC0) $charLen = 2; // 2-byte sequence - if ((ord($letter) & 0xF0) == 0xE0) $charLen = 3; // 3-byte sequence - if ((ord($letter) & 0xF8) == 0xF0) $charLen = 4; // 4-byte sequence + if ((ord($letter) & 0xE0) == 0xC0) $charLen = 2; // 2-byte sequence + if ((ord($letter) & 0xF0) == 0xE0) $charLen = 3; // 3-byte sequence + if ((ord($letter) & 0xF8) == 0xF0) $charLen = 4; // 4-byte sequence $letter = substr($text, 0, $charLen); $text = substr($text, $charLen); if (strpos(WT_UTF8_DIGITS, $letter)!==false) { - $numbers .= $letter; // accumulate numbers in LTR mode + $numbers .= $letter; // accumulate numbers in LTR mode } else { - $reversedText = $numbers.$reversedText; // emit any waiting LTR numbers now + $reversedText = $numbers.$reversedText; // emit any waiting LTR numbers now $numbers = ''; if (strpos(WT_UTF8_PARENTHESES1, $letter)!==false) { $reversedText = substr(WT_UTF8_PARENTHESES2, strpos(WT_UTF8_PARENTHESES1, $letter), strlen($letter)).$reversedText; @@ -1292,6 +1292,6 @@ function reverseText($text) { } } - $reversedText = $numbers.$reversedText; // emit any waiting LTR numbers now + $reversedText = $numbers.$reversedText; // emit any waiting LTR numbers now return $reversedText; } diff --git a/includes/functions/functions_tools.php b/includes/functions/functions_tools.php index d48a2438d7..adf421aa31 100644 --- a/includes/functions/functions_tools.php +++ b/includes/functions/functions_tools.php @@ -42,7 +42,7 @@ define('WT_FUNCTIONS_TOOLS_PHP', ''); * as the event. For example:<code>1 SSN * 2 PLAC 123-45-6789</code> Should really be: <code>1 SSN 123-45-6789</code> * this function checks if this exists - * @return boolean returns true if the cleanup is needed + * @return boolean returns true if the cleanup is needed * @see place_cleanup() */ function need_place_cleanup() @@ -58,7 +58,7 @@ function need_place_cleanup() /** * clean up the bad places found by the need_place_cleanup() function - * @return boolean returns true if cleanup was successful + * @return boolean returns true if cleanup was successful * @see need_place_cleanup() */ function place_cleanup() @@ -103,7 +103,7 @@ function fixreplaceval($val1,$val7,$val3,$val5) * dates in an incorrect format. This function checks if dates have been entered incorrectly. * This function will detect dates in the form YYYY-MM-DD, DD-MM-YYYY, and MM-DD-YYYY. It will also * look for \ / - and . as delimeters. - * @return boolean returns true if the cleanup is needed + * @return boolean returns true if the cleanup is needed * @see date_cleanup() */ function need_date_cleanup() @@ -160,7 +160,7 @@ function changemonth($monval) /** * clean up the bad dates found by the need_date_cleanup() function - * @return boolean returns true if cleanup was successful + * @return boolean returns true if cleanup was successful * @see need_date_cleanup() */ function date_cleanup($dayfirst=1) @@ -203,7 +203,7 @@ function date_cleanup($dayfirst=1) * but instead use another Identifying tag in the Gedcom record. This function will allow * the admin to replace the XREF IDs with the value of another tag. So for example you could replace * the 0 @I1@ INDI with the value of the RIN tag R101 making the line look like this 0 @R101@ INDI - * @param String $tag the alternate tag in the gedcom record to use when replacing the xref id, defaults to RIN + * @param String $tag the alternate tag in the gedcom record to use when replacing the xref id, defaults to RIN */ function xref_change($tag="RIN") { @@ -225,12 +225,10 @@ function xref_change($tag="RIN") } else $name = $xref; -// print "Found record $i - $name: "; $rt = preg_match("/1 $tag (.*)/", $indirec, $rmatch); if ($rt>0) { $rin = trim($rmatch[1]); $fcontents = str_replace("@$xref@", "@$rin@", $fcontents); -// print "successfully set to $rin<br />\n"; } else print "<span class=\"error\">No $tag found in record<br /></span>\n"; } |
