Completed
Push — master ( 95506d...0f93c5 )
by Jonathan
07:55
created
src/Webtrees/Individual.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
 				$ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2);
67 67
 				if($ct2>0){
68 68
 					$this->_titles[$match2[1][0]][]= trim($match2[2][0]);
69
-				}
70
-				else{
69
+				} else{
71 70
 					$this->_titles[$titlefact->getValue()][]='';
72 71
 				}
73 72
 			}
@@ -99,8 +98,7 @@  discard block
 block discarded – undo
99 98
 		if($bplace = $this->gedcomrecord->getBirthPlace()){
100 99
 			if($perc){
101 100
 				return array ($bplace, 1);
102
-			}
103
-			else{
101
+			} else{
104 102
 				return $bplace;
105 103
 			}
106 104
 		}
@@ -169,7 +167,9 @@  discard block
 block discarded – undo
169 167
 	 * @return int Level of sources
170 168
 	 * */
171 169
 	public function isBirthSourced(){
172
-		if($this->_isbirthsourced !== null) return $this->_isbirthsourced;
170
+		if($this->_isbirthsourced !== null) {
171
+			return $this->_isbirthsourced;
172
+		}
173 173
 		$this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT);
174 174
 		return $this->_isbirthsourced;
175 175
 	}
@@ -180,7 +180,9 @@  discard block
 block discarded – undo
180 180
 	* @return int Level of sources
181 181
 	* */
182 182
 	public function isDeathSourced(){
183
-		if($this->_isdeathsourced !== null) return $this->_isdeathsourced;
183
+		if($this->_isdeathsourced !== null) {
184
+			return $this->_isdeathsourced;
185
+		}
184 186
 		$this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT);
185 187
 		return $this->_isdeathsourced;
186 188
 	}
Please login to merge, or discard this patch.
src/Webtrees/Cache.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Webtrees/Family.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@
 block discarded – undo
44 44
 	* @return int Level of sources
45 45
 	* */
46 46
 	function isMarriageSourced(){
47
-		if($this->_ismarriagesourced !== null) return $this->_ismarriagesourced;
47
+		if($this->_ismarriagesourced !== null) {
48
+			return $this->_ismarriagesourced;
49
+		}
48 50
 		$this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC');
49 51
 		return $this->_ismarriagesourced;
50 52
 	}
Please login to merge, or discard this patch.
src/Webtrees/GedcomRecord.php 1 patch
Braces   +13 added lines, -7 removed lines patch added patch discarded remove patch
@@ -104,9 +104,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 				}
Please login to merge, or discard this patch.
src/Webtrees/Module/PatronymicLineage/Model/LineageBuilder.php 1 patch
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@  discard block
 block discarded – undo
54 54
 	public function buildLineages() {				
55 55
 		$indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false);
56 56
 		
57
-		if(count($indis) == 0) return null;
57
+		if(count($indis) == 0) {
58
+			return null;
59
+		}
58 60
 		
59 61
 		$root_lineages = array();
60 62
 		
@@ -72,12 +74,13 @@  discard block
 block discarded – undo
72 74
 						if($indiChildFamily !== null){
73 75
 							$root_node = new LineageRootNode(null); 
74 76
 							$root_node->addFamily($indiChildFamily);
75
-						}
76
-						else{
77
+						} else{
77 78
 							$root_node = new LineageRootNode($indiFirst);
78 79
 						}
79 80
 						$root_node = $this->buildLineage($root_node);		
80
-						if($root_node) $root_lineages[] = $root_node;
81
+						if($root_node) {
82
+							$root_lineages[] = $root_node;
83
+						}
81 84
 					}
82 85
 				}
83 86
 			}
@@ -116,23 +119,19 @@  discard block
 block discarded – undo
116 119
 					//Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical)
117 120
 					if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){
118 121
 						$resIndi=$wife;
119
-					}
120
-					else{
122
+					} else{
121 123
 						$is_first=true;
122 124
 					}
123
-				}
124
-				else{
125
+				} else{
125 126
 					$is_first=true;
126 127
 				}
127
-			}
128
-			else{
128
+			} else{
129 129
 				$is_first=true;
130 130
 			}
131 131
 		}
132 132
 		if(isset($this->used_indis[$resIndi->getXref()])){
133 133
 			return null;
134
-		}
135
-		else{
134
+		} else{
136 135
 			return $resIndi;
137 136
 		}
138 137
 	}
@@ -145,7 +144,9 @@  discard block
 block discarded – undo
145 144
 	 * @return LineageNode Computed lineage
146 145
 	 */
147 146
 	protected function buildLineage(LineageNode $node) {
148
-		if($node === null) return;
147
+		if($node === null) {
148
+			return;
149
+		}
149 150
 		
150 151
 		$indi_surname = null;
151 152
 		
@@ -198,7 +199,9 @@  discard block
 block discarded – undo
198 199
 								$nbNatural++;
199 200
 								$node_child = new LineageNode($child, $node->getRootNode());							
200 201
 								$node_child = $this->buildLineage($node_child);
201
-								if($node_child) $node->addChild($family, $node_child);
202
+								if($node_child) {
203
+									$node->addChild($family, $node_child);
204
+								}
202 205
 							}
203 206
 						}
204 207
 					}
@@ -212,12 +215,15 @@  discard block
 block discarded – undo
212 215
 							$nbNatural++;
213 216
 							$node_child = new LineageNode($child, $node->getRootNode());							
214 217
 							$node_child = $this->buildLineage($node_child);
215
-							if($node_child) $node->addChild($family, $node_child);
216
-						}
217
-						else {
218
+							if($node_child) {
219
+								$node->addChild($family, $node_child);
220
+							}
221
+						} else {
218 222
 							$nbNatural++;
219 223
 							$node_child = new LineageNode($child, $node->getRootNode(), $child_surname);
220
-							if($node_child) $node->addChild($family, $node_child);
224
+							if($node_child) {
225
+								$node->addChild($family, $node_child);
226
+							}
221 227
 						}
222 228
 					}
223 229
 				}
Please login to merge, or discard this patch.
src/Webtrees/Functions/Functions.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -116,16 +116,18 @@  discard block
 block discarded – undo
116 116
 		$len_chars = count($chars);
117 117
 		$token = '';
118 118
 		
119
-		for ($i = 0; $i < $length; $i++)
120
-			$token .= $chars[ mt_rand(0, $len_chars - 1) ];
119
+		for ($i = 0; $i < $length; $i++) {
120
+					$token .= $chars[ mt_rand(0, $len_chars - 1) ];
121
+		}
121 122
 		
122 123
 		# Number of 32 char chunks
123 124
 		$chunks = ceil( strlen($token) / 32 );
124 125
 		$md5token = '';
125 126
 		
126 127
 		# Run each chunk through md5
127
-		for ( $i=1; $i<=$chunks; $i++ )
128
-			$md5token .= md5( substr($token, $i * 32 - 32, 32) );
128
+		for ( $i=1; $i<=$chunks; $i++ ) {
129
+					$md5token .= md5( substr($token, $i * 32 - 32, 32) );
130
+		}
129 131
 		
130 132
 			# Trim the token
131 133
 		return substr($md5token, 0, $length);		
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
 	 */
141 143
 	public static function encryptToSafeBase64($data){
142 144
 		$key = 'STANDARDKEYIFNOSERVER';
143
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
144
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
145
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
146
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
147
+		}
145 148
 		$iv = mcrypt_create_iv(self::ENCRYPTION_IV_SIZE, MCRYPT_RAND);
146 149
 		$id = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC,$iv);
147 150
 		$encrypted = base64_encode($iv.$id);
@@ -160,16 +163,19 @@  discard block
 block discarded – undo
160 163
 	 */
161 164
 	public static function decryptFromSafeBase64($encrypted){
162 165
 		$key = 'STANDARDKEYIFNOSERVER';
163
-		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE'])
164
-			$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
166
+		if($_SERVER['SERVER_NAME'] && $_SERVER['SERVER_SOFTWARE']) {
167
+					$key = md5($_SERVER['SERVER_NAME'].$_SERVER['SERVER_SOFTWARE']);
168
+		}
165 169
 		$encrypted = str_replace('-', '+', $encrypted);
166 170
 		$encrypted = str_replace('_', '/', $encrypted);
167 171
 		$encrypted = str_replace('*', '=', $encrypted);
168 172
 		$encrypted = base64_decode($encrypted);
169
-		if(!$encrypted)
170
-			throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
171
-		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) 
172
-			throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
173
+		if(!$encrypted) {
174
+					throw new \InvalidArgumentException('The encrypted value is not in correct base64 format.');
175
+		}
176
+		if(strlen($encrypted) < self::ENCRYPTION_IV_SIZE) {
177
+					throw new \InvalidArgumentException('The encrypted value does not contain enough characters for the key.');
178
+		}
173 179
 		$iv_dec = substr($encrypted, 0, self::ENCRYPTION_IV_SIZE);
174 180
 		$encrypted = substr($encrypted, self::ENCRYPTION_IV_SIZE);
175 181
 		$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted, MCRYPT_MODE_CBC, $iv_dec);
@@ -210,7 +216,9 @@  discard block
 block discarded – undo
210 216
 	 * @return boolean True if path valid
211 217
 	 */
212 218
 	public static function isValidPath($filename, $acceptfolder = FALSE) {		
213
-		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) return true;
219
+		if(strpbrk($filename, $acceptfolder ? '?%*:|"<>' : '\\/?%*:|"<>') === FALSE) {
220
+			return true;
221
+		}
214 222
 		return false;
215 223
 	}
216 224
 	
Please login to merge, or discard this patch.
src/Webtrees/Functions/FunctionsPrint.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -160,7 +160,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
174 176
 			$html .= '&nbsp;<span><small><em>'.$dindi->format_first_major_fact(WT_EVENTS_BIRT, 10).'</em></small></span>';
175 177
 			$html .= '&nbsp;<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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.