summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2015-01-18 18:13:58 +0000
committerGreg Roach <fisharebest@gmail.com>2015-01-18 18:13:58 +0000
commit34f62eee36c4c50f2335538dbc011be68597a790 (patch)
treea36725be3812cddffbb12ac5a93ad32bdf78f9b7
parent16ac7a86f467f96ae4546b415c4a9f6200b68d89 (diff)
parentb86239b0a87dfdd16858e2846ebe7252d52d9596 (diff)
downloadwebtrees-34f62eee36c4c50f2335538dbc011be68597a790.tar.gz
webtrees-34f62eee36c4c50f2335538dbc011be68597a790.tar.bz2
webtrees-34f62eee36c4c50f2335538dbc011be68597a790.zip
Merge pull request #370 from fisharebest/scrutinizer-patch-1
Scrutinizer Auto-Fixes
-rw-r--r--library/WT/Controller/Repository.php6
-rw-r--r--library/WT/Controller/Search.php18
-rw-r--r--library/WT/Controller/Source.php10
-rw-r--r--library/WT/Controller/Timeline.php12
-rw-r--r--library/WT/DB.php4
-rw-r--r--library/WT/DBStatement.php2
-rw-r--r--library/WT/Date.php2
-rw-r--r--library/WT/Date/Calendar.php10
-rw-r--r--library/WT/Date/Jewish.php6
-rw-r--r--library/WT/Date/Julian.php2
-rw-r--r--library/WT/Fact.php2
-rw-r--r--library/WT/Family.php2
-rw-r--r--library/WT/Filter.php38
-rw-r--r--library/WT/FlashMessages.php2
-rw-r--r--library/WT/GedcomRecord.php160
-rw-r--r--library/WT/I18N.php186
-rw-r--r--library/WT/Individual.php18
-rw-r--r--library/WT/Mail.php12
-rw-r--r--library/WT/Media.php2
-rw-r--r--library/WT/Module.php8
-rw-r--r--library/WT/Place.php76
-rw-r--r--library/WT/Query/Admin.php72
-rw-r--r--library/WT/Query/Media.php2
-rw-r--r--library/WT/Query/Name.php124
24 files changed, 388 insertions, 388 deletions
diff --git a/library/WT/Controller/Repository.php b/library/WT/Controller/Repository.php
index 1c8d2f8a52..5f2afc3d88 100644
--- a/library/WT/Controller/Repository.php
+++ b/library/WT/Controller/Repository.php
@@ -21,7 +21,7 @@
use WT\Auth;
-require_once WT_ROOT.'includes/functions/functions_print_facts.php';
+require_once WT_ROOT . 'includes/functions/functions_print_facts.php';
/**
* Class WT_Controller_Repository - Controller for the repository page
@@ -68,7 +68,7 @@ class WT_Controller_Repository extends WT_Controller_GedcomRecord {
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-repo-del');
- $submenu->setOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName()))."', '".$this->record->getXref()."');");
+ $submenu->setOnclick("return delete_repository('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
@@ -86,7 +86,7 @@ class WT_Controller_Repository extends WT_Controller_GedcomRecord {
'#',
'menu-repo-addfav'
);
- $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&amp;mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})");
+ $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&amp;mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
diff --git a/library/WT/Controller/Search.php b/library/WT/Controller/Search.php
index 6cd1f2be44..9fba135793 100644
--- a/library/WT/Controller/Search.php
+++ b/library/WT/Controller/Search.php
@@ -136,7 +136,7 @@ class WT_Controller_Search extends WT_Controller_Page {
$str = str_replace(array(".", "-", " "), array("_", "_", "_"), $search_tree->tree_name);
if (isset ($_REQUEST["$str"]) || $topsearch) {
$this->search_trees[$search_tree->tree_id] = $search_tree;
- $_REQUEST["$str"] = 'yes';
+ $_REQUEST["$str"] = 'yes';
}
}
} else {
@@ -386,7 +386,7 @@ class WT_Controller_Search extends WT_Controller_Page {
private function searchAndReplace() {
global $STANDARD_NAME_FACTS, $ADVANCED_NAME_FACTS, $WT_TREE;
- $this->search_trees = array(WT_GED_ID => $WT_TREE);
+ $this->search_trees = array(WT_GED_ID => $WT_TREE);
$this->srindi = 'yes';
$this->srfams = 'yes';
$this->srsour = 'yes';
@@ -618,7 +618,7 @@ class WT_Controller_Search extends WT_Controller_Page {
echo '<h3 class="indi-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
<div class="indi-acc_content">',
format_indi_table($datalist);
- echo '</div>';//indi-acc_content
+ echo '</div>'; //indi-acc_content
}
}
echo '</div>';
@@ -641,10 +641,10 @@ class WT_Controller_Search extends WT_Controller_Page {
echo '<h3 class="fam-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
<div class="fam-acc_content">',
format_fam_table($datalist);
- echo '</div>';//fam-acc_content
+ echo '</div>'; //fam-acc_content
}
}
- echo '</div>';//#searchAccordion-fam
+ echo '</div>'; //#searchAccordion-fam
$this->addInlineJavascript('jQuery("#searchAccordion-fam").accordion({heightStyle: "content", collapsible: true});');
// source results
@@ -664,10 +664,10 @@ class WT_Controller_Search extends WT_Controller_Page {
echo '<h3 class="source-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
<div class="source-acc_content">',
format_sour_table($datalist);
- echo '</div>';//fam-acc_content
+ echo '</div>'; //fam-acc_content
}
}
- echo '</div>';//#searchAccordion-source
+ echo '</div>'; //#searchAccordion-source
$this->addInlineJavascript('jQuery("#searchAccordion-source").accordion({heightStyle: "content", collapsible: true});');
// note results
@@ -687,10 +687,10 @@ class WT_Controller_Search extends WT_Controller_Page {
echo '<h3 class="note-acc-header"><a href="#"><span class="search_item" dir="auto">', $this->myquery, '</span> @ <span>', $search_tree->tree_title_html, '</span></a></h3>
<div class="note-acc_content">',
format_note_table($datalist);
- echo '</div>';//note-acc_content
+ echo '</div>'; //note-acc_content
}
}
- echo '</div>';//#searchAccordion-note
+ echo '</div>'; //#searchAccordion-note
$this->addInlineJavascript('jQuery("#searchAccordion-note").accordion({heightStyle: "content", collapsible: true});');
$GEDCOM = WT_GEDCOM;
diff --git a/library/WT/Controller/Source.php b/library/WT/Controller/Source.php
index 4a8325bb3e..45e8883a12 100644
--- a/library/WT/Controller/Source.php
+++ b/library/WT/Controller/Source.php
@@ -21,7 +21,7 @@
use WT\Auth;
-require_once WT_ROOT.'includes/functions/functions_print_facts.php';
+require_once WT_ROOT . 'includes/functions/functions_print_facts.php';
/**
* Class WT_Controller_Source - Controller for the source page
@@ -57,10 +57,10 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
$submenu = new WT_Menu(WT_I18N::translate('Edit source'), '#', 'menu-sour-edit');
if ($fact) {
// Edit existing name
- $submenu->setOnclick('return edit_record(\''.$this->record->getXref().'\', \'' . $fact->getFactId() . '\');');
+ $submenu->setOnclick('return edit_record(\'' . $this->record->getXref() . '\', \'' . $fact->getFactId() . '\');');
} else {
// Add new name
- $submenu->setOnclick('return add_fact(\''.$this->record->getXref().'\', \'TITL\');');
+ $submenu->setOnclick('return add_fact(\'' . $this->record->getXref() . '\', \'TITL\');');
}
$menu->addSubmenu($submenu);
}
@@ -68,7 +68,7 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
// delete
if (WT_USER_CAN_EDIT) {
$submenu = new WT_Menu(WT_I18N::translate('Delete'), '#', 'menu-sour-del');
- $submenu->setOnclick("return delete_source('".WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName()))."', '".$this->record->getXref()."');");
+ $submenu->setOnclick("return delete_source('" . WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($this->record->getFullName())) . "', '" . $this->record->getXref() . "');");
$menu->addSubmenu($submenu);
}
@@ -86,7 +86,7 @@ class WT_Controller_Source extends WT_Controller_GedcomRecord {
'#',
'menu-sour-addfav'
);
- $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&amp;mod_action=menu-add-favorite',{xref:'".$this->record->getXref()."'},function(){location.reload();})");
+ $submenu->setOnclick("jQuery.post('module.php?mod=user_favorites&amp;mod_action=menu-add-favorite',{xref:'" . $this->record->getXref() . "'},function(){location.reload();})");
$menu->addSubmenu($submenu);
}
diff --git a/library/WT/Controller/Timeline.php b/library/WT/Controller/Timeline.php
index 8804a5b297..895852821f 100644
--- a/library/WT/Controller/Timeline.php
+++ b/library/WT/Controller/Timeline.php
@@ -68,7 +68,7 @@ class WT_Controller_Timeline extends WT_Controller_Page {
$this->setPageTitle(WT_I18N::translate('Timeline'));
- $this->baseyear = (int)date('Y');
+ $this->baseyear = (int) date('Y');
// new pid
$newpid = WT_Filter::get('newpid', WT_REGEX_XREF);
@@ -127,7 +127,7 @@ class WT_Controller_Timeline extends WT_Controller_Page {
$this->topyear = max($this->topyear, $date->y);
if (!$indi->isDead()) {
- $this->topyear = max($this->topyear, (int)date('Y'));
+ $this->topyear = max($this->topyear, (int) date('Y'));
}
// do not add the same fact twice (prevents marriages from being added multiple times)
@@ -141,7 +141,7 @@ class WT_Controller_Timeline extends WT_Controller_Page {
}
$scale = WT_Filter::getInteger('scale', 0, 200);
if ($scale === 0) {
- $this->scale = (int)(($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4);
+ $this->scale = (int) (($this->topyear - $this->baseyear) / 20 * count($this->indifacts) / 4);
if ($this->scale < 6) {
$this->scale = 6;
}
@@ -173,8 +173,8 @@ class WT_Controller_Timeline extends WT_Controller_Page {
$yoffset = $baseyoffset + (($year - $this->baseyear) * $this->scale) - ($this->scale);
$yoffset = $yoffset + (($month / 12) * $this->scale);
$yoffset = $yoffset + (($day / 30) * ($this->scale / 12));
- $yoffset = (int)($yoffset);
- $place = (int)($yoffset / $this->bheight);
+ $yoffset = (int) ($yoffset);
+ $place = (int) ($yoffset / $this->bheight);
$i = 1;
$j = 0;
$tyoffset = 0;
@@ -186,7 +186,7 @@ class WT_Controller_Timeline extends WT_Controller_Page {
$tyoffset = -1 * $this->bheight * $j;
$j++;
}
- $place = (int)(($yoffset + $tyoffset) / ($this->bheight));
+ $place = (int) (($yoffset + $tyoffset) / ($this->bheight));
}
$yoffset += $tyoffset;
$xoffset += abs($tyoffset);
diff --git a/library/WT/DB.php b/library/WT/DB.php
index e87306ee40..8104ee322b 100644
--- a/library/WT/DB.php
+++ b/library/WT/DB.php
@@ -308,7 +308,7 @@ class WT_DB {
*/
public static function updateSchema($schema_dir, $schema_name, $target_version) {
try {
- $current_version = (int)WT_Site::getPreference($schema_name);
+ $current_version = (int) WT_Site::getPreference($schema_name);
} catch (PDOException $e) {
// During initial installation, this table won’t exist.
// It will only be a problem if we can’t subsequently create it.
@@ -337,7 +337,7 @@ class WT_DB {
$next_version = $current_version + 1;
require $schema_dir . 'db_schema_' . $current_version . '_' . $next_version . '.php';
// The updatescript should update the version or throw an exception
- $current_version = (int)WT_Site::getPreference($schema_name);
+ $current_version = (int) WT_Site::getPreference($schema_name);
if ($current_version != $next_version) {
throw new Exception("Internal error while updating {$schema_name} to {$next_version}");
}
diff --git a/library/WT/DBStatement.php b/library/WT/DBStatement.php
index a6de7638cd..712c46008d 100644
--- a/library/WT/DBStatement.php
+++ b/library/WT/DBStatement.php
@@ -68,7 +68,7 @@ class WT_DBStatement {
$this->pdo_statement->bindValue($key, $bind_variable, PDO::PARAM_NULL);
break;
case 'boolean':
- $this->pdo_statement->bindValue($key, (int)$bind_variable, PDO::PARAM_INT);
+ $this->pdo_statement->bindValue($key, (int) $bind_variable, PDO::PARAM_INT);
break;
case 'integer':
$this->pdo_statement->bindValue($key, $bind_variable, PDO::PARAM_INT);
diff --git a/library/WT/Date.php b/library/WT/Date.php
index df32273978..5aa2c38158 100644
--- a/library/WT/Date.php
+++ b/library/WT/Date.php
@@ -378,7 +378,7 @@ class WT_Date {
* @return integer
*/
function JD() {
- return (int)(($this->MinJD() + $this->MaxJD()) / 2);
+ return (int) (($this->MinJD() + $this->MaxJD()) / 2);
}
/**
diff --git a/library/WT/Date/Calendar.php b/library/WT/Date/Calendar.php
index 6630205e61..115059088b 100644
--- a/library/WT/Date/Calendar.php
+++ b/library/WT/Date/Calendar.php
@@ -82,7 +82,7 @@ class WT_Date_Calendar {
// Construct from an array (of three gedcom-style strings: "1900", "FEB", "4")
if (is_array($date)) {
- $this->d = (int)$date[2];
+ $this->d = (int) $date[2];
if (array_key_exists($date[1], static::$MONTH_ABBREV)) {
$this->m = static::$MONTH_ABBREV[$date[1]];
} else {
@@ -119,7 +119,7 @@ class WT_Date_Calendar {
$jd = $date->calendar->ymdToJd($today[0], $date->m, $date->d == 0 ? $today[2] : $date->d);
} else {
// Complete date
- $jd = (int)(($date->maxJD + $date->minJD) / 2);
+ $jd = (int) (($date->maxJD + $date->minJD) / 2);
}
list($this->y, $this->m, $this->d) = $this->calendar->jdToYmd($jd);
// New date has same precision as original date
@@ -410,7 +410,7 @@ class WT_Date_Calendar {
* @return integer
*/
protected function extractYear($year) {
- return (int)$year;
+ return (int) $year;
}
/**
@@ -649,7 +649,7 @@ class WT_Date_Calendar {
$format = str_replace($match, $this->daysInMonth(), $format);
break;
case '%L':
- $format = str_replace($match, (int)$this->isLeapYear(), $format);
+ $format = str_replace($match, (int) $this->isLeapYear(), $format);
break;
case '%Y':
$format = str_replace($match, $this->formatLongYear(), $format);
@@ -892,7 +892,7 @@ class WT_Date_Calendar {
protected static function numberToRomanNumerals($number) {
if ($number < 1) {
// Cannot convert zero/negative numbers
- return (string)$number;
+ return (string) $number;
}
$roman = '';
foreach (self::$roman_numerals as $key => $value) {
diff --git a/library/WT/Date/Jewish.php b/library/WT/Date/Jewish.php
index ad81df6d49..9837918e97 100644
--- a/library/WT/Date/Jewish.php
+++ b/library/WT/Date/Jewish.php
@@ -237,7 +237,7 @@ class WT_Date_Jewish extends WT_Date_Calendar {
$shortYear = $num % 1000; //discard thousands
//next check for all possible single Hebrew digit years
$singleDigitYear = ($shortYear < 11 || ($shortYear < 100 && $shortYear % 10 == 0) || ($shortYear <= 400 && $shortYear % 100 == 0));
- $thousands = (int)($num / 1000); //get # thousands
+ $thousands = (int) ($num / 1000); //get # thousands
$sb = "";
//append thousands to String
if ($num % 1000 == 0) {
@@ -253,7 +253,7 @@ class WT_Date_Jewish extends WT_Date_Calendar {
$sb .= " ";
}
$num = $num % 1000; //remove 1000s
- $hundreds = (int)($num / 100); // # of hundreds
+ $hundreds = (int) ($num / 100); // # of hundreds
$sb .= $jHundreds[$hundreds]; //add hundreds to String
$num = $num % 100; //remove 100s
if ($num == 15) {
@@ -261,7 +261,7 @@ class WT_Date_Jewish extends WT_Date_Calendar {
} else if ($num == 16) {
$sb .= $tavTaz[1];
} else {
- $tens = (int)($num / 10);
+ $tens = (int) ($num / 10);
if ($num % 10 == 0) {
if ($singleDigitYear == false) {
$sb .= $jTenEnds[$tens]; // use end letters so that for example 5750 will end with an end nun
diff --git a/library/WT/Date/Julian.php b/library/WT/Date/Julian.php
index c578216c96..068a12c33e 100644
--- a/library/WT/Date/Julian.php
+++ b/library/WT/Date/Julian.php
@@ -63,7 +63,7 @@ class WT_Date_Julian extends WT_Date_Calendar {
} else if (preg_match('/^(\d+) B\.C\.$/', $year, $match)) {
return -$match[1];
} else {
- return (int)$year;
+ return (int) $year;
}
}
diff --git a/library/WT/Fact.php b/library/WT/Fact.php
index a56535e7f9..2769abd8eb 100644
--- a/library/WT/Fact.php
+++ b/library/WT/Fact.php
@@ -68,7 +68,7 @@ class WT_Fact {
$this->fact_id = $fact_id;
$this->tag = $match[1];
} else {
- throw new InvalidArgumentException('Invalid GEDCOM data passed to WT_Fact::_construct('.$gedcom.')');
+ throw new InvalidArgumentException('Invalid GEDCOM data passed to WT_Fact::_construct(' . $gedcom . ')');
}
}
diff --git a/library/WT/Family.php b/library/WT/Family.php
index a0da029276..c3778ff70f 100644
--- a/library/WT/Family.php
+++ b/library/WT/Family.php
@@ -221,7 +221,7 @@ class WT_Family extends WT_GedcomRecord {
public function getNumberOfChildren() {
$nchi = count($this->getChildren());
foreach ($this->getFacts('NCHI') as $fact) {
- $nchi = max($nchi, (int)$fact->getValue());
+ $nchi = max($nchi, (int) $fact->getValue());
}
return $nchi;
diff --git a/library/WT/Filter.php b/library/WT/Filter.php
index 5a1506d817..50214161ff 100644
--- a/library/WT/Filter.php
+++ b/library/WT/Filter.php
@@ -30,7 +30,7 @@ class WT_Filter {
// (([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
// This matches far too much while a “precise” regex is several pages long.
// This is a compromise.
- const URL_REGEX='((https?|ftp]):)(//([^\s/?#<>]*))?([^\s?#<>]*)(\?([^\s#<>]*))?(#[^\s?#<>]+)?';
+ const URL_REGEX = '((https?|ftp]):)(//([^\s/?#<>]*))?([^\s?#<>]*)(\?([^\s#<>]*))?(#[^\s?#<>]+)?';
/**
* Escape a string for use in HTML
@@ -136,7 +136,7 @@ class WT_Filter {
public static function expandUrls($text) {
return preg_replace_callback(
'/' . addcslashes('(?!>)' . WT_Filter::URL_REGEX . '(?!</a>)', '/') . '/i',
- function ($m) {
+ function($m) {
return '<a href="' . $m[0] . '" target="_blank">' . $m[0] . '</a>';
},
WT_Filter::escapeHtml($text)
@@ -181,7 +181,7 @@ class WT_Filter {
*
* @return string|null
*/
- private static function input($source, $variable, $regexp=null, $default=null) {
+ private static function input($source, $variable, $regexp = null, $default = null) {
if ($regexp) {
return filter_input(
$source,
@@ -205,7 +205,7 @@ class WT_Filter {
},
)
);
- return ($tmp===null || $tmp===false) ? $default : $tmp;
+ return ($tmp === null || $tmp === false) ? $default : $tmp;
}
}
@@ -219,7 +219,7 @@ class WT_Filter {
*
* @return string[]
*/
- private static function inputArray($source, $variable, $regexp=null, $default=null) {
+ private static function inputArray($source, $variable, $regexp = null, $default = null) {
if ($regexp) {
// PHP5.3 requires the $tmp variable
$tmp = filter_input_array(
@@ -263,7 +263,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function get($variable, $regexp=null, $default=null) {
+ public static function get($variable, $regexp = null, $default = null) {
return self::input(INPUT_GET, $variable, $regexp, $default);
}
@@ -276,7 +276,7 @@ class WT_Filter {
*
* @return string[]
*/
- public static function getArray($variable, $regexp=null, $default=null) {
+ public static function getArray($variable, $regexp = null, $default = null) {
return self::inputArray(INPUT_GET, $variable, $regexp, $default);
}
@@ -288,7 +288,7 @@ class WT_Filter {
* @return boolean
*/
public static function getBool($variable) {
- return (bool)filter_input(INPUT_GET, $variable, FILTER_VALIDATE_BOOLEAN);
+ return (bool) filter_input(INPUT_GET, $variable, FILTER_VALIDATE_BOOLEAN);
}
/**
@@ -301,7 +301,7 @@ class WT_Filter {
*
* @return integer
*/
- public static function getInteger($variable, $min=0, $max=PHP_INT_MAX, $default=0) {
+ public static function getInteger($variable, $min = 0, $max = PHP_INT_MAX, $default = 0) {
return filter_input(INPUT_GET, $variable, FILTER_VALIDATE_INT, array('options'=>array('min_range'=>$min, 'max_range'=>$max, 'default'=>$default)));
}
@@ -313,7 +313,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function getEmail($variable, $default=null) {
+ public static function getEmail($variable, $default = null) {
return filter_input(INPUT_GET, $variable, FILTER_VALIDATE_EMAIL) ?: $default;
}
@@ -325,7 +325,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function getUrl($variable, $default=null) {
+ public static function getUrl($variable, $default = null) {
return filter_input(INPUT_GET, $variable, FILTER_VALIDATE_URL) ?: $default;
}
@@ -338,7 +338,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function post($variable, $regexp=null, $default=null) {
+ public static function post($variable, $regexp = null, $default = null) {
return self::input(INPUT_POST, $variable, $regexp, $default);
}
@@ -351,7 +351,7 @@ class WT_Filter {
*
* @return string[]
*/
- public static function postArray($variable, $regexp=null, $default=null) {
+ public static function postArray($variable, $regexp = null, $default = null) {
return self::inputArray(INPUT_POST, $variable, $regexp, $default);
}
@@ -363,7 +363,7 @@ class WT_Filter {
* @return boolean
*/
public static function postBool($variable) {
- return (bool)filter_input(INPUT_POST, $variable, FILTER_VALIDATE_BOOLEAN);
+ return (bool) filter_input(INPUT_POST, $variable, FILTER_VALIDATE_BOOLEAN);
}
/**
@@ -376,7 +376,7 @@ class WT_Filter {
*
* @return integer
*/
- public static function postInteger($variable, $min=0, $max=PHP_INT_MAX, $default=0) {
+ public static function postInteger($variable, $min = 0, $max = PHP_INT_MAX, $default = 0) {
return filter_input(INPUT_POST, $variable, FILTER_VALIDATE_INT, array('options'=>array('min_range'=>$min, 'max_range'=>$max, 'default'=>$default)));
}
@@ -388,7 +388,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function postEmail($variable, $default=null) {
+ public static function postEmail($variable, $default = null) {
return filter_input(INPUT_POST, $variable, FILTER_VALIDATE_EMAIL) ?: $default;
}
@@ -400,7 +400,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function postUrl($variable, $default=null) {
+ public static function postUrl($variable, $default = null) {
return filter_input(INPUT_POST, $variable, FILTER_VALIDATE_URL) ?: $default;
}
@@ -413,7 +413,7 @@ class WT_Filter {
*
* @return null|string
*/
- public static function cookie($variable, $regexp=null, $default=null) {
+ public static function cookie($variable, $regexp = null, $default = null) {
return self::input(INPUT_COOKIE, $variable, $regexp, $default);
}
@@ -428,7 +428,7 @@ class WT_Filter {
if ($WT_SESSION->CSRF_TOKEN === null) {
$charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz0123456789';
- for ($n=0; $n<32; ++$n) {
+ for ($n = 0; $n < 32; ++$n) {
$WT_SESSION->CSRF_TOKEN .= substr($charset, mt_rand(0, 61), 1);
}
}
diff --git a/library/WT/FlashMessages.php b/library/WT/FlashMessages.php
index d3d6fd7a61..d216394326 100644
--- a/library/WT/FlashMessages.php
+++ b/library/WT/FlashMessages.php
@@ -27,7 +27,7 @@ class WT_FlashMessages {
* @param string $text
* @param string $status "success", "info", "warning" or "danger"
*/
- public static function addMessage($text, $status='info') {
+ public static function addMessage($text, $status = 'info') {
$message = new stdClass;
$message->text = $text;
$message->status = $status;
diff --git a/library/WT/GedcomRecord.php b/library/WT/GedcomRecord.php
index ba76353c31..f96a7e708e 100644
--- a/library/WT/GedcomRecord.php
+++ b/library/WT/GedcomRecord.php
@@ -133,7 +133,7 @@ class WT_GedcomRecord {
* @return WT_GedcomRecord|null
* @throws Exception
*/
- public static function getInstance($xref, $gedcom_id=WT_GED_ID, $gedcom=null) {
+ public static function getInstance($xref, $gedcom_id = WT_GED_ID, $gedcom = null) {
// Is this record already in the cache?
if (isset(self::$gedcom_record_cache[$xref][$gedcom_id])) {
return self::$gedcom_record_cache[$xref][$gedcom_id];
@@ -148,7 +148,7 @@ class WT_GedcomRecord {
if (WT_USER_CAN_EDIT) {
if (!isset(self::$pending_record_cache[$gedcom_id])) {
// Fetch all pending records in one database query
- self::$pending_record_cache[$gedcom_id]=array();
+ self::$pending_record_cache[$gedcom_id] = array();
$rows = WT_DB::prepare(
"SELECT xref, new_gedcom FROM `##change` WHERE status='pending' AND gedcom_id=?"
)->execute(array($gedcom_id))->fetchAll();
@@ -174,20 +174,20 @@ class WT_GedcomRecord {
}
// Create the object
- if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom.$pending, $match)) {
+ if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom . $pending, $match)) {
$xref = $match[1]; // Collation - we may have requested I123 and found i123
$type = $match[2];
- } elseif (preg_match('/^0 (HEAD|TRLR)/', $gedcom.$pending, $match)) {
+ } elseif (preg_match('/^0 (HEAD|TRLR)/', $gedcom . $pending, $match)) {
$xref = $match[1];
$type = $match[1];
- } elseif ($gedcom.$pending) {
+ } elseif ($gedcom . $pending) {
throw new Exception('Unrecognized GEDCOM record: ' . $gedcom);
} else {
// A record with both pending creation and pending deletion
$type = static::RECORD_TYPE;
}
- switch($type) {
+ switch ($type) {
case 'INDI':
$record = new WT_Individual($xref, $gedcom, $pending, $gedcom_id);
break;
@@ -226,7 +226,7 @@ class WT_GedcomRecord {
* @return null|string
*/
protected static function fetchGedcomRecord($xref, $gedcom_id) {
- static $statement=null;
+ static $statement = null;
// We don't know what type of object this is. Try each one in turn.
$data = WT_Individual::fetchGedcomRecord($xref, $gedcom_id);
@@ -255,7 +255,7 @@ class WT_GedcomRecord {
}
// Some other type of record...
if (is_null($statement)) {
- $statement=WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=?");
+ $statement = WT_DB::prepare("SELECT o_gedcom FROM `##other` WHERE o_id=? AND o_file=?");
}
return $statement->execute(array($xref, $gedcom_id))->fetchOne();
@@ -372,16 +372,16 @@ class WT_GedcomRecord {
}
// We should always be able to see our own record (unless an admin is applying download restrictions)
- if ($this->getXref()==WT_USER_GEDCOM_ID && $this->getGedcomId()==WT_GED_ID && $access_level==WT_USER_ACCESS_LEVEL) {
+ if ($this->getXref() == WT_USER_GEDCOM_ID && $this->getGedcomId() == WT_GED_ID && $access_level == WT_USER_ACCESS_LEVEL) {
return true;
}
// Does this record have a RESN?
if (strpos($this->gedcom, "\n1 RESN confidential")) {
- return WT_PRIV_NONE>=$access_level;
+ return WT_PRIV_NONE >= $access_level;
}
if (strpos($this->gedcom, "\n1 RESN privacy")) {
- return WT_PRIV_USER>=$access_level;
+ return WT_PRIV_USER >= $access_level;
}
if (strpos($this->gedcom, "\n1 RESN none")) {
return true;
@@ -389,11 +389,11 @@ class WT_GedcomRecord {
// Does this record have a default RESN?
if (isset($person_privacy[$this->getXref()])) {
- return $person_privacy[$this->getXref()]>=$access_level;
+ return $person_privacy[$this->getXref()] >= $access_level;
}
// Privacy rules do not apply to admins
- if (WT_PRIV_NONE>=$access_level) {
+ if (WT_PRIV_NONE >= $access_level) {
return true;
}
@@ -413,7 +413,7 @@ class WT_GedcomRecord {
if (isset($global_facts[static::RECORD_TYPE])) {
// Restriction found
- return $global_facts[static::RECORD_TYPE]>=$access_level;
+ return $global_facts[static::RECORD_TYPE] >= $access_level;
} else {
// No restriction found - must be public:
return true;
@@ -427,23 +427,23 @@ class WT_GedcomRecord {
*
* @return boolean
*/
- public function canShow($access_level=WT_USER_ACCESS_LEVEL) {
+ public function canShow($access_level = WT_USER_ACCESS_LEVEL) {
// CACHING: this function can take three different parameters,
// and therefore needs three different caches for the result.
switch ($access_level) {
case WT_PRIV_PUBLIC: // visitor
- if ($this->disp_public===null) {
- $this->disp_public=$this->_canShow(WT_PRIV_PUBLIC);
+ if ($this->disp_public === null) {
+ $this->disp_public = $this->_canShow(WT_PRIV_PUBLIC);
}
return $this->disp_public;
case WT_PRIV_USER: // member
- if ($this->disp_user===null) {
- $this->disp_user=$this->_canShow(WT_PRIV_USER);
+ if ($this->disp_user === null) {
+ $this->disp_user = $this->_canShow(WT_PRIV_USER);
}
return $this->disp_user;
case WT_PRIV_NONE: // admin
- if ($this->disp_none===null) {
- $this->disp_none=$this->_canShow(WT_PRIV_NONE);
+ if ($this->disp_none === null) {
+ $this->disp_none = $this->_canShow(WT_PRIV_NONE);
}
return $this->disp_none;
case WT_PRIV_HIDE: // hidden from admins
@@ -463,7 +463,7 @@ class WT_GedcomRecord {
*
* @return boolean
*/
- public function canShowName($access_level=WT_USER_ACCESS_LEVEL) {
+ public function canShowName($access_level = WT_USER_ACCESS_LEVEL) {
return $this->canShow($access_level);
}
@@ -473,7 +473,7 @@ class WT_GedcomRecord {
* @return boolean
*/
public function canEdit() {
- return WT_USER_GEDCOM_ADMIN || WT_USER_CAN_EDIT && strpos($this->gedcom, "\n1 RESN locked")===false;
+ return WT_USER_GEDCOM_ADMIN || WT_USER_CAN_EDIT && strpos($this->gedcom, "\n1 RESN locked") === false;
}
/**
@@ -485,14 +485,14 @@ class WT_GedcomRecord {
* @return string
*/
public function privatizeGedcom($access_level) {
- if ($access_level==WT_PRIV_HIDE) {
+ if ($access_level == WT_PRIV_HIDE) {
// We may need the original record, for example when downloading a GEDCOM or clippings cart
return $this->gedcom;
} elseif ($this->canShow($access_level)) {
// The record is not private, but the individual facts may be.
// Include the entire first line (for NOTE records)
- list($gedrec)=explode("\n", $this->gedcom, 2);
+ list($gedrec) = explode("\n", $this->gedcom, 2);
// Check each of the facts for access
foreach ($this->getFacts(null, false, $access_level) as $fact) {
@@ -529,7 +529,7 @@ class WT_GedcomRecord {
$this->_getAllNames[] = array(
'type' => $type,
'sort' => preg_replace_callback('/([0-9]+)/', function($matches) { return str_pad($matches[0], 10, '0', STR_PAD_LEFT); }, $value),
- 'full' => '<span dir="auto">'.WT_Filter::escapeHtml($value).'</span>', // This is used for display
+ 'full' => '<span dir="auto">' . WT_Filter::escapeHtml($value) . '</span>', // This is used for display
'fullNN' => $value, // This goes into the database
);
}
@@ -554,7 +554,7 @@ class WT_GedcomRecord {
if (preg_match_all("/^{$level} ({$fact_type}) (.+)((\n[{$sublevel}-9].+)*)/m", $fact->getGedcom(), $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// Treat 1 NAME / 2 TYPE married the same as _MARNM
- if ($match[1]=='NAME' && strpos($match[3], "\n2 TYPE married")!==false) {
+ if ($match[1] == 'NAME' && strpos($match[3], "\n2 TYPE married") !== false) {
$this->addName('_MARNM', $match[2], $fact->getGedcom());
} else {
$this->addName($match[1], $match[2], $fact->getGedcom());
@@ -615,46 +615,46 @@ class WT_GedcomRecord {
public function getPrimaryName() {
if (is_null($this->_getPrimaryName)) {
// Generally, the first name is the primary one....
- $this->_getPrimaryName=0;
+ $this->_getPrimaryName = 0;
// ....except when the language/name use different character sets
- if (count($this->getAllNames())>1) {
+ if (count($this->getAllNames()) > 1) {
switch (WT_LOCALE) {
case 'el':
foreach ($this->getAllNames() as $n=>$name) {
- if ($name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])=='Grek') {
- $this->_getPrimaryName=$n;
+ if ($name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) == 'Grek') {
+ $this->_getPrimaryName = $n;
break;
}
}
break;
case 'ru':
foreach ($this->getAllNames() as $n=>$name) {
- if ($name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])=='Cyrl') {
- $this->_getPrimaryName=$n;
+ if ($name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) == 'Cyrl') {
+ $this->_getPrimaryName = $n;
break;
}
}
break;
case 'he':
foreach ($this->getAllNames() as $n=>$name) {
- if ($name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])=='Hebr') {
- $this->_getPrimaryName=$n;
+ if ($name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) == 'Hebr') {
+ $this->_getPrimaryName = $n;
break;
}
}
break;
case 'ar':
foreach ($this->getAllNames() as $n=>$name) {
- if ($name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])=='Arab') {
- $this->_getPrimaryName=$n;
+ if ($name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) == 'Arab') {
+ $this->_getPrimaryName = $n;
break;
}
}
break;
default:
foreach ($this->getAllNames() as $n=>$name) {
- if ($name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])=='Latn') {
- $this->_getPrimaryName=$n;
+ if ($name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) == 'Latn') {
+ $this->_getPrimaryName = $n;
break;
}
}
@@ -673,14 +673,14 @@ class WT_GedcomRecord {
public function getSecondaryName() {
if (is_null($this->_getSecondaryName)) {
// Generally, the primary and secondary names are the same
- $this->_getSecondaryName=$this->getPrimaryName();
+ $this->_getSecondaryName = $this->getPrimaryName();
// ....except when there are names with different character sets
- $all_names=$this->getAllNames();
- if (count($all_names)>1) {
- $primary_script=WT_I18N::textScript($all_names[$this->getPrimaryName()]['sort']);
+ $all_names = $this->getAllNames();
+ if (count($all_names) > 1) {
+ $primary_script = WT_I18N::textScript($all_names[$this->getPrimaryName()]['sort']);
foreach ($all_names as $n=>$name) {
- if ($n!=$this->getPrimaryName() && $name['type']!='_MARNM' && WT_I18N::textScript($name['sort'])!=$primary_script) {
- $this->_getSecondaryName=$n;
+ if ($n != $this->getPrimaryName() && $name['type'] != '_MARNM' && WT_I18N::textScript($name['sort']) != $primary_script) {
+ $this->_getSecondaryName = $n;
break;
}
}
@@ -764,7 +764,7 @@ class WT_GedcomRecord {
* @return null|string
*/
public function getAddName() {
- if ($this->canShowName() && $this->getPrimaryName()!=$this->getSecondaryName()) {
+ if ($this->canShowName() && $this->getPrimaryName() != $this->getSecondaryName()) {
$all_names = $this->getAllNames();
return $all_names[$this->getSecondaryName()]['full'];
} else {
@@ -783,17 +783,17 @@ class WT_GedcomRecord {
*
* @return string
*/
- public function format_list($tag='li', $find=false, $name=null) {
+ public function format_list($tag = 'li', $find = false, $name = null) {
if (is_null($name)) {
- $name=$this->getFullName();
+ $name = $this->getFullName();
}
- $html='<a href="'.$this->getHtmlUrl().'"';
+ $html = '<a href="' . $this->getHtmlUrl() . '"';
if ($find) {
- $html.=' onclick="pasteid(\''.$this->getXref().'\', \'' . htmlentities($name) . '\');"';
+ $html .= ' onclick="pasteid(\'' . $this->getXref() . '\', \'' . htmlentities($name) . '\');"';
}
- $html.=' class="list_item"><b>'.$name.'</b>';
- $html.=$this->formatListDetails();
- $html='<'.$tag.'>'.$html.'</a></'.$tag.'>';
+ $html .= ' class="list_item"><b>' . $name . '</b>';
+ $html .= $this->formatListDetails();
+ $html = '<' . $tag . '>' . $html . '</a></' . $tag . '>';
return $html;
}
@@ -821,9 +821,9 @@ class WT_GedcomRecord {
if ($event->getDate()->isOK() || !$event->getPlace()->isEmpty()) {
switch ($style) {
case 1:
- return '<br><em>'.$event->getLabel().' '.format_fact_date($event, $this, false, false).' '.format_fact_place($event).'</em>';
+ return '<br><em>' . $event->getLabel() . ' ' . format_fact_date($event, $this, false, false) . ' ' . format_fact_place($event) . '</em>';
case 2:
- return '<dl><dt class="label">'.$event->getLabel().'</dt><dd class="field">'.format_fact_date($event, $this, false, false).' '.format_fact_place($event).'</dd></dl>';
+ return '<dl><dt class="label">' . $event->getLabel() . '</dt><dd class="field">' . format_fact_date($event, $this, false, false) . ' ' . format_fact_place($event) . '</dd></dl>';
}
}
}
@@ -943,13 +943,13 @@ class WT_GedcomRecord {
* @return WT_Note[]
*/
public function linkedNotes($link) {
- $rows=WT_DB::prepare(
- "SELECT o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom".
- " FROM `##other`".
- " JOIN `##link` ON (o_file=l_file AND o_id=l_from)".
- " LEFT JOIN `##name` ON (o_file=n_file AND o_id=n_id AND n_num=0)".
- " WHERE o_file=? AND o_type='NOTE' AND l_type=? AND l_to=?".
- " ORDER BY n_sort COLLATE '".WT_I18N::$collation."'"
+ $rows = WT_DB::prepare(
+ "SELECT o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom" .
+ " FROM `##other`" .
+ " JOIN `##link` ON (o_file=l_file AND o_id=l_from)" .
+ " LEFT JOIN `##name` ON (o_file=n_file AND o_id=n_id AND n_num=0)" .
+ " WHERE o_file=? AND o_type='NOTE' AND l_type=? AND l_to=?" .
+ " ORDER BY n_sort COLLATE '" . WT_I18N::$collation . "'"
)->execute(array($this->gedcom_id, $link, $this->xref))->fetchAll();
$list = array();
@@ -970,13 +970,13 @@ class WT_GedcomRecord {
* @return WT_Repository
*/
public function linkedRepositories($link) {
- $rows=WT_DB::prepare(
- "SELECT o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom".
- " FROM `##other`".
- " JOIN `##link` ON (o_file=l_file AND o_id=l_from)".
- " LEFT JOIN `##name` ON (o_file=n_file AND o_id=n_id AND n_num=0)".
- " WHERE o_file=? AND o_type='REPO' AND l_type=? AND l_to=?".
- " ORDER BY n_sort COLLATE '".WT_I18N::$collation."'"
+ $rows = WT_DB::prepare(
+ "SELECT o_id AS xref, o_file AS gedcom_id, o_gedcom AS gedcom" .
+ " FROM `##other`" .
+ " JOIN `##link` ON (o_file=l_file AND o_id=l_from)" .
+ " LEFT JOIN `##name` ON (o_file=n_file AND o_id=n_id AND n_num=0)" .
+ " WHERE o_file=? AND o_type='REPO' AND l_type=? AND l_to=?" .
+ " ORDER BY n_sort COLLATE '" . WT_I18N::$collation . "'"
)->execute(array($this->gedcom_id, $link, $this->xref))->fetchAll();
$list = array();
@@ -1058,11 +1058,11 @@ class WT_GedcomRecord {
*
* @return WT_Fact[]
*/
- public function getFacts($filter=null, $sort=false, $access_level=WT_USER_ACCESS_LEVEL, $override=false) {
- $facts=array();
+ public function getFacts($filter = null, $sort = false, $access_level = WT_USER_ACCESS_LEVEL, $override = false) {
+ $facts = array();
if ($this->canShow($access_level) || $override) {
foreach ($this->facts as $fact) {
- if (($filter==null || preg_match('/^' . $filter . '$/', $fact->getTag())) && $fact->canShow($access_level)) {
+ if (($filter == null || preg_match('/^' . $filter . '$/', $fact->getTag())) && $fact->canShow($access_level)) {
$facts[] = $fact;
}
}
@@ -1081,18 +1081,18 @@ class WT_GedcomRecord {
*
* @return string
*/
- public function lastChangeTimestamp($sorting=false) {
+ public function lastChangeTimestamp($sorting = false) {
$chan = $this->getFirstFact('CHAN');
if ($chan) {
// The record does have a CHAN event
$d = $chan->getDate()->MinDate();
if (preg_match('/\n3 TIME (\d\d):(\d\d):(\d\d)/', $chan->getGedcom(), $match)) {
- $t=mktime((int)$match[1], (int)$match[2], (int)$match[3], (int)$d->format('%n'), (int)$d->format('%j'), (int)$d->format('%Y'));
+ $t = mktime((int) $match[1], (int) $match[2], (int) $match[3], (int) $d->format('%n'), (int) $d->format('%j'), (int) $d->format('%Y'));
} elseif (preg_match('/\n3 TIME (\d\d):(\d\d)/', $chan->getGedcom(), $match)) {
- $t=mktime((int)$match[1], (int)$match[2], 0, (int)$d->format('%n'), (int)$d->format('%j'), (int)$d->format('%Y'));
+ $t = mktime((int) $match[1], (int) $match[2], 0, (int) $d->format('%n'), (int) $d->format('%j'), (int) $d->format('%Y'));
} else {
- $t=mktime(0, 0, 0, (int)$d->format('%n'), (int)$d->format('%j'), (int)$d->format('%Y'));
+ $t = mktime(0, 0, 0, (int) $d->format('%n'), (int) $d->format('%j'), (int) $d->format('%Y'));
}
if ($sorting) {
return $t;
@@ -1163,7 +1163,7 @@ class WT_GedcomRecord {
$gedcom = preg_replace('/[\r\n]+/', "\n", $gedcom);
$gedcom = trim($gedcom);
- if ($this->pending==='') {
+ if ($this->pending === '') {
throw new Exception('Cannot edit a deleted record');
}
if ($gedcom && !preg_match('/^1 ' . WT_REGEX_TAG . '/', $gedcom)) {
@@ -1187,7 +1187,7 @@ class WT_GedcomRecord {
$new_gedcom .= "\n" . $gedcom;
}
$fact_id = true; // Only replace/delete one copy of a duplicate fact
- } elseif ($fact->getTag()!='CHAN' || !$update_chan) {
+ } elseif ($fact->getTag() != 'CHAN' || !$update_chan) {
$new_gedcom .= "\n" . $fact->getGedcom();
}
}
@@ -1240,7 +1240,7 @@ class WT_GedcomRecord {
} else {
throw new Exception('Invalid argument to WT_GedcomRecord::createRecord(' . $gedcom . ')');
}
- if (strpos("\r", $gedcom)!==false) {
+ if (strpos("\r", $gedcom) !== false) {
// MSDOS line endings will break things in horrible ways
throw new Exception('Evil line endings found in WT_GedcomRecord::createRecord(' . $gedcom . ')');
}
@@ -1366,7 +1366,7 @@ class WT_GedcomRecord {
foreach ($matches as $match) {
$next_level = $match[1] + 1;
$next_levels = '[' . $next_level . '-9]';
- $gedcom = preg_replace('/' . $match[0] . '(\n' . $next_levels .'.*)*/', '', $gedcom);
+ $gedcom = preg_replace('/' . $match[0] . '(\n' . $next_levels . '.*)*/', '', $gedcom);
}
$this->updateFact($fact->getFactId(), $gedcom, $update_chan);
}
diff --git a/library/WT/I18N.php b/library/WT/I18N.php
index 81360989a7..4258d6c9bf 100644
--- a/library/WT/I18N.php
+++ b/library/WT/I18N.php
@@ -227,16 +227,16 @@ class WT_I18N {
}
$prefs2 = array();
foreach ($prefs as $pref) {
- list($l, $q)=explode(';q=', $pref.';q=1.0');
+ list($l, $q) = explode(';q=', $pref . ';q=1.0');
$l = preg_replace_callback(
'/_[a-z][a-z]$/',
function($x) { return strtoupper($x[0]); },
str_replace('-', '_', $l)
); // en-gb => en_GB
if (array_key_exists($l, $prefs2)) {
- $prefs2[$l] = max((float)$q, $prefs2[$l]);
+ $prefs2[$l] = max((float) $q, $prefs2[$l]);
} else {
- $prefs2[$l] = (float)$q;
+ $prefs2[$l] = (float) $q;
}
}
// Ensure there is a fallback.
@@ -263,10 +263,10 @@ class WT_I18N {
if (is_dir(WT_DATA_DIR . 'language')) {
if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.mo')) {
self::addTranslation(
- new Zend_Translate('gettext', WT_DATA_DIR.'language/' . $locale . '.mo', $locale)
+ new Zend_Translate('gettext', WT_DATA_DIR . 'language/' . $locale . '.mo', $locale)
);
}
- if (file_exists(WT_DATA_DIR.'language/' . $locale . '.php')) {
+ if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.php')) {
self::addTranslation(
new Zend_Translate('array', WT_DATA_DIR . 'language/' . $locale . '.php', $locale)
);
@@ -331,7 +331,7 @@ class WT_I18N {
* @return array
*/
public static function installed_languages() {
- $mo_files = glob(WT_ROOT.'language'.DIRECTORY_SEPARATOR.'*.mo');
+ $mo_files = glob(WT_ROOT . 'language' . DIRECTORY_SEPARATOR . '*.mo');
$cache_key = md5(serialize($mo_files));
if (!($installed_languages = self::$cache->load($cache_key))) {
@@ -375,10 +375,10 @@ class WT_I18N {
* @return string
*/
public static function html_markup() {
- $localeData=Zend_Locale_Data::getList(self::$locale, 'layout');
- $dir=$localeData['characterOrder']=='right-to-left' ? 'rtl' : 'ltr';
+ $localeData = Zend_Locale_Data::getList(self::$locale, 'layout');
+ $dir = $localeData['characterOrder'] == 'right-to-left' ? 'rtl' : 'ltr';
list($lang) = preg_split('/[-_@]/', self::$locale);
- return 'lang="'.$lang.'" dir="'.$dir.'"';
+ return 'lang="' . $lang . '" dir="' . $dir . '"';
}
/**
@@ -394,10 +394,10 @@ class WT_I18N {
*
* @return string
*/
- public static function number($n, $precision=0) {
+ public static function number($n, $precision = 0) {
// Add "punctuation" and convert digits
- $n=Zend_Locale_Format::toNumber($n, array('locale'=>WT_LOCALE, 'precision'=>$precision));
- $n=self::digits($n);
+ $n = Zend_Locale_Format::toNumber($n, array('locale'=>WT_LOCALE, 'precision'=>$precision));
+ $n = self::digits($n);
return $n;
}
@@ -431,10 +431,10 @@ class WT_I18N {
*
* @return string
*/
- public static function percentage($n, $precision=0) {
+ public static function percentage($n, $precision = 0) {
return
/* I18N: This is a percentage, such as “32.5%”. “%s” is the number, “%%” is the percent symbol. Some languages require a (non-breaking) space between the two, or a different symbol. */
- self::translate('%s%%', self::number($n*100.0, $precision));
+ self::translate('%s%%', self::number($n * 100.0, $precision));
}
/**
@@ -527,29 +527,29 @@ class WT_I18N {
// I18N: Description of an individual’s age at an event. For example, Died 14 Jan 1900 (in childhood)
return self::translate('(in childhood)');
}
- $age=array();
+ $age = array();
if (preg_match('/(\d+)y/', $string, $match)) {
// I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
- $years=$match[1];
- $age[]=self::plural('%s year', '%s years', $years, self::number($years));
+ $years = $match[1];
+ $age[] = self::plural('%s year', '%s years', $years, self::number($years));
} else {
- $years=-1;
+ $years = -1;
}
if (preg_match('/(\d+)m/', $string, $match)) {
// I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
- $age[]=self::plural('%s month', '%s months', $match[1], self::number($match[1]));
+ $age[] = self::plural('%s month', '%s months', $match[1], self::number($match[1]));
}
if (preg_match('/(\d+)w/', $string, $match)) {
// I18N: Part of an age string. e.g. 7 weeks and 3 days
- $age[]=self::plural('%s week', '%s weeks', $match[1], self::number($match[1]));
+ $age[] = self::plural('%s week', '%s weeks', $match[1], self::number($match[1]));
}
if (preg_match('/(\d+)d/', $string, $match)) {
// I18N: Part of an age string. e.g. 5 years, 4 months and 3 days
- $age[]=self::plural('%s day', '%s days', $match[1], self::number($match[1]));
+ $age[] = self::plural('%s day', '%s days', $match[1], self::number($match[1]));
}
// If an age is just a number of years, only show the number
- if (count($age)==1 && $years>=0) {
- $age=$years;
+ if (count($age) == 1 && $years >= 0) {
+ $age = $years;
}
if ($age) {
if (!substr_compare($string, '<', 0, 1)) {
@@ -582,20 +582,20 @@ class WT_I18N {
$month = 30 * $day;
$year = 365 * $day;
- if ($seconds>$year) {
- $years=(int)($seconds/$year);
+ if ($seconds > $year) {
+ $years = (int) ($seconds / $year);
return self::plural('%s year ago', '%s years ago', $years, self::number($years));
- } elseif ($seconds>$month) {
- $months=(int)($seconds/$month);
+ } elseif ($seconds > $month) {
+ $months = (int) ($seconds / $month);
return self::plural('%s month ago', '%s months ago', $months, self::number($months));
- } elseif ($seconds>$day) {
- $days=(int)($seconds/$day);
+ } elseif ($seconds > $day) {
+ $days = (int) ($seconds / $day);
return self::plural('%s day ago', '%s days ago', $days, self::number($days));
- } elseif ($seconds>$hour) {
- $hours=(int)($seconds/$hour);
+ } elseif ($seconds > $hour) {
+ $hours = (int) ($seconds / $hour);
return self::plural('%s hour ago', '%s hours ago', $hours, self::number($hours));
- } elseif ($seconds>$minute) {
- $minutes=(int)($seconds/$minute);
+ } elseif ($seconds > $minute) {
+ $minutes = (int) ($seconds / $minute);
return self::plural('%s minute ago', '%s minutes ago', $minutes, self::number($minutes));
} else {
return self::plural('%s second ago', '%s seconds ago', $seconds, self::number($seconds));
@@ -646,8 +646,8 @@ class WT_I18N {
* @return string
*/
public static function textScript($string) {
- $string = strip_tags($string); // otherwise HTML tags show up as latin
- $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8'); // otherwise HTML entities show up as latin
+ $string = strip_tags($string); // otherwise HTML tags show up as latin
+ $string = html_entity_decode($string, ENT_QUOTES, 'UTF-8'); // otherwise HTML entities show up as latin
$string = str_replace(array('@N.N.', '@P.N.'), '', $string); // otherwise unknown names show up as latin
$pos = 0;
$strlen = strlen($string);
@@ -761,16 +761,16 @@ class WT_I18N {
$byte1 = ord($string1[$strpos1]);
$byte2 = ord($string2[$strpos2]);
if (($byte1 & 0xE0) == 0xC0) {
- $chr1 = $string1[$strpos1++].$string1[$strpos1++];
+ $chr1 = $string1[$strpos1++] . $string1[$strpos1++];
} elseif (($byte1 & 0xF0) == 0xE0) {
- $chr1 = $string1[$strpos1++].$string1[$strpos1++].$string1[$strpos1++];
+ $chr1 = $string1[$strpos1++] . $string1[$strpos1++] . $string1[$strpos1++];
} else {
$chr1 = $string1[$strpos1++];
}
- if (($byte2 & 0xE0)==0xC0) {
- $chr2 = $string2[$strpos2++].$string2[$strpos2++];
- } elseif (($byte2 & 0xF0)==0xE0) {
- $chr2 = $string2[$strpos2++].$string2[$strpos2++].$string2[$strpos2++];
+ if (($byte2 & 0xE0) == 0xC0) {
+ $chr2 = $string2[$strpos2++] . $string2[$strpos2++];
+ } elseif (($byte2 & 0xF0) == 0xE0) {
+ $chr2 = $string2[$strpos2++] . $string2[$strpos2++] . $string2[$strpos2++];
} else {
$chr2 = $string2[$strpos2++];
}
@@ -865,80 +865,80 @@ class WT_I18N {
*
* @return string
*/
- public static function datatablesI18N(array $lengths=null) {
- if ($lengths===null) {
- $lengths=array(10, 20, 30, 50, 100, -1);
+ public static function datatablesI18N(array $lengths = null) {
+ if ($lengths === null) {
+ $lengths = array(10, 20, 30, 50, 100, -1);
}
- $length_menu='';
+ $length_menu = '';
foreach ($lengths as $length) {
- $length_menu.=
- '<option value="'.$length.'">'.
- ($length==-1 ? /* I18N: listbox option, e.g. “10,25,50,100,all” */ self::translate('All') : self::number($length)).
+ $length_menu .=
+ '<option value="' . $length . '">' .
+ ($length == -1 ? /* I18N: listbox option, e.g. “10,25,50,100,all” */ self::translate('All') : self::number($length)) .
'</option>';
}
- $length_menu='<select>'.$length_menu.'</select>';
- $length_menu=/* I18N: Display %s [records per page], %s is a placeholder for listbox containing numeric options */ self::translate('Display %s', $length_menu);
+ $length_menu = '<select>' . $length_menu . '</select>';
+ $length_menu = /* I18N: Display %s [records per page], %s is a placeholder for listbox containing numeric options */ self::translate('Display %s', $length_menu);
// Which symbol is used for separating numbers into groups
$symbols = Zend_Locale_Data::getList(self::$locale, 'symbols');
// Which digits are used for numbers
$digits = Zend_Locale_Data::getContent(self::$locale, 'numberingsystem', self::$numbering_system);
- if ($digits=='0123456789') {
- $callback='';
+ if ($digits == '0123456789') {
+ $callback = '';
} else {
- $callback=',
+ $callback = ',
"infoCallback": function(oSettings, iStart, iEnd, iMax, iTotal, sPre) {
return sPre
- .replace(/0/g, "'.mb_substr($digits, 0, 1).'")
- .replace(/1/g, "'.mb_substr($digits, 1, 1).'")
- .replace(/2/g, "'.mb_substr($digits, 2, 1).'")
- .replace(/3/g, "'.mb_substr($digits, 3, 1).'")
- .replace(/4/g, "'.mb_substr($digits, 4, 1).'")
- .replace(/5/g, "'.mb_substr($digits, 5, 1).'")
- .replace(/6/g, "'.mb_substr($digits, 6, 1).'")
- .replace(/7/g, "'.mb_substr($digits, 7, 1).'")
- .replace(/8/g, "'.mb_substr($digits, 8, 1).'")
- .replace(/9/g, "'.mb_substr($digits, 9, 1).'");
+ .replace(/0/g, "'.mb_substr($digits, 0, 1) . '")
+ .replace(/1/g, "'.mb_substr($digits, 1, 1) . '")
+ .replace(/2/g, "'.mb_substr($digits, 2, 1) . '")
+ .replace(/3/g, "'.mb_substr($digits, 3, 1) . '")
+ .replace(/4/g, "'.mb_substr($digits, 4, 1) . '")
+ .replace(/5/g, "'.mb_substr($digits, 5, 1) . '")
+ .replace(/6/g, "'.mb_substr($digits, 6, 1) . '")
+ .replace(/7/g, "'.mb_substr($digits, 7, 1) . '")
+ .replace(/8/g, "'.mb_substr($digits, 8, 1) . '")
+ .replace(/9/g, "'.mb_substr($digits, 9, 1) . '");
},
"formatNumber": function(iIn) {
return String(iIn)
- .replace(/0/g, "'.mb_substr($digits, 0, 1).'")
- .replace(/1/g, "'.mb_substr($digits, 1, 1).'")
- .replace(/2/g, "'.mb_substr($digits, 2, 1).'")
- .replace(/3/g, "'.mb_substr($digits, 3, 1).'")
- .replace(/4/g, "'.mb_substr($digits, 4, 1).'")
- .replace(/5/g, "'.mb_substr($digits, 5, 1).'")
- .replace(/6/g, "'.mb_substr($digits, 6, 1).'")
- .replace(/7/g, "'.mb_substr($digits, 7, 1).'")
- .replace(/8/g, "'.mb_substr($digits, 8, 1).'")
- .replace(/9/g, "'.mb_substr($digits, 9, 1).'");
+ .replace(/0/g, "'.mb_substr($digits, 0, 1) . '")
+ .replace(/1/g, "'.mb_substr($digits, 1, 1) . '")
+ .replace(/2/g, "'.mb_substr($digits, 2, 1) . '")
+ .replace(/3/g, "'.mb_substr($digits, 3, 1) . '")
+ .replace(/4/g, "'.mb_substr($digits, 4, 1) . '")
+ .replace(/5/g, "'.mb_substr($digits, 5, 1) . '")
+ .replace(/6/g, "'.mb_substr($digits, 6, 1) . '")
+ .replace(/7/g, "'.mb_substr($digits, 7, 1) . '")
+ .replace(/8/g, "'.mb_substr($digits, 8, 1) . '")
+ .replace(/9/g, "'.mb_substr($digits, 9, 1) . '");
}
';
}
return
- '"language": {'.
- ' "paginate": {'.
- ' "first": "'./* I18N: button label, first page */ self::translate('first').'",'.
- ' "last": "'./* I18N: button label, last page */ self::translate('last').'",'.
- ' "next": "'./* I18N: button label, next page */ self::translate('next').'",'.
- ' "previous": "'./* I18N: button label, previous page */ self::translate('previous').'"'.
- ' },'.
- ' "emptyTable": "'.self::translate('No records to display').'",'.
- ' "info": "'./* I18N: %s are placeholders for numbers */ self::translate('Showing %1$s to %2$s of %3$s', '_START_', '_END_', '_TOTAL_').'",'.
- ' "infoEmpty": "'.self::translate('Showing %1$s to %2$s of %3$s', 0, 0, 0).'",'.
- ' "infoFiltered": "'./* I18N: %s is a placeholder for a number */ self::translate('(filtered from %s total entries)', '_MAX_').'",'.
- ' "infoPostfix": "",'.
- ' "infoThousands": "'.$symbols['group'].'",'.
- ' "lengthMenu": "'.WT_Filter::escapeJs($length_menu).'",'.
- ' "loadingRecords": "'.self::translate('Loading…').'",'.
- ' "processing": "'.self::translate('Loading…').'",'.
- ' "search": "'.self::translate('Filter').'",'.
- ' "url": "",'.
- ' "zeroRecords": "'.self::translate('No records to display').'"'.
- '}'.
+ '"language": {' .
+ ' "paginate": {' .
+ ' "first": "' . /* I18N: button label, first page */ self::translate('first') . '",' .
+ ' "last": "' . /* I18N: button label, last page */ self::translate('last') . '",' .
+ ' "next": "' . /* I18N: button label, next page */ self::translate('next') . '",' .
+ ' "previous": "' . /* I18N: button label, previous page */ self::translate('previous') . '"' .
+ ' },' .
+ ' "emptyTable": "' . self::translate('No records to display') . '",' .
+ ' "info": "' . /* I18N: %s are placeholders for numbers */ self::translate('Showing %1$s to %2$s of %3$s', '_START_', '_END_', '_TOTAL_') . '",' .
+ ' "infoEmpty": "' . self::translate('Showing %1$s to %2$s of %3$s', 0, 0, 0) . '",' .
+ ' "infoFiltered": "' . /* I18N: %s is a placeholder for a number */ self::translate('(filtered from %s total entries)', '_MAX_') . '",' .
+ ' "infoPostfix": "",' .
+ ' "infoThousands": "' . $symbols['group'] . '",' .
+ ' "lengthMenu": "' . WT_Filter::escapeJs($length_menu) . '",' .
+ ' "loadingRecords": "' . self::translate('Loading…') . '",' .
+ ' "processing": "' . self::translate('Loading…') . '",' .
+ ' "search": "' . self::translate('Filter') . '",' .
+ ' "url": "",' .
+ ' "zeroRecords": "' . self::translate('No records to display') . '"' .
+ '}' .
$callback;
}
}
diff --git a/library/WT/Individual.php b/library/WT/Individual.php
index bb98fc1edf..37663f6262 100644
--- a/library/WT/Individual.php
+++ b/library/WT/Individual.php
@@ -660,7 +660,7 @@ class WT_Individual extends WT_GedcomRecord {
if ($min && $max) {
$gregorian_calendar = new GregorianCalendar;
- list($year) = $gregorian_calendar->jdToYmd((int)((max($min) + min($max)) / 2));
+ list($year) = $gregorian_calendar->jdToYmd((int) ((max($min) + min($max)) / 2));
$this->_getEstimatedBirthDate = new WT_Date('EST ' . $year);
} else {
$this->_getEstimatedBirthDate = new WT_Date(''); // always return a date object
@@ -1096,7 +1096,7 @@ class WT_Individual extends WT_GedcomRecord {
// Extract the structured name parts - use for "sortable" names and indexes
////////////////////////////////////////////////////////////////////////////
- $sublevel = 1 + (int)$gedcom[0];
+ $sublevel = 1 + (int) $gedcom[0];
$NPFX = preg_match("/\n{$sublevel} NPFX (.+)/", $gedcom, $match) ? $match[1] : '';
$GIVN = preg_match("/\n{$sublevel} GIVN (.+)/", $gedcom, $match) ? $match[1] : '';
$SURN = preg_match("/\n{$sublevel} SURN (.+)/", $gedcom, $match) ? $match[1] : '';
@@ -1152,9 +1152,9 @@ class WT_Individual extends WT_GedcomRecord {
$GIVN = preg_replace(
array(
'/ ?\/.*\/ ?/', // remove surname
- '/ ?".+"/', // remove nickname
- '/ {2,}/', // multiple spaces, caused by the above
- '/^ | $/', // leading/trailing spaces, caused by the above
+ '/ ?".+"/', // remove nickname
+ '/ {2,}/', // multiple spaces, caused by the above
+ '/^ | $/', // leading/trailing spaces, caused by the above
),
array(
' ',
@@ -1248,11 +1248,11 @@ class WT_Individual extends WT_GedcomRecord {
$this->_getAllNames[] = array(
'type' => $type,
'sort' => $SURN . ',' . $GIVN,
- 'full' => $full, // This is used for display
- 'fullNN' => $fullNN, // This goes into the database
+ 'full' => $full, // This is used for display
+ 'fullNN' => $fullNN, // This goes into the database
'surname' => $surname, // This goes into the database
- 'givn' => $GIVN, // This goes into the database
- 'surn' => $SURN, // This goes into the database
+ 'givn' => $GIVN, // This goes into the database
+ 'surn' => $SURN, // This goes into the database
);
}
}
diff --git a/library/WT/Mail.php b/library/WT/Mail.php
index bae0190c3a..8a0a0e76c6 100644
--- a/library/WT/Mail.php
+++ b/library/WT/Mail.php
@@ -58,13 +58,13 @@ class WT_Mail {
try {
$mail = new Zend_Mail('UTF-8');
$mail
- ->setSubject ($subject)
+ ->setSubject($subject)
->setBodyHtml($message)
->setBodyText(WT_Filter::unescapeHtml($message))
- ->setFrom (WT_Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))
- ->addTo ($to_email, $to_name)
- ->setReplyTo ($replyto_email, $replyto_name)
- ->send (WT_Mail::transport());
+ ->setFrom(WT_Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'))
+ ->addTo($to_email, $to_name)
+ ->setReplyTo($replyto_email, $replyto_name)
+ ->send(WT_Mail::transport());
} catch (Exception $ex) {
Log::addErrorLog('Mail: ' . $ex->getMessage());
@@ -87,7 +87,7 @@ class WT_Mail {
public static function systemMessage(WT_Tree $tree, User $user, $subject, $message) {
return self::send(
$tree,
- $user->getEmail(), $user->getRealName(),
+ $user->getEmail(), $user->getRealName(),
WT_Site::getPreference('SMTP_FROM_NAME'), $tree->getPreference('title'),
$subject,
$message
diff --git a/library/WT/Media.php b/library/WT/Media.php
index ac46902f8c..c37ff8dd32 100644
--- a/library/WT/Media.php
+++ b/library/WT/Media.php
@@ -259,7 +259,7 @@ class WT_Media extends WT_GedcomRecord {
public function getFilesize($which = 'main') {
$size = $this->getFilesizeraw($which);
if ($size) {
- $size = (int)(($size + 1023) / 1024);
+ $size = (int) (($size + 1023) / 1024);
} // add some bytes to be sure we never return “0 KB”
return /* I18N: size of file in KB */
WT_I18N::translate('%s KB', WT_I18N::number($size));
diff --git a/library/WT/Module.php b/library/WT/Module.php
index e3d9dd33d5..3fe9d6dae1 100644
--- a/library/WT/Module.php
+++ b/library/WT/Module.php
@@ -217,8 +217,8 @@ abstract class WT_Module {
}
}
if ($sort && !$sorted) {
- $sorted = uasort($modules, function (WT_Module $x, WT_MOdule $y) {
- return WT_I18N::strcasecmp((string)$x, (string)$y);
+ $sorted = uasort($modules, function(WT_Module $x, WT_MOdule $y) {
+ return WT_I18N::strcasecmp((string) $x, (string) $y);
});
}
@@ -268,8 +268,8 @@ abstract class WT_Module {
// The order of some modules is defined by the user. Others are sorted by name.
if ($component !== 'menu' && $component !== 'sidebar' && $component !== 'tab') {
- uasort($array, function (WT_Module $x, WT_Module $y) {
- return WT_I18N::strcasecmp((string)$x, (string)$y);
+ uasort($array, function(WT_Module $x, WT_Module $y) {
+ return WT_I18N::strcasecmp((string) $x, (string) $y);
});
}
diff --git a/library/WT/Place.php b/library/WT/Place.php
index 55d8b5fd53..d91e31a4bf 100644
--- a/library/WT/Place.php
+++ b/library/WT/Place.php
@@ -21,8 +21,8 @@
*/
class WT_Place {
const GEDCOM_SEPARATOR = ', ';
- private $gedcom_place; // e.g. array("Westminster", "London", "England")
- private $gedcom_id; // We may have the same place in different trees
+ private $gedcom_place; // e.g. array("Westminster", "London", "England")
+ private $gedcom_id; // We may have the same place in different trees
/**
* @param string $gedcom_place
@@ -30,12 +30,12 @@ class WT_Place {
*/
public function __construct($gedcom_place, $gedcom_id) {
if ($gedcom_place) {
- $this->gedcom_place=explode(self::GEDCOM_SEPARATOR, $gedcom_place);
+ $this->gedcom_place = explode(self::GEDCOM_SEPARATOR, $gedcom_place);
} else {
// Empty => "Top level"
- $this->gedcom_place=array();
+ $this->gedcom_place = array();
}
- $this->gedcom_id=$gedcom_id;
+ $this->gedcom_id = $gedcom_id;
}
/**
@@ -160,13 +160,13 @@ class WT_Place {
// Abbreviate the place name, for lists
if ($SHOW_PEDIGREE_PLACES_SUFFIX) {
// The *last* $SHOW_PEDIGREE_PLACES components
- $short_name=implode(self::GEDCOM_SEPARATOR, array_slice($this->gedcom_place, -$SHOW_PEDIGREE_PLACES));
+ $short_name = implode(self::GEDCOM_SEPARATOR, array_slice($this->gedcom_place, -$SHOW_PEDIGREE_PLACES));
} else {
// The *first* $SHOW_PEDIGREE_PLACES components
- $short_name=implode(self::GEDCOM_SEPARATOR, array_slice($this->gedcom_place, 0, $SHOW_PEDIGREE_PLACES));
+ $short_name = implode(self::GEDCOM_SEPARATOR, array_slice($this->gedcom_place, 0, $SHOW_PEDIGREE_PLACES));
}
// Add a tool-tip showing the full name
- return '<span title="'.WT_Filter::escapeHtml($this->getGedcomName()).'" dir="auto">'.WT_Filter::escapeHtml($short_name).'</span>';
+ return '<span title="' . WT_Filter::escapeHtml($this->getGedcomName()) . '" dir="auto">' . WT_Filter::escapeHtml($short_name) . '</span>';
}
}
@@ -190,26 +190,26 @@ class WT_Place {
* @return string[]
*/
public static function allPlaces($gedcom_id) {
- $places=array();
- $rows=
+ $places = array();
+ $rows =
WT_DB::prepare(
- "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)".
- " FROM `##places` AS p1".
- " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)".
- " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)".
- " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)".
- " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)".
- " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)".
- " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)".
- " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)".
- " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)".
- " WHERE p1.p_file=?".
- " ORDER BY CONCAT_WS(', ', p9.p_place, p8.p_place, p7.p_place, p6.p_place, p5.p_place, p4.p_place, p3.p_place, p2.p_place, p1.p_place) COLLATE '".WT_I18N::$collation."'"
+ "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)" .
+ " FROM `##places` AS p1" .
+ " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)" .
+ " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)" .
+ " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)" .
+ " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)" .
+ " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)" .
+ " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)" .
+ " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)" .
+ " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)" .
+ " WHERE p1.p_file=?" .
+ " ORDER BY CONCAT_WS(', ', p9.p_place, p8.p_place, p7.p_place, p6.p_place, p5.p_place, p4.p_place, p3.p_place, p2.p_place, p1.p_place) COLLATE '" . WT_I18N::$collation . "'"
)
->execute(array($gedcom_id))
->fetchOneColumn();
foreach ($rows as $row) {
- $places[]=new WT_Place($row, $gedcom_id);
+ $places[] = new WT_Place($row, $gedcom_id);
}
return $places;
}
@@ -221,26 +221,26 @@ class WT_Place {
* @return WT_Place[]
*/
public static function findPlaces($filter, $gedcom_id) {
- $places=array();
- $rows=
+ $places = array();
+ $rows =
WT_DB::prepare(
- "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)".
- " FROM `##places` AS p1".
- " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)".
- " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)".
- " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)".
- " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)".
- " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)".
- " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)".
- " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)".
- " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)".
- " WHERE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) LIKE CONCAT('%', ?, '%') AND CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) NOT LIKE CONCAT('%,%', ?, '%') AND p1.p_file=?".
- " ORDER BY CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) COLLATE '".WT_I18N::$collation."'"
+ "SELECT SQL_CACHE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place)" .
+ " FROM `##places` AS p1" .
+ " LEFT JOIN `##places` AS p2 ON (p1.p_parent_id=p2.p_id)" .
+ " LEFT JOIN `##places` AS p3 ON (p2.p_parent_id=p3.p_id)" .
+ " LEFT JOIN `##places` AS p4 ON (p3.p_parent_id=p4.p_id)" .
+ " LEFT JOIN `##places` AS p5 ON (p4.p_parent_id=p5.p_id)" .
+ " LEFT JOIN `##places` AS p6 ON (p5.p_parent_id=p6.p_id)" .
+ " LEFT JOIN `##places` AS p7 ON (p6.p_parent_id=p7.p_id)" .
+ " LEFT JOIN `##places` AS p8 ON (p7.p_parent_id=p8.p_id)" .
+ " LEFT JOIN `##places` AS p9 ON (p8.p_parent_id=p9.p_id)" .
+ " WHERE CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) LIKE CONCAT('%', ?, '%') AND CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) NOT LIKE CONCAT('%,%', ?, '%') AND p1.p_file=?" .
+ " ORDER BY CONCAT_WS(', ', p1.p_place, p2.p_place, p3.p_place, p4.p_place, p5.p_place, p6.p_place, p7.p_place, p8.p_place, p9.p_place) COLLATE '" . WT_I18N::$collation . "'"
)
->execute(array($filter, preg_quote($filter), $gedcom_id))
->fetchOneColumn();
foreach ($rows as $row) {
- $places[]=new WT_Place($row, $gedcom_id);
+ $places[] = new WT_Place($row, $gedcom_id);
}
return $places;
}
diff --git a/library/WT/Query/Admin.php b/library/WT/Query/Admin.php
index 199e365934..1e930f55f0 100644
--- a/library/WT/Query/Admin.php
+++ b/library/WT/Query/Admin.php
@@ -18,8 +18,8 @@ class WT_Query_Admin {
public static function countIndiChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -37,8 +37,8 @@ class WT_Query_Admin {
public static function countIndiChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -56,8 +56,8 @@ class WT_Query_Admin {
public static function countIndiChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##individuals` ON (gedcom_id=i_file AND i_id=xref)" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -75,8 +75,8 @@ class WT_Query_Admin {
public static function countFamChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -94,8 +94,8 @@ class WT_Query_Admin {
public static function countFamChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -113,8 +113,8 @@ class WT_Query_Admin {
public static function countFamChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##families` ON (gedcom_id=f_file AND f_id=xref)" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -132,8 +132,8 @@ class WT_Query_Admin {
public static function countSourChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -151,8 +151,8 @@ class WT_Query_Admin {
public static function countSourChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -170,8 +170,8 @@ class WT_Query_Admin {
public static function countSourChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##sources` ON (gedcom_id=s_file AND s_id=xref)" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -189,8 +189,8 @@ class WT_Query_Admin {
public static function countRepoChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -208,8 +208,8 @@ class WT_Query_Admin {
public static function countRepoChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -227,8 +227,8 @@ class WT_Query_Admin {
public static function countRepoChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='REPO')" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -246,8 +246,8 @@ class WT_Query_Admin {
public static function countNoteChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -265,8 +265,8 @@ class WT_Query_Admin {
public static function countNoteChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -284,8 +284,8 @@ class WT_Query_Admin {
public static function countNoteChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##other` ON (gedcom_id=o_file AND o_id=xref AND o_type='NOTE')" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -303,8 +303,8 @@ class WT_Query_Admin {
public static function countObjeChangesToday($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)" .
" WHERE status='accepted' AND DATE(change_time)= DATE(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -322,8 +322,8 @@ class WT_Query_Admin {
public static function countObjeChangesWeek($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)" .
" WHERE status='accepted' AND WEEK(change_time,2)= WEEK(NOW(),2) AND gedcom_id=?"
)
->execute(array($ged_id))
@@ -341,8 +341,8 @@ class WT_Query_Admin {
public static function countObjeChangesMonth($ged_id) {
return WT_I18N::number(
WT_DB::prepare(
- "SELECT count(change_id) FROM `##change`".
- " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)".
+ "SELECT count(change_id) FROM `##change`" .
+ " JOIN `##media` ON (gedcom_id=m_file AND m_id=xref)" .
" WHERE status='accepted' AND MONTH(change_time)= MONTH(NOW()) AND gedcom_id=?"
)
->execute(array($ged_id))
diff --git a/library/WT/Query/Media.php b/library/WT/Query/Media.php
index 0d23e1e06d..8842db9c9b 100644
--- a/library/WT/Query/Media.php
+++ b/library/WT/Query/Media.php
@@ -24,7 +24,7 @@ class WT_Query_Media {
" ORDER BY 1"
)->execute(array(WT_GED_ID))->fetchOneColumn();
- if (!$folders || reset($folders)!='') {
+ if (!$folders || reset($folders) != '') {
array_unshift($folders, '');
}
diff --git a/library/WT/Query/Name.php b/library/WT/Query/Name.php
index a87ef50695..12fa2cf018 100644
--- a/library/WT/Query/Name.php
+++ b/library/WT/Query/Name.php
@@ -18,82 +18,82 @@ class WT_Query_Name {
switch ($locale) {
case 'ar':
return array(
- 'ا','ب','ت','ث','ج','ح','خ','د','ذ','ر','ز','س','ش','ص','ض','ط','ظ','ع','غ','ف','ق','ك','ل','م','ن','ه','و','ي','آ','ة','ى','ی'
+ 'ا', 'ب', 'ت', 'ث', 'ج', 'ح', 'خ', 'د', 'ذ', 'ر', 'ز', 'س', 'ش', 'ص', 'ض', 'ط', 'ظ', 'ع', 'غ', 'ف', 'ق', 'ك', 'ل', 'م', 'ن', 'ه', 'و', 'ي', 'آ', 'ة', 'ى', 'ی'
);
case 'cs':
return array(
- 'A','B','C','D','E','F','G','H','CH','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'CH', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
);
case 'da':
case 'nb':
case 'nn':
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Æ','Ø','Å'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Æ', 'Ø', 'Å'
);
case 'el':
return array(
- 'Α','Β','Γ','Δ','Ε','Ζ','Η','Θ','Ι','Κ','Λ','Μ','Ν','Ξ','Ο','Π','Ρ','Σ','Τ','Υ','Φ','Χ','Ψ','Ω'
+ 'Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ', 'Υ', 'Φ', 'Χ', 'Ψ', 'Ω'
);
case 'es':
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','Ñ','O','P','Q','R','S','T','U','V','W','X','Y','Z'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'Ñ', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
);
case 'et':
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','Š','Z','Ž','T','U','V','W','Õ','Ä','Ö','Ü','X','Y'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'Z', 'Ž', 'T', 'U', 'V', 'W', 'Õ', 'Ä', 'Ö', 'Ü', 'X', 'Y'
);
case 'fi':
case 'sv':
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','Å','Ä','Ö'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Å', 'Ä', 'Ö'
);
case 'he':
return array(
- 'א','ב','ג','ד','ה','ו','ז','ח','ט','י','כ','ל','מ','נ','ס','ע','פ','צ','ק','ר','ש','ת'
+ 'א', 'ב', 'ג', 'ד', 'ה', 'ו', 'ז', 'ח', 'ט', 'י', 'כ', 'ל', 'מ', 'נ', 'ס', 'ע', 'פ', 'צ', 'ק', 'ר', 'ש', 'ת'
);
case 'hu':
return array(
- 'A','B','C','CS','D','DZ','DZS','E','F','G','GY','H','I','J','K','L','LY','M','N','NY','O','Ö','P','Q','R','S','SZ','T','TY','U','Ü','V','W','X','Y','Z','ZS'
+ 'A', 'B', 'C', 'CS', 'D', 'DZ', 'DZS', 'E', 'F', 'G', 'GY', 'H', 'I', 'J', 'K', 'L', 'LY', 'M', 'N', 'NY', 'O', 'Ö', 'P', 'Q', 'R', 'S', 'SZ', 'T', 'TY', 'U', 'Ü', 'V', 'W', 'X', 'Y', 'Z', 'ZS'
);
case 'lt':
return array(
- 'A','Ą','B','C','Č','D','E','Ę','Ė','F','G','H','I','Y','Į','J','K','L','M','N','O','P','R','S','Š','T','U','Ų','Ū','V','Z','Ž'
+ 'A', 'Ą', 'B', 'C', 'Č', 'D', 'E', 'Ę', 'Ė', 'F', 'G', 'H', 'I', 'Y', 'Į', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'T', 'U', 'Ų', 'Ū', 'V', 'Z', 'Ž'
);
case 'nl':
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','IJ'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'IJ'
);
case 'pl':
return array(
- 'A','B','C','Ć','D','E','F','G','H','I','J','K','L','Ł','M','N','O','Ó','P','Q','R','S','Ś','T','U','V','W','X','Y','Z','Ź','Ż'
+ 'A', 'B', 'C', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'O', 'Ó', 'P', 'Q', 'R', 'S', 'Ś', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ź', 'Ż'
);
case 'ro':
return array(
- 'A','Ă','Â','B','C','D','E','F','G','H','I','Î','J','K','L','M','N','O','P','Q','R','S','Ş','T','Ţ','U','V','W','X','Y','Z'
+ 'A', 'Ă', 'Â', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'Î', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Ş', 'T', 'Ţ', 'U', 'V', 'W', 'X', 'Y', 'Z'
);
case 'ru':
return array(
- 'А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я'
+ 'А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я'
);
case 'sk':
return array(
- 'A','Á','Ä','B','C','Č','D','Ď','E','É','F','G','H','I','Í','J','K','L','Ľ','Ĺ','M','N','Ň','O','Ó','Ô','P','Q','R','Ŕ','S','Š','T','Ť','U','Ú','V','W','X','Y','Ý','Z','Ž'
+ 'A', 'Á', 'Ä', 'B', 'C', 'Č', 'D', 'Ď', 'E', 'É', 'F', 'G', 'H', 'I', 'Í', 'J', 'K', 'L', 'Ľ', 'Ĺ', 'M', 'N', 'Ň', 'O', 'Ó', 'Ô', 'P', 'Q', 'R', 'Ŕ', 'S', 'Š', 'T', 'Ť', 'U', 'Ú', 'V', 'W', 'X', 'Y', 'Ý', 'Z', 'Ž'
);
case 'sl':
return array(
- 'A','B','C','Č','Ć','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','Š','T','U','V','W','X','Y','Z','Ž'
+ 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž'
);
case 'sr':
return array(
- 'A','B','C','Č','Ć','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','Š','T','U','V','W','X','Y','Z','Ž'
+ 'A', 'B', 'C', 'Č', 'Ć', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'Š', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'Ž'
);
case 'tr':
return array(
- 'A','B','C','Ç','D','E','F','G','Ğ','H','I','İ','J','K','L','M','N','O','Ö','P','R','S','Ş','T','U','Ü','V','Y','Z'
+ 'A', 'B', 'C', 'Ç', 'D', 'E', 'F', 'G', 'Ğ', 'H', 'I', 'İ', 'J', 'K', 'L', 'M', 'N', 'O', 'Ö', 'P', 'R', 'S', 'Ş', 'T', 'U', 'Ü', 'V', 'Y', 'Z'
);
default:
return array(
- 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
);
}
}
@@ -175,7 +175,7 @@ class WT_Query_Name {
switch (WT_LOCALE) {
case 'cs':
switch ($letter) {
- case 'C': return $field." LIKE 'C%' COLLATE ".WT_I18N::$collation." AND ".$field." NOT LIKE 'CH%' COLLATE ".WT_I18N::$collation;
+ case 'C': return $field . " LIKE 'C%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'CH%' COLLATE " . WT_I18N::$collation;
}
break;
case 'da':
@@ -183,31 +183,31 @@ class WT_Query_Name {
case 'nn':
switch ($letter) {
// AA gets listed under Å
- case 'A': return $field." LIKE 'A%' COLLATE ".WT_I18N::$collation." AND ".$field." NOT LIKE 'AA%' COLLATE ".WT_I18N::$collation;
- case 'Å': return "(".$field." LIKE 'Å%' COLLATE ".WT_I18N::$collation." OR ".$field." LIKE 'AA%' COLLATE ".WT_I18N::$collation.")";
+ case 'A': return $field . " LIKE 'A%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'AA%' COLLATE " . WT_I18N::$collation;
+ case 'Å': return "(" . $field . " LIKE 'Å%' COLLATE " . WT_I18N::$collation . " OR " . $field . " LIKE 'AA%' COLLATE " . WT_I18N::$collation . ")";
}
break;
case 'hu':
switch ($letter) {
- case 'C': return $field." LIKE 'C%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'CS%' COLLATE ". WT_I18N::$collation;
- case 'D': return $field." LIKE 'D%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'DZ%' COLLATE ". WT_I18N::$collation;
- case 'DZ': return $field." LIKE 'DZ%' COLLATE ".WT_I18N::$collation." AND ".$field." NOT LIKE 'DZS%' COLLATE ".WT_I18N::$collation;
- case 'G': return $field." LIKE 'G%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'GY%' COLLATE ". WT_I18N::$collation;
- case 'L': return $field." LIKE 'L%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'LY%' COLLATE ". WT_I18N::$collation;
- case 'N': return $field." LIKE 'N%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'NY%' COLLATE ". WT_I18N::$collation;
- case 'S': return $field." LIKE 'S%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'SZ%' COLLATE ". WT_I18N::$collation;
- case 'T': return $field." LIKE 'T%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'TY%' COLLATE ". WT_I18N::$collation;
- case 'Z': return $field." LIKE 'Z%' COLLATE ". WT_I18N::$collation." AND ".$field." NOT LIKE 'ZS%' COLLATE ". WT_I18N::$collation;
+ case 'C': return $field . " LIKE 'C%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'CS%' COLLATE " . WT_I18N::$collation;
+ case 'D': return $field . " LIKE 'D%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'DZ%' COLLATE " . WT_I18N::$collation;
+ case 'DZ': return $field . " LIKE 'DZ%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'DZS%' COLLATE " . WT_I18N::$collation;
+ case 'G': return $field . " LIKE 'G%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'GY%' COLLATE " . WT_I18N::$collation;
+ case 'L': return $field . " LIKE 'L%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'LY%' COLLATE " . WT_I18N::$collation;
+ case 'N': return $field . " LIKE 'N%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'NY%' COLLATE " . WT_I18N::$collation;
+ case 'S': return $field . " LIKE 'S%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'SZ%' COLLATE " . WT_I18N::$collation;
+ case 'T': return $field . " LIKE 'T%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'TY%' COLLATE " . WT_I18N::$collation;
+ case 'Z': return $field . " LIKE 'Z%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'ZS%' COLLATE " . WT_I18N::$collation;
}
break;
case 'nl':
switch ($letter) {
- case 'I': return $field." LIKE 'I%' COLLATE ".WT_I18N::$collation." AND ".$field." NOT LIKE 'IJ%' COLLATE ".WT_I18N::$collation;
+ case 'I': return $field . " LIKE 'I%' COLLATE " . WT_I18N::$collation . " AND " . $field . " NOT LIKE 'IJ%' COLLATE " . WT_I18N::$collation;
}
break;
}
// Easy cases: the MySQL collation rules take care of it
- return "$field LIKE CONCAT('@',".WT_DB::quote($letter).",'%') COLLATE ".WT_I18N::$collation." ESCAPE '@'";
+ return "$field LIKE CONCAT('@'," . WT_DB::quote($letter) . ",'%') COLLATE " . WT_I18N::$collation . " ESCAPE '@'";
}
/**
@@ -286,7 +286,7 @@ class WT_Query_Name {
* @return integer[]
*/
public static function givenAlpha($surn, $salpha, $marnm, $fams, $ged_id) {
- $alphas=array();
+ $alphas = array();
$sql =
"SELECT SQL_CACHE COUNT(DISTINCT n_id)" .
@@ -297,9 +297,9 @@ class WT_Query_Name {
if ($surn) {
$sql .= " AND n_surn=" . WT_DB::quote($surn) . " COLLATE '" . WT_I18N::$collation . "'";
- } elseif ($salpha==',') {
+ } elseif ($salpha == ',') {
$sql .= " AND n_surn=''";
- } elseif ($salpha=='@') {
+ } elseif ($salpha == '@') {
$sql .= " AND n_surn='@N.N.'";
} elseif ($salpha) {
$sql .= " AND " . self::getInitialSql('n_surn', $salpha);
@@ -312,7 +312,7 @@ class WT_Query_Name {
// are any names beginning with that letter. It looks better to
// show the full alphabet, rather than omitting rare letters such as X
foreach (self::getAlphabetForLocale(WT_LOCALE) as $letter) {
- $count=WT_DB::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne();
+ $count = WT_DB::prepare($sql . " AND " . self::getInitialSql('n_givn', $letter))->fetchOne();
$alphas[$letter] = $count;
}
@@ -327,9 +327,9 @@ class WT_Query_Name {
if ($surn) {
$sql .= " AND n_surn=" . WT_DB::quote($surn) . " COLLATE '" . WT_I18N::$collation . "'";
- } elseif ($salpha==',') {
+ } elseif ($salpha == ',') {
$sql .= " AND n_surn=''";
- } elseif ($salpha=='@') {
+ } elseif ($salpha == '@') {
$sql .= " AND n_surn='@N.N.'";
} elseif ($salpha) {
$sql .= " AND " . self::getInitialSql('n_surn', $salpha);
@@ -361,34 +361,34 @@ class WT_Query_Name {
* @return array
*/
public static function surnames($surn, $salpha, $marnm, $fams, $ged_id) {
- $sql=
- "SELECT SQL_CACHE n2.n_surn, n1.n_surname, n1.n_id".
- " FROM `##name` n1 ".
- ($fams ? " JOIN `##link` ON (n_id=l_from AND n_file=l_file AND l_type='FAMS') " : "").
- " JOIN (SELECT n_surn, n_file FROM `##name`".
- " WHERE n_file={$ged_id}".
+ $sql =
+ "SELECT SQL_CACHE n2.n_surn, n1.n_surname, n1.n_id" .
+ " FROM `##name` n1 " .
+ ($fams ? " JOIN `##link` ON (n_id=l_from AND n_file=l_file AND l_type='FAMS') " : "") .
+ " JOIN (SELECT n_surn, n_file FROM `##name`" .
+ " WHERE n_file={$ged_id}" .
($marnm ? "" : " AND n_type!='_MARNM'");
if ($surn) {
- $sql.=" AND n_surn COLLATE '".WT_I18N::$collation."' =".WT_DB::quote($surn);
- } elseif ($salpha==',') {
- $sql.=" AND n_surn=''";
- } elseif ($salpha=='@') {
- $sql.=" AND n_surn='@N.N.'";
+ $sql .= " AND n_surn COLLATE '" . WT_I18N::$collation . "' =" . WT_DB::quote($surn);
+ } elseif ($salpha == ',') {
+ $sql .= " AND n_surn=''";
+ } elseif ($salpha == '@') {
+ $sql .= " AND n_surn='@N.N.'";
} elseif ($salpha) {
- $sql.=" AND ".self::getInitialSql('n_surn', $salpha);
+ $sql .= " AND " . self::getInitialSql('n_surn', $salpha);
} else {
// All surnames
- $sql.=" AND n_surn NOT IN ('', '@N.N.')";
+ $sql .= " AND n_surn NOT IN ('', '@N.N.')";
}
- $sql.=" GROUP BY n_surn COLLATE '".WT_I18N::$collation."', n_file) n2 ON (n1.n_surn=n2.n_surn COLLATE '".WT_I18N::$collation."' AND n1.n_file=n2.n_file)";
+ $sql .= " GROUP BY n_surn COLLATE '" . WT_I18N::$collation . "', n_file) n2 ON (n1.n_surn=n2.n_surn COLLATE '" . WT_I18N::$collation . "' AND n1.n_file=n2.n_file)";
if (!$marnm) {
- $sql.=" AND n_type!='_MARNM'";
+ $sql .= " AND n_type!='_MARNM'";
}
- $list=array();
+ $list = array();
foreach (WT_DB::prepare($sql)->fetchAll() as $row) {
- $list[WT_I18N::strtoupper($row->n_surn)][$row->n_surname][$row->n_id]=true;
+ $list[WT_I18N::strtoupper($row->n_surn)][$row->n_surname][$row->n_id] = true;
}
return $list;
}
@@ -409,7 +409,7 @@ class WT_Query_Name {
* @return WT_Individual[]
*/
public static function individuals($surn, $salpha, $galpha, $marnm, $fams, $ged_id) {
- $sql=
+ $sql =
"SELECT i_id AS xref, i_file AS gedcom_id, i_gedcom AS gedcom, n_full " .
"FROM `##individuals` " .
"JOIN `##name` ON (n_id=i_id AND n_file=i_file) " .
@@ -419,12 +419,12 @@ class WT_Query_Name {
if ($surn) {
$sql .= " AND n_surn COLLATE '" . WT_I18N::$collation . "'=" . WT_DB::quote($surn);
- } elseif ($salpha==',') {
+ } elseif ($salpha == ',') {
$sql .= " AND n_surn=''";
- } elseif ($salpha=='@') {
+ } elseif ($salpha == '@') {
$sql .= " AND n_surn='@N.N.'";
} elseif ($salpha) {
- $sql .= " AND ".self::getInitialSql('n_surn', $salpha);
+ $sql .= " AND " . self::getInitialSql('n_surn', $salpha);
} else {
// All surnames
$sql .= " AND n_surn NOT IN ('', '@N.N.')";
@@ -469,10 +469,10 @@ class WT_Query_Name {
* @return WT_Family[]
*/
public static function families($surn, $salpha, $galpha, $marnm, $ged_id) {
- $list=array();
+ $list = array();
foreach (self::individuals($surn, $salpha, $galpha, $marnm, true, $ged_id) as $indi) {
foreach ($indi->getSpouseFamilies() as $family) {
- $list[$family->getXref()]=$family;
+ $list[$family->getXref()] = $family;
}
}
usort($list, array('WT_GedcomRecord', 'compare'));