Completed
Push — 1.7 ( 83b3f3...febbf6 )
by
unknown
09:27
created
app/Controller/PedigreeController.php 1 patch
Switch Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -102,26 +102,26 @@  discard block
 block discarded – undo
102 102
 
103 103
 		$this->arrows = new \stdClass();
104 104
 		switch ($this->orientation) {
105
-		case self::PORTRAIT:
106
-			//drop through
107
-		case self::LANDSCAPE:
108
-			$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
-			$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
-			$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
-			$addoffset['y']        = 0;
112
-			break;
113
-		case self::OLDEST_AT_TOP:
114
-			$this->arrows->prevGen = 'icon-uarrow';
115
-			$this->arrows->menu    = 'icon-darrow';
116
-			$addoffset['x']        = 0;
117
-			$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
-			break;
119
-		case self::OLDEST_AT_BOTTOM:
120
-			$this->arrows->prevGen = 'icon-darrow';
121
-			$this->arrows->menu    = 'icon-uarrow';
122
-			$addoffset['x']        = 0;
123
-			$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
-			break;
105
+			case self::PORTRAIT:
106
+				//drop through
107
+			case self::LANDSCAPE:
108
+				$this->arrows->prevGen = I18N::direction() === 'rtl' ? 'icon-larrow' : 'icon-rarrow';
109
+				$this->arrows->menu    = I18N::direction() === 'rtl' ? 'icon-rarrow' : 'icon-larrow';
110
+				$addoffset['x']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
111
+				$addoffset['y']        = 0;
112
+				break;
113
+			case self::OLDEST_AT_TOP:
114
+				$this->arrows->prevGen = 'icon-uarrow';
115
+				$this->arrows->menu    = 'icon-darrow';
116
+				$addoffset['x']        = 0;
117
+				$addoffset['y']        = $this->root->getSpouseFamilies() ? self::ARROW_SIZE : 0;
118
+				break;
119
+			case self::OLDEST_AT_BOTTOM:
120
+				$this->arrows->prevGen = 'icon-darrow';
121
+				$this->arrows->menu    = 'icon-uarrow';
122
+				$addoffset['x']        = 0;
123
+				$addoffset['y']        = $this->chartHasAncestors ? self::ARROW_SIZE : 0;
124
+				break;
125 125
 		}
126 126
 
127 127
 		// -- this next section will create and position the DIV layers for the pedigree tree
@@ -150,73 +150,73 @@  discard block
 block discarded – undo
150 150
 
151 151
 			// -- calculate the xoffset
152 152
 			switch ($this->orientation) {
153
-			case self::PORTRAIT:
154
-				$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
-				if (!$i && $this->root->getSpouseFamilies()) {
156
-					$xoffset -= self::ARROW_SIZE;
157
-				}
158
-				// -- compact the tree
159
-				if ($curgen < $this->generations) {
160
-					if ($i % 2 == 0) {
161
-						$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
162
-					} else {
163
-						$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
153
+				case self::PORTRAIT:
154
+					$xoffset = ($this->generations - $curgen) * (($this->getBoxDimensions()->width + $bxspacing) / 1.8);
155
+					if (!$i && $this->root->getSpouseFamilies()) {
156
+						$xoffset -= self::ARROW_SIZE;
164 157
 					}
165
-					$parent = (int) (($i - 1) / 2);
166
-					$pgen   = $curgen;
167
-					while ($parent > 0) {
168
-						if ($parent % 2 == 0) {
169
-							$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
158
+					// -- compact the tree
159
+					if ($curgen < $this->generations) {
160
+						if ($i % 2 == 0) {
161
+							$yoffset = $yoffset - (($boxspacing / 2) * ($curgen - 1));
170 162
 						} else {
171
-							$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
163
+							$yoffset = $yoffset + (($boxspacing / 2) * ($curgen - 1));
164
+						}
165
+						$parent = (int) (($i - 1) / 2);
166
+						$pgen   = $curgen;
167
+						while ($parent > 0) {
168
+							if ($parent % 2 == 0) {
169
+								$yoffset = $yoffset - (($boxspacing / 2) * $pgen);
170
+							} else {
171
+								$yoffset = $yoffset + (($boxspacing / 2) * $pgen);
172
+							}
173
+							$pgen++;
174
+							if ($pgen > 3) {
175
+								$temp = 0;
176
+								for ($j = 1; $j < ($pgen - 2); $j++) {
177
+									$temp += (pow(2, $j) - 1);
178
+								}
179
+								if ($parent % 2 == 0) {
180
+									$yoffset = $yoffset - (($boxspacing / 2) * $temp);
181
+								} else {
182
+									$yoffset = $yoffset + (($boxspacing / 2) * $temp);
183
+								}
184
+							}
185
+							$parent = (int) (($parent - 1) / 2);
172 186
 						}
173
-						$pgen++;
174
-						if ($pgen > 3) {
187
+						if ($curgen > 3) {
175 188
 							$temp = 0;
176
-							for ($j = 1; $j < ($pgen - 2); $j++) {
189
+							for ($j = 1; $j < ($curgen - 2); $j++) {
177 190
 								$temp += (pow(2, $j) - 1);
178 191
 							}
179
-							if ($parent % 2 == 0) {
192
+							if ($i % 2 == 0) {
180 193
 								$yoffset = $yoffset - (($boxspacing / 2) * $temp);
181 194
 							} else {
182 195
 								$yoffset = $yoffset + (($boxspacing / 2) * $temp);
183 196
 							}
184 197
 						}
185
-						$parent = (int) (($parent - 1) / 2);
186 198
 					}
187
-					if ($curgen > 3) {
188
-						$temp = 0;
189
-						for ($j = 1; $j < ($curgen - 2); $j++) {
190
-							$temp += (pow(2, $j) - 1);
191
-						}
192
-						if ($i % 2 == 0) {
193
-							$yoffset = $yoffset - (($boxspacing / 2) * $temp);
194
-						} else {
195
-							$yoffset = $yoffset + (($boxspacing / 2) * $temp);
196
-						}
199
+					$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
+					break;
201
+				case self::LANDSCAPE:
202
+					$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
+					if ($curgen == 1) {
204
+						$xoffset += 10;
197 205
 					}
198
-				}
199
-				$yoffset -= (($boxspacing / 2) * pow(2, ($this->generations - 2)) - ($boxspacing / 2));
200
-				break;
201
-			case self::LANDSCAPE:
202
-				$xoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->width + $bxspacing);
203
-				if ($curgen == 1) {
204
-					$xoffset += 10;
205
-				}
206
-				break;
207
-			case self::OLDEST_AT_TOP:
208
-				//swap x & y offsets as chart is rotated
209
-				$xoffset = $yoffset;
210
-				$yoffset = $curgen * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
-				break;
212
-			case self::OLDEST_AT_BOTTOM:
213
-				//swap x & y offsets as chart is rotated
214
-				$xoffset = $yoffset;
215
-				$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
-				if ($i && $this->root->getSpouseFamilies()) {
217
-					$yoffset += self::ARROW_SIZE;
218
-				}
219
-				break;
206
+					break;
207
+				case self::OLDEST_AT_TOP:
208
+					//swap x & y offsets as chart is rotated
209
+					$xoffset = $yoffset;
210
+					$yoffset = $curgen * ($this->getBoxDimensions()->height + ($byspacing * 4));
211
+					break;
212
+				case self::OLDEST_AT_BOTTOM:
213
+					//swap x & y offsets as chart is rotated
214
+					$xoffset = $yoffset;
215
+					$yoffset = ($this->generations - $curgen) * ($this->getBoxDimensions()->height + ($byspacing * 2));
216
+					if ($i && $this->root->getSpouseFamilies()) {
217
+						$yoffset += self::ARROW_SIZE;
218
+					}
219
+					break;
220 220
 			}
221 221
 			$this->nodes[$i]["x"] = (int) $xoffset;
222 222
 			$this->nodes[$i]["y"] = (int) $yoffset;
Please login to merge, or discard this patch.
app/Controller/IndividualController.php 1 patch
Switch Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -182,22 +182,22 @@  discard block
 block discarded – undo
182 182
 							$name = str_replace('/', '', $name);
183 183
 							$name = preg_replace('/(\S*)\*/', '<span class="starredname">\\1</span>', $name);
184 184
 							switch ($fact) {
185
-							case 'TYPE':
186
-								echo GedcomCodeName::getValue($name, $this->record);
187
-								break;
188
-							case 'SURN':
189
-								// The SURN field is not necessarily the surname.
190
-								// Where it is not a substring of the real surname, show it after the real surname.
191
-								$surname = Filter::escapeHtml($primary_name['surname']);
192
-								if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
193
-									echo '<span dir="auto">' . $surname . '</span>';
194
-								} else {
195
-									echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
196
-								}
197
-								break;
198
-							default:
199
-								echo '<span dir="auto">' . $name . '</span>';
200
-								break;
185
+								case 'TYPE':
186
+									echo GedcomCodeName::getValue($name, $this->record);
187
+									break;
188
+								case 'SURN':
189
+									// The SURN field is not necessarily the surname.
190
+									// Where it is not a substring of the real surname, show it after the real surname.
191
+									$surname = Filter::escapeHtml($primary_name['surname']);
192
+									if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
193
+										echo '<span dir="auto">' . $surname . '</span>';
194
+									} else {
195
+										echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
196
+									}
197
+									break;
198
+								default:
199
+									echo '<span dir="auto">' . $name . '</span>';
200
+									break;
201 201
 							}
202 202
 						}
203 203
 					echo '</dd>';
@@ -232,33 +232,33 @@  discard block
 block discarded – undo
232 232
 			echo 'new ';
233 233
 		}
234 234
 		switch ($sex) {
235
-		case 'M':
236
-			echo 'male_gender"';
237
-			if ($event->canEdit()) {
238
-				echo ' title="', I18N::translate('Male'), ' - ', I18N::translate('Edit'), '"';
239
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
240
-			 } else {
241
-				echo ' title="', I18N::translate('Male'), '">';
242
-			 }
243
-			break;
244
-		case 'F':
245
-			echo 'female_gender"';
246
-			if ($event->canEdit()) {
247
-				echo ' title="', I18N::translate('Female'), ' - ', I18N::translate('Edit'), '"';
248
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
249
-			 } else {
250
-				echo ' title="', I18N::translate('Female'), '">';
251
-			 }
252
-			break;
253
-		default:
254
-			echo 'unknown_gender"';
255
-			if ($event->canEdit()) {
256
-				echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), ' - ', I18N::translate('Edit'), '"';
257
-				echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
258
-			 } else {
259
-				echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), '">';
260
-			 }
261
-			break;
235
+			case 'M':
236
+				echo 'male_gender"';
237
+				if ($event->canEdit()) {
238
+					echo ' title="', I18N::translate('Male'), ' - ', I18N::translate('Edit'), '"';
239
+					echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
240
+			 	} else {
241
+					echo ' title="', I18N::translate('Male'), '">';
242
+			 	}
243
+				break;
244
+			case 'F':
245
+				echo 'female_gender"';
246
+				if ($event->canEdit()) {
247
+					echo ' title="', I18N::translate('Female'), ' - ', I18N::translate('Edit'), '"';
248
+					echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
249
+			 	} else {
250
+					echo ' title="', I18N::translate('Female'), '">';
251
+			 	}
252
+				break;
253
+			default:
254
+				echo 'unknown_gender"';
255
+				if ($event->canEdit()) {
256
+					echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), ' - ', I18N::translate('Edit'), '"';
257
+					echo ' onclick="edit_record(\'' . $this->record->getXref() . '\', \'' . $event->getFactId() . '\'); return false;">';
258
+			 	} else {
259
+					echo ' title="', I18N::translateContext('unknown gender', 'Unknown'), '">';
260
+			 	}
261
+				break;
262 262
 		}
263 263
 		echo '</span>';
264 264
 	}
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
 	 */
325 325
 	public function getPersonStyle($person) {
326 326
 		switch ($person->getSex()) {
327
-		case 'M':
328
-			$class = 'person_box';
329
-			break;
330
-		case 'F':
331
-			$class = 'person_boxF';
332
-			break;
333
-		default:
334
-			$class = 'person_boxNN';
335
-			break;
327
+			case 'M':
328
+				$class = 'person_box';
329
+				break;
330
+			case 'F':
331
+				$class = 'person_boxF';
332
+				break;
333
+			default:
334
+				$class = 'person_boxNN';
335
+				break;
336 336
 		}
337 337
 		if ($person->isPendingDeletion()) {
338 338
 			$class .= ' old';
Please login to merge, or discard this patch.
app/Controller/FanchartController.php 1 patch
Switch Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -247,15 +247,15 @@  discard block
 block discarded – undo
247 247
 					$text .= "\n" . I18N::reverseText($person->getLifeSpan());
248 248
 
249 249
 					switch ($person->getSex()) {
250
-					case 'M':
251
-						$bg = $bgcolorM;
252
-						break;
253
-					case 'F':
254
-						$bg = $bgcolorF;
255
-						break;
256
-					default:
257
-						$bg = $bgcolor;
258
-						break;
250
+						case 'M':
251
+							$bg = $bgcolorM;
252
+							break;
253
+						case 'F':
254
+							$bg = $bgcolorF;
255
+							break;
256
+						default:
257
+							$bg = $bgcolor;
258
+							break;
259 259
 					}
260 260
 
261 261
 					imagefilledarc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE);
@@ -366,19 +366,19 @@  discard block
 block discarded – undo
366 366
 		$imagemap .= '</map>';
367 367
 
368 368
 		switch ($what) {
369
-		case 'html':
370
-			return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . strip_tags($this->getPageTitle()) . '" usemap="#fanmap"></div>';
369
+			case 'html':
370
+				return $html . $imagemap . '<div id="fan_chart_img"><img src="' . WT_SCRIPT_NAME . '?rootid=' . $this->root->getXref() . '&amp;fan_style=' . $this->fan_style . '&amp;generations=' . $this->generations . '&amp;fan_width=' . $this->fan_width . '&amp;img=1" width="' . $fanw . '" height="' . $fanh . '" alt="' . strip_tags($this->getPageTitle()) . '" usemap="#fanmap"></div>';
371 371
 
372
-		case 'png':
373
-			imagestringup($image, 1, $fanw - 10, $fanh / 3, WT_BASE_URL, $color);
374
-			ob_start();
375
-			imagepng($image);
376
-			imagedestroy($image);
372
+			case 'png':
373
+				imagestringup($image, 1, $fanw - 10, $fanh / 3, WT_BASE_URL, $color);
374
+				ob_start();
375
+				imagepng($image);
376
+				imagedestroy($image);
377 377
 
378
-			return ob_get_clean();
378
+				return ob_get_clean();
379 379
 
380
-		default:
381
-			throw new \InvalidArgumentException(__METHOD__ . ' ' . $what);
380
+			default:
381
+				throw new \InvalidArgumentException(__METHOD__ . ' ' . $what);
382 382
 		}
383 383
 	}
384 384
 }
Please login to merge, or discard this patch.
app/Controller/SearchController.php 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -170,46 +170,46 @@
 block discarded – undo
170 170
 
171 171
 		// If we want to show associated persons, build the list
172 172
 		switch ($this->action) {
173
-		case 'header':
174
-			// We can type in an XREF into the header search, and jump straight to it.
175
-			// Otherwise, the header search is the same as the general search
176
-			if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
177
-				$record = GedcomRecord::getInstance($this->query, $WT_TREE);
178
-				if ($record && $record->canShowName()) {
179
-					header('Location: ' . WT_BASE_URL . $record->getRawUrl());
173
+			case 'header':
174
+				// We can type in an XREF into the header search, and jump straight to it.
175
+				// Otherwise, the header search is the same as the general search
176
+				if (preg_match('/' . WT_REGEX_XREF . '/', $this->query)) {
177
+					$record = GedcomRecord::getInstance($this->query, $WT_TREE);
178
+					if ($record && $record->canShowName()) {
179
+						header('Location: ' . WT_BASE_URL . $record->getRawUrl());
180
+						exit;
181
+					}
182
+				}
183
+				$this->action = 'general';
184
+				$this->srindi = 'checked';
185
+				$this->srfams = 'checked';
186
+				$this->srsour = 'checked';
187
+				$this->srnote = 'checked';
188
+				$this->setPageTitle(I18N::translate('General search'));
189
+				$this->generalSearch();
190
+				break;
191
+			case 'general':
192
+				$this->setPageTitle(I18N::translate('General search'));
193
+				$this->generalSearch();
194
+				break;
195
+			case 'soundex':
196
+				// Create a dummy search query to use as a title to the results list
197
+				$this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
198
+				$this->setPageTitle(I18N::translate('Phonetic search'));
199
+				$this->soundexSearch();
200
+				break;
201
+			case 'replace':
202
+				$this->setPageTitle(I18N::translate('Search and replace'));
203
+				$this->search_trees = array($WT_TREE);
204
+				$this->srindi       = 'checked';
205
+				$this->srfams       = 'checked';
206
+				$this->srsour       = 'checked';
207
+				$this->srnote       = 'checked';
208
+				if (Filter::post('query')) {
209
+					$this->searchAndReplace($WT_TREE);
210
+					header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
180 211
 					exit;
181 212
 				}
182
-			}
183
-			$this->action = 'general';
184
-			$this->srindi = 'checked';
185
-			$this->srfams = 'checked';
186
-			$this->srsour = 'checked';
187
-			$this->srnote = 'checked';
188
-			$this->setPageTitle(I18N::translate('General search'));
189
-			$this->generalSearch();
190
-			break;
191
-		case 'general':
192
-			$this->setPageTitle(I18N::translate('General search'));
193
-			$this->generalSearch();
194
-			break;
195
-		case 'soundex':
196
-			// Create a dummy search query to use as a title to the results list
197
-			$this->query = trim($this->firstname . ' ' . $this->lastname . ' ' . $this->place);
198
-			$this->setPageTitle(I18N::translate('Phonetic search'));
199
-			$this->soundexSearch();
200
-			break;
201
-		case 'replace':
202
-			$this->setPageTitle(I18N::translate('Search and replace'));
203
-			$this->search_trees = array($WT_TREE);
204
-			$this->srindi       = 'checked';
205
-			$this->srfams       = 'checked';
206
-			$this->srsour       = 'checked';
207
-			$this->srnote       = 'checked';
208
-			if (Filter::post('query')) {
209
-				$this->searchAndReplace($WT_TREE);
210
-				header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=replace&query=' . Filter::escapeUrl($this->query) . '&replace=' . Filter::escapeUrl($this->replace) . '&replaceAll=' . $this->replaceAll . '&replaceNames=' . $this->replaceNames . '&replacePlaces=' . $this->replacePlaces . '&replacePlacesWord=' . $this->replacePlacesWord);
211
-				exit;
212
-			}
213 213
 		}
214 214
 	}
215 215
 
Please login to merge, or discard this patch.
app/Controller/LifespanController.php 1 patch
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -509,23 +509,23 @@
 block discarded – undo
509 509
 	 */
510 510
 	public function getCalendarDate($date) {
511 511
 		switch ($this->calendar) {
512
-		case 'julian':
513
-			$caldate = new JulianDate($date);
514
-			break;
515
-		case 'french':
516
-			$caldate = new FrenchDate($date);
517
-			break;
518
-		case 'jewish':
519
-			$caldate = new JewishDate($date);
520
-			break;
521
-		case 'hijri':
522
-			$caldate = new HijriDate($date);
523
-			break;
524
-		case 'jalali':
525
-			$caldate = new JalaliDate($date);
526
-			break;
527
-		default:
528
-			$caldate = new GregorianDate($date);
512
+			case 'julian':
513
+				$caldate = new JulianDate($date);
514
+				break;
515
+			case 'french':
516
+				$caldate = new FrenchDate($date);
517
+				break;
518
+			case 'jewish':
519
+				$caldate = new JewishDate($date);
520
+				break;
521
+			case 'hijri':
522
+				$caldate = new HijriDate($date);
523
+				break;
524
+			case 'jalali':
525
+				$caldate = new JalaliDate($date);
526
+				break;
527
+			default:
528
+				$caldate = new GregorianDate($date);
529 529
 		}
530 530
 
531 531
 		return $caldate;
Please login to merge, or discard this patch.
app/Report/ReportHtmlImage.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,20 +43,20 @@
 block discarded – undo
43 43
 
44 44
 		// Image alignment
45 45
 		switch ($this->align) {
46
-		case "L":
47
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
-			break;
50
-		case "C":
51
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
-			break;
54
-		case "R":
55
-			echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
-			echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
-			break;
58
-		default:
59
-			echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
46
+			case "L":
47
+				echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:left;\">\n";
48
+				echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
49
+				break;
50
+			case "C":
51
+				echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:center;\">\n";
52
+				echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
53
+				break;
54
+			case "R":
55
+				echo "<div style=\"position:absolute;top:", $this->y, "pt;left:0pt;width:", $renderer->getRemainingWidth(), "pt;text-align:right;\">\n";
56
+				echo "<img src=\"", $this->file, "\" style=\"width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n</div>\n";
57
+				break;
58
+			default:
59
+				echo "<img src=\"", $this->file, "\" style=\"position:absolute;", $renderer->alignRTL, ":", $this->x, "pt;top:", $this->y, "pt;width:", $this->width, "pt;height:", $this->height, "pt;\" alt=\"\">\n";
60 60
 		}
61 61
 
62 62
 		$lastpicpage   = $renderer->pageNo();
Please login to merge, or discard this patch.
app/Report/ReportHtmlCell.php 1 patch
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -147,15 +147,15 @@
 block discarded – undo
147 147
 
148 148
 		// Text alignment
149 149
 		switch ($this->align) {
150
-		case "C":
151
-			echo " text-align:center;";
152
-			break;
153
-		case "L":
154
-			echo " text-align:left;";
155
-			break;
156
-		case "R":
157
-			echo " text-align:right;";
158
-			break;
150
+			case "C":
151
+				echo " text-align:center;";
152
+				break;
153
+			case "L":
154
+				echo " text-align:left;";
155
+				break;
156
+			case "R":
157
+				echo " text-align:right;";
158
+				break;
159 159
 		}
160 160
 
161 161
 		// Print the collected HTML code
Please login to merge, or discard this patch.
app/Report/ReportParserGenerate.php 1 patch
Switch Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -934,14 +934,14 @@  discard block
 block discarded – undo
934 934
 				$tags  = preg_split('/[: ]/', $tag);
935 935
 				$value = $this->getGedcomValue($tag, $level, $this->gedrec);
936 936
 				switch (end($tags)) {
937
-				case 'DATE':
938
-					$tmp   = new Date($value);
939
-					$value = $tmp->display();
940
-					break;
941
-				case 'PLAC':
942
-					$tmp   = new Place($value, $WT_TREE);
943
-					$value = $tmp->getShortName();
944
-					break;
937
+					case 'DATE':
938
+						$tmp   = new Date($value);
939
+						$value = $tmp->display();
940
+						break;
941
+					case 'PLAC':
942
+						$tmp   = new Place($value, $WT_TREE);
943
+						$value = $tmp->getShortName();
944
+						break;
945 945
 				}
946 946
 				if ($useBreak == "1") {
947 947
 					// Insert <br> when multiple dates exist.
@@ -1335,22 +1335,22 @@  discard block
 block discarded – undo
1335 1335
 		// Arithmetic functions
1336 1336
 		if (preg_match("/(\d+)\s*([\-\+\*\/])\s*(\d+)/", $value, $match)) {
1337 1337
 			switch ($match[2]) {
1338
-			case "+":
1339
-				$t     = $match[1] + $match[3];
1340
-				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1341
-				break;
1342
-			case "-":
1343
-				$t     = $match[1] - $match[3];
1344
-				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1345
-				break;
1346
-			case "*":
1347
-				$t     = $match[1] * $match[3];
1348
-				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1349
-				break;
1350
-			case "/":
1351
-				$t     = $match[1] / $match[3];
1352
-				$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1353
-				break;
1338
+				case "+":
1339
+					$t     = $match[1] + $match[3];
1340
+					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1341
+					break;
1342
+				case "-":
1343
+					$t     = $match[1] - $match[3];
1344
+					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1345
+					break;
1346
+				case "*":
1347
+					$t     = $match[1] * $match[3];
1348
+					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1349
+					break;
1350
+				case "/":
1351
+					$t     = $match[1] / $match[3];
1352
+					$value = preg_replace("/" . $match[1] . "\s*([\-\+\*\/])\s*" . $match[3] . "/", $t, $value);
1353
+					break;
1354 1354
 			}
1355 1355
 		}
1356 1356
 		if (strpos($value, "@") !== false) {
@@ -1859,180 +1859,180 @@  discard block
 block discarded – undo
1859 1859
 		}
1860 1860
 		// Some filters/sorts can be applied using SQL, while others require PHP
1861 1861
 		switch ($listname) {
1862
-		case "pending":
1863
-			$rows = Database::prepare(
1864
-				"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1865
-				" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1866
-				"  SELECT xref, MAX(change_id)" .
1867
-				"  FROM `##change`" .
1868
-				"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1869
-				"  GROUP BY xref" .
1870
-				" )"
1871
-			)->execute(array(
1872
-				'tree_id' => $WT_TREE->getTreeId(),
1873
-			))->fetchAll();
1874
-			$this->list = array();
1875
-			foreach ($rows as $row) {
1876
-				$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1877
-			}
1878
-			break;
1879
-		case 'individual':
1880
-			$sql_select   = "SELECT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1881
-			$sql_join     = "";
1882
-			$sql_where    = " WHERE i_file = :tree_id";
1883
-			$sql_order_by = "";
1884
-			$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1885
-			foreach ($attrs as $attr => $value) {
1886
-				if (strpos($attr, 'filter') === 0 && $value) {
1887
-					$value = $this->substituteVars($value, false);
1888
-					// Convert the various filters into SQL
1889
-					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1890
-						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1891
-						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1892
-						$sql_params[$attr . 'fact'] = $match[1];
1893
-						$date                       = new Date($match[3]);
1894
-						if ($match[2] == "LTE") {
1895
-							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1896
-							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1897
-						} else {
1898
-							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1899
-							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1900
-						}
1901
-						if ($sortby == $match[1]) {
1902
-							$sortby = "";
1903
-							$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1904
-						}
1905
-						unset($attrs[$attr]); // This filter has been fully processed
1906
-					} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1907
-						// Do nothing, unless you have to
1908
-						if ($match[1] != '' || $sortby == 'NAME') {
1909
-							$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1910
-							// Search the DB only if there is any name supplied
1911
-							if ($match[1] != "") {
1912
-								$names = explode(" ", $match[1]);
1913
-								foreach ($names as $n => $name) {
1914
-									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1915
-									$sql_params[$attr . 'name' . $n] = $name;
1916
-								}
1862
+			case "pending":
1863
+				$rows = Database::prepare(
1864
+					"SELECT xref, CASE new_gedcom WHEN '' THEN old_gedcom ELSE new_gedcom END AS gedcom" .
1865
+					" FROM `##change`" . " WHERE (xref, change_id) IN (" .
1866
+					"  SELECT xref, MAX(change_id)" .
1867
+					"  FROM `##change`" .
1868
+					"  WHERE status = 'pending' AND gedcom_id = :tree_id" .
1869
+					"  GROUP BY xref" .
1870
+					" )"
1871
+				)->execute(array(
1872
+					'tree_id' => $WT_TREE->getTreeId(),
1873
+				))->fetchAll();
1874
+				$this->list = array();
1875
+				foreach ($rows as $row) {
1876
+					$this->list[] = GedcomRecord::getInstance($row->xref, $WT_TREE, $row->gedcom);
1877
+				}
1878
+				break;
1879
+			case 'individual':
1880
+				$sql_select   = "SELECT i_id AS xref, i_gedcom AS gedcom FROM `##individuals` ";
1881
+				$sql_join     = "";
1882
+				$sql_where    = " WHERE i_file = :tree_id";
1883
+				$sql_order_by = "";
1884
+				$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1885
+				foreach ($attrs as $attr => $value) {
1886
+					if (strpos($attr, 'filter') === 0 && $value) {
1887
+						$value = $this->substituteVars($value, false);
1888
+						// Convert the various filters into SQL
1889
+						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1890
+							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=i_file AND {$attr}.d_gid=i_id)";
1891
+							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1892
+							$sql_params[$attr . 'fact'] = $match[1];
1893
+							$date                       = new Date($match[3]);
1894
+							if ($match[2] == "LTE") {
1895
+								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1896
+								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1897
+							} else {
1898
+								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1899
+								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1917 1900
 							}
1918
-							// Let the DB do the name sorting even when no name was entered
1919
-							if ($sortby == "NAME") {
1901
+							if ($sortby == $match[1]) {
1920 1902
 								$sortby = "";
1921
-								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1903
+								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1922 1904
 							}
1905
+							unset($attrs[$attr]); // This filter has been fully processed
1906
+						} elseif (preg_match('/^NAME CONTAINS (.*)$/', $value, $match)) {
1907
+							// Do nothing, unless you have to
1908
+							if ($match[1] != '' || $sortby == 'NAME') {
1909
+								$sql_join .= " JOIN `##name` AS {$attr} ON (n_file=i_file AND n_id=i_id)";
1910
+								// Search the DB only if there is any name supplied
1911
+								if ($match[1] != "") {
1912
+									$names = explode(" ", $match[1]);
1913
+									foreach ($names as $n => $name) {
1914
+										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1915
+										$sql_params[$attr . 'name' . $n] = $name;
1916
+									}
1917
+								}
1918
+								// Let the DB do the name sorting even when no name was entered
1919
+								if ($sortby == "NAME") {
1920
+									$sortby = "";
1921
+									$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1922
+								}
1923
+							}
1924
+							unset($attrs[$attr]); // This filter has been fully processed
1925
+						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1926
+							$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1927
+							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1928
+							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1929
+							unset($attrs[$attr]); // This filter has been fully processed
1930
+						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1931
+							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1932
+							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1933
+							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1934
+							$sql_params[$attr . 'place'] = $match[1];
1935
+							// Don't unset this filter. This is just initial filtering
1936
+						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1937
+							$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1938
+							$sql_params[$attr . 'contains1'] = $match[1];
1939
+							$sql_params[$attr . 'contains2'] = $match[2];
1940
+							$sql_params[$attr . 'contains3'] = $match[3];
1941
+							// Don't unset this filter. This is just initial filtering
1923 1942
 						}
1924
-						unset($attrs[$attr]); // This filter has been fully processed
1925
-					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1926
-						$sql_where .= " AND i_gedcom REGEXP :{$attr}gedcom";
1927
-						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1928
-						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1929
-						unset($attrs[$attr]); // This filter has been fully processed
1930
-					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
1931
-						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file = i_file)";
1932
-						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file = {$attr}b.pl_file AND {$attr}b.pl_p_id = {$attr}a.p_id AND {$attr}b.pl_gid = i_id)";
1933
-						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
1934
-						$sql_params[$attr . 'place'] = $match[1];
1935
-						// Don't unset this filter. This is just initial filtering
1936
-					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
1937
-						$sql_where .= " AND i_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
1938
-						$sql_params[$attr . 'contains1'] = $match[1];
1939
-						$sql_params[$attr . 'contains2'] = $match[2];
1940
-						$sql_params[$attr . 'contains3'] = $match[3];
1941
-						// Don't unset this filter. This is just initial filtering
1942 1943
 					}
1943 1944
 				}
1944
-			}
1945 1945
 
1946
-			$this->list = array();
1947
-			$rows       = Database::prepare(
1948
-				$sql_select . $sql_join . $sql_where . $sql_order_by
1949
-			)->execute($sql_params)->fetchAll();
1950
-
1951
-			foreach ($rows as $row) {
1952
-				$this->list[$row->xref] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1953
-			}
1954
-			break;
1955
-
1956
-		case 'family':
1957
-			$sql_select   = "SELECT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1958
-			$sql_join     = "";
1959
-			$sql_where    = " WHERE f_file = :tree_id";
1960
-			$sql_order_by = "";
1961
-			$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1962
-			foreach ($attrs as $attr => $value) {
1963
-				if (strpos($attr, 'filter') === 0 && $value) {
1964
-					$value = $this->substituteVars($value, false);
1965
-					// Convert the various filters into SQL
1966
-					if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1967
-						$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1968
-						$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1969
-						$sql_params[$attr . 'fact'] = $match[1];
1970
-						$date                       = new Date($match[3]);
1971
-						if ($match[2] == "LTE") {
1972
-							$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1973
-							$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1974
-						} else {
1975
-							$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1976
-							$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1977
-						}
1978
-						if ($sortby == $match[1]) {
1979
-							$sortby = "";
1980
-							$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1981
-						}
1982
-						unset($attrs[$attr]); // This filter has been fully processed
1983
-					} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1984
-						$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1985
-						// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1986
-						$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1987
-						unset($attrs[$attr]); // This filter has been fully processed
1988
-					} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1989
-						// Do nothing, unless you have to
1990
-						if ($match[1] != '' || $sortby == 'NAME') {
1991
-							$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1992
-							// Search the DB only if there is any name supplied
1993
-							if ($match[1] != "") {
1994
-								$names = explode(" ", $match[1]);
1995
-								foreach ($names as $n => $name) {
1996
-									$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1997
-									$sql_params[$attr . 'name' . $n] = $name;
1998
-								}
1946
+				$this->list = array();
1947
+				$rows       = Database::prepare(
1948
+					$sql_select . $sql_join . $sql_where . $sql_order_by
1949
+				)->execute($sql_params)->fetchAll();
1950
+
1951
+				foreach ($rows as $row) {
1952
+					$this->list[$row->xref] = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
1953
+				}
1954
+				break;
1955
+
1956
+			case 'family':
1957
+				$sql_select   = "SELECT f_id AS xref, f_gedcom AS gedcom FROM `##families`";
1958
+				$sql_join     = "";
1959
+				$sql_where    = " WHERE f_file = :tree_id";
1960
+				$sql_order_by = "";
1961
+				$sql_params   = array('tree_id' => $WT_TREE->getTreeId());
1962
+				foreach ($attrs as $attr => $value) {
1963
+					if (strpos($attr, 'filter') === 0 && $value) {
1964
+						$value = $this->substituteVars($value, false);
1965
+						// Convert the various filters into SQL
1966
+						if (preg_match('/^(\w+):DATE (LTE|GTE) (.+)$/', $value, $match)) {
1967
+							$sql_join .= " JOIN `##dates` AS {$attr} ON ({$attr}.d_file=f_file AND {$attr}.d_gid=f_id)";
1968
+							$sql_where .= " AND {$attr}.d_fact = :{$attr}fact";
1969
+							$sql_params[$attr . 'fact'] = $match[1];
1970
+							$date                       = new Date($match[3]);
1971
+							if ($match[2] == "LTE") {
1972
+								$sql_where .= " AND {$attr}.d_julianday2 <= :{$attr}date";
1973
+								$sql_params[$attr . 'date'] = $date->maximumJulianDay();
1974
+							} else {
1975
+								$sql_where .= " AND {$attr}.d_julianday1 >= :{$attr}date";
1976
+								$sql_params[$attr . 'date'] = $date->minimumJulianDay();
1999 1977
 							}
2000
-							// Let the DB do the name sorting even when no name was entered
2001
-							if ($sortby == "NAME") {
1978
+							if ($sortby == $match[1]) {
2002 1979
 								$sortby = "";
2003
-								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
1980
+								$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.d_julianday1";
1981
+							}
1982
+							unset($attrs[$attr]); // This filter has been fully processed
1983
+						} elseif (preg_match('/^REGEXP \/(.+)\//', $value, $match)) {
1984
+							$sql_where .= " AND f_gedcom REGEXP :{$attr}gedcom";
1985
+							// PDO helpfully escapes backslashes for us, preventing us from matching "\n1 FACT"
1986
+							$sql_params[$attr . 'gedcom'] = str_replace('\n', "\n", $match[1]);
1987
+							unset($attrs[$attr]); // This filter has been fully processed
1988
+						} elseif (preg_match('/^NAME CONTAINS (.+)$/', $value, $match)) {
1989
+							// Do nothing, unless you have to
1990
+							if ($match[1] != '' || $sortby == 'NAME') {
1991
+								$sql_join .= " JOIN `##name` AS {$attr} ON n_file = f_file AND n_id IN (f_husb, f_wife)";
1992
+								// Search the DB only if there is any name supplied
1993
+								if ($match[1] != "") {
1994
+									$names = explode(" ", $match[1]);
1995
+									foreach ($names as $n => $name) {
1996
+										$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
1997
+										$sql_params[$attr . 'name' . $n] = $name;
1998
+									}
1999
+								}
2000
+								// Let the DB do the name sorting even when no name was entered
2001
+								if ($sortby == "NAME") {
2002
+									$sortby = "";
2003
+									$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
2004
+								}
2004 2005
 							}
2006
+							unset($attrs[$attr]); // This filter has been fully processed
2007
+
2008
+						} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
2009
+							$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
2010
+							$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
2011
+							$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
2012
+							$sql_params[$attr . 'place'] = $match[1];
2013
+							// Don't unset this filter. This is just initial filtering
2014
+						} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
2015
+							$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
2016
+							$sql_params[$attr . 'contains1'] = $match[1];
2017
+							$sql_params[$attr . 'contains2'] = $match[2];
2018
+							$sql_params[$attr . 'contains3'] = $match[3];
2019
+							// Don't unset this filter. This is just initial filtering
2005 2020
 						}
2006
-						unset($attrs[$attr]); // This filter has been fully processed
2007
-
2008
-					} elseif (preg_match('/^(?:\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
2009
-						$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
2010
-						$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
2011
-						$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
2012
-						$sql_params[$attr . 'place'] = $match[1];
2013
-						// Don't unset this filter. This is just initial filtering
2014
-					} elseif (preg_match('/^(\w*):*(\w*) CONTAINS (.+)$/', $value, $match)) {
2015
-						$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
2016
-						$sql_params[$attr . 'contains1'] = $match[1];
2017
-						$sql_params[$attr . 'contains2'] = $match[2];
2018
-						$sql_params[$attr . 'contains3'] = $match[3];
2019
-						// Don't unset this filter. This is just initial filtering
2020 2021
 					}
2021 2022
 				}
2022
-			}
2023 2023
 
2024
-			$this->list = array();
2025
-			$rows       = Database::prepare(
2026
-				$sql_select . $sql_join . $sql_where . $sql_order_by
2027
-			)->execute($sql_params)->fetchAll();
2024
+				$this->list = array();
2025
+				$rows       = Database::prepare(
2026
+					$sql_select . $sql_join . $sql_where . $sql_order_by
2027
+				)->execute($sql_params)->fetchAll();
2028 2028
 
2029
-			foreach ($rows as $row) {
2030
-				$this->list[$row->xref] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
2031
-			}
2032
-			break;
2029
+				foreach ($rows as $row) {
2030
+					$this->list[$row->xref] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
2031
+				}
2032
+				break;
2033 2033
 
2034
-		default:
2035
-			throw new \DomainException('Invalid list name: ' . $listname);
2034
+			default:
2035
+				throw new \DomainException('Invalid list name: ' . $listname);
2036 2036
 		}
2037 2037
 
2038 2038
 		$filters  = array();
@@ -2093,17 +2093,17 @@  discard block
 block discarded – undo
2093 2093
 								$searchstr = "1 " . $tag;
2094 2094
 							}
2095 2095
 							switch ($expr) {
2096
-							case "CONTAINS":
2097
-								if ($t == "PLAC") {
2098
-									$searchstr .= "[^\n]*[, ]*" . $val;
2099
-								} else {
2100
-									$searchstr .= "[^\n]*" . $val;
2101
-								}
2102
-								$filters[] = $searchstr;
2103
-								break;
2104
-							default:
2105
-								$filters2[] = array("tag" => $tag, "expr" => $expr, "val" => $val);
2106
-								break;
2096
+								case "CONTAINS":
2097
+									if ($t == "PLAC") {
2098
+										$searchstr .= "[^\n]*[, ]*" . $val;
2099
+									} else {
2100
+										$searchstr .= "[^\n]*" . $val;
2101
+									}
2102
+									$filters[] = $searchstr;
2103
+									break;
2104
+								default:
2105
+									$filters2[] = array("tag" => $tag, "expr" => $expr, "val" => $val);
2106
+									break;
2107 2107
 							}
2108 2108
 						}
2109 2109
 					}
@@ -2147,31 +2147,31 @@  discard block
 block discarded – undo
2147 2147
 						}
2148 2148
 
2149 2149
 						switch ($expr) {
2150
-						case "GTE":
2151
-							if ($t == "DATE") {
2152
-								$date1 = new Date($v);
2153
-								$date2 = new Date($val);
2154
-								$keep  = (Date::compare($date1, $date2) >= 0);
2155
-							} elseif ($val >= $v) {
2156
-								$keep = true;
2157
-							}
2158
-							break;
2159
-						case "LTE":
2160
-							if ($t == "DATE") {
2161
-								$date1 = new Date($v);
2162
-								$date2 = new Date($val);
2163
-								$keep  = (Date::compare($date1, $date2) <= 0);
2164
-							} elseif ($val >= $v) {
2165
-								$keep = true;
2166
-							}
2167
-							break;
2168
-						default:
2169
-							if ($v == $val) {
2170
-								$keep = true;
2171
-							} else {
2172
-								$keep = false;
2173
-							}
2174
-							break;
2150
+							case "GTE":
2151
+								if ($t == "DATE") {
2152
+									$date1 = new Date($v);
2153
+									$date2 = new Date($val);
2154
+									$keep  = (Date::compare($date1, $date2) >= 0);
2155
+								} elseif ($val >= $v) {
2156
+									$keep = true;
2157
+								}
2158
+								break;
2159
+							case "LTE":
2160
+								if ($t == "DATE") {
2161
+									$date1 = new Date($v);
2162
+									$date2 = new Date($val);
2163
+									$keep  = (Date::compare($date1, $date2) <= 0);
2164
+								} elseif ($val >= $v) {
2165
+									$keep = true;
2166
+								}
2167
+								break;
2168
+							default:
2169
+								if ($v == $val) {
2170
+									$keep = true;
2171
+								} else {
2172
+									$keep = false;
2173
+								}
2174
+								break;
2175 2175
 						}
2176 2176
 					}
2177 2177
 				}
@@ -2183,26 +2183,26 @@  discard block
 block discarded – undo
2183 2183
 		}
2184 2184
 
2185 2185
 		switch ($sortby) {
2186
-		case 'NAME':
2187
-			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2188
-			break;
2189
-		case 'CHAN':
2190
-			uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2191
-				return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2192
-			});
2193
-			break;
2194
-		case 'BIRT:DATE':
2195
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2196
-			break;
2197
-		case 'DEAT:DATE':
2198
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2199
-			break;
2200
-		case 'MARR:DATE':
2201
-			uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2202
-			break;
2203
-		default:
2204
-			// unsorted or already sorted by SQL
2205
-			break;
2186
+			case 'NAME':
2187
+				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2188
+				break;
2189
+			case 'CHAN':
2190
+				uasort($this->list, function (GedcomRecord $x, GedcomRecord $y) {
2191
+					return $y->lastChangeTimestamp(true) - $x->lastChangeTimestamp(true);
2192
+				});
2193
+				break;
2194
+			case 'BIRT:DATE':
2195
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2196
+				break;
2197
+			case 'DEAT:DATE':
2198
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2199
+				break;
2200
+			case 'MARR:DATE':
2201
+				uasort($this->list, '\Fisharebest\Webtrees\Family::compareMarrDate');
2202
+				break;
2203
+			default:
2204
+				// unsorted or already sorted by SQL
2205
+				break;
2206 2206
 		}
2207 2207
 
2208 2208
 		array_push($this->repeats_stack, array($this->repeats, $this->repeat_bytes));
@@ -2353,88 +2353,88 @@  discard block
 block discarded – undo
2353 2353
 		if (!empty($person)) {
2354 2354
 			$this->list[$id] = $person;
2355 2355
 			switch ($group) {
2356
-			case "child-family":
2357
-				foreach ($person->getChildFamilies() as $family) {
2358
-					$husband = $family->getHusband();
2359
-					$wife    = $family->getWife();
2360
-					if (!empty($husband)) {
2361
-						$this->list[$husband->getXref()] = $husband;
2362
-					}
2363
-					if (!empty($wife)) {
2364
-						$this->list[$wife->getXref()] = $wife;
2365
-					}
2366
-					$children = $family->getChildren();
2367
-					foreach ($children as $child) {
2368
-						if (!empty($child)) {
2369
-							$this->list[$child->getXref()] = $child;
2356
+				case "child-family":
2357
+					foreach ($person->getChildFamilies() as $family) {
2358
+						$husband = $family->getHusband();
2359
+						$wife    = $family->getWife();
2360
+						if (!empty($husband)) {
2361
+							$this->list[$husband->getXref()] = $husband;
2362
+						}
2363
+						if (!empty($wife)) {
2364
+							$this->list[$wife->getXref()] = $wife;
2365
+						}
2366
+						$children = $family->getChildren();
2367
+						foreach ($children as $child) {
2368
+							if (!empty($child)) {
2369
+								$this->list[$child->getXref()] = $child;
2370
+							}
2370 2371
 						}
2371 2372
 					}
2372
-				}
2373
-				break;
2374
-			case "spouse-family":
2375
-				foreach ($person->getSpouseFamilies() as $family) {
2376
-					$husband = $family->getHusband();
2377
-					$wife    = $family->getWife();
2378
-					if (!empty($husband)) {
2379
-						$this->list[$husband->getXref()] = $husband;
2380
-					}
2381
-					if (!empty($wife)) {
2382
-						$this->list[$wife->getXref()] = $wife;
2383
-					}
2384
-					$children = $family->getChildren();
2385
-					foreach ($children as $child) {
2386
-						if (!empty($child)) {
2387
-							$this->list[$child->getXref()] = $child;
2373
+					break;
2374
+				case "spouse-family":
2375
+					foreach ($person->getSpouseFamilies() as $family) {
2376
+						$husband = $family->getHusband();
2377
+						$wife    = $family->getWife();
2378
+						if (!empty($husband)) {
2379
+							$this->list[$husband->getXref()] = $husband;
2380
+						}
2381
+						if (!empty($wife)) {
2382
+							$this->list[$wife->getXref()] = $wife;
2383
+						}
2384
+						$children = $family->getChildren();
2385
+						foreach ($children as $child) {
2386
+							if (!empty($child)) {
2387
+								$this->list[$child->getXref()] = $child;
2388
+							}
2388 2389
 						}
2389 2390
 					}
2390
-				}
2391
-				break;
2392
-			case "direct-ancestors":
2393
-				$this->addAncestors($this->list, $id, false, $maxgen);
2394
-				break;
2395
-			case "ancestors":
2396
-				$this->addAncestors($this->list, $id, true, $maxgen);
2397
-				break;
2398
-			case "descendants":
2399
-				$this->list[$id]->generation = 1;
2400
-				$this->addDescendancy($this->list, $id, false, $maxgen);
2401
-				break;
2402
-			case "all":
2403
-				$this->addAncestors($this->list, $id, true, $maxgen);
2404
-				$this->addDescendancy($this->list, $id, true, $maxgen);
2405
-				break;
2391
+					break;
2392
+				case "direct-ancestors":
2393
+					$this->addAncestors($this->list, $id, false, $maxgen);
2394
+					break;
2395
+				case "ancestors":
2396
+					$this->addAncestors($this->list, $id, true, $maxgen);
2397
+					break;
2398
+				case "descendants":
2399
+					$this->list[$id]->generation = 1;
2400
+					$this->addDescendancy($this->list, $id, false, $maxgen);
2401
+					break;
2402
+				case "all":
2403
+					$this->addAncestors($this->list, $id, true, $maxgen);
2404
+					$this->addDescendancy($this->list, $id, true, $maxgen);
2405
+					break;
2406 2406
 			}
2407 2407
 		}
2408 2408
 
2409 2409
 		switch ($sortby) {
2410
-		case 'NAME':
2411
-			uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2412
-			break;
2413
-		case 'BIRT:DATE':
2414
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2415
-			break;
2416
-		case 'DEAT:DATE':
2417
-			uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2418
-			break;
2419
-		case 'generation':
2420
-			$newarray = array();
2421
-			reset($this->list);
2422
-			$genCounter = 1;
2423
-			while (count($newarray) < count($this->list)) {
2424
-				foreach ($this->list as $key => $value) {
2425
-					$this->generation = $value->generation;
2426
-					if ($this->generation == $genCounter) {
2427
-						$newarray[$key]             = new \stdClass;
2428
-						$newarray[$key]->generation = $this->generation;
2410
+			case 'NAME':
2411
+				uasort($this->list, '\Fisharebest\Webtrees\GedcomRecord::compare');
2412
+				break;
2413
+			case 'BIRT:DATE':
2414
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareBirthDate');
2415
+				break;
2416
+			case 'DEAT:DATE':
2417
+				uasort($this->list, '\Fisharebest\Webtrees\Individual::compareDeathDate');
2418
+				break;
2419
+			case 'generation':
2420
+				$newarray = array();
2421
+				reset($this->list);
2422
+				$genCounter = 1;
2423
+				while (count($newarray) < count($this->list)) {
2424
+					foreach ($this->list as $key => $value) {
2425
+						$this->generation = $value->generation;
2426
+						if ($this->generation == $genCounter) {
2427
+							$newarray[$key]             = new \stdClass;
2428
+							$newarray[$key]->generation = $this->generation;
2429
+						}
2429 2430
 					}
2431
+					$genCounter++;
2430 2432
 				}
2431
-				$genCounter++;
2432
-			}
2433
-			$this->list = $newarray;
2434
-			break;
2435
-		default:
2436
-			// unsorted
2437
-			break;
2433
+				$this->list = $newarray;
2434
+				break;
2435
+			default:
2436
+				// unsorted
2437
+				break;
2438 2438
 		}
2439 2439
 		array_push($this->repeats_stack, array($this->repeats, $this->repeat_bytes));
2440 2440
 		$this->repeat_bytes = xml_get_current_line_number($this->parser) + 1;
Please login to merge, or discard this patch.
app/Report/ReportBase.php 1 patch
Switch Indentation   +252 added lines, -252 removed lines patch added patch discarded remove patch
@@ -139,258 +139,258 @@
 block discarded – undo
139 139
 			 */
140 140
 			switch ($this->pageFormat) {
141 141
 				// ISO A series
142
-			case '4A0': // ISO 216, 1682 mm x 2378 mm
143
-				$sizes = array(4767.86, 6740.79);
144
-				break;
145
-			case '2A0': // ISO 216, 1189 mm x 1682 mm
146
-				$sizes = array(3370.39, 4767.86);
147
-				break;
148
-			case 'A0': // ISO 216, 841 mm x 1189mm
149
-				$sizes = array(2383.94, 3370.39);
150
-				break;
151
-			case 'A1': // ISO 216, 594 mm x 841 mm
152
-				$sizes = array(1683.78, 2383.94);
153
-				break;
154
-			case 'A2': // ISO 216, 420 mm x 594 mm
155
-				$sizes = array(1190.55, 1683.78);
156
-				break;
157
-			case 'A3': // ISO 216, 297 mm x 420 mm
158
-				$sizes = array(841.89, 1190.55);
159
-				break;
160
-			case 'A4': // ISO 216, 210 mm 297 mm
161
-				$sizes = array(595.28, 841.89);
162
-				break;
163
-			case 'A5': // ISO 216, 148 mm x 210 mm
164
-				$sizes = array(419.53, 595.28);
165
-				break;
166
-			case 'A6': // ISO 216, 105 mm x 148 mm
167
-				$sizes = array(297.64, 419.53);
168
-				break;
169
-			case 'A7': // ISO 216, 74 mm x 105 mm
170
-				$sizes = array(209.76, 297.64);
171
-				break;
172
-			case 'A8': // ISO 216, 52 mm x 74 mm
173
-				$sizes = array(147.40, 209.76);
174
-				break;
175
-			case 'A9': // ISO 216, 37 mm x 52 mm
176
-				$sizes = array(104.88, 147.40);
177
-				break;
178
-			case 'A10': // ISO 216, 26 mm x 37 mm
179
-				$sizes = array(73.70, 104.88);
180
-				break;
181
-
182
-			// ISO B series
183
-			case 'B0': // ISO 216, 1000 mm x 1414 mm
184
-				$sizes = array(2834.65, 4008.19);
185
-				break;
186
-			case 'B1': // ISO 216, 707 mm x 1000 mm
187
-				$sizes = array(2004.09, 2834.65);
188
-				break;
189
-			case 'B2': // ISO 216, 500 mm x 707 mm
190
-				$sizes = array(1417.32, 2004.09);
191
-				break;
192
-			case 'B3': // ISO 216, 353 mm x 500 mm
193
-				$sizes = array(1000.63, 1417.32);
194
-				break;
195
-			case 'B4': // ISO 216, 250 mm x 353 mm
196
-				$sizes = array(708.66, 1000.63);
197
-				break;
198
-			case 'B5': // ISO 216, 176 mm x 250 mm
199
-				$sizes = array(498.90, 708.66);
200
-				break;
201
-			case 'B6': // ISO 216, 125 mm x 176 mm
202
-				$sizes = array(354.33, 498.90);
203
-				break;
204
-			case 'B7': // ISO 216, 88 mm x 125 mm
205
-				$sizes = array(249.45, 354.33);
206
-				break;
207
-			case 'B8': // ISO 216, 62 mm x 88 mm
208
-				$sizes = array(175.75, 249.45);
209
-				break;
210
-			case 'B9': // ISO 216, 44 mm x 62 mm
211
-				$sizes = array(124.72, 175.75);
212
-				break;
213
-			case 'B10': // ISO 216, 31 mm x 44 mm
214
-				$sizes = array(87.87, 124.72);
215
-				break;
216
-
217
-			// ISO C series, Envelope
218
-			case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
-				$sizes = array(2599.37, 3676.54);
220
-				break;
221
-			case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
-				$sizes = array(1836.85, 2599.37);
223
-				break;
224
-			case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
-				$sizes = array(1298.27, 1836.85);
226
-				break;
227
-			case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
-				$sizes = array(918.43, 1298.27);
229
-				break;
230
-			case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
-				$sizes = array(649.13, 918.43);
232
-				break;
233
-			case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
-				$sizes = array(459.21, 649.13);
235
-				break;
236
-			case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
-				$sizes = array(323.15, 649.13);
238
-				break;
239
-			case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
-				$sizes = array(323.15, 459.21);
241
-				break;
242
-			case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
-				$sizes = array(229.61, 459.21);
244
-				break;
245
-			case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
-				$sizes = array(229.61, 323.15);
247
-				break;
248
-			case 'C8': // ISO 269, 57 mm x 81 mm
249
-				$sizes = array(161.57, 229.61);
250
-				break;
251
-			case 'C9': // ISO 269, 40 mm x 57 mm
252
-				$sizes = array(113.39, 161.57);
253
-				break;
254
-			case 'C10': // ISO 269, 28 mm x 40 mm
255
-				$sizes = array(79.37, 113.39);
256
-				break;
257
-			case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
-				$sizes = array(311.81, 623.62);
259
-				break;
260
-
261
-			// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
-			case 'RA0': // ISO 478, 860 mm x 1220 mm
263
-				$sizes = array(2437.80, 3458.27);
264
-				break;
265
-			case 'RA1': // ISO 478, 610 mm x 860 mm
266
-				$sizes = array(1729.13, 2437.80);
267
-				break;
268
-			case 'RA2': // ISO 478, 430 mm x 610 mm
269
-				$sizes = array(1218.90, 1729.13);
270
-				break;
271
-			case 'RA3': // ISO 478, 305 mm x 430 mm
272
-				$sizes = array(864.57, 1218.90);
273
-				break;
274
-			case 'RA4': // ISO 478, 215 mm x 305 mm
275
-				$sizes = array(609.45, 864.57);
276
-				break;
277
-
278
-			// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
-			case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
-				$sizes = array(2551.18, 3628.35);
281
-				break;
282
-			case 'SRA1': // ISO 593, 640 mm x 900 mm
283
-				$sizes = array(1814.17, 2551.18);
284
-				break;
285
-			case 'SRA2': // ISO 593, 450 mm x 640 mm
286
-				$sizes = array(1275.59, 1814.17);
287
-				break;
288
-			case 'SRA3': // ISO 593, 320 mm x 450 mm
289
-				$sizes = array(907.09, 1275.59);
290
-				break;
291
-			case 'SRA4': // ISO 593, 225 mm x 320 mm
292
-				$sizes = array(637.80, 907.09);
293
-				break;
294
-
295
-			// ISO size variations
296
-			case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
-				$sizes = array(1261.42, 1754.65);
298
-				break;
299
-			case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
-				$sizes = array(864.57, 1440.00);
301
-				break;
302
-			case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
-				$sizes = array(912.76, 1261.42);
304
-				break;
305
-			case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
-				$sizes = array(864.57, 1380.47);
307
-				break;
308
-			case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
-				$sizes = array(666.14, 912.76);
310
-				break;
311
-			case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
-				$sizes = array(595.28, 986.46);
313
-				break;
314
-			case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
-				$sizes = array(649.13, 912.76);
316
-				break;
317
-			case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
-				$sizes = array(643.46, 1009.13);
319
-				break;
320
-			case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
-				$sizes = array(490.39, 666.14);
322
-				break;
323
-			case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
-				$sizes = array(572.60, 782.36);
325
-				break;
326
-
327
-			// Japanese version of the ISO 216 B series
328
-			case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
-				$sizes = array(2919.69, 4127.24);
330
-				break;
331
-			case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
-				$sizes = array(2063.62, 2919.69);
333
-				break;
334
-			case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
-				$sizes = array(1459.84, 2063.62);
336
-				break;
337
-			case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
-				$sizes = array(1031.81, 1459.84);
339
-				break;
340
-			case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
-				$sizes = array(728.50, 1031.81);
342
-				break;
343
-			case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
-				$sizes = array(515.91, 728.50);
345
-				break;
346
-			case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
-				$sizes = array(362.83, 515.91);
348
-				break;
349
-			case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
-				$sizes = array(257.95, 362.83);
351
-				break;
352
-			case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
-				$sizes = array(181.42, 257.95);
354
-				break;
355
-			case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
-				$sizes = array(127.56, 181.42);
357
-				break;
358
-			case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
-				$sizes = array(90.71, 127.56);
360
-				break;
361
-
362
-			// US pages
363
-			case 'EXECUTIVE': // 7.25 in x 10.5 in
364
-				$sizes = array(522.00, 756.00);
365
-				break;
366
-			case 'FOLIO': // 8.5 in x 13 in
367
-				$sizes = array(612.00, 936.00);
368
-				break;
369
-			case 'FOOLSCAP': // 13.5 in x 17 in
370
-				$sizes = array(972.00, 1224.00);
371
-				break;
372
-			case 'LEDGER': // 11 in x 17 in
373
-				$sizes = array(792.00, 1224.00);
374
-				break;
375
-			case 'LEGAL': // 8.5 in x 14 in
376
-				$sizes = array(612.00, 1008.00);
377
-				break;
378
-			case 'LETTER': // 8.5 in x 11 in
379
-				$sizes = array(612.00, 792.00);
380
-				break;
381
-			case 'QUARTO': // 8.46 in x 10.8 in
382
-				$sizes = array(609.12, 777.50);
383
-				break;
384
-			case 'STATEMENT': // 5.5 in x 8.5 in
385
-				$sizes = array(396.00, 612.00);
386
-				break;
387
-			case 'USGOVT': // 8 in x 11 in
388
-				$sizes = array(576.00, 792.00);
389
-				break;
390
-			default:
391
-				$this->pageFormat = 'A4';
392
-				$sizes            = array(595.28, 841.89);
393
-				break;
142
+				case '4A0': // ISO 216, 1682 mm x 2378 mm
143
+					$sizes = array(4767.86, 6740.79);
144
+					break;
145
+				case '2A0': // ISO 216, 1189 mm x 1682 mm
146
+					$sizes = array(3370.39, 4767.86);
147
+					break;
148
+				case 'A0': // ISO 216, 841 mm x 1189mm
149
+					$sizes = array(2383.94, 3370.39);
150
+					break;
151
+				case 'A1': // ISO 216, 594 mm x 841 mm
152
+					$sizes = array(1683.78, 2383.94);
153
+					break;
154
+				case 'A2': // ISO 216, 420 mm x 594 mm
155
+					$sizes = array(1190.55, 1683.78);
156
+					break;
157
+				case 'A3': // ISO 216, 297 mm x 420 mm
158
+					$sizes = array(841.89, 1190.55);
159
+					break;
160
+				case 'A4': // ISO 216, 210 mm 297 mm
161
+					$sizes = array(595.28, 841.89);
162
+					break;
163
+				case 'A5': // ISO 216, 148 mm x 210 mm
164
+					$sizes = array(419.53, 595.28);
165
+					break;
166
+				case 'A6': // ISO 216, 105 mm x 148 mm
167
+					$sizes = array(297.64, 419.53);
168
+					break;
169
+				case 'A7': // ISO 216, 74 mm x 105 mm
170
+					$sizes = array(209.76, 297.64);
171
+					break;
172
+				case 'A8': // ISO 216, 52 mm x 74 mm
173
+					$sizes = array(147.40, 209.76);
174
+					break;
175
+				case 'A9': // ISO 216, 37 mm x 52 mm
176
+					$sizes = array(104.88, 147.40);
177
+					break;
178
+				case 'A10': // ISO 216, 26 mm x 37 mm
179
+					$sizes = array(73.70, 104.88);
180
+					break;
181
+
182
+				// ISO B series
183
+				case 'B0': // ISO 216, 1000 mm x 1414 mm
184
+					$sizes = array(2834.65, 4008.19);
185
+					break;
186
+				case 'B1': // ISO 216, 707 mm x 1000 mm
187
+					$sizes = array(2004.09, 2834.65);
188
+					break;
189
+				case 'B2': // ISO 216, 500 mm x 707 mm
190
+					$sizes = array(1417.32, 2004.09);
191
+					break;
192
+				case 'B3': // ISO 216, 353 mm x 500 mm
193
+					$sizes = array(1000.63, 1417.32);
194
+					break;
195
+				case 'B4': // ISO 216, 250 mm x 353 mm
196
+					$sizes = array(708.66, 1000.63);
197
+					break;
198
+				case 'B5': // ISO 216, 176 mm x 250 mm
199
+					$sizes = array(498.90, 708.66);
200
+					break;
201
+				case 'B6': // ISO 216, 125 mm x 176 mm
202
+					$sizes = array(354.33, 498.90);
203
+					break;
204
+				case 'B7': // ISO 216, 88 mm x 125 mm
205
+					$sizes = array(249.45, 354.33);
206
+					break;
207
+				case 'B8': // ISO 216, 62 mm x 88 mm
208
+					$sizes = array(175.75, 249.45);
209
+					break;
210
+				case 'B9': // ISO 216, 44 mm x 62 mm
211
+					$sizes = array(124.72, 175.75);
212
+					break;
213
+				case 'B10': // ISO 216, 31 mm x 44 mm
214
+					$sizes = array(87.87, 124.72);
215
+					break;
216
+
217
+				// ISO C series, Envelope
218
+				case 'C0': // ISO 269, 917 mm x 1297 mm, For flat A0 sheet
219
+					$sizes = array(2599.37, 3676.54);
220
+					break;
221
+				case 'C1': // ISO 269, 648 mm x 917 mm, For flat A1 sheet
222
+					$sizes = array(1836.85, 2599.37);
223
+					break;
224
+				case 'C2': // ISO 269, 458 mm x 648 mm, For flat A2 sheet, A1 folded in half
225
+					$sizes = array(1298.27, 1836.85);
226
+					break;
227
+				case 'C3': // ISO 269, 324 mm x 458 mm, For flat A3 sheet, A2 folded in half
228
+					$sizes = array(918.43, 1298.27);
229
+					break;
230
+				case 'C4': // ISO 269, 229 mm x 324 mm, For flat A4 sheet, A3 folded in half
231
+					$sizes = array(649.13, 918.43);
232
+					break;
233
+				case 'C5': // ISO 269, 162 mm x 229 mm, For flat A5 sheet, A4 folded in half
234
+					$sizes = array(459.21, 649.13);
235
+					break;
236
+				case 'C6/5': // ISO 269, 114 mm x 229 mm. A5 folded twice = 1/3 A4. Alternative for the DL envelope
237
+					$sizes = array(323.15, 649.13);
238
+					break;
239
+				case 'C6': // ISO 269, 114 mm x 162 mm, For A5 folded in half
240
+					$sizes = array(323.15, 459.21);
241
+					break;
242
+				case 'C7/6': // ISO 269, 81 mm x 162 mm, For A5 sheet folded in thirds
243
+					$sizes = array(229.61, 459.21);
244
+					break;
245
+				case 'C7': // ISO 269, 81 mm x 114 mm, For A5 folded in quarters
246
+					$sizes = array(229.61, 323.15);
247
+					break;
248
+				case 'C8': // ISO 269, 57 mm x 81 mm
249
+					$sizes = array(161.57, 229.61);
250
+					break;
251
+				case 'C9': // ISO 269, 40 mm x 57 mm
252
+					$sizes = array(113.39, 161.57);
253
+					break;
254
+				case 'C10': // ISO 269, 28 mm x 40 mm
255
+					$sizes = array(79.37, 113.39);
256
+					break;
257
+				case 'DL': // Original DIN 678 but ISO 269 now has this C6/5 , 110 mm x 220 mm, For A4 sheet folded in thirds, A5 in half
258
+					$sizes = array(311.81, 623.62);
259
+					break;
260
+
261
+				// Untrimmed stock sizes for the ISO-A Series - ISO primary range
262
+				case 'RA0': // ISO 478, 860 mm x 1220 mm
263
+					$sizes = array(2437.80, 3458.27);
264
+					break;
265
+				case 'RA1': // ISO 478, 610 mm x 860 mm
266
+					$sizes = array(1729.13, 2437.80);
267
+					break;
268
+				case 'RA2': // ISO 478, 430 mm x 610 mm
269
+					$sizes = array(1218.90, 1729.13);
270
+					break;
271
+				case 'RA3': // ISO 478, 305 mm x 430 mm
272
+					$sizes = array(864.57, 1218.90);
273
+					break;
274
+				case 'RA4': // ISO 478, 215 mm x 305 mm
275
+					$sizes = array(609.45, 864.57);
276
+					break;
277
+
278
+				// Untrimmed stock sizes for the ISO-A Series - ISO supplementary range
279
+				case 'SRA0': // ISO 593, 900 mm x 1280 mm
280
+					$sizes = array(2551.18, 3628.35);
281
+					break;
282
+				case 'SRA1': // ISO 593, 640 mm x 900 mm
283
+					$sizes = array(1814.17, 2551.18);
284
+					break;
285
+				case 'SRA2': // ISO 593, 450 mm x 640 mm
286
+					$sizes = array(1275.59, 1814.17);
287
+					break;
288
+				case 'SRA3': // ISO 593, 320 mm x 450 mm
289
+					$sizes = array(907.09, 1275.59);
290
+					break;
291
+				case 'SRA4': // ISO 593, 225 mm x 320 mm
292
+					$sizes = array(637.80, 907.09);
293
+					break;
294
+
295
+				// ISO size variations
296
+				case 'A2EXTRA': // ISO 216, 445 mm x 619 mm
297
+					$sizes = array(1261.42, 1754.65);
298
+					break;
299
+				case 'A2SUPER': // ISO 216, 305 mm x 508 mm
300
+					$sizes = array(864.57, 1440.00);
301
+					break;
302
+				case 'A3EXTRA': // ISO 216, 322 mm x 445 mm
303
+					$sizes = array(912.76, 1261.42);
304
+					break;
305
+				case 'SUPERA3': // ISO 216, 305 mm x 487 mm
306
+					$sizes = array(864.57, 1380.47);
307
+					break;
308
+				case 'A4EXTRA': // ISO 216, 235 mm x 322 mm
309
+					$sizes = array(666.14, 912.76);
310
+					break;
311
+				case 'A4LONG': // ISO 216, 210 mm x 348 mm
312
+					$sizes = array(595.28, 986.46);
313
+					break;
314
+				case 'A4SUPER': // ISO 216, 229 mm x 322 mm
315
+					$sizes = array(649.13, 912.76);
316
+					break;
317
+				case 'SUPERA4': // ISO 216, 227 mm x 356 mm
318
+					$sizes = array(643.46, 1009.13);
319
+					break;
320
+				case 'A5EXTRA': // ISO 216, 173 mm x 235 mm
321
+					$sizes = array(490.39, 666.14);
322
+					break;
323
+				case 'SOB5EXTRA': // ISO 216, 202 mm x 276 mm
324
+					$sizes = array(572.60, 782.36);
325
+					break;
326
+
327
+				// Japanese version of the ISO 216 B series
328
+				case 'JB0': // JIS P 0138-61, 1030 mm x 1456 mm
329
+					$sizes = array(2919.69, 4127.24);
330
+					break;
331
+				case 'JB1': // JIS P 0138-61, 728 mm x 1030 mm
332
+					$sizes = array(2063.62, 2919.69);
333
+					break;
334
+				case 'JB2': // JIS P 0138-61, 515 mm x 728 mm
335
+					$sizes = array(1459.84, 2063.62);
336
+					break;
337
+				case 'JB3': // JIS P 0138-61, 364 mm x 515 mm
338
+					$sizes = array(1031.81, 1459.84);
339
+					break;
340
+				case 'JB4': // JIS P 0138-61, 257 mm x 364 mm
341
+					$sizes = array(728.50, 1031.81);
342
+					break;
343
+				case 'JB5': // JIS P 0138-61, 182 mm x 257 mm
344
+					$sizes = array(515.91, 728.50);
345
+					break;
346
+				case 'JB6': // JIS P 0138-61, 128 mm x 182 mm
347
+					$sizes = array(362.83, 515.91);
348
+					break;
349
+				case 'JB7': // JIS P 0138-61, 91 mm x 128 mm
350
+					$sizes = array(257.95, 362.83);
351
+					break;
352
+				case 'JB8': // JIS P 0138-61, 64 mm x 91 mm
353
+					$sizes = array(181.42, 257.95);
354
+					break;
355
+				case 'JB9': // JIS P 0138-61, 45 mm x 64 mm
356
+					$sizes = array(127.56, 181.42);
357
+					break;
358
+				case 'JB10': // JIS P 0138-61, 32 mm x 45 mm
359
+					$sizes = array(90.71, 127.56);
360
+					break;
361
+
362
+				// US pages
363
+				case 'EXECUTIVE': // 7.25 in x 10.5 in
364
+					$sizes = array(522.00, 756.00);
365
+					break;
366
+				case 'FOLIO': // 8.5 in x 13 in
367
+					$sizes = array(612.00, 936.00);
368
+					break;
369
+				case 'FOOLSCAP': // 13.5 in x 17 in
370
+					$sizes = array(972.00, 1224.00);
371
+					break;
372
+				case 'LEDGER': // 11 in x 17 in
373
+					$sizes = array(792.00, 1224.00);
374
+					break;
375
+				case 'LEGAL': // 8.5 in x 14 in
376
+					$sizes = array(612.00, 1008.00);
377
+					break;
378
+				case 'LETTER': // 8.5 in x 11 in
379
+					$sizes = array(612.00, 792.00);
380
+					break;
381
+				case 'QUARTO': // 8.46 in x 10.8 in
382
+					$sizes = array(609.12, 777.50);
383
+					break;
384
+				case 'STATEMENT': // 5.5 in x 8.5 in
385
+					$sizes = array(396.00, 612.00);
386
+					break;
387
+				case 'USGOVT': // 8 in x 11 in
388
+					$sizes = array(576.00, 792.00);
389
+					break;
390
+				default:
391
+					$this->pageFormat = 'A4';
392
+					$sizes            = array(595.28, 841.89);
393
+					break;
394 394
 			}
395 395
 			$this->pagew = $sizes[0];
396 396
 			$this->pageh = $sizes[1];
Please login to merge, or discard this patch.