@@ -60,7 +60,7 @@ |
||
| 60 | 60 | { |
| 61 | 61 | parent::onAfterDelete(); |
| 62 | 62 | if ($failedRewriteObjects = DataObject::get(FailedURLRewriteObject::class)->filter('ContainedInID', $this->owner->ID)) { |
| 63 | - $failedRewriteObjects->each(function ($item) { |
|
| 63 | + $failedRewriteObjects->each(function($item) { |
|
| 64 | 64 | $item->delete(); |
| 65 | 65 | }); |
| 66 | 66 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | $task = $this; |
| 177 | 177 | // Callback for URL rewriter, called from StaticSiteLinkRewriter and passed through $callback($url) |
| 178 | - $rewriter = StaticSiteLinkRewriter::create(function ($url) use ($pageLookup, $fileLookup, $task) { |
|
| 178 | + $rewriter = StaticSiteLinkRewriter::create(function($url) use ($pageLookup, $fileLookup, $task) { |
|
| 179 | 179 | $origUrl = $url; |
| 180 | 180 | $anchor = ''; |
| 181 | 181 | if (strpos($url, '#') !== false) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | if ($siteTreeObject = $pageLookup->find('StaticSiteURL', $pageMapKey)) { |
| 213 | 213 | $output = '[sitetree_link,id=' . $siteTreeObject->ID . ']'; |
| 214 | 214 | $task->printMessage("\tFound: SiteTree ID#" . $siteTreeObject->ID, null, $output); |
| 215 | - $anchorPattern = "<[\w]+\s+(name|id)=('|\")?". $anchor ."('|\")?"; |
|
| 215 | + $anchorPattern = "<[\w]+\s+(name|id)=('|\")?" . $anchor . "('|\")?"; |
|
| 216 | 216 | if (strlen($anchor) && preg_match("#$anchorPattern#mi", $siteTreeObject->Content)) { |
| 217 | 217 | $output = "#$anchor"; |
| 218 | 218 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $this->printMessage("Amended $changedFields content fields for {$pages->count()} pages and {$files->count()} files processed."); |
| 286 | 286 | |
| 287 | 287 | $msgNextSteps = " - Not all links will get fixed. It's recommended to also run a 3rd party link-checker over your imported content."; |
| 288 | - $msgSeeReport = " - Check the CMS \"".singleton(FailedURLRewriteReport::class)->title()."\" report for a summary of failed link-rewrites."; |
|
| 288 | + $msgSeeReport = " - Check the CMS \"" . singleton(FailedURLRewriteReport::class)->title() . "\" report for a summary of failed link-rewrites."; |
|
| 289 | 289 | |
| 290 | 290 | $this->printMessage("Tips:"); |
| 291 | 291 | $this->printMessage("{$newLine}$msgNextSteps"); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | return; |
| 310 | 310 | } |
| 311 | 311 | $url = ($url ? '(' . $url . ') ' : ''); |
| 312 | - $level = ($level ? '[' . $level .'] ' : ''); |
|
| 312 | + $level = ($level ? '[' . $level . '] ' : ''); |
|
| 313 | 313 | if (Director::is_cli()) { |
| 314 | 314 | echo "$level$message$url" . PHP_EOL; |
| 315 | 315 | } else { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | 'ContainedInID' => $failure['ContainedInID'] |
| 343 | 343 | )); |
| 344 | 344 | |
| 345 | - if ($failureExists->count() >0) { |
|
| 345 | + if ($failureExists->count() > 0) { |
|
| 346 | 346 | continue; |
| 347 | 347 | } |
| 348 | 348 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | public function linkIsThirdParty($link) |
| 419 | 419 | { |
| 420 | 420 | $link = trim($link); |
| 421 | - return (bool)preg_match("#^http(s)?://#", $link); |
|
| 421 | + return (bool) preg_match("#^http(s)?://#", $link); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | /** |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | $nonHTTPSchemes = implode('|', self::$non_http_uri_schemes); |
| 433 | 433 | $badScheme = preg_match("#^($nonHTTPSchemes):#", $link); |
| 434 | 434 | $alreadyImported = $this->linkIsAlreadyRewritten($link); |
| 435 | - return (bool)($badScheme || $alreadyImported); |
|
| 435 | + return (bool) ($badScheme || $alreadyImported); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | */ |
| 444 | 444 | public function linkIsNotImported($link) |
| 445 | 445 | { |
| 446 | - return (bool)(stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 446 | + return (bool) (stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | */ |
| 455 | 455 | public function linkIsAlreadyRewritten($link) |
| 456 | 456 | { |
| 457 | - return (bool)(stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 457 | + return (bool) (stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function linkIsJunk($link) |
| 467 | 467 | { |
| 468 | - return (bool)preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 468 | + return (bool) preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** |
@@ -588,13 +588,13 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | // List the content sources to prompt user for selection |
| 590 | 590 | if ($contentSources = StaticSiteContentSource::get()) { |
| 591 | - $this->printMessage($newLine.'Available content-sources:'.$newLine); |
|
| 591 | + $this->printMessage($newLine . 'Available content-sources:' . $newLine); |
|
| 592 | 592 | foreach ($contentSources as $i => $contentSource) { |
| 593 | 593 | $this->printMessage("\tdev/tasks/" . __CLASS__ . ' SourceID=' . $contentSource->ID . ' ImportID=<number>'); |
| 594 | 594 | } |
| 595 | 595 | echo $newLine; |
| 596 | 596 | if (Director::is_cli()) { |
| 597 | - $this->printMessage('Available command line options: '.$newLine); |
|
| 597 | + $this->printMessage('Available command line options: ' . $newLine); |
|
| 598 | 598 | $this->printMessage("\tSourceID=<number> \t\tThe ID of the original crawl."); |
| 599 | 599 | $this->printMessage("\tImportID=<number> \t\tThe ID of the import to use."); |
| 600 | 600 | $this->printMessage("\tSHOW=pages \tPrint the contents of the pages map."); |