@@ -52,7 +52,7 @@ |
||
| 52 | 52 | /** |
| 53 | 53 | * Find the spouse of a person, using the Xref comparison. |
| 54 | 54 | * |
| 55 | - * @param Individual $person |
|
| 55 | + * @param fw\Individual $person |
|
| 56 | 56 | * |
| 57 | 57 | * @return Individual|null |
| 58 | 58 | */ |
@@ -45,7 +45,9 @@ |
||
| 45 | 45 | * @return int Level of sources |
| 46 | 46 | * */ |
| 47 | 47 | function isMarriageSourced(){ |
| 48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 48 | + if($this->is_marriage_sourced !== null) { |
|
| 49 | + return $this->is_marriage_sourced; |
|
| 50 | + } |
|
| 49 | 51 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
| 50 | 52 | return $this->is_marriage_sourced; |
| 51 | 53 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @param \Fisharebest\Webtrees\Place $place |
| 76 | 76 | * @param string $icon_path |
| 77 | - * @param number $size |
|
| 77 | + * @param integer $size |
|
| 78 | 78 | * @return string HTML code of the inserted flag |
| 79 | 79 | */ |
| 80 | 80 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
@@ -184,7 +184,6 @@ discard block |
||
| 184 | 184 | /** |
| 185 | 185 | * Format date to display short (just years) |
| 186 | 186 | * |
| 187 | - * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date |
|
| 188 | 187 | * @param boolean $anchor option to print a link to calendar |
| 189 | 188 | * @return string HTML code for short date |
| 190 | 189 | */ |
@@ -212,7 +211,6 @@ discard block |
||
| 212 | 211 | /** |
| 213 | 212 | * Format fact place to display short |
| 214 | 213 | * |
| 215 | - * @param \Fisharebest\Webtrees\Fact $eventObj Fact to display date |
|
| 216 | 214 | * @param string $format Format of the place |
| 217 | 215 | * @param boolean $anchor option to print a link to placelist |
| 218 | 216 | * @return string HTML code for short place |
@@ -160,7 +160,9 @@ discard block |
||
| 160 | 160 | public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true){ |
| 161 | 161 | $html = ''; |
| 162 | 162 | $tag = 'em'; |
| 163 | - if($isStrong) $tag = 'strong'; |
|
| 163 | + if($isStrong) { |
|
| 164 | + $tag = 'strong'; |
|
| 165 | + } |
|
| 164 | 166 | if($individual && $individual->canShow()){ |
| 165 | 167 | $dindi = new Individual($individual); |
| 166 | 168 | $html = $individual->getSexImage(); |
@@ -174,8 +176,7 @@ discard block |
||
| 174 | 176 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
| 175 | 177 | $html .= ' <span><small><em>'.$dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10).'</em></small></span>'; |
| 176 | 178 | $html .= '</a>'; |
| 177 | - } |
|
| 178 | - else { |
|
| 179 | + } else { |
|
| 179 | 180 | $html .= '<span class=\"list_item\"><'.$tag.'>' . I18N::translate('Private') . '</'.$tag.'></span>'; |
| 180 | 181 | } |
| 181 | 182 | return $html; |
@@ -193,8 +194,7 @@ discard block |
||
| 193 | 194 | $date = $fact->getDate(); |
| 194 | 195 | if($date->isOK()){ |
| 195 | 196 | $html.=' '.$date->Display($anchor && !Globals::isSearchSpider(), '%Y'); |
| 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 |
@@ -218,7 +218,9 @@ discard block |
||
| 218 | 218 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
| 219 | 219 | $html=''; |
| 220 | 220 | |
| 221 | - if ($fact === null) return $html; |
|
| 221 | + if ($fact === null) { |
|
| 222 | + return $html; |
|
| 223 | + } |
|
| 222 | 224 | $place = $fact->getPlace(); |
| 223 | 225 | if($place){ |
| 224 | 226 | $dplace = new Place($place); |
@@ -336,7 +338,9 @@ discard block |
||
| 336 | 338 | default: |
| 337 | 339 | break; |
| 338 | 340 | } |
| 339 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 341 | + if($image && $title) { |
|
| 342 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 343 | + } |
|
| 340 | 344 | break; |
| 341 | 345 | default: |
| 342 | 346 | break; |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * Returns an estimated birth place based on statistics on the base |
| 94 | 94 | * |
| 95 | 95 | * @param boolean $perc Should the coefficient of reliability be returned |
| 96 | - * @return string|array Estimated birth place if found, null otherwise |
|
| 96 | + * @return string Estimated birth place if found, null otherwise |
|
| 97 | 97 | */ |
| 98 | 98 | public function getEstimatedBirthPlace($perc=false){ |
| 99 | 99 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
@@ -110,7 +110,6 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * Returns a significant place for the individual |
| 112 | 112 | * |
| 113 | - * @param boolean $perc Should the coefficient of reliability be returned |
|
| 114 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 115 | 114 | */ |
| 116 | 115 | public function getSignificantPlace(){ |
@@ -65,8 +65,7 @@ discard block |
||
| 65 | 65 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
| 66 | 66 | if($ct2>0){ |
| 67 | 67 | $this->titles[$match2[1][0]][]= trim($match2[2][0]); |
| 68 | - } |
|
| 69 | - else{ |
|
| 68 | + } else{ |
|
| 70 | 69 | $this->titles[$titlefact->getValue()][]=''; |
| 71 | 70 | } |
| 72 | 71 | } |
@@ -98,8 +97,7 @@ discard block |
||
| 98 | 97 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
| 99 | 98 | if($perc){ |
| 100 | 99 | return array ($bplace, 1); |
| 101 | - } |
|
| 102 | - else{ |
|
| 100 | + } else{ |
|
| 103 | 101 | return $bplace; |
| 104 | 102 | } |
| 105 | 103 | } |
@@ -168,7 +166,9 @@ discard block |
||
| 168 | 166 | * @return int Level of sources |
| 169 | 167 | * */ |
| 170 | 168 | public function isBirthSourced(){ |
| 171 | - if($this->is_birth_sourced !== null) return $this->is_birth_sourced; |
|
| 169 | + if($this->is_birth_sourced !== null) { |
|
| 170 | + return $this->is_birth_sourced; |
|
| 171 | + } |
|
| 172 | 172 | $this->is_birth_sourced = $this->isFactSourced(WT_EVENTS_BIRT); |
| 173 | 173 | return $this->is_birth_sourced; |
| 174 | 174 | } |
@@ -179,7 +179,9 @@ discard block |
||
| 179 | 179 | * @return int Level of sources |
| 180 | 180 | * */ |
| 181 | 181 | public function isDeathSourced(){ |
| 182 | - if($this->is_death_sourced !== null) return $this->is_death_sourced; |
|
| 182 | + if($this->is_death_sourced !== null) { |
|
| 183 | + return $this->is_death_sourced; |
|
| 184 | + } |
|
| 183 | 185 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
| 184 | 186 | return $this->is_death_sourced; |
| 185 | 187 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * Set parameters of the Task |
| 111 | 111 | * |
| 112 | 112 | * @param bool $is_enabled Status of the task |
| 113 | - * @param \DateTime $lastupdated Time of the last task run |
|
| 113 | + * @param \DateTime $last_updated Time of the last task run |
|
| 114 | 114 | * @param bool $last_result Result of the last run, true for success, false for failure |
| 115 | 115 | * @param int $frequency Frequency of execution in minutes |
| 116 | 116 | * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
@@ -235,7 +235,9 @@ discard block |
||
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function save() { |
| 238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 238 | + if(!$this->provider) { |
|
| 239 | + throw new \Exception('The task has not been initialised with a provider.'); |
|
| 240 | + } |
|
| 239 | 241 | return $this->provider->updateTask($this); |
| 240 | 242 | } |
| 241 | 243 | |
@@ -245,8 +247,9 @@ discard block |
||
| 245 | 247 | */ |
| 246 | 248 | public function execute(){ |
| 247 | 249 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | - $this->is_running = false; |
|
| 250 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) { |
|
| 251 | + $this->is_running = false; |
|
| 252 | + } |
|
| 250 | 253 | |
| 251 | 254 | if(!$this->is_running){ |
| 252 | 255 | $this->last_result = false; |
@@ -259,7 +262,9 @@ discard block |
||
| 259 | 262 | $this->last_updated = new \DateTime(); |
| 260 | 263 | if($this->nb_occurrences > 0){ |
| 261 | 264 | $this->nb_occurrences--; |
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 265 | + if($this->nb_occurrences == 0) { |
|
| 266 | + $this->is_enabled = false; |
|
| 267 | + } |
|
| 263 | 268 | } |
| 264 | 269 | } |
| 265 | 270 | $this->is_running = false; |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | * Set the status of a specific admin task. |
| 33 | 33 | * The status can be enabled (true), or disabled (false). |
| 34 | 34 | * |
| 35 | - * @param AbstractTask $ga |
|
| 36 | 35 | * @param bool $status |
| 36 | + * @return void |
|
| 37 | 37 | */ |
| 38 | 38 | public function setTaskStatus(AbstractTask $task, $status); |
| 39 | 39 | |
@@ -49,6 +49,7 @@ discard block |
||
| 49 | 49 | * Delete the task from the database, in a transactional manner. |
| 50 | 50 | * |
| 51 | 51 | * @param string $task_name Task to delete |
| 52 | + * @return boolean |
|
| 52 | 53 | */ |
| 53 | 54 | public function deleteTask($task_name); |
| 54 | 55 | |
@@ -75,7 +76,7 @@ discard block |
||
| 75 | 76 | * Returns the list of tasks that are currently meant to run. |
| 76 | 77 | * Tasks to run can be forced, or can be limited to only one. |
| 77 | 78 | * |
| 78 | - * @param string|null $force Force the enabled tasks to run. |
|
| 79 | + * @param boolean $force Force the enabled tasks to run. |
|
| 79 | 80 | * @param string|null $task_name Name of the specific task to run |
| 80 | 81 | */ |
| 81 | 82 | function getTasksToRun($force = false, $task_name = null); |
@@ -109,6 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * {@inhericDoc} |
| 111 | 111 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
| 112 | + * @param string $xref |
|
| 112 | 113 | */ |
| 113 | 114 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
| 114 | 115 | try{ |
@@ -150,7 +151,7 @@ discard block |
||
| 150 | 151 | /** |
| 151 | 152 | * Define a source associated with the certificate |
| 152 | 153 | * |
| 153 | - * @param string|Source $xref |
|
| 154 | + * @param string|null $xref |
|
| 154 | 155 | */ |
| 155 | 156 | public function setSource($xref){ |
| 156 | 157 | if($xref instanceof Source){ |
@@ -118,8 +118,7 @@ discard block |
||
| 118 | 118 | if(Functions::isValidPath($certfile, true)) { |
| 119 | 119 | return new Certificate($certfile, $tree, $provider); |
| 120 | 120 | } |
| 121 | - } |
|
| 122 | - catch (\Exception $ex) { |
|
| 121 | + } catch (\Exception $ex) { |
|
| 123 | 122 | Log::addErrorLog('Certificate module error : > '.$ex->getMessage().' < with data > '.$xref.' <'); |
| 124 | 123 | } |
| 125 | 124 | |
@@ -202,7 +201,9 @@ discard block |
||
| 202 | 201 | */ |
| 203 | 202 | public function getCity(){ |
| 204 | 203 | $chunks = explode('/', $this->getFilename(), 2); |
| 205 | - if(count($chunks) > 1) return $chunks[0]; |
|
| 204 | + if(count($chunks) > 1) { |
|
| 205 | + return $chunks[0]; |
|
| 206 | + } |
|
| 206 | 207 | return null; |
| 207 | 208 | } |
| 208 | 209 | |
@@ -246,8 +247,7 @@ discard block |
||
| 246 | 247 | |
| 247 | 248 | if($sid){ |
| 248 | 249 | $this->source = Source::getInstance($sid, $this->tree); |
| 249 | - } |
|
| 250 | - else{ |
|
| 250 | + } else{ |
|
| 251 | 251 | $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -256,7 +256,9 @@ discard block |
||
| 256 | 256 | $repofact = $this->source->getFirstFact('REPO'); |
| 257 | 257 | if($repofact) { |
| 258 | 258 | $repo = $repofact->getTarget(); |
| 259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
| 259 | + if($repo && $repo instanceof Repository) { |
|
| 260 | + $wmtext .= ' '.$repo->getFullName().' - '; |
|
| 261 | + } |
|
| 260 | 262 | } |
| 261 | 263 | $wmtext .= $this->source->getFullName(); |
| 262 | 264 | } |
@@ -426,7 +428,9 @@ discard block |
||
| 426 | 428 | } |
| 427 | 429 | } |
| 428 | 430 | |
| 429 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
| 431 | + if($sid) { |
|
| 432 | + $this->source = Source::getInstance($sid, $this->tree); |
|
| 433 | + } |
|
| 430 | 434 | |
| 431 | 435 | return $this->source; |
| 432 | 436 | } |
@@ -252,7 +252,7 @@ |
||
| 252 | 252 | /** |
| 253 | 253 | * Return the HTML code for custom simple tag _ACT |
| 254 | 254 | * |
| 255 | - * @param Certificate $certificatePath Certificate (as per the GEDCOM) |
|
| 255 | + * @param Certificate $certificate Certificate (as per the GEDCOM) |
|
| 256 | 256 | * @param string|null $sid Linked Source ID, if it exists |
| 257 | 257 | */ |
| 258 | 258 | protected function getDisplay_ACT(Certificate $certificate, $sid = null){ |
@@ -115,7 +115,9 @@ discard block |
||
| 115 | 115 | $sid=null; |
| 116 | 116 | |
| 117 | 117 | if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($wt_tree)){ |
| 118 | - if (!$srec || strlen($srec) == 0) return $html; |
|
| 118 | + if (!$srec || strlen($srec) == 0) { |
|
| 119 | + return $html; |
|
| 120 | + } |
|
| 119 | 121 | |
| 120 | 122 | $certificate = null; |
| 121 | 123 | $subrecords = explode("\n", $srec); |
@@ -129,11 +131,14 @@ discard block |
||
| 129 | 131 | $subrecords[$i] = trim($subrecords[$i]); |
| 130 | 132 | $tag = substr($subrecords[$i], 2, 4); |
| 131 | 133 | $text = substr($subrecords[$i], 7); |
| 132 | - if($tag == '_ACT') $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
| 134 | + if($tag == '_ACT') { |
|
| 135 | + $certificate= new Certificate($text, $wt_tree, $this->getProvider()); |
|
| 136 | + } |
|
| 133 | 137 | } |
| 134 | 138 | |
| 135 | - if($certificate && $certificate->canShow()) |
|
| 136 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 139 | + if($certificate && $certificate->canShow()) { |
|
| 140 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 141 | + } |
|
| 137 | 142 | |
| 138 | 143 | } |
| 139 | 144 | return $html; |
@@ -161,7 +166,9 @@ discard block |
||
| 161 | 166 | $html = ''; |
| 162 | 167 | switch($tag){ |
| 163 | 168 | case '_ACT': |
| 164 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 169 | + if($context == 'SOUR') { |
|
| 170 | + $html = $this->getDisplay_ACT($value, $contextid); |
|
| 171 | + } |
|
| 165 | 172 | break; |
| 166 | 173 | } |
| 167 | 174 | return $html; |
@@ -189,7 +196,9 @@ discard block |
||
| 189 | 196 | $html .= '<select id="certifCity'.$element_id.'" class="_CITY">'; |
| 190 | 197 | foreach ($tabCities as $cities){ |
| 191 | 198 | $selectedCity=''; |
| 192 | - if($certificate && $cities== $certificate->getCity()) $selectedCity='selected="true"'; |
|
| 199 | + if($certificate && $cities== $certificate->getCity()) { |
|
| 200 | + $selectedCity='selected="true"'; |
|
| 201 | + } |
|
| 193 | 202 | $html .= '<option value="'.$cities.'" '.$selectedCity.' />'.$cities.'</option>'; |
| 194 | 203 | } |
| 195 | 204 | $html .= '</select>'; |
@@ -42,7 +42,6 @@ |
||
| 42 | 42 | * Get all the data from the bag for a given key. |
| 43 | 43 | * |
| 44 | 44 | * @param string $key |
| 45 | - * @param string $format |
|
| 46 | 45 | * @return unknown |
| 47 | 46 | */ |
| 48 | 47 | public function get($key, $default = null) |
@@ -73,8 +73,12 @@ |
||
| 73 | 73 | * @param bool $override |
| 74 | 74 | */ |
| 75 | 75 | public function set($key, $value, $override = true) { |
| 76 | - if(is_null($key)) return; |
|
| 77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
| 76 | + if(is_null($key)) { |
|
| 77 | + return; |
|
| 78 | + } |
|
| 79 | + if(!$override && array_key_exists($key, $this->data)) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 78 | 82 | $this->data[$key] = $value; |
| 79 | 83 | } |
| 80 | 84 | |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | return $task; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - } |
|
| 53 | - catch(\Exception $ex) { } |
|
| 52 | + } catch(\Exception $ex) { } |
|
| 54 | 53 | |
| 55 | 54 | return null; |
| 56 | 55 | } |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | ); |
| 84 | 83 | |
| 85 | 84 | return $task; |
| 86 | - } |
|
| 87 | - else { |
|
| 85 | + } else { |
|
| 88 | 86 | $this->deleteTask($row['majat_name']); |
| 89 | 87 | } |
| 90 | 88 | return null; |
@@ -156,8 +154,7 @@ discard block |
||
| 156 | 154 | 'is_running' => $task->isRunning() ? 1 : 0 |
| 157 | 155 | )); |
| 158 | 156 | return true; |
| 159 | - } |
|
| 160 | - catch (\Exception $ex) { |
|
| 157 | + } catch (\Exception $ex) { |
|
| 161 | 158 | Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage())); |
| 162 | 159 | return false; |
| 163 | 160 | } |
@@ -279,7 +276,9 @@ discard block |
||
| 279 | 276 | $dir=opendir($this->root_path); |
| 280 | 277 | while (($file=readdir($dir))!==false){ |
| 281 | 278 | try { |
| 282 | - if($file == '.' || $file == '..') continue; |
|
| 279 | + if($file == '.' || $file == '..') { |
|
| 280 | + continue; |
|
| 281 | + } |
|
| 283 | 282 | $task = include $this->root_path . $file; |
| 284 | 283 | if($task ) { |
| 285 | 284 | $task->setProvider($this); |
@@ -294,12 +293,10 @@ discard block |
||
| 294 | 293 | )); |
| 295 | 294 | |
| 296 | 295 | $tasks[] = $task; |
| 297 | - } |
|
| 298 | - else { |
|
| 296 | + } else { |
|
| 299 | 297 | throw new \Exception; |
| 300 | 298 | } |
| 301 | - } |
|
| 302 | - catch (\Exception $ex) { |
|
| 299 | + } catch (\Exception $ex) { |
|
| 303 | 300 | Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage()); |
| 304 | 301 | } |
| 305 | 302 | } |
@@ -325,8 +322,7 @@ discard block |
||
| 325 | 322 | Log::addConfigurationLog('Admin Task '.$task_name.' has been deleted from disk - deleting it from DB'); |
| 326 | 323 | |
| 327 | 324 | return true; |
| 328 | - } |
|
| 329 | - catch(\Exception $ex) { |
|
| 325 | + } catch(\Exception $ex) { |
|
| 330 | 326 | Database::rollback(); |
| 331 | 327 | |
| 332 | 328 | Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage()); |