@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * Manage updates sent from the AdminConfig@index form. |
32 | 32 | */ |
33 | 33 | protected function update() { |
34 | - if(Auth::isAdmin()){ |
|
34 | + if (Auth::isAdmin()) { |
|
35 | 35 | |
36 | 36 | $this->module->setSetting('MAJ_TITLE_PREFIX', Filter::post('MAJ_TITLE_PREFIX')); |
37 | 37 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function index() { |
63 | 63 | $action = Filter::post('action'); |
64 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
64 | + if ($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
65 | 65 | |
66 | 66 | Theme::theme(new AdministrationTheme)->init(Globals::getTree()); |
67 | 67 | $ctrl = new PageController(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
78 | 78 | */ |
79 | 79 | public function getConfigLink() { |
80 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
80 | + return 'module.php?mod='.$this->getName().'&mod_action=AdminConfig'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function getMenu(Tree $tree, $reference = null) { |
104 | 104 | $tree_url = $tree ? $tree->getNameUrl() : ''; |
105 | - return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
105 | + return new Menu($this->getTitle(), 'module.php?mod='.$this->getName().'&mod_action=Certificate@listAll&ged='.$tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow')); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -111,10 +111,10 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function hFactSourcePrepend($srec) { |
113 | 113 | $wt_tree = Globals::getTree(); |
114 | - $html=''; |
|
115 | - $sid=null; |
|
114 | + $html = ''; |
|
115 | + $sid = null; |
|
116 | 116 | |
117 | - if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)){ |
|
117 | + if ($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)) { |
|
118 | 118 | if (!$srec || strlen($srec) == 0) return $html; |
119 | 119 | |
120 | 120 | $certificate = null; |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | $levelSOUR = substr($subrecords[0], 0, 1); |
123 | 123 | $match = null; |
124 | 124 | if (preg_match('~^'.$levelSOUR.' SOUR @('.WT_REGEX_XREF.')@$~', $subrecords[0], $match)) { |
125 | - $sid=$match[1]; |
|
125 | + $sid = $match[1]; |
|
126 | 126 | }; |
127 | 127 | $nb_subrecords = count($subrecords); |
128 | - for ($i=0; $i < $nb_subrecords; $i++) { |
|
128 | + for ($i = 0; $i < $nb_subrecords; $i++) { |
|
129 | 129 | $subrecords[$i] = trim($subrecords[$i]); |
130 | 130 | $tag = substr($subrecords[$i], 2, 4); |
131 | 131 | $text = substr($subrecords[$i], 7); |
132 | - if($tag == '_ACT') $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
132 | + if ($tag == '_ACT') $certificate = new Certificate($text, $wt_tree, $this->getProvider()); |
|
133 | 133 | } |
134 | 134 | |
135 | - if($certificate && $certificate->canShow()) |
|
135 | + if ($certificate && $certificate->canShow()) |
|
136 | 136 | $html = $this->getDisplay_ACT($certificate, $sid); |
137 | 137 | |
138 | 138 | } |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function hHtmlSimpleTagDisplay($tag, $value, $context = null, $contextid = null) { |
161 | 161 | $html = ''; |
162 | - switch($tag){ |
|
162 | + switch ($tag) { |
|
163 | 163 | case '_ACT': |
164 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
164 | + if ($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
165 | 165 | break; |
166 | 166 | } |
167 | 167 | return $html; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null) { |
175 | 175 | $html = ''; |
176 | 176 | |
177 | - switch($tag){ |
|
177 | + switch ($tag) { |
|
178 | 178 | case '_ACT': |
179 | 179 | $element_id = Uuid::uuid4(); |
180 | 180 | Globals::getController() |
@@ -182,14 +182,14 @@ discard block |
||
182 | 182 | ->addExternalJavascript(WT_STATIC_URL.WT_MODULES_DIR.$this->getName().'/js/autocomplete.js') |
183 | 183 | ->addExternalJavascript(WT_STATIC_URL.WT_MODULES_DIR.$this->getName().'/js/updatecertificatevalues.js'); |
184 | 184 | $certificate = null; |
185 | - if($value){ |
|
185 | + if ($value) { |
|
186 | 186 | $certificate = new Certificate($value, Globals::getTree(), $this->getProvider()); |
187 | 187 | } |
188 | 188 | $tabCities = $this->getProvider()->getCitiesList(); |
189 | 189 | $html .= '<select id="certifCity'.$element_id.'" class="_CITY">'; |
190 | - foreach ($tabCities as $cities){ |
|
191 | - $selectedCity=''; |
|
192 | - if($certificate && $cities== $certificate->getCity()) $selectedCity='selected="true"'; |
|
190 | + foreach ($tabCities as $cities) { |
|
191 | + $selectedCity = ''; |
|
192 | + if ($certificate && $cities == $certificate->getCity()) $selectedCity = 'selected="true"'; |
|
193 | 193 | $html .= '<option value="'.$cities.'" '.$selectedCity.' />'.$cities.'</option>'; |
194 | 194 | } |
195 | 195 | $html .= '</select>'; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hAddSimpleTag() |
208 | 208 | */ |
209 | 209 | public function hAddSimpleTag($context, $level) { |
210 | - switch($context){ |
|
210 | + switch ($context) { |
|
211 | 211 | case 'SOUR': |
212 | 212 | FunctionsEdit::addSimpleTag($level.' _ACT'); |
213 | 213 | break; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHasHelpTextTag() |
220 | 220 | */ |
221 | 221 | public function hHasHelpTextTag($tag) { |
222 | - switch($tag){ |
|
222 | + switch ($tag) { |
|
223 | 223 | case '_ACT': |
224 | 224 | return true; |
225 | 225 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hGetHelpTextTag() |
232 | 232 | */ |
233 | 233 | public function hGetHelpTextTag($tag) { |
234 | - switch($tag){ |
|
234 | + switch ($tag) { |
|
235 | 235 | case '_ACT': |
236 | 236 | return array( |
237 | 237 | I18N::translate('Certificate'), |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface |
248 | 248 | */ |
249 | 249 | public function getProvider() { |
250 | - if(!$this->provider) { |
|
250 | + if (!$this->provider) { |
|
251 | 251 | $root_path = $this->getSetting('MAJ_CERT_ROOTDIR', 'certificates/'); |
252 | 252 | $this->provider = new CertificateFileProvider($root_path, Globals::getTree()); |
253 | 253 | } |
@@ -261,9 +261,9 @@ discard block |
||
261 | 261 | * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
262 | 262 | * @param string|null $sid Linked Source ID, if it exists |
263 | 263 | */ |
264 | - protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
|
264 | + protected function getDisplay_ACT(Certificate $certificate, $sid = null) { |
|
265 | 265 | $html = ''; |
266 | - if($certificate){ |
|
266 | + if ($certificate) { |
|
267 | 267 | $certificate->setSource($sid); |
268 | 268 | $html = $certificate->displayImage('icon'); |
269 | 269 | } |
@@ -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; |
@@ -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 | } |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() |
26 | 26 | */ |
27 | 27 | public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { |
28 | - if(!$place->isEmpty()) { |
|
29 | - $parent = array_reverse(explode (',', $place->getGedcomName())); |
|
28 | + if (!$place->isEmpty()) { |
|
29 | + $parent = array_reverse(explode(',', $place->getGedcomName())); |
|
30 | 30 | $place_id = 0; |
31 | 31 | $nb_levels = count($parent); |
32 | - for ($i=0; $i < $nb_levels; $i++) { |
|
32 | + for ($i = 0; $i < $nb_levels; $i++) { |
|
33 | 33 | $parent[$i] = trim($parent[$i]); |
34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | - $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
34 | + if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | + $pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
36 | 36 | ->execute(array($i, $place_id, $parent[$i])) |
37 | 37 | ->fetchOne(); |
38 | 38 | if (empty($pl_id)) break; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon() |
49 | 49 | */ |
50 | 50 | public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) { |
51 | - if(!$place->isEmpty()){ |
|
51 | + if (!$place->isEmpty()) { |
|
52 | 52 | $place_details = |
53 | 53 | Database::prepare('SELECT pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place') |
54 | 54 | ->execute(array($this->getProviderPlaceId($place))) |
55 | 55 | ->fetchOneRow(); |
56 | - if($place_details){ |
|
56 | + if ($place_details) { |
|
57 | 57 | return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon; |
58 | 58 | } |
59 | 59 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getPossibleHooks() |
72 | 72 | */ |
73 | 73 | public function getPossibleHooks() { |
74 | - static $hooks=null; |
|
74 | + static $hooks = null; |
|
75 | 75 | if ($hooks === null) { |
76 | 76 | $hooks = array(); |
77 | 77 | |
@@ -83,31 +83,31 @@ discard block |
||
83 | 83 | 'SELECT module_name FROM `##module`' |
84 | 84 | )->fetchOneColumn(); |
85 | 85 | |
86 | - foreach($module_names as $module_name) { |
|
86 | + foreach ($module_names as $module_name) { |
|
87 | 87 | $module = Module::getModuleByName($module_name); |
88 | 88 | |
89 | - if($module instanceof HookSubscriberInterface){ |
|
89 | + if ($module instanceof HookSubscriberInterface) { |
|
90 | 90 | $subscribedhooks = $module->getSubscribedHooks(); |
91 | - if(is_array($subscribedhooks)){ |
|
92 | - foreach($subscribedhooks as $key => $value){ |
|
93 | - if(is_int($key)) { |
|
91 | + if (is_array($subscribedhooks)) { |
|
92 | + foreach ($subscribedhooks as $key => $value) { |
|
93 | + if (is_int($key)) { |
|
94 | 94 | $hook_item = $value; |
95 | 95 | $priority = self::DEFAULT_PRIORITY; |
96 | 96 | } |
97 | - else{ |
|
97 | + else { |
|
98 | 98 | $hook_item = explode('#', $key, 2); |
99 | 99 | $priority = $value; |
100 | 100 | } |
101 | - if($hook_item && count($hook_item) == 2){ |
|
101 | + if ($hook_item && count($hook_item) == 2) { |
|
102 | 102 | $hook_func = $hook_item[0]; |
103 | 103 | $hook_cont = $hook_item[1]; |
104 | 104 | } |
105 | - else{ |
|
105 | + else { |
|
106 | 106 | $hook_func = $hook_item[0]; |
107 | 107 | $hook_cont = 'all'; |
108 | 108 | } |
109 | - if(method_exists($module, $hook_func)){ |
|
110 | - $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont]=$priority; |
|
109 | + if (method_exists($module, $hook_func)) { |
|
110 | + $hooks[$module->getName().'#'.$hook_func.'#'.$hook_cont] = $priority; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * {@inheritDoc} |
122 | 122 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getRawInstalledHooks() |
123 | 123 | */ |
124 | - public function getRawInstalledHooks(){ |
|
125 | - if(self::isModuleOperational()){ |
|
124 | + public function getRawInstalledHooks() { |
|
125 | + if (self::isModuleOperational()) { |
|
126 | 126 | return Database::prepare( |
127 | 127 | "SELECT majh_id AS id, majh_module_name AS module, majh_hook_function AS hook, majh_hook_context as context, majh_module_priority AS priority, majh_status AS status". |
128 | 128 | " FROM `##maj_hooks`". |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * {@inheritDoc} |
137 | 137 | * @see \MyArtJaub\Webtrees\Hook\HookProviderInterface::getInstalledHooks() |
138 | 138 | */ |
139 | - public function getInstalledHooks(){ |
|
140 | - static $installedhooks =null; |
|
141 | - if($installedhooks===null){ |
|
142 | - $dbhooks=self::getRawInstalledHooks(); |
|
143 | - foreach($dbhooks as $dbhook){ |
|
139 | + public function getInstalledHooks() { |
|
140 | + static $installedhooks = null; |
|
141 | + if ($installedhooks === null) { |
|
142 | + $dbhooks = self::getRawInstalledHooks(); |
|
143 | + foreach ($dbhooks as $dbhook) { |
|
144 | 144 | $installedhooks[($dbhook->module).'#'.($dbhook->hook).'#'.($dbhook->context)] = array('id' => $dbhook->id, 'status' => $dbhook->status, 'priority' => $dbhook->priority); |
145 | 145 | } |
146 | 146 | } |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function updateHooks() { |
155 | 155 | |
156 | - if(Auth::isAdmin()){ |
|
156 | + if (Auth::isAdmin()) { |
|
157 | 157 | $ihooks = self::getInstalledHooks(); |
158 | 158 | $phooks = self::getPossibleHooks(); |
159 | 159 | |
160 | 160 | // Insert hooks not existing yet in the DB |
161 | - if($phooks !== null){ |
|
162 | - foreach($phooks as $phook => $priority){ |
|
161 | + if ($phooks !== null) { |
|
162 | + foreach ($phooks as $phook => $priority) { |
|
163 | 163 | $array_hook = explode('#', $phook); |
164 | - if($ihooks === null || !array_key_exists($phook, $ihooks)){ |
|
164 | + if ($ihooks === null || !array_key_exists($phook, $ihooks)) { |
|
165 | 165 | $chook = new Hook($array_hook[1], $array_hook[2]); |
166 | 166 | $chook->subscribe($array_hook[0]); |
167 | 167 | $chook->setPriority($array_hook[0], $priority); |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | //Remove hooks not existing any more in the file system |
173 | - if($ihooks !== null){ |
|
174 | - foreach(array_keys($ihooks) as $ihook){ |
|
173 | + if ($ihooks !== null) { |
|
174 | + foreach (array_keys($ihooks) as $ihook) { |
|
175 | 175 | $array_hook = explode('#', $ihook); |
176 | - if($phooks === null || !array_key_exists($ihook, $phooks)){ |
|
176 | + if ($phooks === null || !array_key_exists($ihook, $phooks)) { |
|
177 | 177 | $chook = new Hook($array_hook[1], $array_hook[2]); |
178 | 178 | $chook->remove($array_hook[0]); |
179 | 179 | } |