@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | if (!trim($excludeSelector)) { |
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | - $element = $this->phpQuery[$parentSelector.' '.$excludeSelector]; |
|
| 219 | + $element = $this->phpQuery[$parentSelector . ' ' . $excludeSelector]; |
|
| 220 | 220 | if ($element) { |
| 221 | 221 | $remove = $element->htmlOuter(); |
| 222 | 222 | $content = str_replace($remove, '', $content); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | // Run request |
| 331 | 331 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
| 332 | 332 | // See: http://forums.devshed.com/php-development-5/curlopt-timeout-option-for-curl-calls-isn-t-being-obeyed-605642.html |
| 333 | - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // No. seconds to wait while trying to connect. |
|
| 333 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); // No. seconds to wait while trying to connect. |
|
| 334 | 334 | |
| 335 | 335 | // Deal to files, write to them directly and then return |
| 336 | 336 | if ($this->mimeProcessor->isOfFileOrImage($this->mime)) { |
@@ -175,8 +175,8 @@ discard block |
||
| 175 | 175 | $mimeCategories = File::config()->get('app_categories'); |
| 176 | 176 | list($ext, $mime) = [strtolower($ext), strtolower($mime)]; |
| 177 | 177 | |
| 178 | - $notAuthoratative = !isset($httpMimeTypes[$ext]); // We've found ourselves a weird extension |
|
| 179 | - $notMatch = (!$notAuthoratative && $httpMimeTypes[$ext] !== $mime); // No match found for passed extension in our ext=>mime mapping from config |
|
| 178 | + $notAuthoratative = !isset($httpMimeTypes[$ext]); // We've found ourselves a weird extension |
|
| 179 | + $notMatch = (!$notAuthoratative && $httpMimeTypes[$ext] !== $mime); // No match found for passed extension in our ext=>mime mapping from config |
|
| 180 | 180 | |
| 181 | 181 | if ($notAuthoratative || $notMatch) { |
| 182 | 182 | if (!$fix) { |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | $coreExts = array_merge($mimeCategories['document'], $mimeCategories['image']); |
| 188 | 188 | foreach ($coreExts as $coreExt) { |
| 189 | 189 | // Make sure we check the correct category so we don't find a match for ms-excel in the image \File category (.cel) !! |
| 190 | - $isFile = in_array($coreExt, $mimeCategories['document']) && singleton(__CLASS__)->isOfFile($mime); // dirty |
|
| 191 | - $isImge = in_array($coreExt, $mimeCategories['image']) && singleton(__CLASS__)->isOfImage($mime); // more dirt |
|
| 190 | + $isFile = in_array($coreExt, $mimeCategories['document']) && singleton(__CLASS__)->isOfFile($mime); // dirty |
|
| 191 | + $isImge = in_array($coreExt, $mimeCategories['image']) && singleton(__CLASS__)->isOfImage($mime); // more dirt |
|
| 192 | 192 | |
| 193 | 193 | if (($isFile || $isImge) && stristr($mime, $coreExt) !== false) { |
| 194 | 194 | // "Manually" force "jpg" as the file-suffix to be returned |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | if ($logFile && is_writable($logFile) || !file_exists($logFile) && is_writable(dirname($logFile))) { |
| 32 | 32 | $message = $message . ($filename ? ' ' . $filename : '') . ($mime ? ' (' . $mime . ')' : ''); |
| 33 | - error_log($message. PHP_EOL, 3, $logFile); |
|
| 33 | + error_log($message . PHP_EOL, 3, $logFile); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | if ($set && is_bool($set) && $set !== false) { |
| 48 | 48 | $proxyOpts = StaticSiteContentExtractor::config()->get('curl_opts_proxy'); |
| 49 | 49 | |
| 50 | - if (!$proxyOpts || !is_array($proxyOpts) || !count($proxyOpts)>0) { |
|
| 50 | + if (!$proxyOpts || !is_array($proxyOpts) || !count($proxyOpts) > 0) { |
|
| 51 | 51 | return []; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -100,11 +100,11 @@ |
||
| 100 | 100 | $relatedFailedRewriteObjects = DataObject::get(FailedURLRewriteObject::class)->filter('ImportID', $this->ID); |
| 101 | 101 | $relatedFailedRewriteSummaries = DataObject::get(FailedURLRewriteSummary::class)->filter('ImportID', $this->ID); |
| 102 | 102 | |
| 103 | - $relatedFailedRewriteObjects->each(function ($item) { |
|
| 103 | + $relatedFailedRewriteObjects->each(function($item) { |
|
| 104 | 104 | $item->delete(); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | - $relatedFailedRewriteSummaries->each(function ($item) { |
|
| 107 | + $relatedFailedRewriteSummaries->each(function($item) { |
|
| 108 | 108 | $item->delete(); |
| 109 | 109 | }); |
| 110 | 110 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | "Order" => DBInt::class, |
| 45 | 45 | "AppliesTo" => DBVarchar::class, |
| 46 | 46 | "MimeTypes" => DBText::class, |
| 47 | - "Notes" => DBText::class, // Purely informational. Not used in imports. |
|
| 47 | + "Notes" => DBText::class, // Purely informational. Not used in imports. |
|
| 48 | 48 | ]; |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function getTitle(): string |
| 98 | 98 | { |
| 99 | - return $this->DataType . ' (' .$this->AppliesTo . ')'; |
|
| 99 | + return $this->DataType . ' (' . $this->AppliesTo . ')'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | return [ |
| 123 | 123 | 'Title' => [ |
| 124 | 124 | 'title' => 'Imported page', |
| 125 | - 'formatting' => function ($value, $item) { |
|
| 125 | + 'formatting' => function($value, $item) { |
|
| 126 | 126 | return sprintf( |
| 127 | 127 | '<a href="admin/pages/edit/show/%s">%s</a>', |
| 128 | 128 | $item->ContainedInID, |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($imports) { |
| 84 | - $imports->each(function ($item) { |
|
| 84 | + $imports->each(function($item) { |
|
| 85 | 85 | $item->delete(); |
| 86 | 86 | }); |
| 87 | 87 | $messageType = 'good'; |
@@ -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 | } |
@@ -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"); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | $url = ($url ? '(' . $url . ') ' : ''); |
| 316 | - $level = ($level ? '[' . $level .'] ' : ''); |
|
| 316 | + $level = ($level ? '[' . $level . '] ' : ''); |
|
| 317 | 317 | if (Director::is_cli()) { |
| 318 | 318 | echo "$level$message$url" . PHP_EOL; |
| 319 | 319 | } else { |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | 'ContainedInID' => $failure['ContainedInID'] |
| 347 | 347 | )); |
| 348 | 348 | |
| 349 | - if ($failureExists->count() >0) { |
|
| 349 | + if ($failureExists->count() > 0) { |
|
| 350 | 350 | continue; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public function linkIsThirdParty($link) |
| 423 | 423 | { |
| 424 | 424 | $link = trim($link); |
| 425 | - return (bool)preg_match("#^http(s)?://#", $link); |
|
| 425 | + return (bool) preg_match("#^http(s)?://#", $link); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | $nonHTTPSchemes = implode('|', self::$non_http_uri_schemes); |
| 437 | 437 | $badScheme = preg_match("#^($nonHTTPSchemes):#", $link); |
| 438 | 438 | $alreadyImported = $this->linkIsAlreadyRewritten($link); |
| 439 | - return (bool)($badScheme || $alreadyImported); |
|
| 439 | + return (bool) ($badScheme || $alreadyImported); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | public function linkIsNotImported($link) |
| 449 | 449 | { |
| 450 | - return (bool)(stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 450 | + return (bool) (stristr($link, 'sitetree') === false && stristr($link, 'assets') === false); |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | */ |
| 459 | 459 | public function linkIsAlreadyRewritten($link) |
| 460 | 460 | { |
| 461 | - return (bool)(stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 461 | + return (bool) (stristr($link, 'sitetree') !== false || stristr($link, 'assets') !== false); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | */ |
| 470 | 470 | public function linkIsJunk($link) |
| 471 | 471 | { |
| 472 | - return (bool)preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 472 | + return (bool) preg_match("#^[^\[\/a-zA-Z\d].+#", $link); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
@@ -592,13 +592,13 @@ discard block |
||
| 592 | 592 | |
| 593 | 593 | // List the content sources to prompt user for selection |
| 594 | 594 | if ($contentSources = StaticSiteContentSource::get()) { |
| 595 | - $this->printMessage($newLine.'Available content-sources:'.$newLine); |
|
| 595 | + $this->printMessage($newLine . 'Available content-sources:' . $newLine); |
|
| 596 | 596 | foreach ($contentSources as $i => $contentSource) { |
| 597 | 597 | $this->printMessage("\tdev/tasks/" . __CLASS__ . ' SourceID=' . $contentSource->ID . ' ImportID=<number>'); |
| 598 | 598 | } |
| 599 | 599 | echo $newLine; |
| 600 | 600 | if (Director::is_cli()) { |
| 601 | - $this->printMessage('Available command line options: '.$newLine); |
|
| 601 | + $this->printMessage('Available command line options: ' . $newLine); |
|
| 602 | 602 | $this->printMessage("\tSourceID=<number> \t\tThe ID of the original crawl."); |
| 603 | 603 | $this->printMessage("\tImportID=<number> \t\tThe ID of the import to use."); |
| 604 | 604 | $this->printMessage("\tSHOW=pages \tPrint the contents of the pages map."); |