@@ -17,41 +17,41 @@ |
||
17 | 17 | */ |
18 | 18 | interface CertificateProviderInterface { |
19 | 19 | |
20 | - /** |
|
21 | - * Returns the certificates directory path as it is really (within the firewall directory). |
|
22 | - * |
|
23 | - * @return string Real certificates directory path |
|
24 | - */ |
|
25 | - function getRealCertificatesDirectory(); |
|
20 | + /** |
|
21 | + * Returns the certificates directory path as it is really (within the firewall directory). |
|
22 | + * |
|
23 | + * @return string Real certificates directory path |
|
24 | + */ |
|
25 | + function getRealCertificatesDirectory(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * Returns an array of the folders (cities) in the certificate directory. |
|
29 | - * Cities name are UTF8 encoded. |
|
30 | - * |
|
31 | - * @return array Array of cities name |
|
32 | - */ |
|
33 | - function getCitiesList(); |
|
27 | + /** |
|
28 | + * Returns an array of the folders (cities) in the certificate directory. |
|
29 | + * Cities name are UTF8 encoded. |
|
30 | + * |
|
31 | + * @return array Array of cities name |
|
32 | + */ |
|
33 | + function getCitiesList(); |
|
34 | 34 | |
35 | - /** |
|
36 | - * Returns the list of available certificates for a specified city. |
|
37 | - * Format of the list : |
|
38 | - * < file name , date of the certificate , type of certificate , name of the certificate > |
|
39 | - * Data are UTF8 encoded. |
|
40 | - * |
|
41 | - * @param string $selCity City to look in |
|
42 | - * @return array List of certificates |
|
43 | - */ |
|
44 | - function getCertificatesList($selCity); |
|
35 | + /** |
|
36 | + * Returns the list of available certificates for a specified city. |
|
37 | + * Format of the list : |
|
38 | + * < file name , date of the certificate , type of certificate , name of the certificate > |
|
39 | + * Data are UTF8 encoded. |
|
40 | + * |
|
41 | + * @param string $selCity City to look in |
|
42 | + * @return array List of certificates |
|
43 | + */ |
|
44 | + function getCertificatesList($selCity); |
|
45 | 45 | |
46 | - /** |
|
47 | - * Return the list of certificates from a city $city and containing the characters $contains |
|
48 | - * |
|
49 | - * @param string $city City to search in |
|
50 | - * @param string $contains Characters to match |
|
51 | - * @param string $limit Maximum number of results |
|
52 | - * @return array Array of matching certificates |
|
53 | - */ |
|
54 | - function getCertificatesListBeginWith($city, $contains, $limit); |
|
46 | + /** |
|
47 | + * Return the list of certificates from a city $city and containing the characters $contains |
|
48 | + * |
|
49 | + * @param string $city City to search in |
|
50 | + * @param string $contains Characters to match |
|
51 | + * @param string $limit Maximum number of results |
|
52 | + * @return array Array of matching certificates |
|
53 | + */ |
|
54 | + function getCertificatesListBeginWith($city, $contains, $limit); |
|
55 | 55 | |
56 | 56 | } |
57 | 57 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Interface for providers of certificates |
17 | 17 | */ |
18 | -interface CertificateProviderInterface { |
|
18 | +interface CertificateProviderInterface { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Returns the certificates directory path as it is really (within the firewall directory). |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class Certificate extends Media { |
37 | 37 | |
38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
39 | 39 | |
40 | - /** @var string The "TITL" value from the GEDCOM |
|
41 | - * This is a tweak to overcome the private level from the parent object... |
|
42 | - */ |
|
43 | - protected $title = ''; |
|
40 | + /** @var string The "TITL" value from the GEDCOM |
|
41 | + * This is a tweak to overcome the private level from the parent object... |
|
42 | + */ |
|
43 | + protected $title = ''; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Certificate provider |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param CertificateProviderInterface $provider |
81 | 81 | */ |
82 | 82 | public function __construct($data, Tree $tree, CertificateProviderInterface $provider) { |
83 | - $this->provider = $provider; |
|
83 | + $this->provider = $provider; |
|
84 | 84 | // Data is only the file name |
85 | 85 | $data = str_replace("\\", '/', $data); |
86 | 86 | $xref = Functions::encryptToSafeBase64($data); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @see \Fisharebest\Webtrees\Media::getTitle() |
166 | 166 | */ |
167 | 167 | public function getTitle() { |
168 | - return $this->title; |
|
168 | + return $this->title; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -241,26 +241,26 @@ discard block |
||
241 | 241 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
242 | 242 | |
243 | 243 | if($module) { |
244 | - $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
|
245 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
244 | + $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
|
245 | + $sid= Filter::get('sid', WT_REGEX_XREF); |
|
246 | 246 | |
247 | - if($sid){ |
|
248 | - $this->source = Source::getInstance($sid, $this->tree); |
|
249 | - } |
|
250 | - else{ |
|
251 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | - } |
|
247 | + if($sid){ |
|
248 | + $this->source = Source::getInstance($sid, $this->tree); |
|
249 | + } |
|
250 | + else{ |
|
251 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
252 | + } |
|
253 | 253 | |
254 | - if($this->source) { |
|
255 | - $wmtext = '©'; |
|
256 | - $repofact = $this->source->getFirstFact('REPO'); |
|
257 | - if($repofact) { |
|
258 | - $repo = $repofact->getTarget(); |
|
259 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | - } |
|
261 | - $wmtext .= $this->source->getFullName(); |
|
262 | - } |
|
263 | - return $wmtext; |
|
254 | + if($this->source) { |
|
255 | + $wmtext = '©'; |
|
256 | + $repofact = $this->source->getFirstFact('REPO'); |
|
257 | + if($repofact) { |
|
258 | + $repo = $repofact->getTarget(); |
|
259 | + if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | + } |
|
261 | + $wmtext .= $this->source->getFullName(); |
|
262 | + } |
|
263 | + return $wmtext; |
|
264 | 264 | } |
265 | 265 | return ''; |
266 | 266 | } |
@@ -323,8 +323,8 @@ discard block |
||
323 | 323 | ' FROM `##individuals`'. |
324 | 324 | ' WHERE i_file= :gedcom_id AND i_gedcom LIKE :gedcom') |
325 | 325 | ->execute(array( |
326 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
327 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
326 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
327 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
328 | 328 | ))->fetchAll(); |
329 | 329 | |
330 | 330 | $list = array(); |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | ' FROM `##families`'. |
348 | 348 | ' WHERE f_file= :gedcom_id AND f_gedcom LIKE :gedcom') |
349 | 349 | ->execute(array( |
350 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
351 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
350 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
351 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
352 | 352 | ))->fetchAll(); |
353 | 353 | |
354 | 354 | $list = array(); |
@@ -375,25 +375,25 @@ discard block |
||
375 | 375 | 'SELECT i_gedcom AS gedrec FROM `##individuals`'. |
376 | 376 | ' WHERE i_file=:gedcom_id AND i_gedcom LIKE :gedcom') |
377 | 377 | ->execute(array( |
378 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
379 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
378 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
379 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
380 | 380 | ))->fetchOne(); |
381 | 381 | if(!$ged){ |
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
385 | - ->execute(array( |
|
386 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
387 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
388 | - ))->fetchOne(); |
|
385 | + ->execute(array( |
|
386 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
387 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
388 | + ))->fetchOne(); |
|
389 | 389 | if(!$ged){ |
390 | 390 | $ged = Database::prepare( |
391 | - 'SELECT o_gedcom AS gedrec FROM `##other`'. |
|
392 | - ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
|
393 | - ->execute(array( |
|
394 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
395 | - 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
396 | - ))->fetchOne(); |
|
391 | + 'SELECT o_gedcom AS gedrec FROM `##other`'. |
|
392 | + ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
|
393 | + ->execute(array( |
|
394 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
395 | + 'gedcom' => '%_ACT '.$this->getFilename().'%' |
|
396 | + ))->fetchOne(); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
@@ -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 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class Certificate extends Media { |
37 | 37 | |
38 | - const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
38 | + const URL_PREFIX = 'module.php?mod=myartjaub_certificates&mod_action=Certificate&cid='; |
|
39 | 39 | |
40 | 40 | /** @var string The "TITL" value from the GEDCOM |
41 | 41 | * This is a tweak to overcome the private level from the parent object... |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | |
96 | 96 | $match = null; |
97 | 97 | $ct = preg_match("/(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}) )?(?<details>.*)/", $this->title, $match); |
98 | - if($ct > 0){ |
|
99 | - $monthId = (int) $match['month']; |
|
98 | + if ($ct > 0) { |
|
99 | + $monthId = (int)$match['month']; |
|
100 | 100 | $calendarShortMonths = Functions::getCalendarShortMonths(); |
101 | 101 | $monthShortName = array_key_exists($monthId, $calendarShortMonths) ? $calendarShortMonths[$monthId] : $monthId; |
102 | 102 | $this->certDate = new Date($match['day'].' '.strtoupper($monthShortName).' '.$match['year']); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | * @see \Fisharebest\Webtrees\GedcomRecord::getInstance() |
113 | 113 | */ |
114 | 114 | static public function getInstance($xref, Tree $tree, $gedcom = null, CertificateProviderInterface $provider = null) { |
115 | - try{ |
|
115 | + try { |
|
116 | 116 | $certfile = Functions::decryptFromSafeBase64($xref); |
117 | 117 | |
118 | 118 | //NEED TO CHECK THAT !!! |
119 | - if(Functions::isValidPath($certfile, true)) { |
|
119 | + if (Functions::isValidPath($certfile, true)) { |
|
120 | 120 | return new Certificate($certfile, $tree, $provider); |
121 | 121 | } |
122 | 122 | } |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param string|Source $xref |
155 | 155 | */ |
156 | - public function setSource($xref){ |
|
157 | - if($xref instanceof Source){ |
|
156 | + public function setSource($xref) { |
|
157 | + if ($xref instanceof Source) { |
|
158 | 158 | $this->source = $xref; |
159 | 159 | } else { |
160 | 160 | $this->source = Source::getInstance($xref, $this->tree); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * |
175 | 175 | * @return Date Certificate date |
176 | 176 | */ |
177 | - public function getCertificateDate(){ |
|
177 | + public function getCertificateDate() { |
|
178 | 178 | return $this->certDate; |
179 | 179 | } |
180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string Certificate date |
185 | 185 | */ |
186 | - public function getCertificateType(){ |
|
186 | + public function getCertificateType() { |
|
187 | 187 | return $this->certType; |
188 | 188 | } |
189 | 189 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * |
193 | 193 | * @return string Certificate details |
194 | 194 | */ |
195 | - public function getCertificateDetails(){ |
|
195 | + public function getCertificateDetails() { |
|
196 | 196 | return $this->certDetails; |
197 | 197 | } |
198 | 198 | |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string|NULL Certificate city |
203 | 203 | */ |
204 | - public function getCity(){ |
|
204 | + public function getCity() { |
|
205 | 205 | $chunks = explode('/', $this->getFilename(), 2); |
206 | - if(count($chunks) > 1) return $chunks[0]; |
|
206 | + if (count($chunks) > 1) return $chunks[0]; |
|
207 | 207 | return null; |
208 | 208 | } |
209 | 209 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | * {@inhericDoc} |
212 | 212 | * @see \Fisharebest\Webtrees\Media::getServerFilename() |
213 | 213 | */ |
214 | - public function getServerFilename($which='main') { |
|
215 | - $filename = $this->provider->getRealCertificatesDirectory() . $this->getFilename(); |
|
214 | + public function getServerFilename($which = 'main') { |
|
215 | + $filename = $this->provider->getRealCertificatesDirectory().$this->getFilename(); |
|
216 | 216 | return Functions::encodeUtf8ToFileSystem($filename); |
217 | 217 | } |
218 | 218 | |
@@ -223,11 +223,11 @@ discard block |
||
223 | 223 | public function getHtmlUrlDirect($which = 'main', $download = false) { |
224 | 224 | $sidstr = ($this->source) ? '&sid='.$this->source->getXref() : ''; |
225 | 225 | return |
226 | - 'module.php?mod='. \MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME . |
|
227 | - '&mod_action=Certificate@image' . |
|
228 | - '&ged='. $this->tree->getNameUrl() . |
|
229 | - '&cid=' . $this->getXref() . $sidstr . |
|
230 | - '&cb=' . $this->getEtag($which); |
|
226 | + 'module.php?mod='.\MyArtJaub\Webtrees\Constants::MODULE_MAJ_CERTIF_NAME. |
|
227 | + '&mod_action=Certificate@image'. |
|
228 | + '&ged='.$this->tree->getNameUrl(). |
|
229 | + '&cid='.$this->getXref().$sidstr. |
|
230 | + '&cb='.$this->getEtag($which); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -238,26 +238,26 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return string Watermark text |
240 | 240 | */ |
241 | - public function getWatermarkText(){ |
|
241 | + public function getWatermarkText() { |
|
242 | 242 | $module = Module::getModuleByName(Constants::MODULE_MAJ_CERTIF_NAME); |
243 | 243 | |
244 | - if($module) { |
|
244 | + if ($module) { |
|
245 | 245 | $wmtext = $module->getSetting('MAJ_WM_DEFAULT', I18N::translate('This image is protected under copyright law.')); |
246 | - $sid= Filter::get('sid', WT_REGEX_XREF); |
|
246 | + $sid = Filter::get('sid', WT_REGEX_XREF); |
|
247 | 247 | |
248 | - if($sid){ |
|
248 | + if ($sid) { |
|
249 | 249 | $this->source = Source::getInstance($sid, $this->tree); |
250 | 250 | } |
251 | - else{ |
|
252 | - $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
251 | + else { |
|
252 | + $this->fetchALinkedSource(); // the method already attach the source to the Certificate object; |
|
253 | 253 | } |
254 | 254 | |
255 | - if($this->source) { |
|
255 | + if ($this->source) { |
|
256 | 256 | $wmtext = '©'; |
257 | 257 | $repofact = $this->source->getFirstFact('REPO'); |
258 | - if($repofact) { |
|
258 | + if ($repofact) { |
|
259 | 259 | $repo = $repofact->getTarget(); |
260 | - if($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
260 | + if ($repo && $repo instanceof Repository) $wmtext .= ' '.$repo->getFullName().' - '; |
|
261 | 261 | } |
262 | 262 | $wmtext .= $this->source->getFullName(); |
263 | 263 | } |
@@ -279,45 +279,45 @@ discard block |
||
279 | 279 | |
280 | 280 | $script = ''; |
281 | 281 | $controller = Globals::getController(); |
282 | - if($controller && !($controller instanceof IndividualController)){ |
|
282 | + if ($controller && !($controller instanceof IndividualController)) { |
|
283 | 283 | $controller->addInlineJavascript('$(document).ready(function() { '.$js.' });'); |
284 | 284 | } else { |
285 | - $script = '<script>' . $js . '</script>'; |
|
285 | + $script = '<script>'.$js.'</script>'; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | if ($which == 'icon' || !file_exists($this->getServerFilename())) { |
289 | 289 | // Use an icon |
290 | 290 | $image = |
291 | - '<i dir="auto" class="icon-maj-certificate margin-h-2"' . |
|
292 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
291 | + '<i dir="auto" class="icon-maj-certificate margin-h-2"'. |
|
292 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
293 | 293 | '></i>'; |
294 | 294 | } else { |
295 | 295 | $imgsize = getimagesize($this->getServerFilename()); |
296 | 296 | $image = |
297 | - '<img' . |
|
298 | - ' class ="'. 'certif_image' . '"' . |
|
299 | - ' dir="' . 'auto' . '"' . // For the tool-tip |
|
300 | - ' src="' . $this->getHtmlUrlDirect() . '"' . |
|
301 | - ' alt="' . strip_tags($this->getFullName()) . '"' . |
|
302 | - ' title="' . strip_tags($this->getFullName()) . '"' . |
|
303 | - $imgsize[3] . // height="yyy" width="xxx" |
|
297 | + '<img'. |
|
298 | + ' class ="'.'certif_image'.'"'. |
|
299 | + ' dir="'.'auto'.'"'.// For the tool-tip |
|
300 | + ' src="'.$this->getHtmlUrlDirect().'"'. |
|
301 | + ' alt="'.strip_tags($this->getFullName()).'"'. |
|
302 | + ' title="'.strip_tags($this->getFullName()).'"'. |
|
303 | + $imgsize[3].// height="yyy" width="xxx" |
|
304 | 304 | '>'; |
305 | 305 | } |
306 | 306 | return |
307 | - '<a' . |
|
308 | - ' class="' . 'certgallery' . '"' . |
|
309 | - ' href="' . $this->getHtmlUrlDirect() . '"' . |
|
310 | - ' type="' . $this->mimeType() . '"' . |
|
311 | - ' data-obje-url="' . $this->getHtmlUrl() . '"' . |
|
312 | - ' data-title="' . strip_tags($this->getFullName()) . '"' . |
|
313 | - '>' . $image . '</a>'.$script; |
|
307 | + '<a'. |
|
308 | + ' class="'.'certgallery'.'"'. |
|
309 | + ' href="'.$this->getHtmlUrlDirect().'"'. |
|
310 | + ' type="'.$this->mimeType().'"'. |
|
311 | + ' data-obje-url="'.$this->getHtmlUrl().'"'. |
|
312 | + ' data-title="'.strip_tags($this->getFullName()).'"'. |
|
313 | + '>'.$image.'</a>'.$script; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
317 | 317 | * {@inhericDoc} |
318 | 318 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedIndividuals() |
319 | 319 | */ |
320 | - public function linkedIndividuals($link = '_ACT'){ |
|
320 | + public function linkedIndividuals($link = '_ACT') { |
|
321 | 321 | $rows = Database::prepare( |
322 | 322 | 'SELECT i_id AS xref, i_gedcom AS gedcom'. |
323 | 323 | ' FROM `##individuals`'. |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * {@inhericDoc} |
342 | 342 | * @see \Fisharebest\Webtrees\GedcomRecord::linkedFamilies() |
343 | 343 | */ |
344 | - public function linkedFamilies($link = '_ACT'){ |
|
344 | + public function linkedFamilies($link = '_ACT') { |
|
345 | 345 | $rows = Database::prepare( |
346 | 346 | 'SELECT f_id AS xref, f_gedcom AS gedcom'. |
347 | 347 | ' FROM `##families`'. |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return Source|NULL Linked source |
368 | 368 | */ |
369 | - public function fetchALinkedSource(){ |
|
369 | + public function fetchALinkedSource() { |
|
370 | 370 | $sid = null; |
371 | 371 | |
372 | 372 | // Try to find in individual, then families, then other types of records. We are interested in the first available value. |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | 'gedcom_id' => $this->tree->getTreeId(), |
379 | 379 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
380 | 380 | ))->fetchOne(); |
381 | - if(!$ged){ |
|
381 | + if (!$ged) { |
|
382 | 382 | $ged = Database::prepare( |
383 | 383 | 'SELECT f_gedcom AS gedrec FROM `##families`'. |
384 | 384 | ' WHERE f_file=:gedcom_id AND f_gedcom LIKE :gedcom') |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | 'gedcom_id' => $this->tree->getTreeId(), |
387 | 387 | 'gedcom' => '%_ACT '.$this->getFilename().'%' |
388 | 388 | ))->fetchOne(); |
389 | - if(!$ged){ |
|
389 | + if (!$ged) { |
|
390 | 390 | $ged = Database::prepare( |
391 | 391 | 'SELECT o_gedcom AS gedrec FROM `##other`'. |
392 | 392 | ' WHERE o_file=:gedcom_id AND o_gedcom LIKE :gedcom') |
@@ -397,19 +397,19 @@ discard block |
||
397 | 397 | } |
398 | 398 | } |
399 | 399 | //If a record has been found, parse it to find the source reference. |
400 | - if($ged){ |
|
400 | + if ($ged) { |
|
401 | 401 | $gedlines = explode("\n", $ged); |
402 | 402 | $level = 0; |
403 | 403 | $levelsource = -1; |
404 | - $sid_tmp=null; |
|
404 | + $sid_tmp = null; |
|
405 | 405 | $sourcefound = false; |
406 | - foreach($gedlines as $gedline){ |
|
406 | + foreach ($gedlines as $gedline) { |
|
407 | 407 | // Get the level |
408 | 408 | $match = null; |
409 | 409 | if (!$sourcefound && preg_match('~^('.WT_REGEX_INTEGER.') ~', $gedline, $match)) { |
410 | 410 | $level = $match[1]; |
411 | 411 | //If we are not any more within the context of a source, reset |
412 | - if($level <= $levelsource){ |
|
412 | + if ($level <= $levelsource) { |
|
413 | 413 | $levelsource = -1; |
414 | 414 | $sid_tmp = null; |
415 | 415 | } |
@@ -417,11 +417,11 @@ discard block |
||
417 | 417 | $match2 = null; |
418 | 418 | if (preg_match('~^'.$level.' SOUR @('.WT_REGEX_XREF.')@$~', $gedline, $match2)) { |
419 | 419 | $levelsource = $level; |
420 | - $sid_tmp=$match2[1]; |
|
420 | + $sid_tmp = $match2[1]; |
|
421 | 421 | } |
422 | 422 | // If the image has be found, get the source reference and exit. |
423 | 423 | $match3 = null; |
424 | - if($levelsource>=0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)){ |
|
424 | + if ($levelsource >= 0 && $sid_tmp && preg_match('~^'.$level.' _ACT '.preg_quote($this->getFilename()).'~', $gedline, $match3)) { |
|
425 | 425 | $sid = $sid_tmp; |
426 | 426 | $sourcefound = true; |
427 | 427 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } |
430 | 430 | } |
431 | 431 | |
432 | - if($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
432 | + if ($sid) $this->source = Source::getInstance($sid, $this->tree); |
|
433 | 433 | |
434 | 434 | return $this->source; |
435 | 435 | } |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | * {@inhericDoc} |
26 | 26 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
27 | 27 | */ |
28 | - protected function renderContent() { |
|
29 | - ?> |
|
28 | + protected function renderContent() { |
|
29 | + ?> |
|
30 | 30 | <div id="maj-cert-page" class="center"> |
31 | 31 | <h2><?php echo $this->data->get('title'); ?></h2> |
32 | 32 | |
33 | 33 | <?php if($this->data->get('has_certif', false)) { |
34 | - /** @var Certificate $certificate */ |
|
35 | - $certificate = $this->data->get('certificate'); |
|
36 | - $has_linked_indis = $this->data->get('has_linked_indis', false); |
|
37 | - $has_linked_fams = $this->data->get('has_linked_fams', false); |
|
38 | - ?> |
|
34 | + /** @var Certificate $certificate */ |
|
35 | + $certificate = $this->data->get('certificate'); |
|
36 | + $has_linked_indis = $this->data->get('has_linked_indis', false); |
|
37 | + $has_linked_fams = $this->data->get('has_linked_fams', false); |
|
38 | + ?> |
|
39 | 39 | <div id="certificate-details"> |
40 | 40 | <h3> |
41 | 41 | <?php echo $certificate->getCity(); ?> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </div> |
87 | 87 | |
88 | 88 | <?php |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | } |
92 | 92 | |
93 | 93 | \ No newline at end of file |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <div id="maj-cert-page" class="center"> |
31 | 31 | <h2><?php echo $this->data->get('title'); ?></h2> |
32 | 32 | |
33 | - <?php if($this->data->get('has_certif', false)) { |
|
33 | + <?php if ($this->data->get('has_certif', false)) { |
|
34 | 34 | /** @var Certificate $certificate */ |
35 | 35 | $certificate = $this->data->get('certificate'); |
36 | 36 | $has_linked_indis = $this->data->get('has_linked_indis', false); |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | <div id="certificate-edit"> |
50 | 50 | <?php echo $certificate->displayImage(); ?> |
51 | 51 | </div> |
52 | - <?php if($has_linked_indis || $has_linked_fams) { ?> |
|
52 | + <?php if ($has_linked_indis || $has_linked_fams) { ?> |
|
53 | 53 | <ul> |
54 | - <?php if($has_linked_indis) { ?> |
|
54 | + <?php if ($has_linked_indis) { ?> |
|
55 | 55 | <li> |
56 | 56 | <a href="#indi-certificate"> |
57 | 57 | <span id="indisource"><?php echo I18N::translate('Individuals'); ?></span> |
58 | 58 | </a> |
59 | 59 | </li> |
60 | 60 | <?php } ?> |
61 | - <?php if($has_linked_fams) { ?> |
|
61 | + <?php if ($has_linked_fams) { ?> |
|
62 | 62 | <li> |
63 | 63 | <a href="#fam-certificate"> |
64 | 64 | <span id="famsource"><?php echo I18N::translate('Families'); ?></span> |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | <?php } ?> |
68 | 68 | </ul> |
69 | 69 | |
70 | - <?php if($has_linked_indis) { ?> |
|
70 | + <?php if ($has_linked_indis) { ?> |
|
71 | 71 | <div id="indi-certificate"> |
72 | 72 | <?php echo FunctionsPrintLists::individualTable($this->data->get('linked_indis')); ?> |
73 | 73 | </div> |
74 | 74 | <?php } ?> |
75 | 75 | |
76 | - <?php if($has_linked_fams) { ?> |
|
76 | + <?php if ($has_linked_fams) { ?> |
|
77 | 77 | <div id="fam-certificate"> |
78 | 78 | <?php echo FunctionsPrintLists::familyTable($this->data->get('linked_fams')); ?> |
79 | 79 | </div> |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * {@inhericDoc} |
27 | 27 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
28 | 28 | */ |
29 | - protected function renderContent() { |
|
29 | + protected function renderContent() { |
|
30 | 30 | |
31 | - /** @var AbstractModule $module */ |
|
32 | - $module = $this->data->get('module'); |
|
33 | - ?> |
|
31 | + /** @var AbstractModule $module */ |
|
32 | + $module = $this->data->get('module'); |
|
33 | + ?> |
|
34 | 34 | <ol class="breadcrumb small"> |
35 | 35 | <li><a href="admin.php"><?php echo I18N::translate('Control panel'); ?></a></li> |
36 | 36 | <li><a href="admin_modules.php"><?php echo I18N::translate('Module administration'); ?></a></li> |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | </form> |
187 | 187 | |
188 | 188 | <?php |
189 | - } |
|
189 | + } |
|
190 | 190 | |
191 | 191 | } |
192 | 192 | |
193 | 193 | \ No newline at end of file |
@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
29 | 29 | */ |
30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
31 | 31 | $this->place = $place; |
32 | 32 | } |
33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
41 | 41 | */ |
42 | - public static function getIntance($place_str, Tree $tree){ |
|
42 | + public static function getIntance($place_str, Tree $tree) { |
|
43 | 43 | $dplace = null; |
44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
46 | 46 | } |
47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
54 | 54 | */ |
55 | - public function getDerivedPlace(){ |
|
55 | + public function getDerivedPlace() { |
|
56 | 56 | return $this->place; |
57 | 57 | } |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @param bool $anchor Option to print a link to placelist |
66 | 66 | * @return string HTML code for formatted place |
67 | 67 | */ |
68 | - public function htmlFormattedName($format, $anchor = false){ |
|
69 | - $html=''; |
|
68 | + public function htmlFormattedName($format, $anchor = false) { |
|
69 | + $html = ''; |
|
70 | 70 | |
71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
75 | 75 | foreach ($matches[0] as $match2) { |
76 | 76 | $index = str_replace('%', '', $match2); |
77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
79 | 79 | } |
80 | - else{ |
|
81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
80 | + else { |
|
81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
86 | 86 | } else { |
87 | 87 | $html .= $displayPlace; |
88 | 88 | } |
@@ -15,12 +15,12 @@ |
||
15 | 15 | */ |
16 | 16 | interface MvcControllerInterface { |
17 | 17 | |
18 | - /** |
|
19 | - * Return the module attached to this controller. |
|
20 | - * |
|
21 | - * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | - */ |
|
23 | - function getModule(); |
|
18 | + /** |
|
19 | + * Return the module attached to this controller. |
|
20 | + * |
|
21 | + * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | + */ |
|
23 | + function getModule(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | 27 | \ No newline at end of file |
@@ -17,28 +17,28 @@ |
||
17 | 17 | */ |
18 | 18 | class MvcController implements MvcControllerInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * Reference module |
|
22 | - * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | - */ |
|
24 | - protected $module; |
|
20 | + /** |
|
21 | + * Reference module |
|
22 | + * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | + */ |
|
24 | + protected $module; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Constructor for MvcController |
|
28 | - * |
|
29 | - * @param AbstractModule $module |
|
30 | - */ |
|
31 | - public function __construct(AbstractModule $module) { |
|
32 | - $this->module = $module; |
|
33 | - } |
|
26 | + /** |
|
27 | + * Constructor for MvcController |
|
28 | + * |
|
29 | + * @param AbstractModule $module |
|
30 | + */ |
|
31 | + public function __construct(AbstractModule $module) { |
|
32 | + $this->module = $module; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | - */ |
|
39 | - public function getModule() { |
|
40 | - return $this->module; |
|
41 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | + */ |
|
39 | + public function getModule() { |
|
40 | + return $this->module; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | 45 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
22 | 22 | * @param string $request |
23 | 23 | */ |
24 | - public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
24 | + public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
25 | 25 | |
26 | 26 | } |
27 | 27 | |
28 | 28 | \ No newline at end of file |
@@ -17,87 +17,87 @@ |
||
17 | 17 | */ |
18 | 18 | class ViewFactory { |
19 | 19 | |
20 | - /** |
|
21 | - * @var ViewFactory $instance Singleton pattern instance |
|
22 | - */ |
|
23 | - private static $instance = null; |
|
20 | + /** |
|
21 | + * @var ViewFactory $instance Singleton pattern instance |
|
22 | + */ |
|
23 | + private static $instance = null; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Returns the *ViewFactory* instance of this class. |
|
27 | - * |
|
28 | - * @return ViewFactory The *Singleton* instance. |
|
29 | - */ |
|
30 | - public static function getInstance() |
|
31 | - { |
|
32 | - if (null === static::$instance) { |
|
33 | - static::$instance = new static(); |
|
34 | - } |
|
25 | + /** |
|
26 | + * Returns the *ViewFactory* instance of this class. |
|
27 | + * |
|
28 | + * @return ViewFactory The *Singleton* instance. |
|
29 | + */ |
|
30 | + public static function getInstance() |
|
31 | + { |
|
32 | + if (null === static::$instance) { |
|
33 | + static::$instance = new static(); |
|
34 | + } |
|
35 | 35 | |
36 | - return static::$instance; |
|
37 | - } |
|
36 | + return static::$instance; |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Protected constructor |
|
41 | - */ |
|
42 | - protected function __construct() {} |
|
39 | + /** |
|
40 | + * Protected constructor |
|
41 | + */ |
|
42 | + protected function __construct() {} |
|
43 | 43 | |
44 | - /** |
|
45 | - * Return the view specified by the controller and view name, using data from the ViewBag |
|
46 | - * |
|
47 | - * @param string $view_name |
|
48 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
49 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
50 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
51 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
52 | - * @throws \Exception |
|
53 | - */ |
|
54 | - public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
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'); |
|
44 | + /** |
|
45 | + * Return the view specified by the controller and view name, using data from the ViewBag |
|
46 | + * |
|
47 | + * @param string $view_name |
|
48 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
49 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
50 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
51 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
52 | + * @throws \Exception |
|
53 | + */ |
|
54 | + public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
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'); |
|
59 | 59 | |
60 | - $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
60 | + $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
61 | + $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | + if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
63 | 63 | |
64 | - return new $view_class($ctrl, $data); |
|
65 | - } |
|
64 | + return new $view_class($ctrl, $data); |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Static invocation of the makeView method |
|
69 | - * |
|
70 | - * @param string $view_name |
|
71 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
72 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
73 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
74 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
75 | - * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
76 | - */ |
|
77 | - public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
78 | - { |
|
79 | - return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
80 | - } |
|
67 | + /** |
|
68 | + * Static invocation of the makeView method |
|
69 | + * |
|
70 | + * @param string $view_name |
|
71 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
72 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
73 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
74 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
75 | + * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
76 | + */ |
|
77 | + public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
78 | + { |
|
79 | + return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Private clone method to prevent cloning of the instance of the |
|
84 | - * *Dispatcher* instance. |
|
85 | - * |
|
86 | - * @return void |
|
87 | - */ |
|
88 | - private function __clone() |
|
89 | - { |
|
90 | - } |
|
82 | + /** |
|
83 | + * Private clone method to prevent cloning of the instance of the |
|
84 | + * *Dispatcher* instance. |
|
85 | + * |
|
86 | + * @return void |
|
87 | + */ |
|
88 | + private function __clone() |
|
89 | + { |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
94 | - * instance. |
|
95 | - * |
|
96 | - * @return void |
|
97 | - */ |
|
98 | - private function __wakeup() |
|
99 | - { |
|
100 | - } |
|
92 | + /** |
|
93 | + * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
94 | + * instance. |
|
95 | + * |
|
96 | + * @return void |
|
97 | + */ |
|
98 | + private function __wakeup() |
|
99 | + { |
|
100 | + } |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | 104 | \ No newline at end of file |
@@ -53,13 +53,13 @@ |
||
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) 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'); |
|
59 | 59 | |
60 | 60 | $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
61 | + $view_class = $mvc_ctrl_refl->getNamespaceName().'\\Views\\'.$view_name.'View'; |
|
62 | + if (!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
63 | 63 | |
64 | 64 | return new $view_class($ctrl, $data); |
65 | 65 | } |
@@ -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 | } |