@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | public function setQuickSearchType(string $nameOrType): SearchApi |
| 114 | 114 | { |
| 115 | - if($nameOrType === 'all') { |
|
| 115 | + if ($nameOrType === 'all') { |
|
| 116 | 116 | $this->isQuickSearch = false; |
| 117 | 117 | $this->quickSearchType = ''; |
| 118 | - } elseif($nameOrType === 'limited') { |
|
| 118 | + } elseif ($nameOrType === 'limited') { |
|
| 119 | 119 | $this->isQuickSearch = true; |
| 120 | 120 | $this->quickSearchType = ''; |
| 121 | - } elseif(class_exists($nameOrType)) { |
|
| 121 | + } elseif (class_exists($nameOrType)) { |
|
| 122 | 122 | $this->quickSearchType = $nameOrType; |
| 123 | 123 | $object = Injector::inst()->get($nameOrType); |
| 124 | 124 | $this->setIncludedClasses($object->getClassesToSearch()); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | public function setBaseClass(string $class): SearchApi |
| 151 | 151 | { |
| 152 | - if(class_exists($class)) { |
|
| 152 | + if (class_exists($class)) { |
|
| 153 | 153 | $this->baseClass = $class; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | { |
| 253 | 253 | $this->initCache(); |
| 254 | 254 | $count = 0; |
| 255 | - if($word) { |
|
| 255 | + if ($word) { |
|
| 256 | 256 | $this->buildCache($word); |
| 257 | 257 | $replace = $this->securityCheckInput($replace); |
| 258 | 258 | foreach ($this->objects as $item) { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | if ($item->canEdit()) { |
| 261 | 261 | $fields = $this->getAllValidFields($className); |
| 262 | 262 | foreach ($fields as $field) { |
| 263 | - if(!$this->includeFieldTest($className, $field)) { |
|
| 263 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 264 | 264 | continue; |
| 265 | 265 | } |
| 266 | 266 | $new = str_replace($word, $replace, $item->{$field}); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $this->workOutInclusionsAndExclusions(); |
| 326 | 326 | |
| 327 | 327 | // important to do this first |
| 328 | - if($word) { |
|
| 328 | + if ($word) { |
|
| 329 | 329 | $this->setWordsAsString($word); |
| 330 | 330 | } |
| 331 | 331 | $this->workOutWordsForSearching(); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | if (count($this->words)) { |
| 339 | 339 | foreach ($this->getAllDataObjects() as $className) { |
| 340 | 340 | |
| 341 | - if(!$this->includeClassTest($className)) { |
|
| 341 | + if (!$this->includeClassTest($className)) { |
|
| 342 | 342 | continue; |
| 343 | 343 | } |
| 344 | 344 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $fields = $this->getAllValidFields($className); |
| 347 | 347 | $filterAny = []; |
| 348 | 348 | foreach ($fields as $field) { |
| 349 | - if(!$this->includeFieldTest($className, $field)) { |
|
| 349 | + if (!$this->includeFieldTest($className, $field)) { |
|
| 350 | 350 | continue; |
| 351 | 351 | } |
| 352 | 352 | $filterAny[$field . ':PartialMatch'] = $this->words; |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | DB::alteration_message(' ... Filter: ' . implode(', ', array_keys($filterAny))); |
| 361 | 361 | } |
| 362 | 362 | $defaultList = $this->getDefaultList($className); |
| 363 | - if(empty($defaultList)) { |
|
| 363 | + if (empty($defaultList)) { |
|
| 364 | 364 | $array[$className] = $className::get(); |
| 365 | 365 | } |
| 366 | 366 | $array[$className] = $array[$className]->filter(['ClassName' => $className]); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $array = []; |
| 404 | 404 | $classNames = $this->getAllDataObjects(); |
| 405 | 405 | foreach ($classNames as $className) { |
| 406 | - if($this->includeClassTest($className)) { |
|
| 406 | + if ($this->includeClassTest($className)) { |
|
| 407 | 407 | $array[$className] = $className::get() |
| 408 | 408 | ->filter('LastEdited:GreaterThan', date('Y-m-d H:i:s', $threshold)) |
| 409 | 409 | ->sort(['LastEdited' => 'DESC']) |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | ->limit($limit) |
| 451 | 451 | ; |
| 452 | 452 | foreach ($items as $item) { |
| 453 | - if(isset($fullListCheck[$item->ClassName][$item->ID])) { |
|
| 453 | + if (isset($fullListCheck[$item->ClassName][$item->ID])) { |
|
| 454 | 454 | continue; |
| 455 | 455 | } |
| 456 | 456 | if ($item->canView()) { |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | $items = $this->turnArrayIntoObjects($matches); |
| 485 | 485 | foreach ($items as $item) { |
| 486 | 486 | $link = $finder->getLink($item, $this->excludedClasses); |
| 487 | - if($item->canView()) { |
|
| 487 | + if ($item->canView()) { |
|
| 488 | 488 | $cmsEditLink = $item->canEdit() ? $finder->getCMSEditLink($item) : ''; |
| 489 | 489 | $list->push( |
| 490 | 490 | ArrayData::create( |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | $finder->saveCache(); |
| 508 | 508 | |
| 509 | - if(!empty($this->sortOverride)) { |
|
| 509 | + if (!empty($this->sortOverride)) { |
|
| 510 | 510 | return $list->sort($this->sortOverride); |
| 511 | 511 | } else { |
| 512 | 512 | return $list->sort(['SiteWideSearchSortValue' => 'ASC']); |
@@ -659,13 +659,13 @@ discard block |
||
| 659 | 659 | |
| 660 | 660 | protected function includeClassTest(string $className): bool |
| 661 | 661 | { |
| 662 | - if(count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 662 | + if (count($this->includedClassesWithSubClassess) && !in_array($className, $this->includedClassesWithSubClassess, true)) { |
|
| 663 | 663 | if ($this->debug) { |
| 664 | 664 | DB::alteration_message(' ... Skipping as not included ' . $className); |
| 665 | 665 | } |
| 666 | 666 | return false; |
| 667 | 667 | } |
| 668 | - if(count($this->excludedClassesWithSubClassess) && in_array($className, $this->excludedClassesWithSubClassess, true)) { |
|
| 668 | + if (count($this->excludedClassesWithSubClassess) && in_array($className, $this->excludedClassesWithSubClassess, true)) { |
|
| 669 | 669 | if ($this->debug) { |
| 670 | 670 | DB::alteration_message(' ... Skipping as excluded ' . $className); |
| 671 | 671 | } |
@@ -680,9 +680,9 @@ discard block |
||
| 680 | 680 | |
| 681 | 681 | protected function includeFieldTest(string $className, string $field): bool |
| 682 | 682 | { |
| 683 | - if(isset($this->includedClassFieldCombos[$className][$field])) { |
|
| 683 | + if (isset($this->includedClassFieldCombos[$className][$field])) { |
|
| 684 | 684 | return true; |
| 685 | - } elseif(count($this->includedFields)) { |
|
| 685 | + } elseif (count($this->includedFields)) { |
|
| 686 | 686 | return in_array($field, $this->includedFields, true); |
| 687 | 687 | } elseif (count($this->excludedFields)) { |
| 688 | 688 | return in_array($field, $this->includedFields, true) ? false : true; |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | protected function includeSubClasses(array $classes): array |
| 695 | 695 | { |
| 696 | 696 | $toAdd = []; |
| 697 | - foreach($classes as $class) { |
|
| 697 | + foreach ($classes as $class) { |
|
| 698 | 698 | $toAdd = array_merge($toAdd, ClassInfo::subclassesFor($class, false)); |
| 699 | 699 | } |
| 700 | 700 | return array_unique(array_merge($classes, $toAdd)); |