@@ -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 | } |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @param integer $num Numerator |
| 53 | 53 | * @param integer $denom Denominator |
| 54 | - * @param float $default Default value if denominator null or 0 |
|
| 55 | - * @return float Result of the safe division |
|
| 54 | + * @param integer $default Default value if denominator null or 0 |
|
| 55 | + * @return integer Result of the safe division |
|
| 56 | 56 | */ |
| 57 | 57 | public static function safeDivision($num, $denom, $default = 0) { |
| 58 | 58 | if($denom && $denom!=0){ |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @param int $num Numerator |
| 68 | 68 | * @param int $denom Denominator |
| 69 | - * @param float $default Default value if denominator null or 0 |
|
| 70 | - * @return float Percentage |
|
| 69 | + * @param integer $default Default value if denominator null or 0 |
|
| 70 | + * @return integer Percentage |
|
| 71 | 71 | */ |
| 72 | 72 | public static function getPercentage($num, $denom, $default = 0){ |
| 73 | 73 | return 100 * self::safeDivision($num, $denom, $default); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @param string $file The image to resize |
| 80 | 80 | * @param int $target The final max width/height |
| 81 | - * @return array array of ($width, $height). One of them must be $target |
|
| 81 | + * @return integer[] array of ($width, $height). One of them must be $target |
|
| 82 | 82 | */ |
| 83 | 83 | static public function getResizedImageSize($file, $target=25){ |
| 84 | 84 | list($width, $height, $type, $attr) = getimagesize($file); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * Returns the generation associated with a Sosa number |
| 234 | 234 | * |
| 235 | 235 | * @param int $sosa Sosa number |
| 236 | - * @return number |
|
| 236 | + * @return integer |
|
| 237 | 237 | */ |
| 238 | 238 | public static function getGeneration($sosa){ |
| 239 | 239 | return(int)log($sosa, 2)+1; |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * Returns whether the image type is supported by the system, and if so, return the standardised type |
| 247 | 247 | * |
| 248 | 248 | * @param string $reqtype Extension to test |
| 249 | - * @return boolean|string Is supported? |
|
| 249 | + * @return false|string Is supported? |
|
| 250 | 250 | */ |
| 251 | 251 | public static function isImageTypeSupported($reqtype) { |
| 252 | 252 | $supportByGD = array('jpg'=>'jpeg', 'jpeg'=>'jpeg', 'gif'=>'gif', 'png'=>'png'); |
@@ -114,16 +114,18 @@ discard block |
||
| 114 | 114 | $len_chars = count($chars); |
| 115 | 115 | $token = ''; |
| 116 | 116 | |
| 117 | - for ($i = 0; $i < $length; $i++) |
|
| 118 | - $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
| 117 | + for ($i = 0; $i < $length; $i++) { |
|
| 118 | + $token .= $chars[ mt_rand(0, $len_chars - 1) ]; |
|
| 119 | + } |
|
| 119 | 120 | |
| 120 | 121 | # Number of 32 char chunks |
| 121 | 122 | $chunks = ceil( strlen($token) / 32 ); |
| 122 | 123 | $md5token = ''; |
| 123 | 124 | |
| 124 | 125 | # Run each chunk through md5 |
| 125 | - for ( $i=1; $i<=$chunks; $i++ ) |
|
| 126 | - $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
| 126 | + for ( $i=1; $i<=$chunks; $i++ ) { |
|
| 127 | + $md5token .= md5( substr($token, $i * 32 - 32, 32) ); |
|
| 128 | + } |
|
| 127 | 129 | |
| 128 | 130 | # Trim the token |
| 129 | 131 | return substr($md5token, 0, $length); |
@@ -146,12 +148,14 @@ discard block |
||
| 146 | 148 | * @return string Encrypted and encoded text |
| 147 | 149 | */ |
| 148 | 150 | public static function encryptToSafeBase64($data){ |
| 149 | - if(!self::isEncryptionCompatible()) |
|
| 150 | - throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
| 151 | + if(!self::isEncryptionCompatible()) { |
|
| 152 | + throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
| 153 | + } |
|
| 151 | 154 | |
| 152 | 155 | $key = 'STANDARDKEYIFNOSERVER'; |
| 153 | - if(Filter::server('SERVER_NAME') && Filter::server('SERVER_SOFTWARE')) |
|
| 154 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 156 | + if(Filter::server('SERVER_NAME') && Filter::server('SERVER_SOFTWARE')) { |
|
| 157 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 158 | + } |
|
| 155 | 159 | $iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND); |
| 156 | 160 | $id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv); |
| 157 | 161 | $encrypted = base64_encode($iv.$id); |
@@ -169,20 +173,24 @@ discard block |
||
| 169 | 173 | * @return string Decrypted text |
| 170 | 174 | */ |
| 171 | 175 | public static function decryptFromSafeBase64($encrypted){ |
| 172 | - if(!self::isEncryptionCompatible()) |
|
| 173 | - throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
| 176 | + if(!self::isEncryptionCompatible()) { |
|
| 177 | + throw new \Exception('MCrypt PHP extension is required to use encryption.'); |
|
| 178 | + } |
|
| 174 | 179 | |
| 175 | 180 | $key = 'STANDARDKEYIFNOSERVER'; |
| 176 | - if(Filter::server('SERVER_NAME') && Filter::server('SERVER_SOFTWARE')) |
|
| 177 | - $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 181 | + if(Filter::server('SERVER_NAME') && Filter::server('SERVER_SOFTWARE')) { |
|
| 182 | + $key = md5(Filter::server('SERVER_NAME').Filter::server('SERVER_SOFTWARE')); |
|
| 183 | + } |
|
| 178 | 184 | $encrypted = str_replace('-', '+', $encrypted); |
| 179 | 185 | $encrypted = str_replace('_', '/', $encrypted); |
| 180 | 186 | $encrypted = str_replace('*', '=', $encrypted); |
| 181 | 187 | $encrypted = base64_decode($encrypted); |
| 182 | - if(!$encrypted) |
|
| 183 | - throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
| 184 | - if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) |
|
| 185 | - throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 188 | + if(!$encrypted) { |
|
| 189 | + throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.'); |
|
| 190 | + } |
|
| 191 | + if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) { |
|
| 192 | + throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.'); |
|
| 193 | + } |
|
| 186 | 194 | $iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE); |
| 187 | 195 | $encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE); |
| 188 | 196 | $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec); |
@@ -223,7 +231,9 @@ discard block |
||
| 223 | 231 | * @return boolean True if path valid |
| 224 | 232 | */ |
| 225 | 233 | public static function isValidPath($filename, $acceptfolder = FALSE) { |
| 226 | - if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true; |
|
| 234 | + if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) { |
|
| 235 | + return true; |
|
| 236 | + } |
|
| 227 | 237 | return false; |
| 228 | 238 | } |
| 229 | 239 | |
@@ -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->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>'; |
| 175 | 177 | $html .= ' <span><small><em>'.$dindi->format_first_major_fact(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; |
@@ -195,8 +196,7 @@ discard block |
||
| 195 | 196 | $date = $fact->getDate(); |
| 196 | 197 | if($date->isOK()){ |
| 197 | 198 | $html.=' '.$date->Display($anchor && !$SEARCH_SPIDER, '%Y'); |
| 198 | - } |
|
| 199 | - else{ |
|
| 199 | + } else{ |
|
| 200 | 200 | // 1 DEAT Y with no DATE => print YES |
| 201 | 201 | // 1 BIRT 2 SOUR @S1@ => print YES |
| 202 | 202 | // 1 DEAT N is not allowed |
@@ -220,7 +220,9 @@ discard block |
||
| 220 | 220 | public static function formatFactPlaceShort(\Fisharebest\Webtrees\Fact $fact, $format, $anchor=false){ |
| 221 | 221 | $html=''; |
| 222 | 222 | |
| 223 | - if ($fact === null) return $html; |
|
| 223 | + if ($fact === null) { |
|
| 224 | + return $html; |
|
| 225 | + } |
|
| 224 | 226 | $place = $fact->getPlace(); |
| 225 | 227 | if($place){ |
| 226 | 228 | $dplace = new Place($place); |
@@ -339,7 +341,9 @@ discard block |
||
| 339 | 341 | default: |
| 340 | 342 | break; |
| 341 | 343 | } |
| 342 | - if($image && $title) $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 344 | + if($image && $title) { |
|
| 345 | + $html = '<i class="icon-maj-sourced-'.$size.'_'.$image.'" title="'.$title.'"></i>'; |
|
| 346 | + } |
|
| 343 | 347 | break; |
| 344 | 348 | default: |
| 345 | 349 | 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 |
@@ -236,7 +236,9 @@ discard block |
||
| 236 | 236 | * @return bool |
| 237 | 237 | */ |
| 238 | 238 | public function save() { |
| 239 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | + if(!$this->provider) { |
|
| 240 | + throw new \Exception('The task has not been initialised with a provider.'); |
|
| 241 | + } |
|
| 240 | 242 | return $this->provider->updateTask($this); |
| 241 | 243 | } |
| 242 | 244 | |
@@ -246,8 +248,9 @@ discard block |
||
| 246 | 248 | */ |
| 247 | 249 | public function execute(){ |
| 248 | 250 | |
| 249 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 250 | - $this->is_running = false; |
|
| 251 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) { |
|
| 252 | + $this->is_running = false; |
|
| 253 | + } |
|
| 251 | 254 | |
| 252 | 255 | if(!$this->is_running){ //TODO put in place a time_out for running... |
| 253 | 256 | //TODO Log the executions in the logs |
@@ -261,7 +264,9 @@ discard block |
||
| 261 | 264 | $this->last_updated = new \DateTime(); |
| 262 | 265 | if($this->nb_occurrences > 0){ |
| 263 | 266 | $this->nb_occurrences--; |
| 264 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 267 | + if($this->nb_occurrences == 0) { |
|
| 268 | + $this->is_enabled = false; |
|
| 269 | + } |
|
| 265 | 270 | } |
| 266 | 271 | } |
| 267 | 272 | $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){ |
@@ -105,7 +105,9 @@ discard block |
||
| 105 | 105 | $sid=null; |
| 106 | 106 | |
| 107 | 107 | if($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)){ |
| 108 | - if (!$srec || strlen($srec) == 0) return $html; |
|
| 108 | + if (!$srec || strlen($srec) == 0) { |
|
| 109 | + return $html; |
|
| 110 | + } |
|
| 109 | 111 | |
| 110 | 112 | $certificate = null; |
| 111 | 113 | $subrecords = explode("\n", $srec); |
@@ -118,11 +120,14 @@ discard block |
||
| 118 | 120 | $level = substr($subrecords[$i], 0, 1); |
| 119 | 121 | $tag = substr($subrecords[$i], 2, 4); |
| 120 | 122 | $text = substr($subrecords[$i], 7); |
| 121 | - if($tag == '_ACT') $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
| 123 | + if($tag == '_ACT') { |
|
| 124 | + $certificate= new Certificate($text, $WT_TREE, $this->getProvider()); |
|
| 125 | + } |
|
| 122 | 126 | } |
| 123 | 127 | |
| 124 | - if($certificate && $certificate->canShow()) |
|
| 125 | - $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 128 | + if($certificate && $certificate->canShow()) { |
|
| 129 | + $html = $this->getDisplay_ACT($certificate, $sid); |
|
| 130 | + } |
|
| 126 | 131 | |
| 127 | 132 | } |
| 128 | 133 | return $html; |
@@ -150,7 +155,9 @@ discard block |
||
| 150 | 155 | $html = ''; |
| 151 | 156 | switch($tag){ |
| 152 | 157 | case '_ACT': |
| 153 | - if($context == 'SOUR') $html = $this->getDisplay_ACT($value, $contextid); |
|
| 158 | + if($context == 'SOUR') { |
|
| 159 | + $html = $this->getDisplay_ACT($value, $contextid); |
|
| 160 | + } |
|
| 154 | 161 | break; |
| 155 | 162 | } |
| 156 | 163 | return $html; |
@@ -180,7 +187,9 @@ discard block |
||
| 180 | 187 | $html .= '<select id="certifCity'.$element_id.'" class="_CITY">'; |
| 181 | 188 | foreach ($tabCities as $cities){ |
| 182 | 189 | $selectedCity=''; |
| 183 | - if($certificate && $cities== $certificate->getCity()) $selectedCity='selected="true"'; |
|
| 190 | + if($certificate && $cities== $certificate->getCity()) { |
|
| 191 | + $selectedCity='selected="true"'; |
|
| 192 | + } |
|
| 184 | 193 | $html .= '<option value="'.$cities.'" '.$selectedCity.' />'.$cities.'</option>'; |
| 185 | 194 | } |
| 186 | 195 | $html .= '</select>'; |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | /** |
| 90 | 90 | * Returns the number of geographical analysis (active and inactive). |
| 91 | 91 | * |
| 92 | - * @return int |
|
| 92 | + * @return string |
|
| 93 | 93 | */ |
| 94 | 94 | public function getGeoAnalysisCount() { |
| 95 | 95 | return Database::prepare( |
@@ -167,8 +167,7 @@ discard block |
||
| 167 | 167 | $ga = $this->getGeoAnalysis($id, false); |
| 168 | 168 | |
| 169 | 169 | $id = Database::commit(); |
| 170 | - } |
|
| 171 | - catch(\Exception $ex) { |
|
| 170 | + } catch(\Exception $ex) { |
|
| 172 | 171 | Database::rollback(); |
| 173 | 172 | $ga = null; |
| 174 | 173 | Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage()); |
@@ -210,8 +209,7 @@ discard block |
||
| 210 | 209 | $ga = $this->getGeoAnalysis($ga->getId(), false); |
| 211 | 210 | |
| 212 | 211 | $id = Database::commit(); |
| 213 | - } |
|
| 214 | - catch(\Exception $ex) { |
|
| 212 | + } catch(\Exception $ex) { |
|
| 215 | 213 | Database::rollback(); |
| 216 | 214 | Log::addErrorLog('The Geo Analysis ID “' . $ga->getId() . '” failed to be updated. Transaction rollbacked. Exception: '.$ex->getMessage()); |
| 217 | 215 | $ga = null; |
@@ -350,8 +348,7 @@ discard block |
||
| 350 | 348 | if(!$this->place_hierarchy) { |
| 351 | 349 | if($place_structure = $this->getPlacesHierarchyFromHeader()) { |
| 352 | 350 | $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure); |
| 353 | - } |
|
| 354 | - else { |
|
| 351 | + } else { |
|
| 355 | 352 | $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData()); |
| 356 | 353 | } |
| 357 | 354 | } |