@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | $task = $this; |
172 | 172 | // Callback for URL rewriter, called from StaticSiteLinkRewriter and passed through $callback($url) |
173 | - $rewriter = StaticSiteLinkRewriter::create(function ($url) use ($pageLookup, $fileLookup, $task) { |
|
173 | + $rewriter = StaticSiteLinkRewriter::create(function($url) use ($pageLookup, $fileLookup, $task) { |
|
174 | 174 | $origUrl = $url; |
175 | 175 | $anchor = ''; |
176 | 176 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ($siteTreeObject = $pageLookup->find('StaticSiteURL', $pageMapKey)) { |
209 | 209 | $output = '[sitetree_link,id=' . $siteTreeObject->ID . ']'; |
210 | 210 | $task->printMessage("\tFound: SiteTree ID#" . $siteTreeObject->ID, null, $output); |
211 | - $anchorPattern = "<[\w]+\s+(name|id)=('|\")?". $anchor ."('|\")?"; |
|
211 | + $anchorPattern = "<[\w]+\s+(name|id)=('|\")?" . $anchor . "('|\")?"; |
|
212 | 212 | |
213 | 213 | if (strlen($anchor) && preg_match("#$anchorPattern#mi", $siteTreeObject->Content)) { |
214 | 214 | $output = "#$anchor"; |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $this->printMessage("Amended $changedFields content fields for {$pages->count()} pages and {$files->count()} files processed."); |
290 | 290 | |
291 | 291 | $msgNextSteps = " - Not all links will get fixed. It's recommended to also run a 3rd party link-checker over your imported content."; |
292 | - $msgSeeReport = " - Check the CMS \"".singleton(FailedURLRewriteReport::class)->title()."\" report for a summary of failed link-rewrites."; |
|
292 | + $msgSeeReport = " - Check the CMS \"" . singleton(FailedURLRewriteReport::class)->title() . "\" report for a summary of failed link-rewrites."; |
|
293 | 293 | |
294 | 294 | $this->printMessage("Tips:"); |
295 | 295 | $this->printMessage("{$newLine}$msgNextSteps"); |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | $url = ($url ? '(' . $url . ') ' : ''); |
318 | - $level = ($level ? '[' . $level .'] ' : ''); |
|
318 | + $level = ($level ? '[' . $level . '] ' : ''); |
|
319 | 319 | |
320 | 320 | if (Director::is_cli()) { |
321 | 321 | echo "$level$message$url" . PHP_EOL; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | 'ContainedInID' => $failure['ContainedInID'] |
350 | 350 | )); |
351 | 351 | |
352 | - if ($failureExists->count() >0) { |
|
352 | + if ($failureExists->count() > 0) { |
|
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | public function linkIsThirdParty($link) |
426 | 426 | { |
427 | 427 | $link = trim($link); |
428 | - return (bool)preg_match("#^http(s)?://#", $link); |
|
428 | + return (bool) preg_match("#^http(s)?://#", $link); |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | /** |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $nonHTTPSchemes = implode('|', self::$non_http_uri_schemes); |
440 | 440 | $badScheme = preg_match("#^($nonHTTPSchemes):#", $link); |
441 | 441 | $alreadyImported = $this->linkIsAlreadyRewritten($link); |
442 | - return (bool)($badScheme || $alreadyImported); |
|
442 | + return (bool) ($badScheme || $alreadyImported); |
|
443 | 443 | } |
444 | 444 | |
445 | 445 | /** |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | */ |
451 | 451 | public function linkIsNotImported($link) |
452 | 452 | { |
453 | - return (bool)(stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
453 | + return (bool) (stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | /** |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | */ |
462 | 462 | public function linkIsAlreadyRewritten($link) |
463 | 463 | { |
464 | - return (bool)(stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
464 | + return (bool) (stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | */ |
473 | 473 | public function linkIsJunk($link) |
474 | 474 | { |
475 | - return (bool)preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
475 | + return (bool) preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | |
596 | 596 | // List the content sources to prompt user for selection |
597 | 597 | if ($contentSources = StaticSiteContentSource::get()) { |
598 | - $this->printMessage($newLine.'Available content-sources:'.$newLine); |
|
598 | + $this->printMessage($newLine . 'Available content-sources:' . $newLine); |
|
599 | 599 | foreach ($contentSources as $i => $contentSource) { |
600 | 600 | $this->printMessage("\tdev/tasks/" . __CLASS__ . ' SourceID=' . $contentSource->ID . ' ImportID=<number>'); |
601 | 601 | } |
602 | 602 | echo $newLine; |
603 | 603 | if (Director::is_cli()) { |
604 | - $this->printMessage('Available command line options: '.$newLine); |
|
604 | + $this->printMessage('Available command line options: ' . $newLine); |
|
605 | 605 | $this->printMessage("\tSourceID=<number> \t\tThe ID of the original crawl."); |
606 | 606 | $this->printMessage("\tImportID=<number> \t\tThe ID of the import to use."); |
607 | 607 | $this->printMessage("\tSHOW=pages \tPrint the contents of the pages map."); |