@@ -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 | echo "$level$message$url" . PHP_EOL; |
| 321 | 321 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | 'ContainedInID' => $failure['ContainedInID'] |
| 346 | 346 | )); |
| 347 | 347 | |
| 348 | - if ($failureExists->count() >0) { |
|
| 348 | + if ($failureExists->count() > 0) { |
|
| 349 | 349 | continue; |
| 350 | 350 | } |
| 351 | 351 | |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | public function linkIsThirdParty($link) |
| 422 | 422 | { |
| 423 | 423 | $link = trim($link); |
| 424 | - return (bool)preg_match("#^http(s)?://#", $link); |
|
| 424 | + return (bool) preg_match("#^http(s)?://#", $link); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | /** |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $nonHTTPSchemes = implode('|', self::$non_http_uri_schemes); |
| 436 | 436 | $badScheme = preg_match("#^($nonHTTPSchemes):#", $link); |
| 437 | 437 | $alreadyImported = $this->linkIsAlreadyRewritten($link); |
| 438 | - return (bool)($badScheme || $alreadyImported); |
|
| 438 | + return (bool) ($badScheme || $alreadyImported); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | /** |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | public function linkIsNotImported($link) |
| 448 | 448 | { |
| 449 | - return (bool)(stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 449 | + return (bool) (stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function linkIsAlreadyRewritten($link) |
| 459 | 459 | { |
| 460 | - return (bool)(stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 460 | + return (bool) (stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | /** |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | */ |
| 469 | 469 | public function linkIsJunk($link) |
| 470 | 470 | { |
| 471 | - return (bool)preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 471 | + return (bool) preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
@@ -591,13 +591,13 @@ discard block |
||
| 591 | 591 | |
| 592 | 592 | // List the content sources to prompt user for selection |
| 593 | 593 | if ($contentSources = StaticSiteContentSource::get()) { |
| 594 | - $this->printMessage($newLine.'Available content-sources:'.$newLine); |
|
| 594 | + $this->printMessage($newLine . 'Available content-sources:' . $newLine); |
|
| 595 | 595 | foreach ($contentSources as $i => $contentSource) { |
| 596 | 596 | $this->printMessage("\tdev/tasks/" . __CLASS__ . ' SourceID=' . $contentSource->ID . ' ImportID=<number>'); |
| 597 | 597 | } |
| 598 | 598 | echo $newLine; |
| 599 | 599 | if (Director::is_cli()) { |
| 600 | - $this->printMessage('Available command line options: '.$newLine); |
|
| 600 | + $this->printMessage('Available command line options: ' . $newLine); |
|
| 601 | 601 | $this->printMessage("\tSourceID=<number> \t\tThe ID of the original crawl."); |
| 602 | 602 | $this->printMessage("\tImportID=<number> \t\tThe ID of the import to use."); |
| 603 | 603 | $this->printMessage("\tSHOW=pages \tPrint the contents of the pages map."); |