@@ -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 | } |
@@ -29,8 +29,7 @@ |
||
| 29 | 29 | date('Y'), |
| 30 | 30 | '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
| 31 | 31 | ); |
| 32 | - } |
|
| 33 | - else { |
|
| 32 | + } else { |
|
| 34 | 33 | $html = I18N::translate('No statistics could be retrieved from Piwik.'); |
| 35 | 34 | } |
| 36 | 35 | |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | $index = str_replace('%', '', $match2); |
| 78 | 78 | if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
| 79 | 79 | $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
| 80 | - } |
|
| 81 | - else{ |
|
| 80 | + } else{ |
|
| 82 | 81 | $displayPlace = str_replace($match2, '' , $displayPlace); |
| 83 | 82 | } |
| 84 | 83 | } |
@@ -53,13 +53,21 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
| 55 | 55 | { |
| 56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
| 57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
| 58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
| 56 | + if(!$mvc_ctrl) { |
|
| 57 | + throw new \Exception('Mvc Controller not defined'); |
|
| 58 | + } |
|
| 59 | + if(!$ctrl) { |
|
| 60 | + throw new \Exception('Base Controller not defined'); |
|
| 61 | + } |
|
| 62 | + if(!$view_name) { |
|
| 63 | + throw new \Exception('View not defined'); |
|
| 64 | + } |
|
| 59 | 65 | |
| 60 | 66 | $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
| 61 | 67 | $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
| 62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
| 68 | + if(!class_exists($view_class)) { |
|
| 69 | + throw new \Exception('View does not exist'); |
|
| 70 | + } |
|
| 63 | 71 | |
| 64 | 72 | return new $view_class($ctrl, $data); |
| 65 | 73 | } |
@@ -45,7 +45,9 @@ |
||
| 45 | 45 | public function render() { |
| 46 | 46 | global $controller; |
| 47 | 47 | |
| 48 | - if(!$this->ctrl) throw new \Exception('Controller not initialised'); |
|
| 48 | + if(!$this->ctrl) { |
|
| 49 | + throw new \Exception('Controller not initialised'); |
|
| 50 | + } |
|
| 49 | 51 | |
| 50 | 52 | $controller = $this->ctrl; |
| 51 | 53 | $this->ctrl->pageHeader(); |
@@ -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 | |
@@ -87,7 +87,9 @@ discard block |
||
| 87 | 87 | * @return ImageBuilder |
| 88 | 88 | */ |
| 89 | 89 | public function setExpireOffset($expireOffset) { |
| 90 | - if($expireOffset) $this->expire_offset = $expireOffset; |
|
| 90 | + if($expireOffset) { |
|
| 91 | + $this->expire_offset = $expireOffset; |
|
| 92 | + } |
|
| 91 | 93 | return $this; |
| 92 | 94 | } |
| 93 | 95 | |
@@ -107,7 +109,9 @@ discard block |
||
| 107 | 109 | * @return ImageBuilder |
| 108 | 110 | */ |
| 109 | 111 | public function setShowWatermark($show_watermark) { |
| 110 | - if(!is_null($show_watermark)) $this->show_watermark = $show_watermark; |
|
| 112 | + if(!is_null($show_watermark)) { |
|
| 113 | + $this->show_watermark = $show_watermark; |
|
| 114 | + } |
|
| 111 | 115 | return $this; |
| 112 | 116 | } |
| 113 | 117 | |
@@ -118,7 +122,9 @@ discard block |
||
| 118 | 122 | * @return ImageBuilder |
| 119 | 123 | */ |
| 120 | 124 | public function setFontMaxSize($font_max_size) { |
| 121 | - if($font_max_size) $this->font_max_size = $font_max_size; |
|
| 125 | + if($font_max_size) { |
|
| 126 | + $this->font_max_size = $font_max_size; |
|
| 127 | + } |
|
| 122 | 128 | return $this; |
| 123 | 129 | } |
| 124 | 130 | |
@@ -129,7 +135,9 @@ discard block |
||
| 129 | 135 | * @return ImageBuilder |
| 130 | 136 | */ |
| 131 | 137 | public function setFontColor($font_color) { |
| 132 | - if($font_color) $this->font_color = $font_color; |
|
| 138 | + if($font_color) { |
|
| 139 | + $this->font_color = $font_color; |
|
| 140 | + } |
|
| 133 | 141 | return $this; |
| 134 | 142 | } |
| 135 | 143 | |
@@ -280,8 +288,7 @@ discard block |
||
| 280 | 288 | // text to watermark with |
| 281 | 289 | if(method_exists($this->media, 'getWatermarkText')) { |
| 282 | 290 | $word1_text = $this->media->getWatermarkText(); |
| 283 | - } |
|
| 284 | - else { |
|
| 291 | + } else { |
|
| 285 | 292 | $word1_text = $this->media->getTitle(); |
| 286 | 293 | } |
| 287 | 294 | |
@@ -80,7 +80,9 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | */ |
| 82 | 82 | protected function checkInit(){ |
| 83 | - if(!$this->is_init) $this->init(); |
|
| 83 | + if(!$this->is_init) { |
|
| 84 | + $this->init(); |
|
| 85 | + } |
|
| 84 | 86 | } |
| 85 | 87 | |
| 86 | 88 | /** |
@@ -93,7 +95,9 @@ discard block |
||
| 93 | 95 | protected function getKeyName($value, AbstractModule $mod = null){ |
| 94 | 96 | $this->checkInit(); |
| 95 | 97 | $mod_name = 'myartjaub'; |
| 96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
| 98 | + if($mod !== null) { |
|
| 99 | + $mod_name = $mod->getName(); |
|
| 100 | + } |
|
| 97 | 101 | return $mod_name.'_'.$value; |
| 98 | 102 | } |
| 99 | 103 | |
@@ -104,9 +104,12 @@ discard block |
||
| 104 | 104 | public function canDisplayIsSourced($access_level = null){ |
| 105 | 105 | global $global_facts; |
| 106 | 106 | |
| 107 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
| 108 | - if($access_level === null ) |
|
| 109 | - $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 107 | + if(!$this->gedcomrecord->canShow($access_level)) { |
|
| 108 | + return false; |
|
| 109 | + } |
|
| 110 | + if($access_level === null ) { |
|
| 111 | + $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 112 | + } |
|
| 110 | 113 | |
| 111 | 114 | if (isset($global_facts['SOUR'])) { |
| 112 | 115 | return $global_facts['SOUR'] >= $access_level; |
@@ -125,7 +128,9 @@ discard block |
||
| 125 | 128 | * @return int Level of sources |
| 126 | 129 | */ |
| 127 | 130 | public function isSourced(){ |
| 128 | - if($this->_issourced !== null) return $this->_issourced; |
|
| 131 | + if($this->_issourced !== null) { |
|
| 132 | + return $this->_issourced; |
|
| 133 | + } |
|
| 129 | 134 | $this->_issourced=-1; |
| 130 | 135 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
| 131 | 136 | foreach($sourcesfacts as $sourcefact){ |
@@ -144,7 +149,9 @@ discard block |
||
| 144 | 149 | * @return int Level of sources |
| 145 | 150 | */ |
| 146 | 151 | public function isFactSourced($eventslist){ |
| 147 | - if(empty($eventslist)) return 0; |
|
| 152 | + if(empty($eventslist)) { |
|
| 153 | + return 0; |
|
| 154 | + } |
|
| 148 | 155 | $isSourced=0; |
| 149 | 156 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 150 | 157 | foreach($facts as $fact){ |
@@ -154,8 +161,7 @@ discard block |
||
| 154 | 161 | if($tmpIsSourced != 0) { |
| 155 | 162 | if($isSourced==0) { |
| 156 | 163 | $isSourced = $tmpIsSourced; |
| 157 | - } |
|
| 158 | - else{ |
|
| 164 | + } else{ |
|
| 159 | 165 | $isSourced = max($isSourced, $tmpIsSourced); |
| 160 | 166 | } |
| 161 | 167 | } |