@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -217,7 +217,7 @@ |
||
217 | 217 | $crawlButtonText = _t('StaticSiteContentSource.RECRAWL_SITE', 'Re-Crawl'); |
218 | 218 | break; |
219 | 219 | default: |
220 | - throw new \LogicException("Invalid getSpiderStatus() value '".$this->urlList()->getSpiderStatus().";"); |
|
220 | + throw new \LogicException("Invalid getSpiderStatus() value '" . $this->urlList()->getSpiderStatus() . ";"); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | $crawlButton = FormAction::create('crawlsite', $crawlButtonText) |
@@ -373,7 +373,7 @@ |
||
373 | 373 | foreach ($this->urls['regular'] as $url => $urlData) { |
374 | 374 | // TODO Log this in exodus.log |
375 | 375 | if (empty($urlData['url'])) { |
376 | - // echo $urlData['mime'] . "\n"; |
|
376 | + // echo $urlData['mime'] . "\n"; |
|
377 | 377 | continue; |
378 | 378 | } |
379 | 379 |
@@ -624,12 +624,11 @@ discard block |
||
624 | 624 | */ |
625 | 625 | $sng = singleton(StaticSiteMimeProcessor::class); |
626 | 626 | $mime = $sng->IsOfHtml($processedURLData['mime']) ? |
627 | - $processedURLData['mime'] : |
|
628 | - self::$undefined_mime_type; |
|
627 | + $processedURLData['mime'] : self::$undefined_mime_type; |
|
629 | 628 | $processedURL = $processedURLData['url']; |
630 | 629 | } |
631 | 630 | |
632 | - $default = function ($fragment) use ($mime) { |
|
631 | + $default = function($fragment) use ($mime) { |
|
633 | 632 | return [ |
634 | 633 | 'url' => $fragment, |
635 | 634 | 'mime' => $mime, |
@@ -699,7 +698,7 @@ discard block |
||
699 | 698 | } |
700 | 699 | |
701 | 700 | return $this->urls['regular'][$url]; |
702 | - } elseif(isset($this->urls['inferred'][$url])) { |
|
701 | + } elseif (isset($this->urls['inferred'][$url])) { |
|
703 | 702 | return $this->urls['inferred'][$url]; |
704 | 703 | } |
705 | 704 |
@@ -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."); |