@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $user_id = Filter::postInteger('userid', -1) ?: Filter::getInteger('userid', -1); |
40 | 40 | return Auth::check() && |
41 | 41 | ( |
42 | - $user_id == Auth::user()->getUserId() || // Allow update for yourself |
|
42 | + $user_id == Auth::user()->getUserId() || // Allow update for yourself |
|
43 | 43 | ($user_id == -1 && Auth::isManager(Globals::getTree())) // Allow a manager to update the default user |
44 | 44 | ); |
45 | 45 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | */ |
53 | 53 | protected function update(BaseController $controller) { |
54 | 54 | $wt_tree = Globals::getTree(); |
55 | - if($this->canUpdate() && Filter::checkCsrf()) |
|
55 | + if ($this->canUpdate() && Filter::checkCsrf()) |
|
56 | 56 | { |
57 | 57 | $indi = Individual::getInstance(Filter::post('rootid'), $wt_tree); |
58 | 58 | $user = User::find(Filter::postInteger('userid', -1)); |
59 | 59 | |
60 | - if($user && $indi) { |
|
60 | + if ($user && $indi) { |
|
61 | 61 | $wt_tree->setUserPreference($user, 'MAJ_SOSA_ROOT_ID', $indi->getXref()); |
62 | 62 | $controller->addInlineJavascript(' |
63 | 63 | $( document ).ready(function() { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | function majComputeSosa(user_id) { |
97 | 97 | jQuery("#bt_sosa_compute").prop( "disabled", true ); |
98 | - jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i> '. I18N::translate('Computing...') .'"); |
|
98 | + jQuery("#bt_sosa_computing").empty().html("<i class=\"icon-loading-small\"></i> '. I18N::translate('Computing...').'"); |
|
99 | 99 | jQuery("#bt_sosa_computing").load( |
100 | 100 | "module.php?mod='.$this->module->getName().'&mod_action=SosaConfig@computeAll&ged='.$wt_tree->getNameUrl().'&userid=" + user_id, |
101 | 101 | function() { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | }'); |
105 | 105 | |
106 | 106 | $action = Filter::post('action'); |
107 | - if($action === 'update') $this->update($controller); |
|
107 | + if ($action === 'update') $this->update($controller); |
|
108 | 108 | |
109 | 109 | $view_bag = new ViewBag(); |
110 | 110 | $view_bag->set('title', $controller->getPageTitle()); |
@@ -113,21 +113,21 @@ discard block |
||
113 | 113 | |
114 | 114 | $users_root = array(); |
115 | 115 | $users_js_array = 'var users_array = [];'; |
116 | - if(Auth::check()) { |
|
116 | + if (Auth::check()) { |
|
117 | 117 | $root_id = $wt_tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID'); |
118 | - $users_root[] = array( 'user' => Auth::user(), 'rootid' => $root_id); |
|
119 | - $users_js_array .= 'users_array["'.Auth::user()->getUserId().'"] = "' . $root_id . '";'; |
|
118 | + $users_root[] = array('user' => Auth::user(), 'rootid' => $root_id); |
|
119 | + $users_js_array .= 'users_array["'.Auth::user()->getUserId().'"] = "'.$root_id.'";'; |
|
120 | 120 | |
121 | - if(Auth::isManager($wt_tree)) { |
|
121 | + if (Auth::isManager($wt_tree)) { |
|
122 | 122 | $default_user = User::find(-1); |
123 | 123 | $default_root_id = $wt_tree->getUserPreference($default_user, 'MAJ_SOSA_ROOT_ID'); |
124 | - $users_root[] = array( 'user' => $default_user, 'rootid' => $default_root_id); |
|
125 | - $users_js_array .= 'users_array["'.$default_user->getUserId().'"] = "' . $default_root_id . '";'; |
|
124 | + $users_root[] = array('user' => $default_user, 'rootid' => $default_root_id); |
|
125 | + $users_js_array .= 'users_array["'.$default_user->getUserId().'"] = "'.$default_root_id.'";'; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | $view_bag->set('users_settings', $users_root); |
129 | 129 | |
130 | - $controller->addInlineJavascript($users_js_array . ' |
|
130 | + $controller->addInlineJavascript($users_js_array.' |
|
131 | 131 | $("#maj-sosa-config-select").change(function() { |
132 | 132 | $("#rootid").val(users_array[this.value]); |
133 | 133 | }); |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | $view_bag->set('is_success', false); |
148 | 148 | |
149 | 149 | $user = User::find(Filter::getInteger('userid', -1)); |
150 | - if($user) { |
|
150 | + if ($user) { |
|
151 | 151 | $calculator = new SosaCalculator(Globals::getTree(), $user); |
152 | - if($calculator->computeAll()) $view_bag->set('is_success', true); |
|
152 | + if ($calculator->computeAll()) $view_bag->set('is_success', true); |
|
153 | 153 | } |
154 | 154 | ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render(); |
155 | 155 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | $user = User::find(Filter::getInteger('userid', -1)); |
169 | 169 | $indi = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $wt_tree); |
170 | 170 | |
171 | - if($user && $indi) { |
|
171 | + if ($user && $indi) { |
|
172 | 172 | $calculator = new SosaCalculator($wt_tree, $user); |
173 | - if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true); |
|
173 | + if ($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true); |
|
174 | 174 | } |
175 | 175 | else { |
176 | 176 | $view_bag->set('error', I18N::translate('Non existing individual')); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function getConfigLink() { |
82 | 82 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
83 | 83 | |
84 | - return 'module.php?mod=' . $this->getName() . '&mod_action=SosaConfig'; |
|
84 | + return 'module.php?mod='.$this->getName().'&mod_action=SosaConfig'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /********** |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | public function getMenu() { |
104 | 104 | $wt_tree = Globals::getTree(); |
105 | 105 | $menu = null; |
106 | - if(ModuleManager::getInstance()->isOperational($this->getName())) { |
|
106 | + if (ModuleManager::getInstance()->isOperational($this->getName())) { |
|
107 | 107 | |
108 | - $root_url = 'module.php?mod=' . $this->getName() . '&ged=' . $wt_tree->getNameUrl() . '&'; |
|
109 | - $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url . 'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
108 | + $root_url = 'module.php?mod='.$this->getName().'&ged='.$wt_tree->getNameUrl().'&'; |
|
109 | + $sosa_stat_menu = new Menu(I18N::translate('Sosa Statistics'), $root_url.'mod_action=SosaStats', 'menu-maj-sosa-stats'); |
|
110 | 110 | |
111 | 111 | $menu = clone $sosa_stat_menu; |
112 | 112 | $menu->setClass('menu-maj-sosa'); |
113 | 113 | |
114 | 114 | $submenus = array_filter(array( |
115 | - new Menu(I18N::translate('Sosa Ancestors'), $root_url . 'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
116 | - new Menu(I18N::translate('Missing Ancestors'), $root_url . 'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
115 | + new Menu(I18N::translate('Sosa Ancestors'), $root_url.'mod_action=SosaList', 'menu-maj-sosa-list', array('rel' => 'nofollow')), |
|
116 | + new Menu(I18N::translate('Missing Ancestors'), $root_url.'mod_action=SosaList@missing', 'menu-maj-sosa-missing', array('rel' => 'nofollow')), |
|
117 | 117 | $sosa_stat_menu |
118 | 118 | )); |
119 | 119 | |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | && $ga_list = Module::getModuleByName(Constants::MODULE_MAJ_GEODISP_NAME)->getProvider()->getGeoAnalysisList() |
123 | 123 | ) |
124 | 124 | { |
125 | - if(count($ga_list) > 0) { |
|
126 | - $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&ged=' . $wt_tree->getNameUrl() . '&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
125 | + if (count($ga_list) > 0) { |
|
126 | + $submenus[] = new Menu(I18N::translate('Geographical Dispersion'), 'module.php?mod='.Constants::MODULE_MAJ_GEODISP_NAME.'&ged='.$wt_tree->getNameUrl().'&mod_action=GeoAnalysis@listAll', 'menu-maj-sosa-geodispersion'); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - if(Auth::check()) { |
|
130 | + if (Auth::check()) { |
|
131 | 131 | $submenus[] = new Menu( |
132 | 132 | I18N::translate('Sosa Configuration'), |
133 | 133 | $this->getConfigLink(), |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | ->addInlineJavascript(' |
145 | 145 | function majComputeSosaFromIndi(){ |
146 | 146 | if($("#computesosadlg").length == 0) { |
147 | - $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation') .'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
147 | + $("body").append("<div id=\"computesosadlg\" title=\"'. I18N::translate('Sosas computation').'\"><div id=\"sosaloadingarea\"></div></div>"); |
|
148 | 148 | } |
149 | 149 | $("#computesosadlg").dialog({ |
150 | 150 | modal: true, |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | open: function(event, ui) { |
154 | 154 | $("button.ui-dialog-titlebar-close").hide(); |
155 | 155 | $("#sosaloadingarea").empty().html("<i class=\"icon-loading-small\"></i>"); |
156 | - $("#sosaloadingarea").load("module.php?mod=' . $this->getName() . '&mod_action=SosaConfig@computePartial&ged='. $wt_tree->getNameUrl() .'&userid='.Auth::user()->getUserId().'&pid=' . $controller->getSignificantIndividual()->getXref() . '", |
|
156 | + $("#sosaloadingarea").load("module.php?mod=' . $this->getName().'&mod_action=SosaConfig@computePartial&ged='.$wt_tree->getNameUrl().'&userid='.Auth::user()->getUserId().'&pid='.$controller->getSignificantIndividual()->getXref().'", |
|
157 | 157 | function(){ |
158 | 158 | $("button.ui-dialog-titlebar-close").show(); |
159 | 159 | setTimeout(function(){ |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
204 | 204 | */ |
205 | 205 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
206 | - if($ctrlIndi){ |
|
206 | + if ($ctrlIndi) { |
|
207 | 207 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
208 | 208 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'large'); |
209 | 209 | } |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderRight() |
222 | 222 | */ |
223 | 223 | public function hExtendIndiHeaderRight(IndividualController $ctrlIndi) { |
224 | - if($ctrlIndi){ |
|
224 | + if ($ctrlIndi) { |
|
225 | 225 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
226 | - return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
226 | + return array('indi-header-sosa', FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 2, 'normal')); |
|
227 | 227 | } |
228 | 228 | return ''; |
229 | 229 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
234 | 234 | */ |
235 | 235 | public function hRecordNameAppend(GedcomRecord $grec, $size = 'small') { |
236 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ // Only apply to individuals |
|
236 | + if ($grec instanceof \Fisharebest\Webtrees\Individual) { // Only apply to individuals |
|
237 | 237 | $dindi = new Individual($grec); |
238 | 238 | return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, $size); |
239 | 239 | } |
@@ -34,26 +34,26 @@ discard block |
||
34 | 34 | * Manage updates sent from the AdminConfig@index form. |
35 | 35 | */ |
36 | 36 | protected function update() { |
37 | - if(Auth::isAdmin()){ |
|
37 | + if (Auth::isAdmin()) { |
|
38 | 38 | $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
39 | 39 | |
40 | - $module_names= Database::prepare( |
|
40 | + $module_names = Database::prepare( |
|
41 | 41 | "SELECT module_name FROM `##module` WHERE status='disabled'" |
42 | 42 | )->fetchOneColumn(); |
43 | 43 | |
44 | - if($ihooks !== null){ |
|
44 | + if ($ihooks !== null) { |
|
45 | 45 | foreach ($ihooks as $ihook => $params) { |
46 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
46 | + if (Filter::post('hook-'.$params['id']) === 'yes') { |
|
47 | 47 | $array_hook = explode('#', $ihook); |
48 | 48 | //Update status |
49 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
50 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
49 | + $new_status = Filter::postBool('status-'.$params['id']); |
|
50 | + if (in_array($array_hook[0], $module_names)) $new_status = false; |
|
51 | 51 | $previous_status = $params['status']; |
52 | 52 | if ($new_status !== null) { |
53 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
54 | - if($new_status != $previous_status){ |
|
53 | + $new_status = $new_status ? 'enabled' : 'disabled'; |
|
54 | + if ($new_status != $previous_status) { |
|
55 | 55 | $chook = new Hook($array_hook[1], $array_hook[2]); |
56 | - switch($new_status){ |
|
56 | + switch ($new_status) { |
|
57 | 57 | case 'enabled': |
58 | 58 | $chook->enable($array_hook[0]); |
59 | 59 | break; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
71 | 71 | $previous_priority = $params['priority']; |
72 | 72 | if ($new_priority !== null) { |
73 | - if($new_priority != $previous_priority){ |
|
73 | + if ($new_priority != $previous_priority) { |
|
74 | 74 | $chook = new Hook($array_hook[1], $array_hook[2]); |
75 | 75 | $chook->setPriority($array_hook[0], $new_priority); |
76 | 76 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | HookProvider::getInstance()->updateHooks(); |
93 | 93 | |
94 | 94 | $action = Filter::post('action'); |
95 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
95 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
96 | 96 | |
97 | 97 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
98 | 98 | $ctrl = new PageController(); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ->restrictAccess(Auth::isAdmin()) |
101 | 101 | ->setPageTitle($this->module->getTitle()); |
102 | 102 | |
103 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
103 | + $table_id = 'table-installedhooks-'.Uuid::uuid4(); |
|
104 | 104 | |
105 | 105 | $view_bag = new ViewBag(); |
106 | 106 | $view_bag->set('title', $ctrl->getPageTitle()); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
64 | 64 | */ |
65 | 65 | public function getConfigLink() { |
66 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
66 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -92,19 +92,19 @@ discard block |
||
92 | 92 | $res = ''; |
93 | 93 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
94 | 94 | $titles = $dindi->getTitles(); |
95 | - if(count($titles)>0){ |
|
95 | + if (count($titles) > 0) { |
|
96 | 96 | $res = ' |
97 | 97 | <dl> |
98 | 98 | <dt class="label">'.I18N::translate('Titles').'</dt>'; |
99 | - foreach($titles as $title=>$props){ |
|
99 | + foreach ($titles as $title=>$props) { |
|
100 | 100 | $res .= |
101 | - '<dd class="field">' . $title. ' ' . |
|
102 | - FunctionsPrint::getListFromArray($props) . |
|
101 | + '<dd class="field">'.$title.' '. |
|
102 | + FunctionsPrint::getListFromArray($props). |
|
103 | 103 | '</dd>'; |
104 | 104 | } |
105 | - $res .= '</dl>'; |
|
105 | + $res .= '</dl>'; |
|
106 | 106 | } |
107 | - return array( 'indi-header-titles' , $res); |
|
107 | + return array('indi-header-titles', $res); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function hPrintHeader() { |
121 | 121 | $html = ''; |
122 | - if($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1){ |
|
123 | - if(Auth::accessLevel(Globals::getTree()) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')){ |
|
122 | + if ($this->getSetting('MAJ_ADD_HTML_HEADER', 0) == 1) { |
|
123 | + if (Auth::accessLevel(Globals::getTree()) >= $this->getSetting('MAJ_SHOW_HTML_HEADER', Auth::PRIV_HIDE) && !Filter::getBool('noheader')) { |
|
124 | 124 | $html .= $this->getSetting('MAJ_HTML_HEADER', ''); |
125 | 125 | } |
126 | 126 | } |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | public function hPrintFooter() { |
135 | 135 | $wt_tree = Globals::getTree(); |
136 | 136 | $html = ''; |
137 | - if($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1){ |
|
137 | + if ($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1) { |
|
138 | 138 | $html .= '<br/>'; |
139 | 139 | $html .= '<div class="center">'; |
140 | 140 | $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', ''); |
141 | - if($cnil_ref != ''){ |
|
141 | + if ($cnil_ref != '') { |
|
142 | 142 | $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref); |
143 | 143 | } |
144 | 144 | $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $html .= '</div>'; |
147 | 147 | } |
148 | 148 | |
149 | - if($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1){ |
|
150 | - if(Auth::accessLevel($wt_tree) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')){ |
|
149 | + if ($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1) { |
|
150 | + if (Auth::accessLevel($wt_tree) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')) { |
|
151 | 151 | $html .= $this->getSetting('MAJ_HTML_FOOTER', ''); |
152 | 152 | } |
153 | 153 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | public function getConfigLink() { |
69 | 69 | Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
70 | 70 | |
71 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
92 | 92 | */ |
93 | 93 | public function getProvider() { |
94 | - if(!$this->provider) { |
|
94 | + if (!$this->provider) { |
|
95 | 95 | $this->provider = new GeoAnalysisProvider(Globals::getTree()); |
96 | 96 | } |
97 | 97 | return $this->provider; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @return string List of elements |
33 | 33 | */ |
34 | 34 | public static function getListFromArray(array $array) { |
35 | - $n=count($array); |
|
35 | + $n = count($array); |
|
36 | 36 | switch ($n) { |
37 | 37 | case 0: |
38 | 38 | return ''; |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | default: |
42 | 42 | return implode( |
43 | 43 | /* I18N: list separator */ I18N::translate(', '), |
44 | - array_slice($array, 0, $n-1) |
|
45 | - ) . |
|
46 | - /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and ') . |
|
47 | - $array[$n-1]; |
|
44 | + array_slice($array, 0, $n - 1) |
|
45 | + ). |
|
46 | + /* I18N: last list separator, " and " in English, " et " in French */ I18N::translate(' and '). |
|
47 | + $array[$n - 1]; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | \MyArtJaub\Webtrees\Map\MapProviderInterface $mapProvider |
61 | 61 | ) { |
62 | 62 | $place = $fact->getPlace(); |
63 | - if(!$place->isEmpty()) { |
|
64 | - $iconPlace= $mapProvider->getPlaceIcon($place); |
|
65 | - if($iconPlace && strlen($iconPlace) > 0){ |
|
66 | - return '<div class="fact_flag">'. self::htmlPlaceIcon($place, $iconPlace, 50). '</div>'; |
|
63 | + if (!$place->isEmpty()) { |
|
64 | + $iconPlace = $mapProvider->getPlaceIcon($place); |
|
65 | + if ($iconPlace && strlen($iconPlace) > 0) { |
|
66 | + return '<div class="fact_flag">'.self::htmlPlaceIcon($place, $iconPlace, 50).'</div>'; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | return ''; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * @param number $size |
78 | 78 | * @return string HTML code of the inserted flag |
79 | 79 | */ |
80 | - public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
|
81 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
80 | + public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path, $size = 50) { |
|
81 | + return '<img class="flag_gm_h'.$size.'" src="'.$icon_path.'" title="'.$place->getGedcomName().'" alt="'.$place->getGedcomName().'" />'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $minimum = PHP_INT_MAX; |
97 | 97 | $maximum = 1; |
98 | 98 | foreach ($list as $params) { |
99 | - if(array_key_exists('count', $params)) { |
|
99 | + if (array_key_exists('count', $params)) { |
|
100 | 100 | $maximum = max($maximum, $params['count']); |
101 | 101 | $minimum = min($minimum, $params['count']); |
102 | 102 | } |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum); |
115 | 115 | } |
116 | 116 | |
117 | - $html .= '<a style="font-size:' . $size . '%" href="' . $url . '">'; |
|
117 | + $html .= '<a style="font-size:'.$size.'%" href="'.$url.'">'; |
|
118 | 118 | if ($totals) { |
119 | - $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $text . '</span>', I18N::number($count)); |
|
119 | + $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">'.$text.'</span>', I18N::number($count)); |
|
120 | 120 | } else { |
121 | 121 | $html .= $text; |
122 | 122 | } |
123 | 123 | $html .= '</a>'; |
124 | 124 | } |
125 | - return '<div class="tag_cloud">' . $html . '</div>'; |
|
125 | + return '<div class="tag_cloud">'.$html.'</div>'; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param bool $isStrong Bolden the name ? |
158 | 158 | * @return string HTML Code for individual item |
159 | 159 | */ |
160 | - public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
|
160 | + public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true) { |
|
161 | 161 | $html = ''; |
162 | 162 | $tag = 'em'; |
163 | - if($isStrong) $tag = 'strong'; |
|
164 | - if($individual && $individual->canShow()){ |
|
163 | + if ($isStrong) $tag = 'strong'; |
|
164 | + if ($individual && $individual->canShow()) { |
|
165 | 165 | $dindi = new Individual($individual); |
166 | 166 | $html = $individual->getSexImage(); |
167 | 167 | $html .= '<a class="list_item" href="'. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $html .= '</a>'; |
177 | 177 | } |
178 | 178 | else { |
179 | - $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
|
179 | + $html .= '<span class=\"list_item\"><'.$tag.'>'.I18N::translate('Private').'</'.$tag.'></span>'; |
|
180 | 180 | } |
181 | 181 | return $html; |
182 | 182 | } |
@@ -188,20 +188,20 @@ discard block |
||
188 | 188 | * @param boolean $anchor option to print a link to calendar |
189 | 189 | * @return string HTML code for short date |
190 | 190 | */ |
191 | - public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor=false) { |
|
192 | - $html=''; |
|
191 | + public static function formatFactDateShort(\Fisharebest\Webtrees\Fact $fact, $anchor = false) { |
|
192 | + $html = ''; |
|
193 | 193 | $date = $fact->getDate(); |
194 | - if($date->isOK()){ |
|
195 | - $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
194 | + if ($date->isOK()) { |
|
195 | + $html .= ' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
|
196 | 196 | } |
197 | - else{ |
|
197 | + else { |
|
198 | 198 | // 1 DEAT Y with no DATE => print YES |
199 | 199 | // 1 BIRT 2 SOUR @S1@ => print YES |
200 | 200 | // 1 DEAT N is not allowed |
201 | 201 | // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen. |
202 | 202 | $factdetail = explode(' ', trim($fact->getGedcom())); |
203 | 203 | if (isset($factdetail) && (count($factdetail) == 3 && strtoupper($factdetail[2]) == 'Y') || (count($factdetail) == 4 && $factdetail[2] == 'SOUR')) { |
204 | - $html.=I18N::translate('yes'); |
|
204 | + $html .= I18N::translate('yes'); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | return $html; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | * @param boolean $anchor option to print a link to placelist |
216 | 216 | * @return string HTML code for short place |
217 | 217 | */ |
218 | - public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
|
219 | - $html=''; |
|
218 | + public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor = false) { |
|
219 | + $html = ''; |
|
220 | 220 | |
221 | 221 | if ($fact === null) return $html; |
222 | 222 | $place = $fact->getPlace(); |
223 | - if($place){ |
|
223 | + if ($place) { |
|
224 | 224 | $dplace = new Place($place); |
225 | 225 | $html .= $dplace->htmlFormattedName($format, $anchor); |
226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
238 | 238 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
239 | 239 | * @return string HTML code for the formatted Sosa numbers |
240 | 240 | */ |
241 | - public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small'){ |
|
241 | + public static function formatSosaNumbers(array $sosatab, $format = 1, $size = 'small') { |
|
242 | 242 | $html = ''; |
243 | - switch($format){ |
|
243 | + switch ($format) { |
|
244 | 244 | case 1: |
245 | - if(count($sosatab)>0){ |
|
245 | + if (count($sosatab) > 0) { |
|
246 | 246 | $html = '<i class="icon-maj-sosa_'.$size.'" title="'.I18N::translate('Sosa').'"></i>'; |
247 | 247 | } |
248 | 248 | break; |
249 | 249 | case 2: |
250 | - if(count($sosatab)>0){ |
|
250 | + if (count($sosatab) > 0) { |
|
251 | 251 | ksort($sosatab); |
252 | 252 | $tmp_html = array(); |
253 | 253 | foreach ($sosatab as $sosa => $gen) { |
254 | 254 | $tmp_html[] = sprintf( |
255 | - '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen) .'</strong>', |
|
255 | + '<i class="icon-maj-sosa_%1$s" title="'.I18N::translate('Sosa').'"></i> <strong>%2$d '.I18N::translate('(G%s)', $gen).'</strong>', |
|
256 | 256 | $size, |
257 | 257 | $sosa |
258 | 258 | ); |
@@ -278,15 +278,15 @@ discard block |
||
278 | 278 | * @param string $size CSS size for the icon. A CSS style css_$size is required |
279 | 279 | * @return string HTML code for IsSourced icon |
280 | 280 | */ |
281 | - public static function formatIsSourcedIcon($sourceType, $isSourced, $tag='EVEN', $format = 1, $size='normal'){ |
|
282 | - $html=''; |
|
283 | - $image=null; |
|
284 | - $title=null; |
|
285 | - switch($format){ |
|
281 | + public static function formatIsSourcedIcon($sourceType, $isSourced, $tag = 'EVEN', $format = 1, $size = 'normal') { |
|
282 | + $html = ''; |
|
283 | + $image = null; |
|
284 | + $title = null; |
|
285 | + switch ($format) { |
|
286 | 286 | case 1: |
287 | - switch($sourceType){ |
|
287 | + switch ($sourceType) { |
|
288 | 288 | case 'E': |
289 | - switch($isSourced){ |
|
289 | + switch ($isSourced) { |
|
290 | 290 | case 0: |
291 | 291 | $image = 'event_unknown'; |
292 | 292 | $title = I18N::translate('%s not found', GedcomTag::getLabel($tag)); |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | break; |
318 | 318 | case 'R': |
319 | - switch($isSourced){ |
|
319 | + switch ($isSourced) { |
|
320 | 320 | case -1: |
321 | 321 | $image = 'record_notsourced'; |
322 | 322 | $title = I18N::translate('%s not sourced', GedcomTag::getLabel($tag)); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | default: |
337 | 337 | break; |
338 | 338 | } |
339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
339 | + if ($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
340 | 340 | break; |
341 | 341 | default: |
342 | 342 | break; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->view_bag = new ViewBag(); |
70 | 70 | $this->view_bag->set('generation', $this->generation); |
71 | 71 | $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
72 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
72 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0) > 0); |
|
73 | 73 | |
74 | 74 | } |
75 | 75 | |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->view_bag->set('title', $controller->getPageTitle()); |
91 | 91 | |
92 | - if($this->view_bag->get('is_setup', false)) { |
|
92 | + if ($this->view_bag->get('is_setup', false)) { |
|
93 | 93 | $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
94 | 94 | $this->view_bag->set('url_module', $this->module->getName()); |
95 | 95 | $this->view_bag->set('url_action', 'SosaList'); |
96 | 96 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
97 | 97 | $this->view_bag->set('min_gen', 1); |
98 | 98 | |
99 | - if($this->view_bag->get('has_sosa', false)) { |
|
99 | + if ($this->view_bag->get('has_sosa', false)) { |
|
100 | 100 | $controller->addInlineJavascript(' |
101 | 101 | jQuery("#sosalist-tabs").tabs(); |
102 | 102 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | "mod" : "'.$this->module->getName().'", |
108 | 108 | "mod_action": "SosaList@sosalist", |
109 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
109 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
110 | 110 | "type" : "indi", |
111 | 111 | "gen" : "'.$this->generation.'" |
112 | 112 | }, |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | { |
132 | 132 | "mod" : "'.$this->module->getName().'", |
133 | 133 | "mod_action": "SosaList@sosalist", |
134 | - "ged" : "' . $wt_tree->getNameUrl(). '", |
|
134 | + "ged" : "' . $wt_tree->getNameUrl().'", |
|
135 | 135 | "type" : "fam", |
136 | 136 | "gen" : "'.$this->generation.'" |
137 | 137 | }, |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $this->view_bag->set('title', $controller->getPageTitle()); |
171 | 171 | |
172 | - if($this->view_bag->get('is_setup', false)) { |
|
172 | + if ($this->view_bag->get('is_setup', false)) { |
|
173 | 173 | $this->view_bag->set('url_module', $this->module->getName()); |
174 | 174 | $this->view_bag->set('url_action', 'SosaList@missing'); |
175 | 175 | $this->view_bag->set('url_ged', $wt_tree->getNameUrl()); |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
179 | 179 | $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
180 | 180 | |
181 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
181 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); |
|
182 | 182 | $this->view_bag->set('perc_sosa', $perc_sosa); |
183 | 183 | |
184 | - if($this->view_bag->get('has_missing', false)) { |
|
185 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
184 | + if ($this->view_bag->get('has_missing', false)) { |
|
185 | + $table_id = 'table-sosa-missing-'.Uuid::uuid4(); |
|
186 | 186 | $this->view_bag->set('table_id', $table_id); |
187 | 187 | |
188 | 188 | $controller |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
193 | 193 | |
194 | 194 | jQuery("#'.$table_id.'").dataTable( { |
195 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
195 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
196 | 196 | '.I18N::datatablesI18N().', |
197 | 197 | jQueryUI: true, |
198 | 198 | autoWidth:false, |
@@ -218,14 +218,14 @@ discard block |
||
218 | 218 | pagingType: "full_numbers" |
219 | 219 | }); |
220 | 220 | |
221 | - jQuery("#' . $table_id . '") |
|
221 | + jQuery("#' . $table_id.'") |
|
222 | 222 | /* Filter buttons in table header */ |
223 | 223 | .on("click", "button[data-filter-column]", function() { |
224 | 224 | var btn = jQuery(this); |
225 | 225 | // De-activate the other buttons in this button group |
226 | 226 | btn.siblings().removeClass("ui-state-active"); |
227 | 227 | // Apply (or clear) this filter |
228 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
228 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
229 | 229 | if (btn.hasClass("ui-state-active")) { |
230 | 230 | btn.removeClass("ui-state-active"); |
231 | 231 | col.search("").draw(); |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | $unique_indis = array(); |
243 | 243 | $sum_missing_different = 0; |
244 | 244 | $sum_missing_different_without_hidden = 0; |
245 | - foreach($missing_list as $num => $missing_tab) { |
|
246 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
245 | + foreach ($missing_list as $num => $missing_tab) { |
|
246 | + if (isset($unique_indis[$missing_tab['indi']])) { |
|
247 | 247 | unset($missing_list[$num]); |
248 | 248 | continue; |
249 | 249 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $this->view_bag->set('missing_list', $missing_list); |
262 | 262 | $this->view_bag->set('missing_diff_count', $sum_missing_different); |
263 | 263 | $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
264 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
264 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); |
|
265 | 265 | $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
266 | 266 | } |
267 | 267 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $controller = new AjaxController(); |
280 | 280 | $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
281 | 281 | |
282 | - switch ($type){ |
|
282 | + switch ($type) { |
|
283 | 283 | case 'indi': |
284 | 284 | $this->renderSosaListIndi($controller); |
285 | 285 | break; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
302 | 302 | $this->view_bag->set('has_sosa', false); |
303 | 303 | |
304 | - if(count($listSosa) > 0) { |
|
304 | + if (count($listSosa) > 0) { |
|
305 | 305 | $this->view_bag->set('has_sosa', true); |
306 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
306 | + $table_id = 'table-sosa-indi-'.Uuid::uuid4(); |
|
307 | 307 | $this->view_bag->set('table_id', $table_id); |
308 | 308 | |
309 | 309 | $controller |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
314 | 314 | |
315 | 315 | jQuery("#'.$table_id.'").dataTable( { |
316 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
317 | - ' . I18N::datatablesI18N() . ', |
|
316 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
317 | + ' . I18N::datatablesI18N().', |
|
318 | 318 | jQueryUI: true, |
319 | 319 | autoWidth: false, |
320 | 320 | processing: true, |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | pagingType: "full_numbers" |
344 | 344 | }); |
345 | 345 | |
346 | - jQuery("#' . $table_id . '") |
|
346 | + jQuery("#' . $table_id.'") |
|
347 | 347 | /* Hide/show parents */ |
348 | 348 | .on("click", ".btn-toggle-parents", function() { |
349 | 349 | jQuery(this).toggleClass("ui-state-active"); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | /* Hide/show statistics */ |
353 | 353 | .on("click", ".btn-toggle-statistics", function() { |
354 | 354 | jQuery(this).toggleClass("ui-state-active"); |
355 | - jQuery("#indi_list_table-charts_' . $table_id . '").slideToggle(); |
|
355 | + jQuery("#indi_list_table-charts_' . $table_id.'").slideToggle(); |
|
356 | 356 | }) |
357 | 357 | /* Filter buttons in table header */ |
358 | 358 | .on("click", "button[data-filter-column]", function() { |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | // De-activate the other buttons in this button group |
361 | 361 | btn.siblings().removeClass("ui-state-active"); |
362 | 362 | // Apply (or clear) this filter |
363 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
363 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
364 | 364 | if (btn.hasClass("ui-state-active")) { |
365 | 365 | btn.removeClass("ui-state-active"); |
366 | 366 | col.search("").draw(); |
@@ -395,30 +395,30 @@ discard block |
||
395 | 395 | $nb_displayed = 0; |
396 | 396 | |
397 | 397 | Individual::load($wt_tree, $listSosa); |
398 | - foreach($listSosa as $sosa => $pid) { |
|
398 | + foreach ($listSosa as $sosa => $pid) { |
|
399 | 399 | $person = Individual::getInstance($pid, $wt_tree); |
400 | 400 | if (!$person || !$person->canShowName()) { |
401 | 401 | unset($listSosa[$sosa]); |
402 | 402 | continue; |
403 | 403 | } |
404 | 404 | $nb_displayed++; |
405 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
405 | + if ($birth_dates = $person->getAllBirthDates()) { |
|
406 | 406 | if ( |
407 | 407 | FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
408 | 408 | !isset($unique_indis[$person->getXref()]) |
409 | 409 | ) { |
410 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
410 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | else { |
414 | - $birth_dates[0]=new Date(''); |
|
414 | + $birth_dates[0] = new Date(''); |
|
415 | 415 | } |
416 | 416 | if ($death_dates = $person->getAllDeathDates()) { |
417 | 417 | if ( |
418 | 418 | FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
419 | 419 | !isset($unique_indis[$person->getXref()]) |
420 | 420 | ) { |
421 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
421 | + $deat_by_decade[(int)($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | else { |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $this->view_bag->set('sosa_list', $listSosa); |
435 | 435 | |
436 | 436 | $this->view_bag->set('sosa_count', count($listSosa)); |
437 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
437 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation - 1)); |
|
438 | 438 | $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
439 | 439 | |
440 | 440 | $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
@@ -453,12 +453,12 @@ discard block |
||
453 | 453 | */ |
454 | 454 | protected function renderFamSosaListIndi(AjaxController $controller) { |
455 | 455 | $wt_tree = Globals::getTree(); |
456 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
456 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation); ; |
|
457 | 457 | $this->view_bag->set('has_sosa', false); |
458 | 458 | |
459 | - if(count($listFamSosa) > 0) { |
|
459 | + if (count($listFamSosa) > 0) { |
|
460 | 460 | $this->view_bag->set('has_sosa', true); |
461 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
461 | + $table_id = 'table-sosa-fam-'.Uuid::uuid4(); |
|
462 | 462 | $this->view_bag->set('table_id', $table_id); |
463 | 463 | |
464 | 464 | $controller |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
469 | 469 | |
470 | 470 | jQuery("#'.$table_id.'").dataTable( { |
471 | - dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
471 | + dom: \'<"H"<"filtersH_' . $table_id.'"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
472 | 472 | '.I18N::datatablesI18N(array(16, 32, 64, 128, -1)).', |
473 | 473 | jQueryUI: true, |
474 | 474 | autoWidth: false, |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | pagingType: "full_numbers" |
496 | 496 | }); |
497 | 497 | |
498 | - jQuery("#' . $table_id . '") |
|
498 | + jQuery("#' . $table_id.'") |
|
499 | 499 | /* Hide/show parents */ |
500 | 500 | .on("click", ".btn-toggle-parents", function() { |
501 | 501 | jQuery(this).toggleClass("ui-state-active"); |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | /* Hide/show statistics */ |
505 | 505 | .on("click", ".btn-toggle-statistics", function() { |
506 | 506 | jQuery(this).toggleClass("ui-state-active"); |
507 | - jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle(); |
|
507 | + jQuery("#fam_list_table-charts_' . $table_id.'").slideToggle(); |
|
508 | 508 | }) |
509 | 509 | /* Filter buttons in table header */ |
510 | 510 | .on("click", "button[data-filter-column]", function() { |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | // De-activate the other buttons in this button group |
513 | 513 | btn.siblings().removeClass("ui-state-active"); |
514 | 514 | // Apply (or clear) this filter |
515 | - var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); |
|
515 | + var col = jQuery("#' . $table_id.'").DataTable().column(btn.data("filter-column")); |
|
516 | 516 | if (btn.hasClass("ui-state-active")) { |
517 | 517 | btn.removeClass("ui-state-active"); |
518 | 518 | col.search("").draw(); |
@@ -532,29 +532,29 @@ discard block |
||
532 | 532 | |
533 | 533 | //-- init chart data |
534 | 534 | $marr_by_age = array(); |
535 | - for ($age=0; $age<=$max_age; $age++) { |
|
535 | + for ($age = 0; $age <= $max_age; $age++) { |
|
536 | 536 | $marr_by_age[$age] = ''; |
537 | 537 | } |
538 | 538 | $birt_by_decade = array(); |
539 | 539 | $marr_by_decade = array(); |
540 | - for ($year=1550; $year<2030; $year+=10) { |
|
540 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
541 | 541 | $birt_by_decade[$year] = ''; |
542 | 542 | $marr_by_decade[$year] = ''; |
543 | 543 | } |
544 | 544 | |
545 | - foreach($listFamSosa as $sosa => $fid) { |
|
545 | + foreach ($listFamSosa as $sosa => $fid) { |
|
546 | 546 | $sfamily = Family::getInstance($fid, $wt_tree); |
547 | - if(!$sfamily || !$sfamily->canShow()) { |
|
547 | + if (!$sfamily || !$sfamily->canShow()) { |
|
548 | 548 | unset($listFamSosa[$sosa]); |
549 | 549 | continue; |
550 | 550 | } |
551 | - $mdate=$sfamily->getMarriageDate(); |
|
551 | + $mdate = $sfamily->getMarriageDate(); |
|
552 | 552 | |
553 | - if( ($husb = $sfamily->getHusband()) && |
|
553 | + if (($husb = $sfamily->getHusband()) && |
|
554 | 554 | ($hdate = $husb->getBirthDate()) && |
555 | 555 | $hdate->isOK() && $mdate->isOK()) { |
556 | 556 | if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
557 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
557 | + $birt_by_decade[(int)($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
558 | 558 | } |
559 | 559 | $hage = Date::getAge($hdate, $mdate, 0); |
560 | 560 | if ($hage >= 0 && $hage <= $max_age) { |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | - if(($wife = $sfamily->getWife()) && |
|
566 | - ($wdate=$wife->getBirthDate()) && |
|
565 | + if (($wife = $sfamily->getWife()) && |
|
566 | + ($wdate = $wife->getBirthDate()) && |
|
567 | 567 | $wdate->isOK() && $mdate->isOK()) { |
568 | 568 | if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
569 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
569 | + $birt_by_decade[(int)($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
570 | 570 | } |
571 | 571 | $wage = Date::getAge($wdate, $mdate, 0); |
572 | 572 | if ($wage >= 0 && $wage <= $max_age) { |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | } |
576 | 576 | |
577 | 577 | if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
578 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
578 | + $marr_by_decade[(int)($mdate->gregorianYear() / 10) * 10] .= $husb->getSex().$wife->getSex(); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | $listFamSosa[$sosa] = $sfamily; |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | protected $gedcomrecord; |
24 | 24 | |
25 | 25 | /** @var bool Is the GedcomRecord sourced (cache) */ |
26 | - protected $_issourced=null; |
|
26 | + protected $_issourced = null; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Contructor for the decorator |
30 | 30 | * |
31 | 31 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
32 | 32 | */ |
33 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
33 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
34 | 34 | $this->gedcomrecord = $gedcomrecord_in; |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
41 | 41 | */ |
42 | - public function getDerivedRecord(){ |
|
42 | + public function getDerivedRecord() { |
|
43 | 43 | return $this->gedcomrecord; |
44 | 44 | } |
45 | 45 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
71 | 71 | switch ($style) { |
72 | 72 | case 10: |
73 | - return '<i>'.$fact->getLabel().' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. \MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
73 | + return '<i>'.$fact->getLabel().' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactDateShort($fact).' '.\MyArtJaub\Webtrees\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
74 | 74 | default: |
75 | 75 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
76 | 76 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @param int $access_level |
86 | 86 | * @return boolean |
87 | 87 | */ |
88 | - public function canDisplayIsSourced($access_level = null){ |
|
89 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
90 | - if($access_level === null ) |
|
88 | + public function canDisplayIsSourced($access_level = null) { |
|
89 | + if (!$this->gedcomrecord->canShow($access_level)) return false; |
|
90 | + if ($access_level === null) |
|
91 | 91 | $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
92 | 92 | |
93 | 93 | $global_facts = Globals::getGlobalFacts(); |
@@ -107,14 +107,14 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return int Level of sources |
109 | 109 | */ |
110 | - public function isSourced(){ |
|
111 | - if($this->_issourced !== null) return $this->_issourced; |
|
112 | - $this->_issourced=-1; |
|
110 | + public function isSourced() { |
|
111 | + if ($this->_issourced !== null) return $this->_issourced; |
|
112 | + $this->_issourced = -1; |
|
113 | 113 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
114 | - foreach($sourcesfacts as $sourcefact){ |
|
115 | - $this->_issourced=max($this->_issourced, 1); |
|
116 | - if($sourcefact->getAttribute('_ACT')){ |
|
117 | - $this->_issourced=max($this->_issourced, 2); |
|
114 | + foreach ($sourcesfacts as $sourcefact) { |
|
115 | + $this->_issourced = max($this->_issourced, 1); |
|
116 | + if ($sourcefact->getAttribute('_ACT')) { |
|
117 | + $this->_issourced = max($this->_issourced, 2); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | return $this->_issourced; |
@@ -126,19 +126,19 @@ discard block |
||
126 | 126 | * @param string $eventslist |
127 | 127 | * @return int Level of sources |
128 | 128 | */ |
129 | - public function isFactSourced($eventslist){ |
|
130 | - if(empty($eventslist)) return 0; |
|
131 | - $isSourced=0; |
|
129 | + public function isFactSourced($eventslist) { |
|
130 | + if (empty($eventslist)) return 0; |
|
131 | + $isSourced = 0; |
|
132 | 132 | $facts = $this->gedcomrecord->getFacts($eventslist); |
133 | - foreach($facts as $fact){ |
|
134 | - if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){ |
|
133 | + foreach ($facts as $fact) { |
|
134 | + if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) { |
|
135 | 135 | $dfact = new Fact($fact); |
136 | 136 | $tmpIsSourced = $dfact->isSourced(); |
137 | - if($tmpIsSourced != 0) { |
|
138 | - if($isSourced==0) { |
|
139 | - $isSourced = $tmpIsSourced; |
|
137 | + if ($tmpIsSourced != 0) { |
|
138 | + if ($isSourced == 0) { |
|
139 | + $isSourced = $tmpIsSourced; |
|
140 | 140 | } |
141 | - else{ |
|
141 | + else { |
|
142 | 142 | $isSourced = max($isSourced, $tmpIsSourced); |
143 | 143 | } |
144 | 144 | } |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param string $text Text to display |
34 | 34 | */ |
35 | - static public function promptAlert($text){ |
|
35 | + static public function promptAlert($text) { |
|
36 | 36 | echo '<script>'; |
37 | - echo 'alert("',fw\Filter::escapeHtml($text),'")'; |
|
37 | + echo 'alert("', fw\Filter::escapeHtml($text), '")'; |
|
38 | 38 | echo '</script>'; |
39 | 39 | } |
40 | 40 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @return float Result of the safe division |
48 | 48 | */ |
49 | 49 | public static function safeDivision($num, $denom, $default = 0) { |
50 | - if($denom && $denom!=0){ |
|
50 | + if ($denom && $denom != 0) { |
|
51 | 51 | return $num / $denom; |
52 | 52 | } |
53 | 53 | return $default; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @param float $default Default value if denominator null or 0 |
62 | 62 | * @return float Percentage |
63 | 63 | */ |
64 | - public static function getPercentage($num, $denom, $default = 0){ |
|
64 | + public static function getPercentage($num, $denom, $default = 0) { |
|
65 | 65 | return 100 * self::safeDivision($num, $denom, $default); |
66 | 66 | } |
67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | * @param int $target The final max width/height |
73 | 73 | * @return array array of ($width, $height). One of them must be $target |
74 | 74 | */ |
75 | - static public function getResizedImageSize($file, $target=25){ |
|
76 | - list($width, $height, , ) = getimagesize($file); |
|
75 | + static public function getResizedImageSize($file, $target = 25) { |
|
76 | + list($width, $height,,) = getimagesize($file); |
|
77 | 77 | $max = max($width, $height); |
78 | 78 | $rapp = $target / $max; |
79 | 79 | $width = intval($rapp * $width); |
@@ -103,21 +103,21 @@ discard block |
||
103 | 103 | * @param int $length Length of the token, default to 32 |
104 | 104 | * @return string Random token |
105 | 105 | */ |
106 | - public static function generateRandomToken($length=32) { |
|
106 | + public static function generateRandomToken($length = 32) { |
|
107 | 107 | $chars = str_split('abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'); |
108 | 108 | $len_chars = count($chars); |
109 | 109 | $token = ''; |
110 | 110 | |
111 | 111 | for ($i = 0; $i < $length; $i++) |
112 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
112 | + $token .= $chars[mt_rand(0, $len_chars - 1)]; |
|
113 | 113 | |
114 | 114 | # Number of 32 char chunks |
115 | - $chunks = ceil( strlen($token) / 32 ); |
|
115 | + $chunks = ceil(strlen($token) / 32); |
|
116 | 116 | $md5token = ''; |
117 | 117 | |
118 | 118 | # Run each chunk through md5 |
119 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
120 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
119 | + for ($i = 1; $i <= $chunks; $i++) |
|
120 | + $md5token .= md5(substr($token, $i * 32 - 32, 32)); |
|
121 | 121 | |
122 | 122 | # Trim the token |
123 | 123 | return substr($md5token, 0, $length); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected static function getBase64EncryptionKey() { |
132 | 132 | $key = 'STANDARDKEYIFNOSERVER'; |
133 | - if(!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
133 | + if (!empty(Filter::server('SERVER_NAME')) && !empty(Filter::server('SERVER_SOFTWARE'))) |
|
134 | 134 | $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
135 | 135 | |
136 | 136 | return $key; |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param string $data Text to encrypt |
144 | 144 | * @return string Encrypted and encoded text |
145 | 145 | */ |
146 | - public static function encryptToSafeBase64($data){ |
|
146 | + public static function encryptToSafeBase64($data) { |
|
147 | 147 | $nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
148 | 148 | $id = sodium_crypto_secretbox($data, $nonce, self::getBase64EncryptionKey()); |
149 | 149 | $encrypted = base64_encode($nonce.$id); |
@@ -163,12 +163,12 @@ discard block |
||
163 | 163 | * @param string $encrypted Text to decrypt |
164 | 164 | * @return string Decrypted text |
165 | 165 | */ |
166 | - public static function decryptFromSafeBase64($encrypted){ |
|
166 | + public static function decryptFromSafeBase64($encrypted) { |
|
167 | 167 | $encrypted = str_replace('-', '+', $encrypted); |
168 | 168 | $encrypted = str_replace('_', '/', $encrypted); |
169 | 169 | $encrypted = str_replace('*', '=', $encrypted); |
170 | 170 | $encrypted = base64_decode($encrypted); |
171 | - if($encrypted === false) |
|
171 | + if ($encrypted === false) |
|
172 | 172 | throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
173 | 173 | |
174 | 174 | if (mb_strlen($encrypted, '8bit') < (SODIUM_CRYPTO_SECRETBOX_NONCEBYTES + SODIUM_CRYPTO_SECRETBOX_MACBYTES)) |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | |
180 | 180 | $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, self::getBase64EncryptionKey()); |
181 | 181 | |
182 | - if($decrypted === false) { |
|
182 | + if ($decrypted === false) { |
|
183 | 183 | throw new \InvalidArgumentException('The message has been tampered with in transit.'); |
184 | 184 | } |
185 | 185 | |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | * @param string $string Filesystem encoded string to encode |
195 | 195 | * @return string UTF-8 encoded string |
196 | 196 | */ |
197 | - public static function encodeFileSystemToUtf8($string){ |
|
197 | + public static function encodeFileSystemToUtf8($string) { |
|
198 | 198 | if (strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
199 | - return iconv('cp1252', 'utf-8//IGNORE',$string); |
|
199 | + return iconv('cp1252', 'utf-8//IGNORE', $string); |
|
200 | 200 | } |
201 | 201 | return $string; |
202 | 202 | } |
@@ -207,9 +207,9 @@ discard block |
||
207 | 207 | * @param string $string UTF-8 encoded string to encode |
208 | 208 | * @return string Filesystem encoded string |
209 | 209 | */ |
210 | - public static function encodeUtf8ToFileSystem($string){ |
|
210 | + public static function encodeUtf8ToFileSystem($string) { |
|
211 | 211 | if (preg_match('//u', $string) && strtoupper(substr(php_uname('s'), 0, 7)) === 'WINDOWS') { |
212 | - return iconv('utf-8', 'cp1252//IGNORE' , $string); |
|
212 | + return iconv('utf-8', 'cp1252//IGNORE', $string); |
|
213 | 213 | } |
214 | 214 | return $string; |
215 | 215 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | * @return boolean True if path valid |
223 | 223 | */ |
224 | 224 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
225 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
225 | + if (strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
226 | 226 | return false; |
227 | 227 | } |
228 | 228 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @return array Array of month short names |
235 | 235 | */ |
236 | 236 | public static function getCalendarShortMonths($calendarId = 0) { |
237 | - if(!isset(self::$calendarShortMonths[$calendarId])) { |
|
237 | + if (!isset(self::$calendarShortMonths[$calendarId])) { |
|
238 | 238 | $calendar_info = cal_info($calendarId); |
239 | 239 | self::$calendarShortMonths[$calendarId] = $calendar_info['abbrevmonths']; |
240 | 240 | } |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | * @param int $sosa Sosa number |
248 | 248 | * @return number |
249 | 249 | */ |
250 | - public static function getGeneration($sosa){ |
|
251 | - return(int)log($sosa, 2)+1; |
|
250 | + public static function getGeneration($sosa) { |
|
251 | + return(int)log($sosa, 2) + 1; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 |