@@ -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."); |
@@ -7,4 +7,4 @@ |
||
7 | 7 | // - loading javascript from the updateLinkForm call yields a blank form |
8 | 8 | //Object::add_extension('HtmlEditorField_Toolbar', 'ExternalContentHtmlEditorExtension'); |
9 | 9 | |
10 | -set_include_path(dirname(__FILE__).'/thirdparty'.PATH_SEPARATOR.get_include_path()); |
|
10 | +set_include_path(dirname(__FILE__) . '/thirdparty' . PATH_SEPARATOR . get_include_path()); |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * |
80 | 80 | * @return DataObject |
81 | 81 | */ |
82 | - public function ContentItem($what='k') |
|
82 | + public function ContentItem($what = 'k') |
|
83 | 83 | { |
84 | 84 | if ($this->requestedItem) { |
85 | 85 | return $this->requestedItem; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public const MIN_REPEAT = 300; |
16 | 16 | |
17 | - public function __construct($repeat = null, $contentItem = null, $target = null, $includeParent = false, $includeChildren = true, $targetType = null, $duplicateStrategy='Overwrite', $params = array()) |
|
17 | + public function __construct($repeat = null, $contentItem = null, $target = null, $includeParent = false, $includeChildren = true, $targetType = null, $duplicateStrategy = 'Overwrite', $params = array()) |
|
18 | 18 | { |
19 | 19 | if ($contentItem) { |
20 | 20 | $this->sourceObjectID = $contentItem->ID; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $return[] = $this->recursiveQuote($v); |
67 | 67 | } |
68 | 68 | |
69 | - return '('.implode(',', $return).')'; |
|
69 | + return '(' . implode(',', $return) . ')'; |
|
70 | 70 | } elseif (is_null($val)) { |
71 | 71 | $val = 'NULL'; |
72 | 72 | } elseif (is_int($val)) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return $val; |
83 | 83 | } |
84 | 84 | |
85 | - public function log($message, $level=null) |
|
85 | + public function log($message, $level = null) |
|
86 | 86 | { |
87 | 87 | if (!$level) { |
88 | 88 | $level = Logger::NOTICE; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return ExternalContentImporter |
157 | 157 | */ |
158 | - public function getContentImporter($target=null) |
|
158 | + public function getContentImporter($target = null) |
|
159 | 159 | { |
160 | 160 | return null; |
161 | 161 | } |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function canImport() |
226 | 226 | { |
227 | - $importer = $this->getContentImporter(); |
|
227 | + $importer = $this->getContentImporter(); |
|
228 | 228 | return $importer != null; |
229 | 229 | } |
230 | 230 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | { |
282 | 282 | return str_replace( |
283 | 283 | array('=', '/', '+'), |
284 | - array('-', '~' ,','), |
|
284 | + array('-', '~', ','), |
|
285 | 285 | base64_encode($id) |
286 | 286 | ); |
287 | 287 | } |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function decodeId($id) |
298 | 298 | { |
299 | - $id= str_replace( |
|
300 | - array('-', '~' ,','), |
|
299 | + $id = str_replace( |
|
300 | + array('-', '~', ','), |
|
301 | 301 | array('=', '/', '+'), |
302 | 302 | $id |
303 | 303 | ); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | { |
342 | 342 | $treeTitle = sprintf( |
343 | 343 | "<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>", |
344 | - Convert::raw2xml(str_replace(array("\n","\r"), "", $this->Name)) |
|
344 | + Convert::raw2xml(str_replace(array("\n", "\r"), "", $this->Name)) |
|
345 | 345 | ); |
346 | 346 | |
347 | 347 | return $treeTitle; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * some systems loading up entire representations when you make |
85 | 85 | * a call to 'getChildren', for example. |
86 | 86 | */ |
87 | - public function __construct($source=null, $id=null) |
|
87 | + public function __construct($source = null, $id = null) |
|
88 | 88 | { |
89 | 89 | parent::__construct(); |
90 | 90 | if ($source) { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return ExternalContentImporter |
203 | 203 | */ |
204 | - public function getContentImporter($target=null) |
|
204 | + public function getContentImporter($target = null) |
|
205 | 205 | { |
206 | 206 | return $this->source->getContentImporter($target); |
207 | 207 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | $fields->addFieldToTab('Root.Main', $field); |
317 | 317 | } |
318 | 318 | } else { |
319 | - $childValue = is_object($childValue) || is_array($childValue) ? json_encode($childValue) : (string) $childValue; |
|
319 | + $childValue = is_object($childValue) || is_array($childValue) ? json_encode($childValue) : (string) $childValue; |
|
320 | 320 | $field = ReadonlyField::create("{$childName}{$childValue}", $name . ':' . $childName, $childValue); |
321 | 321 | $fields->addFieldToTab('Root.Main', $field); |
322 | 322 | } |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | $treeTitle = sprintf( |
542 | 542 | "<span class=\"jstree-pageicon\"></span><span class=\"item\">%s</span>", |
543 | - Convert::raw2xml(str_replace(array("\n","\r"), "", $title)) |
|
543 | + Convert::raw2xml(str_replace(array("\n", "\r"), "", $title)) |
|
544 | 544 | ); |
545 | 545 | return $treeTitle; |
546 | 546 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->controller, |
53 | 53 | "{$this->name}/LinkForm", |
54 | 54 | FieldList::create( |
55 | - LiteralField::create('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close').'" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.LINK', 'Link') . '</h2>'), |
|
55 | + LiteralField::create('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close') . '" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.LINK', 'Link') . '</h2>'), |
|
56 | 56 | OptionsetField::create( |
57 | 57 | 'LinkType', |
58 | 58 | _t('HtmlEditorField.LINKTO', 'Link to'), |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $this->controller, |
164 | 164 | "{$this->name}/FlashForm", |
165 | 165 | FieldList::create( |
166 | - LiteralField::create('Heading', '<h2><img src="cms/images/closeicon.gif" alt="'._t('HtmlEditorField.CLOSE', 'close').'" title="'._t('HtmlEditorField.CLOSE', 'close').'" />'._t('HtmlEditorField.FLASH', 'Flash').'</h2>'), |
|
166 | + LiteralField::create('Heading', '<h2><img src="cms/images/closeicon.gif" alt="' . _t('HtmlEditorField.CLOSE', 'close') . '" title="' . _t('HtmlEditorField.CLOSE', 'close') . '" />' . _t('HtmlEditorField.FLASH', 'Flash') . '</h2>'), |
|
167 | 167 | TreeDropdownField::create("FolderID", _t('HtmlEditorField.FOLDER'), Folder::class), |
168 | 168 | TextField::create('getflashSearch', _t('HtmlEditorField.SEARCHFILENAME', 'Search by file name')), |
169 | 169 | ThumbnailStripField::create("Flash", "FolderID", "getflash"), |