@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | |
192 | 192 | |
193 | 193 | /** |
194 | - * Overrides the parent to add a field for autocomplete |
|
195 | - * @return HTMLText |
|
196 | - */ |
|
194 | + * Overrides the parent to add a field for autocomplete |
|
195 | + * @return HTMLText |
|
196 | + */ |
|
197 | 197 | function getTypes() { |
198 | 198 | $val = parent::getTypes(); |
199 | 199 | if (!$val || !is_object($val)) return $val; |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | |
467 | 467 | foreach ($facets as $name => $spec) { |
468 | 468 | // With our current implementation, "range" facets aren't true facets in solr terms. |
469 | - // They're just a type of filter which can be handled elsewhere. |
|
469 | + // They're just a type of filter which can be handled elsewhere. |
|
470 | 470 | // For the other types we just ignore the rest of the spec and let Solr do its thing |
471 | 471 | if ($spec['Type'] != ShopSearch::FACET_TYPE_RANGE && isset($this->fieldMap[$name])) { |
472 | 472 | $params['facet.field'] = $this->fieldMap[$name]; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * @param string $sort [optional] |
235 | 235 | * @return ArrayData |
236 | 236 | */ |
237 | - public function searchFromVars($keywords, array $filters=array(), array $facetSpec=array(), $start=-1, $limit=-1, $sort='score desc') { |
|
237 | + public function searchFromVars($keywords, array $filters = array(), array $facetSpec = array(), $start = -1, $limit = -1, $sort = 'score desc') { |
|
238 | 238 | $query = new SearchQuery(); |
239 | 239 | $params = array( |
240 | 240 | 'sort' => $sort, |
@@ -349,11 +349,11 @@ discard block |
||
349 | 349 | $classq = array(); |
350 | 350 | |
351 | 351 | foreach ($query->classes as $class) { |
352 | - if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:'.$class['class']; |
|
353 | - else $classq[] = 'ClassName:'.$class['class']; |
|
352 | + if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:' . $class['class']; |
|
353 | + else $classq[] = 'ClassName:' . $class['class']; |
|
354 | 354 | } |
355 | 355 | |
356 | - if ($classq) $fq[] = '+('.implode(' ', $classq).')'; |
|
356 | + if ($classq) $fq[] = '+(' . implode(' ', $classq) . ')'; |
|
357 | 357 | |
358 | 358 | // Filter by filters |
359 | 359 | foreach ($query->require as $field => $values) { |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | $requireq[] = "$field:[$start TO $end]"; |
373 | 373 | } |
374 | 374 | else { |
375 | - $requireq[] = $field.':"'.$value.'"'; |
|
375 | + $requireq[] = $field . ':"' . $value . '"'; |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | - $fq[] = '+('.implode(' ', $requireq).')'; |
|
379 | + $fq[] = '+(' . implode(' ', $requireq) . ')'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | foreach ($query->exclude as $field => $values) { |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | $excludeq[] = "$field:[$start TO $end]"; |
397 | 397 | } |
398 | 398 | else { |
399 | - $excludeq[] = $field.':"'.$value.'"'; |
|
399 | + $excludeq[] = $field . ':"' . $value . '"'; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - $fq[] = ($missing ? "+{$field}:[* TO *] " : '') . '-('.implode(' ', $excludeq).')'; |
|
403 | + $fq[] = ($missing ? "+{$field}:[* TO *] " : '') . '-(' . implode(' ', $excludeq) . ')'; |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | // if(!headers_sent()) { |
@@ -419,10 +419,10 @@ discard block |
||
419 | 419 | ); |
420 | 420 | |
421 | 421 | $results = new ArrayList(); |
422 | - if($res->getHttpStatus() >= 200 && $res->getHttpStatus() < 300) { |
|
422 | + if ($res->getHttpStatus() >= 200 && $res->getHttpStatus() < 300) { |
|
423 | 423 | foreach ($res->response->docs as $doc) { |
424 | 424 | $result = DataObject::get_by_id($doc->ClassName, $doc->ID); |
425 | - if($result) { |
|
425 | + if ($result) { |
|
426 | 426 | $results->push($result); |
427 | 427 | } |
428 | 428 | } |
@@ -509,17 +509,17 @@ discard block |
||
509 | 509 | |
510 | 510 | foreach ($parts[0] as $part) { |
511 | 511 | $fields = (isset($search['fields'])) ? $search['fields'] : array(); |
512 | - if(isset($search['boost'])) $fields = array_merge($fields, array_keys($search['boost'])); |
|
512 | + if (isset($search['boost'])) $fields = array_merge($fields, array_keys($search['boost'])); |
|
513 | 513 | if ($fields) { |
514 | 514 | $searchq = array(); |
515 | 515 | foreach ($fields as $field) { |
516 | 516 | $boost = (isset($search['boost'][$field])) ? '^' . $search['boost'][$field] : ''; |
517 | - $searchq[] = "{$field}:".$part.$fuzzy.$boost; |
|
517 | + $searchq[] = "{$field}:" . $part . $fuzzy . $boost; |
|
518 | 518 | } |
519 | - $q[] = '+('.implode(' OR ', $searchq).')'; |
|
519 | + $q[] = '+(' . implode(' OR ', $searchq) . ')'; |
|
520 | 520 | } |
521 | 521 | else { |
522 | - $q[] = '+'.$part.$fuzzy; |
|
522 | + $q[] = '+' . $part . $fuzzy; |
|
523 | 523 | } |
524 | 524 | } |
525 | 525 | } |
@@ -529,11 +529,11 @@ discard block |
||
529 | 529 | $classq = array(); |
530 | 530 | |
531 | 531 | foreach ($query->classes as $class) { |
532 | - if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:'.$class['class']; |
|
533 | - else $classq[] = 'ClassName:'.$class['class']; |
|
532 | + if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:' . $class['class']; |
|
533 | + else $classq[] = 'ClassName:' . $class['class']; |
|
534 | 534 | } |
535 | 535 | |
536 | - if ($classq) $fq[] = '+('.implode(' ', $classq).')'; |
|
536 | + if ($classq) $fq[] = '+(' . implode(' ', $classq) . ')'; |
|
537 | 537 | |
538 | 538 | // Filter by filters |
539 | 539 | |
@@ -553,11 +553,11 @@ discard block |
||
553 | 553 | $requireq[] = "$field:[$start TO $end]"; |
554 | 554 | } |
555 | 555 | else { |
556 | - $requireq[] = $field.':"'.$value.'"'; |
|
556 | + $requireq[] = $field . ':"' . $value . '"'; |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
560 | - $fq[] = '+('.implode(' ', $requireq).')'; |
|
560 | + $fq[] = '+(' . implode(' ', $requireq) . ')'; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | foreach ($query->exclude as $field => $values) { |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | $excludeq[] = "$field:[$start TO $end]"; |
578 | 578 | } |
579 | 579 | else { |
580 | - $excludeq[] = $field.':"'.$value.'"'; |
|
580 | + $excludeq[] = $field . ':"' . $value . '"'; |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | - $fq[] = ($missing ? "+{$field}:[* TO *] " : '') . '-('.implode(' ', $excludeq).')'; |
|
584 | + $fq[] = ($missing ? "+{$field}:[* TO *] " : '') . '-(' . implode(' ', $excludeq) . ')'; |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | // if(!headers_sent()) { |
@@ -605,20 +605,20 @@ discard block |
||
605 | 605 | //Debug::dump($res); |
606 | 606 | |
607 | 607 | $results = new ArrayList(); |
608 | - if($res->getHttpStatus() >= 200 && $res->getHttpStatus() < 300) { |
|
608 | + if ($res->getHttpStatus() >= 200 && $res->getHttpStatus() < 300) { |
|
609 | 609 | foreach ($res->response->docs as $doc) { |
610 | 610 | $result = DataObject::get_by_id($doc->ClassName, $doc->ID); |
611 | - if($result) { |
|
611 | + if ($result) { |
|
612 | 612 | $results->push($result); |
613 | 613 | |
614 | 614 | // Add highlighting (optional) |
615 | 615 | $docId = $doc->_documentid; |
616 | - if($res->highlighting && $res->highlighting->$docId) { |
|
616 | + if ($res->highlighting && $res->highlighting->$docId) { |
|
617 | 617 | // TODO Create decorator class for search results rather than adding arbitrary object properties |
618 | 618 | // TODO Allow specifying highlighted field, and lazy loading |
619 | 619 | // in case the search API needs another query (similar to SphinxSearchable->buildExcerpt()). |
620 | 620 | $combinedHighlights = array(); |
621 | - foreach($res->highlighting->$docId as $field => $highlights) { |
|
621 | + foreach ($res->highlighting->$docId as $field => $highlights) { |
|
622 | 622 | $combinedHighlights = array_merge($combinedHighlights, $highlights); |
623 | 623 | } |
624 | 624 | |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | } |
658 | 658 | |
659 | 659 | // Suggestions (requires custom setup, assumes spellcheck.collate=true) |
660 | - if(isset($res->spellcheck->suggestions->collation)) { |
|
660 | + if (isset($res->spellcheck->suggestions->collation)) { |
|
661 | 661 | $ret['Suggestion'] = $res->spellcheck->suggestions->collation; |
662 | 662 | } |
663 | 663 |
@@ -102,7 +102,9 @@ discard block |
||
102 | 102 | */ |
103 | 103 | protected function scrubFieldList($in) { |
104 | 104 | $out = array(); |
105 | - if (empty($in) || !is_array($in)) return $out; |
|
105 | + if (empty($in) || !is_array($in)) { |
|
106 | + return $out; |
|
107 | + } |
|
106 | 108 | |
107 | 109 | foreach ($in as $name => $val) { |
108 | 110 | // supports an indexed array format of simple field names |
@@ -121,8 +123,12 @@ discard block |
||
121 | 123 | 'params' => $params, |
122 | 124 | ); |
123 | 125 | |
124 | - if (isset($def['params']['field'])) unset($def['params']['field']); |
|
125 | - if (isset($def['params']['type'])) unset($def['params']['type']); |
|
126 | + if (isset($def['params']['field'])) { |
|
127 | + unset($def['params']['field']); |
|
128 | + } |
|
129 | + if (isset($def['params']['type'])) { |
|
130 | + unset($def['params']['type']); |
|
131 | + } |
|
126 | 132 | |
127 | 133 | $out[$name] = $def; |
128 | 134 | } |
@@ -136,7 +142,9 @@ discard block |
||
136 | 142 | */ |
137 | 143 | protected function getFulltextSpec() { |
138 | 144 | $fields = Config::inst()->get('ShopSearch', 'solr_fulltext_fields'); |
139 | - if (empty($fields)) $fields = array('Title', 'Content'); |
|
145 | + if (empty($fields)) { |
|
146 | + $fields = array('Title', 'Content'); |
|
147 | + } |
|
140 | 148 | return $this->scrubFieldList($fields); |
141 | 149 | } |
142 | 150 | |
@@ -196,7 +204,9 @@ discard block |
||
196 | 204 | */ |
197 | 205 | function getTypes() { |
198 | 206 | $val = parent::getTypes(); |
199 | - if (!$val || !is_object($val)) return $val; |
|
207 | + if (!$val || !is_object($val)) { |
|
208 | + return $val; |
|
209 | + } |
|
200 | 210 | $xml = $val->getValue(); |
201 | 211 | $xml .= <<<XML |
202 | 212 | |
@@ -241,7 +251,9 @@ discard block |
||
241 | 251 | ); |
242 | 252 | |
243 | 253 | // swap out title search |
244 | - if ($params['sort'] == 'SiteTree_Title') $params['sort'] = '_titleSort'; |
|
254 | + if ($params['sort'] == 'SiteTree_Title') { |
|
255 | + $params['sort'] = '_titleSort'; |
|
256 | + } |
|
245 | 257 | |
246 | 258 | // search by keywords |
247 | 259 | $query->search(empty($keywords) ? '*:*' : $keywords); |
@@ -349,11 +361,16 @@ discard block |
||
349 | 361 | $classq = array(); |
350 | 362 | |
351 | 363 | foreach ($query->classes as $class) { |
352 | - if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:'.$class['class']; |
|
353 | - else $classq[] = 'ClassName:'.$class['class']; |
|
364 | + if (!empty($class['includeSubclasses'])) { |
|
365 | + $classq[] = 'ClassHierarchy:'.$class['class']; |
|
366 | + } else { |
|
367 | + $classq[] = 'ClassName:'.$class['class']; |
|
368 | + } |
|
354 | 369 | } |
355 | 370 | |
356 | - if ($classq) $fq[] = '+('.implode(' ', $classq).')'; |
|
371 | + if ($classq) { |
|
372 | + $fq[] = '+('.implode(' ', $classq).')'; |
|
373 | + } |
|
357 | 374 | |
358 | 375 | // Filter by filters |
359 | 376 | foreach ($query->require as $field => $values) { |
@@ -362,16 +379,17 @@ discard block |
||
362 | 379 | foreach ($values as $value) { |
363 | 380 | if ($value === SearchQuery::$missing) { |
364 | 381 | $requireq[] = "(*:* -{$field}:[* TO *])"; |
365 | - } |
|
366 | - else if ($value === SearchQuery::$present) { |
|
382 | + } else if ($value === SearchQuery::$present) { |
|
367 | 383 | $requireq[] = "{$field}:[* TO *]"; |
368 | - } |
|
369 | - else if ($value instanceof SearchQuery_Range) { |
|
370 | - $start = $value->start; if ($start === null) $start = '*'; |
|
371 | - $end = $value->end; if ($end === null) $end = '*'; |
|
384 | + } else if ($value instanceof SearchQuery_Range) { |
|
385 | + $start = $value->start; if ($start === null) { |
|
386 | + $start = '*'; |
|
387 | + } |
|
388 | + $end = $value->end; if ($end === null) { |
|
389 | + $end = '*'; |
|
390 | + } |
|
372 | 391 | $requireq[] = "$field:[$start TO $end]"; |
373 | - } |
|
374 | - else { |
|
392 | + } else { |
|
375 | 393 | $requireq[] = $field.':"'.$value.'"'; |
376 | 394 | } |
377 | 395 | } |
@@ -386,16 +404,17 @@ discard block |
||
386 | 404 | foreach ($values as $value) { |
387 | 405 | if ($value === SearchQuery::$missing) { |
388 | 406 | $missing = true; |
389 | - } |
|
390 | - else if ($value === SearchQuery::$present) { |
|
407 | + } else if ($value === SearchQuery::$present) { |
|
391 | 408 | $excludeq[] = "{$field}:[* TO *]"; |
392 | - } |
|
393 | - else if ($value instanceof SearchQuery_Range) { |
|
394 | - $start = $value->start; if ($start === null) $start = '*'; |
|
395 | - $end = $value->end; if ($end === null) $end = '*'; |
|
409 | + } else if ($value instanceof SearchQuery_Range) { |
|
410 | + $start = $value->start; if ($start === null) { |
|
411 | + $start = '*'; |
|
412 | + } |
|
413 | + $end = $value->end; if ($end === null) { |
|
414 | + $end = '*'; |
|
415 | + } |
|
396 | 416 | $excludeq[] = "$field:[$start TO $end]"; |
397 | - } |
|
398 | - else { |
|
417 | + } else { |
|
399 | 418 | $excludeq[] = $field.':"'.$value.'"'; |
400 | 419 | } |
401 | 420 | } |
@@ -509,7 +528,9 @@ discard block |
||
509 | 528 | |
510 | 529 | foreach ($parts[0] as $part) { |
511 | 530 | $fields = (isset($search['fields'])) ? $search['fields'] : array(); |
512 | - if(isset($search['boost'])) $fields = array_merge($fields, array_keys($search['boost'])); |
|
531 | + if(isset($search['boost'])) { |
|
532 | + $fields = array_merge($fields, array_keys($search['boost'])); |
|
533 | + } |
|
513 | 534 | if ($fields) { |
514 | 535 | $searchq = array(); |
515 | 536 | foreach ($fields as $field) { |
@@ -517,8 +538,7 @@ discard block |
||
517 | 538 | $searchq[] = "{$field}:".$part.$fuzzy.$boost; |
518 | 539 | } |
519 | 540 | $q[] = '+('.implode(' OR ', $searchq).')'; |
520 | - } |
|
521 | - else { |
|
541 | + } else { |
|
522 | 542 | $q[] = '+'.$part.$fuzzy; |
523 | 543 | } |
524 | 544 | } |
@@ -529,11 +549,16 @@ discard block |
||
529 | 549 | $classq = array(); |
530 | 550 | |
531 | 551 | foreach ($query->classes as $class) { |
532 | - if (!empty($class['includeSubclasses'])) $classq[] = 'ClassHierarchy:'.$class['class']; |
|
533 | - else $classq[] = 'ClassName:'.$class['class']; |
|
552 | + if (!empty($class['includeSubclasses'])) { |
|
553 | + $classq[] = 'ClassHierarchy:'.$class['class']; |
|
554 | + } else { |
|
555 | + $classq[] = 'ClassName:'.$class['class']; |
|
556 | + } |
|
534 | 557 | } |
535 | 558 | |
536 | - if ($classq) $fq[] = '+('.implode(' ', $classq).')'; |
|
559 | + if ($classq) { |
|
560 | + $fq[] = '+('.implode(' ', $classq).')'; |
|
561 | + } |
|
537 | 562 | |
538 | 563 | // Filter by filters |
539 | 564 | |
@@ -543,16 +568,17 @@ discard block |
||
543 | 568 | foreach ($values as $value) { |
544 | 569 | if ($value === SearchQuery::$missing) { |
545 | 570 | $requireq[] = "(*:* -{$field}:[* TO *])"; |
546 | - } |
|
547 | - else if ($value === SearchQuery::$present) { |
|
571 | + } else if ($value === SearchQuery::$present) { |
|
548 | 572 | $requireq[] = "{$field}:[* TO *]"; |
549 | - } |
|
550 | - else if ($value instanceof SearchQuery_Range) { |
|
551 | - $start = $value->start; if ($start === null) $start = '*'; |
|
552 | - $end = $value->end; if ($end === null) $end = '*'; |
|
573 | + } else if ($value instanceof SearchQuery_Range) { |
|
574 | + $start = $value->start; if ($start === null) { |
|
575 | + $start = '*'; |
|
576 | + } |
|
577 | + $end = $value->end; if ($end === null) { |
|
578 | + $end = '*'; |
|
579 | + } |
|
553 | 580 | $requireq[] = "$field:[$start TO $end]"; |
554 | - } |
|
555 | - else { |
|
581 | + } else { |
|
556 | 582 | $requireq[] = $field.':"'.$value.'"'; |
557 | 583 | } |
558 | 584 | } |
@@ -567,16 +593,17 @@ discard block |
||
567 | 593 | foreach ($values as $value) { |
568 | 594 | if ($value === SearchQuery::$missing) { |
569 | 595 | $missing = true; |
570 | - } |
|
571 | - else if ($value === SearchQuery::$present) { |
|
596 | + } else if ($value === SearchQuery::$present) { |
|
572 | 597 | $excludeq[] = "{$field}:[* TO *]"; |
573 | - } |
|
574 | - else if ($value instanceof SearchQuery_Range) { |
|
575 | - $start = $value->start; if ($start === null) $start = '*'; |
|
576 | - $end = $value->end; if ($end === null) $end = '*'; |
|
598 | + } else if ($value instanceof SearchQuery_Range) { |
|
599 | + $start = $value->start; if ($start === null) { |
|
600 | + $start = '*'; |
|
601 | + } |
|
602 | + $end = $value->end; if ($end === null) { |
|
603 | + $end = '*'; |
|
604 | + } |
|
577 | 605 | $excludeq[] = "$field:[$start TO $end]"; |
578 | - } |
|
579 | - else { |
|
606 | + } else { |
|
580 | 607 | $excludeq[] = $field.':"'.$value.'"'; |
581 | 608 | } |
582 | 609 | } |
@@ -589,9 +616,15 @@ discard block |
||
589 | 616 | // if ($fq) header('X-Filters: "'.implode('", "', $fq).'"'); |
590 | 617 | // } |
591 | 618 | |
592 | - if ($offset == -1) $offset = $query->start; |
|
593 | - if ($limit == -1) $limit = $query->limit; |
|
594 | - if ($limit == -1) $limit = SearchQuery::$default_page_size; |
|
619 | + if ($offset == -1) { |
|
620 | + $offset = $query->start; |
|
621 | + } |
|
622 | + if ($limit == -1) { |
|
623 | + $limit = $query->limit; |
|
624 | + } |
|
625 | + if ($limit == -1) { |
|
626 | + $limit = SearchQuery::$default_page_size; |
|
627 | + } |
|
595 | 628 | |
596 | 629 | $params = array_merge($params, array('fq' => implode(' ', $fq))); |
597 | 630 | |
@@ -677,8 +710,12 @@ discard block |
||
677 | 710 | if ($facet['Type'] == ShopSearch::FACET_TYPE_RANGE) { |
678 | 711 | // If it's a range facet, set up the min/max |
679 | 712 | // TODO: we could probably get the real min and max with solr's range faceting if we tried |
680 | - if (isset($facet['RangeMin'])) $facet['MinValue'] = $facet['RangeMin']; |
|
681 | - if (isset($facet['RangeMax'])) $facet['MaxValue'] = $facet['RangeMax']; |
|
713 | + if (isset($facet['RangeMin'])) { |
|
714 | + $facet['MinValue'] = $facet['RangeMin']; |
|
715 | + } |
|
716 | + if (isset($facet['RangeMax'])) { |
|
717 | + $facet['MaxValue'] = $facet['RangeMax']; |
|
718 | + } |
|
682 | 719 | $out->push(new ArrayData($facet)); |
683 | 720 | } elseif (isset($this->fieldMap[$field])) { |
684 | 721 | // Otherwise, look through Solr's results |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->model = $query->applyRelation($this->relation); |
19 | 19 | $value = $this->getDbFormattedValue(); |
20 | 20 | |
21 | - if(is_numeric($value)) $filter = sprintf("%s > %s", $this->getDbName(), Convert::raw2sql($value)); |
|
21 | + if (is_numeric($value)) $filter = sprintf("%s > %s", $this->getDbName(), Convert::raw2sql($value)); |
|
22 | 22 | else $filter = sprintf("%s > '%s'", $this->getDbName(), Convert::raw2sql($value)); |
23 | 23 | |
24 | 24 | return $query->where($filter); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $this->model = $query->applyRelation($this->relation); |
33 | 33 | $value = $this->getDbFormattedValue(); |
34 | 34 | |
35 | - if(is_numeric($value)) $filter = sprintf("%s <= %s", $this->getDbName(), Convert::raw2sql($value)); |
|
35 | + if (is_numeric($value)) $filter = sprintf("%s <= %s", $this->getDbName(), Convert::raw2sql($value)); |
|
36 | 36 | else $filter = sprintf("%s <= '%s'", $this->getDbName(), Convert::raw2sql($value)); |
37 | 37 | |
38 | 38 | return $query->where($filter); |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | |
48 | 48 | $filters = array(); |
49 | 49 | $ops = array('>=', '<='); |
50 | - foreach($this->getValue() as $i => $value) { |
|
51 | - if(is_numeric($value)) { |
|
50 | + foreach ($this->getValue() as $i => $value) { |
|
51 | + if (is_numeric($value)) { |
|
52 | 52 | $filters[] = sprintf("%s %s %s", $this->getDbName(), $ops[$i], Convert::raw2sql($value)); |
53 | 53 | } else { |
54 | 54 | $filters[] = sprintf("%s %s '%s'", $this->getDbName(), $ops[$i], Convert::raw2sql($value)); |
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - return $query->where( implode(' AND ', $filters) ); |
|
58 | + return $query->where(implode(' AND ', $filters)); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | |
68 | 68 | $filters = array(); |
69 | 69 | $ops = array('<', '>'); |
70 | - foreach($this->getValue() as $i => $value) { |
|
71 | - if(is_numeric($value)) { |
|
70 | + foreach ($this->getValue() as $i => $value) { |
|
71 | + if (is_numeric($value)) { |
|
72 | 72 | $filters[] = sprintf("%s %s %s", $this->getDbName(), $ops[$i], Convert::raw2sql($value)); |
73 | 73 | } else { |
74 | 74 | $filters[] = sprintf("%s %s '%s'", $this->getDbName(), $ops[$i], Convert::raw2sql($value)); |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - return $query->where( implode(' OR ', $filters) ); |
|
78 | + return $query->where(implode(' OR ', $filters)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -18,8 +18,11 @@ discard block |
||
18 | 18 | $this->model = $query->applyRelation($this->relation); |
19 | 19 | $value = $this->getDbFormattedValue(); |
20 | 20 | |
21 | - if(is_numeric($value)) $filter = sprintf("%s > %s", $this->getDbName(), Convert::raw2sql($value)); |
|
22 | - else $filter = sprintf("%s > '%s'", $this->getDbName(), Convert::raw2sql($value)); |
|
21 | + if(is_numeric($value)) { |
|
22 | + $filter = sprintf("%s > %s", $this->getDbName(), Convert::raw2sql($value)); |
|
23 | + } else { |
|
24 | + $filter = sprintf("%s > '%s'", $this->getDbName(), Convert::raw2sql($value)); |
|
25 | + } |
|
23 | 26 | |
24 | 27 | return $query->where($filter); |
25 | 28 | } |
@@ -32,8 +35,11 @@ discard block |
||
32 | 35 | $this->model = $query->applyRelation($this->relation); |
33 | 36 | $value = $this->getDbFormattedValue(); |
34 | 37 | |
35 | - if(is_numeric($value)) $filter = sprintf("%s <= %s", $this->getDbName(), Convert::raw2sql($value)); |
|
36 | - else $filter = sprintf("%s <= '%s'", $this->getDbName(), Convert::raw2sql($value)); |
|
38 | + if(is_numeric($value)) { |
|
39 | + $filter = sprintf("%s <= %s", $this->getDbName(), Convert::raw2sql($value)); |
|
40 | + } else { |
|
41 | + $filter = sprintf("%s <= '%s'", $this->getDbName(), Convert::raw2sql($value)); |
|
42 | + } |
|
37 | 43 | |
38 | 44 | return $query->where($filter); |
39 | 45 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function updateCMSFields(FieldList $fields) { |
40 | 40 | if (Config::inst()->get('FacetedCategory', 'show_disabled_facets_tab')) { |
41 | - $spec = FacetHelper::inst()->expandFacetSpec( $this->getFacetSpec() ); |
|
41 | + $spec = FacetHelper::inst()->expandFacetSpec($this->getFacetSpec()); |
|
42 | 42 | $facets = array(); |
43 | 43 | foreach ($spec as $f => $v) $facets[$f] = $v['Label']; |
44 | 44 | $fields->addFieldToTab('Root.Facets', CheckboxSetField::create('DisabledFacets', "Don't show the following facets for this category:", $facets)); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param bool $recursive |
81 | 81 | * @return mixed |
82 | 82 | */ |
83 | - public function FilteredProducts($recursive=true) { |
|
83 | + public function FilteredProducts($recursive = true) { |
|
84 | 84 | if (!isset($this->_filteredProducts)) { |
85 | 85 | $fn = Config::inst()->get('FacetedCategory', 'products_method'); |
86 | 86 | if (empty($fn)) $fn = 'ProductsShowable'; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @return ArrayList |
108 | 108 | */ |
109 | 109 | public function Facets() { |
110 | - $spec = $this->getFacetSpec(); |
|
110 | + $spec = $this->getFacetSpec(); |
|
111 | 111 | if (empty($spec)) return new ArrayList; |
112 | 112 | |
113 | 113 | // remove any disabled facets |
@@ -40,7 +40,9 @@ discard block |
||
40 | 40 | if (Config::inst()->get('FacetedCategory', 'show_disabled_facets_tab')) { |
41 | 41 | $spec = FacetHelper::inst()->expandFacetSpec( $this->getFacetSpec() ); |
42 | 42 | $facets = array(); |
43 | - foreach ($spec as $f => $v) $facets[$f] = $v['Label']; |
|
43 | + foreach ($spec as $f => $v) { |
|
44 | + $facets[$f] = $v['Label']; |
|
45 | + } |
|
44 | 46 | $fields->addFieldToTab('Root.Facets', CheckboxSetField::create('DisabledFacets', "Don't show the following facets for this category:", $facets)); |
45 | 47 | } |
46 | 48 | } |
@@ -68,10 +70,14 @@ discard block |
||
68 | 70 | */ |
69 | 71 | protected function getFilters() { |
70 | 72 | $qs_f = Config::inst()->get('ShopSearch', 'qs_filters'); |
71 | - if (!$qs_f) return array(); |
|
73 | + if (!$qs_f) { |
|
74 | + return array(); |
|
75 | + } |
|
72 | 76 | $request = $this->getController()->getRequest(); |
73 | 77 | $filters = $request->requestVar($qs_f); |
74 | - if (empty($filters) || !is_array($filters)) return array(); |
|
78 | + if (empty($filters) || !is_array($filters)) { |
|
79 | + return array(); |
|
80 | + } |
|
75 | 81 | return FacetHelper::inst()->scrubFilters($filters); |
76 | 82 | } |
77 | 83 | |
@@ -83,7 +89,9 @@ discard block |
||
83 | 89 | public function FilteredProducts($recursive=true) { |
84 | 90 | if (!isset($this->_filteredProducts)) { |
85 | 91 | $fn = Config::inst()->get('FacetedCategory', 'products_method'); |
86 | - if (empty($fn)) $fn = 'ProductsShowable'; |
|
92 | + if (empty($fn)) { |
|
93 | + $fn = 'ProductsShowable'; |
|
94 | + } |
|
87 | 95 | $this->_filteredProducts = $this->owner->$fn($recursive); |
88 | 96 | $this->_filteredProducts = FacetHelper::inst()->addFiltersToDataList($this->_filteredProducts, $this->getFilters()); |
89 | 97 | } |
@@ -98,7 +106,9 @@ discard block |
||
98 | 106 | * @return array |
99 | 107 | */ |
100 | 108 | public function getDisabledFacetsArray() { |
101 | - if (empty($this->owner->DisabledFacets)) return array(); |
|
109 | + if (empty($this->owner->DisabledFacets)) { |
|
110 | + return array(); |
|
111 | + } |
|
102 | 112 | return explode(',', $this->owner->DisabledFacets); |
103 | 113 | } |
104 | 114 | |
@@ -108,11 +118,15 @@ discard block |
||
108 | 118 | */ |
109 | 119 | public function Facets() { |
110 | 120 | $spec = $this->getFacetSpec(); |
111 | - if (empty($spec)) return new ArrayList; |
|
121 | + if (empty($spec)) { |
|
122 | + return new ArrayList; |
|
123 | + } |
|
112 | 124 | |
113 | 125 | // remove any disabled facets |
114 | 126 | foreach ($this->getDisabledFacetsArray() as $disabled) { |
115 | - if (isset($spec[$disabled])) unset($spec[$disabled]); |
|
127 | + if (isset($spec[$disabled])) { |
|
128 | + unset($spec[$disabled]); |
|
129 | + } |
|
116 | 130 | } |
117 | 131 | |
118 | 132 | $request = $this->getController()->getRequest(); |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This extension can be applied to ProductCategory |
|
4 | - * to allow categories to have facets as well. |
|
5 | - * |
|
6 | - * NOTE: You could apply this to either ProductCategory |
|
7 | - * or ProductCategory_Controller. I tend to use the model b/c |
|
8 | - * that will also cover some other cases like where you |
|
9 | - * might list subcategory products on the parent category page. |
|
10 | - * In such a case those products would be filtered as well. |
|
11 | - * |
|
12 | - * @author Mark Guinn <[email protected]> |
|
13 | - * @date 10.22.2013 |
|
14 | - * @package shop_search |
|
15 | - * @subpackage helpers |
|
16 | - */ |
|
3 | + * This extension can be applied to ProductCategory |
|
4 | + * to allow categories to have facets as well. |
|
5 | + * |
|
6 | + * NOTE: You could apply this to either ProductCategory |
|
7 | + * or ProductCategory_Controller. I tend to use the model b/c |
|
8 | + * that will also cover some other cases like where you |
|
9 | + * might list subcategory products on the parent category page. |
|
10 | + * In such a case those products would be filtered as well. |
|
11 | + * |
|
12 | + * @author Mark Guinn <[email protected]> |
|
13 | + * @date 10.22.2013 |
|
14 | + * @package shop_search |
|
15 | + * @subpackage helpers |
|
16 | + */ |
|
17 | 17 | class FacetedCategory extends SiteTreeExtension |
18 | 18 | { |
19 | 19 | private static $db = array( |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param bool $recursive [optional] - include the parents of the categories as well? - default: true |
17 | 17 | * @return array - array of productCategory records |
18 | 18 | */ |
19 | - protected function buildParentCategoriesArray($recursive=true) { |
|
19 | + protected function buildParentCategoriesArray($recursive = true) { |
|
20 | 20 | $out = array(); |
21 | 21 | |
22 | 22 | // add the main parent |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return ArrayList - array of productCategory records |
50 | 50 | */ |
51 | 51 | public function getAllCategories() { |
52 | - return new ArrayList( $this->buildParentCategoriesArray(false) ); |
|
52 | + return new ArrayList($this->buildParentCategoriesArray(false)); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return ArrayList - array of productCategory records |
59 | 59 | */ |
60 | 60 | public function getAllCategoriesRecursive() { |
61 | - return new ArrayList( $this->buildParentCategoriesArray(true) ); |
|
61 | + return new ArrayList($this->buildParentCategoriesArray(true)); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return array - array of ID's |
68 | 68 | */ |
69 | 69 | public function getAllCategoryIDs() { |
70 | - return array_keys( $this->buildParentCategoriesArray(false) ); |
|
70 | + return array_keys($this->buildParentCategoriesArray(false)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * @return array - array of ID's |
77 | 77 | */ |
78 | 78 | public function getAllCategoryIDsRecursive() { |
79 | - return array_keys( $this->buildParentCategoriesArray(true) ); |
|
79 | + return array_keys($this->buildParentCategoriesArray(true)); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |
@@ -21,12 +21,18 @@ discard block |
||
21 | 21 | |
22 | 22 | // add the main parent |
23 | 23 | $parent = $this->owner->Parent(); |
24 | - if (!$parent || !$parent->exists()) return $out; |
|
25 | - if ($parent->ClassName == 'ProductCategory') $out[$parent->ID] = $parent; |
|
24 | + if (!$parent || !$parent->exists()) { |
|
25 | + return $out; |
|
26 | + } |
|
27 | + if ($parent->ClassName == 'ProductCategory') { |
|
28 | + $out[$parent->ID] = $parent; |
|
29 | + } |
|
26 | 30 | |
27 | 31 | if ($recursive) { |
28 | 32 | foreach ($parent->getAncestors() as $rec) { |
29 | - if ($rec->ClassName == 'ProductCategory') $out[$rec->ID] = $rec; |
|
33 | + if ($rec->ClassName == 'ProductCategory') { |
|
34 | + $out[$rec->ID] = $rec; |
|
35 | + } |
|
30 | 36 | } |
31 | 37 | } |
32 | 38 | |
@@ -35,7 +41,9 @@ discard block |
||
35 | 41 | $out[$cat->ID] = $cat; |
36 | 42 | if ($recursive) { |
37 | 43 | foreach ($cat->getAncestors() as $rec) { |
38 | - if ($rec->ClassName == 'ProductCategory') $out[$rec->ID] = $rec; |
|
44 | + if ($rec->ClassName == 'ProductCategory') { |
|
45 | + $out[$rec->ID] = $rec; |
|
46 | + } |
|
39 | 47 | } |
40 | 48 | } |
41 | 49 | } |
@@ -87,7 +95,9 @@ discard block |
||
87 | 95 | public function getAllCategoryTitles() { |
88 | 96 | $cats = $this->buildParentCategoriesArray(false); |
89 | 97 | $out = array(); |
90 | - foreach ($cats as $cat) $out[] = $cat->Title; |
|
98 | + foreach ($cats as $cat) { |
|
99 | + $out[] = $cat->Title; |
|
100 | + } |
|
91 | 101 | return $out; |
92 | 102 | } |
93 | 103 | |
@@ -99,7 +109,9 @@ discard block |
||
99 | 109 | public function getAllCategoryTitlesRecursive() { |
100 | 110 | $cats = $this->buildParentCategoriesArray(true); |
101 | 111 | $out = array(); |
102 | - foreach ($cats as $cat) $out[] = $cat->Title; |
|
112 | + foreach ($cats as $cat) { |
|
113 | + $out[] = $cat->Title; |
|
114 | + } |
|
103 | 115 | return $out; |
104 | 116 | } |
105 | 117 |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Adds some methods to the Product class to list out all categories |
|
4 | - * a product is in. This is generally useful, but also really helps |
|
5 | - * with building search indexes. |
|
6 | - * |
|
7 | - * @author Mark Guinn <[email protected]> |
|
8 | - * @date 05.23.2014 |
|
9 | - * @package shop_search |
|
10 | - * @subpackage helpers |
|
11 | - */ |
|
3 | + * Adds some methods to the Product class to list out all categories |
|
4 | + * a product is in. This is generally useful, but also really helps |
|
5 | + * with building search indexes. |
|
6 | + * |
|
7 | + * @author Mark Guinn <[email protected]> |
|
8 | + * @date 05.23.2014 |
|
9 | + * @package shop_search |
|
10 | + * @subpackage helpers |
|
11 | + */ |
|
12 | 12 | class ProductCategoryHelperMethods extends DataExtension |
13 | 13 | { |
14 | 14 | /** |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * If the queued jobs module is installed, this will be used instead of |
|
4 | - * updating vfi's in onBeforeWrite. |
|
5 | - * |
|
6 | - * @author Mark Guinn <[email protected]> |
|
7 | - * @date 07.02.2015 |
|
8 | - * @package shop_search |
|
9 | - * @subpackage helpers |
|
10 | - */ |
|
3 | + * If the queued jobs module is installed, this will be used instead of |
|
4 | + * updating vfi's in onBeforeWrite. |
|
5 | + * |
|
6 | + * @author Mark Guinn <[email protected]> |
|
7 | + * @date 07.02.2015 |
|
8 | + * @package shop_search |
|
9 | + * @subpackage helpers |
|
10 | + */ |
|
11 | 11 | if(!interface_exists('QueuedJob')) return; |
12 | 12 | |
13 | 13 | class VirtualFieldIndexQueuedJob extends AbstractQueuedJob implements QueuedJob |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @package shop_search |
9 | 9 | * @subpackage helpers |
10 | 10 | */ |
11 | -if(!interface_exists('QueuedJob')) return; |
|
11 | +if (!interface_exists('QueuedJob')) return; |
|
12 | 12 | |
13 | 13 | class VirtualFieldIndexQueuedJob extends AbstractQueuedJob implements QueuedJob |
14 | 14 | { |
@@ -8,7 +8,9 @@ |
||
8 | 8 | * @package shop_search |
9 | 9 | * @subpackage helpers |
10 | 10 | */ |
11 | -if(!interface_exists('QueuedJob')) return; |
|
11 | +if(!interface_exists('QueuedJob')) { |
|
12 | + return; |
|
13 | +} |
|
12 | 14 | |
13 | 15 | class VirtualFieldIndexQueuedJob extends AbstractQueuedJob implements QueuedJob |
14 | 16 | { |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Rebuilds all VirtualFieldIndexes |
|
4 | - * |
|
5 | - * @author Mark Guinn <[email protected]> |
|
6 | - * @date 9.26.13 |
|
7 | - * @package shop_search |
|
8 | - * @subpackage tasks |
|
9 | - */ |
|
3 | + * Rebuilds all VirtualFieldIndexes |
|
4 | + * |
|
5 | + * @author Mark Guinn <[email protected]> |
|
6 | + * @date 9.26.13 |
|
7 | + * @package shop_search |
|
8 | + * @subpackage tasks |
|
9 | + */ |
|
10 | 10 | class BuildVFI extends BuildTask |
11 | 11 | { |
12 | 12 | protected $title = 'Rebuild Virtual Field Indexes'; |
@@ -76,9 +76,9 @@ discard block |
||
76 | 76 | $this->runFrom($_GET['class'], $_GET['start'], $_GET['field']); |
77 | 77 | } |
78 | 78 | else { |
79 | - foreach(array('framework','sapphire') as $dirname) { |
|
79 | + foreach (array('framework', 'sapphire') as $dirname) { |
|
80 | 80 | $script = sprintf("%s%s$dirname%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR); |
81 | - if(file_exists($script)) { |
|
81 | + if (file_exists($script)) { |
|
82 | 82 | break; |
83 | 83 | } |
84 | 84 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $query = $singleton->get($class); |
91 | 91 | $dtaQuery = $query->dataQuery(); |
92 | 92 | $sqlQuery = $dtaQuery->getFinalisedQuery(); |
93 | - $singleton->extend('augmentSQL',$sqlQuery,$dtaQuery); |
|
93 | + $singleton->extend('augmentSQL', $sqlQuery, $dtaQuery); |
|
94 | 94 | $total = $query->count(); |
95 | 95 | $startFrom = isset($_GET['startfrom']) ? $_GET['startfrom'] : 0; |
96 | 96 | $field = isset($_GET['field']) ? $_GET['field'] : ''; |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | for ($offset = $startFrom; $offset < $total; $offset += $this->stat('recordsPerRequest')) { |
101 | 101 | echo "$offset.."; |
102 | 102 | $cmd = "php $script dev/tasks/$self class=$class start=$offset field=$field"; |
103 | - if($verbose) echo "\n Running '$cmd'\n"; |
|
103 | + if ($verbose) echo "\n Running '$cmd'\n"; |
|
104 | 104 | $res = $verbose ? passthru($cmd) : `$cmd`; |
105 | - if($verbose) echo " ".preg_replace('/\r\n|\n/', '$0 ', $res)."\n"; |
|
105 | + if ($verbose) echo " " . preg_replace('/\r\n|\n/', '$0 ', $res) . "\n"; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -27,8 +27,12 @@ discard block |
||
27 | 27 | $count = $list->count(); |
28 | 28 | for ($i = $n; $i < $count; $i += 10) { |
29 | 29 | $chunk = $list->limit(10, $i); |
30 | - if (Controller::curr() instanceof TaskRunner) echo "Processing VFI #$i...\n"; |
|
31 | - foreach ($chunk as $rec) $rec->rebuildVFI(); |
|
30 | + if (Controller::curr() instanceof TaskRunner) { |
|
31 | + echo "Processing VFI #$i...\n"; |
|
32 | + } |
|
33 | + foreach ($chunk as $rec) { |
|
34 | + $rec->rebuildVFI(); |
|
35 | + } |
|
32 | 36 | } |
33 | 37 | VirtualFieldIndex::build($c); |
34 | 38 | |
@@ -58,7 +62,9 @@ discard block |
||
58 | 62 | |
59 | 63 | if (isset($_GET['class']) && isset($_GET['id'])) { |
60 | 64 | $item = DataObject::get($_GET['class'])->byID($_GET['id']); |
61 | - if (!$item || !$item->exists()) die('not found: ' . $_GET['id']); |
|
65 | + if (!$item || !$item->exists()) { |
|
66 | + die('not found: ' . $_GET['id']); |
|
67 | + } |
|
62 | 68 | $item->rebuildVFI(); |
63 | 69 | echo "done"; |
64 | 70 | return; |
@@ -66,7 +72,9 @@ discard block |
||
66 | 72 | |
67 | 73 | if (isset($_GET['link'])) { |
68 | 74 | $item = SiteTree::get_by_link($_GET['link']); |
69 | - if (!$item || !$item->exists()) die('not found: ' . $_GET['link']); |
|
75 | + if (!$item || !$item->exists()) { |
|
76 | + die('not found: ' . $_GET['link']); |
|
77 | + } |
|
70 | 78 | $item->rebuildVFI(); |
71 | 79 | echo "done"; |
72 | 80 | return; |
@@ -74,8 +82,7 @@ discard block |
||
74 | 82 | |
75 | 83 | if (isset($_GET['start'])) { |
76 | 84 | $this->runFrom($_GET['class'], $_GET['start'], $_GET['field']); |
77 | - } |
|
78 | - else { |
|
85 | + } else { |
|
79 | 86 | foreach(array('framework','sapphire') as $dirname) { |
80 | 87 | $script = sprintf("%s%s$dirname%scli-script.php", BASE_PATH, DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR); |
81 | 88 | if(file_exists($script)) { |
@@ -85,7 +92,9 @@ discard block |
||
85 | 92 | |
86 | 93 | $classes = VirtualFieldIndex::get_classes_with_vfi(); |
87 | 94 | foreach ($classes as $class) { |
88 | - if (isset($_GET['class']) && $class != $_GET['class']) continue; |
|
95 | + if (isset($_GET['class']) && $class != $_GET['class']) { |
|
96 | + continue; |
|
97 | + } |
|
89 | 98 | $singleton = singleton($class); |
90 | 99 | $query = $singleton->get($class); |
91 | 100 | $dtaQuery = $query->dataQuery(); |
@@ -100,9 +109,13 @@ discard block |
||
100 | 109 | for ($offset = $startFrom; $offset < $total; $offset += $this->stat('recordsPerRequest')) { |
101 | 110 | echo "$offset.."; |
102 | 111 | $cmd = "php $script dev/tasks/$self class=$class start=$offset field=$field"; |
103 | - if($verbose) echo "\n Running '$cmd'\n"; |
|
112 | + if($verbose) { |
|
113 | + echo "\n Running '$cmd'\n"; |
|
114 | + } |
|
104 | 115 | $res = $verbose ? passthru($cmd) : `$cmd`; |
105 | - if($verbose) echo " ".preg_replace('/\r\n|\n/', '$0 ', $res)."\n"; |
|
116 | + if($verbose) { |
|
117 | + echo " ".preg_replace('/\r\n|\n/', '$0 ', $res)."\n"; |
|
118 | + } |
|
106 | 119 | } |
107 | 120 | } |
108 | 121 | } |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Silverstripe report for searchs |
|
4 | - * |
|
5 | - * @author Mark Guinn <[email protected]> |
|
6 | - * @date 09.24.2014 |
|
7 | - * @package apluswhs.com |
|
8 | - * @subpackage |
|
9 | - */ |
|
3 | + * Silverstripe report for searchs |
|
4 | + * |
|
5 | + * @author Mark Guinn <[email protected]> |
|
6 | + * @date 09.24.2014 |
|
7 | + * @package apluswhs.com |
|
8 | + * @subpackage |
|
9 | + */ |
|
10 | 10 | class SearchTermsReport extends ShopPeriodReport |
11 | 11 | { |
12 | 12 | protected $title = "Search Terms"; |