111.cache.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php return '/**
  2. * Show the search form
  3. *
  4. * @var modX $modx
  5. * @var array $scriptProperties
  6. * @package simplesearch
  7. */
  8. require_once $modx->getOption(
  9. \'simplesearch.core_path\',
  10. null,
  11. $modx->getOption(\'core_path\') . \'components/simplesearch/\'
  12. ) . \'model/simplesearch/simplesearch.class.php\';
  13. $search = new SimpleSearch($modx, $scriptProperties);
  14. /* Setup default options. */
  15. $scriptProperties = array_merge(
  16. array(
  17. \'tpl\' => \'SearchForm\',
  18. \'method\' => \'get\',
  19. \'searchIndex\' => \'search\',
  20. \'toPlaceholder\' => false,
  21. \'landing\' => $modx->resource->get(\'id\'),
  22. ), $scriptProperties);
  23. if (empty($scriptProperties[\'landing\'])) {
  24. $scriptProperties[\'landing\'] = $modx->resource->get(\'id\');
  25. }
  26. /* If get value already exists, set it as default. */
  27. $searchValue = isset($_REQUEST[$scriptProperties[\'searchIndex\']]) ? $_REQUEST[$scriptProperties[\'searchIndex\']] : \'\';
  28. $searchValues = explode(\' \', $searchValue);
  29. array_map(array($modx, \'sanitizeString\'), $searchValues);
  30. $searchValue = implode(\' \', $searchValues);
  31. $placeholders = array(
  32. \'method\' => $scriptProperties[\'method\'],
  33. \'landing\' => $scriptProperties[\'landing\'],
  34. \'searchValue\' => strip_tags(htmlspecialchars($searchValue, ENT_QUOTES, \'UTF-8\')),
  35. \'searchIndex\' => $scriptProperties[\'searchIndex\'],
  36. );
  37. $output = $search->getChunk($scriptProperties[\'tpl\'], $placeholders);
  38. return $search->output($output, $scriptProperties[\'toPlaceholder\']);
  39. return;
  40. ';