preserved.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. <?php return array (
  2. '80a029f57dc8daed96ad383b1fe37822' =>
  3. array (
  4. 'criteria' =>
  5. array (
  6. 'name' => 'simplesearch',
  7. ),
  8. 'object' =>
  9. array (
  10. 'name' => 'simplesearch',
  11. 'path' => '{core_path}components/simplesearch/',
  12. 'assets_path' => '{assets_path}components/simplesearch/',
  13. ),
  14. ),
  15. 'ec06bde7ce9e2ceb3222b02ef9cbf7f3' =>
  16. array (
  17. 'criteria' =>
  18. array (
  19. 'key' => 'simplesearch.driver_class',
  20. ),
  21. 'object' =>
  22. array (
  23. 'key' => 'simplesearch.driver_class',
  24. 'value' => 'SimpleSearchDriverBasic',
  25. 'xtype' => 'textfield',
  26. 'namespace' => 'simplesearch',
  27. 'area' => 'Drivers',
  28. 'editedon' => NULL,
  29. ),
  30. ),
  31. 'cce671c5e6a128ef84657b263c52ca11' =>
  32. array (
  33. 'criteria' =>
  34. array (
  35. 'key' => 'simplesearch.driver_class_path',
  36. ),
  37. 'object' =>
  38. array (
  39. 'key' => 'simplesearch.driver_class_path',
  40. 'value' => '',
  41. 'xtype' => 'textfield',
  42. 'namespace' => 'simplesearch',
  43. 'area' => 'Drivers',
  44. 'editedon' => NULL,
  45. ),
  46. ),
  47. '9fe0735d2ac62949ee10ec3a568d00e4' =>
  48. array (
  49. 'criteria' =>
  50. array (
  51. 'key' => 'simplesearch.driver_db_specific',
  52. ),
  53. 'object' =>
  54. array (
  55. 'key' => 'simplesearch.driver_db_specific',
  56. 'value' => '1',
  57. 'xtype' => 'combo-boolean',
  58. 'namespace' => 'simplesearch',
  59. 'area' => 'Drivers',
  60. 'editedon' => NULL,
  61. ),
  62. ),
  63. '795fc404c44dc49f4da8c5d2ef87c9c1' =>
  64. array (
  65. 'criteria' =>
  66. array (
  67. 'key' => 'simplesearch.autosuggest_tv',
  68. ),
  69. 'object' =>
  70. array (
  71. 'key' => 'simplesearch.autosuggest_tv',
  72. 'value' => 'simpleSearchAutoSuggestions',
  73. 'xtype' => 'textfield',
  74. 'namespace' => 'simplesearch',
  75. 'area' => 'Autosuggest',
  76. 'editedon' => NULL,
  77. ),
  78. ),
  79. 'ccdfeb0db27480f94aae91787e1ca55a' =>
  80. array (
  81. 'criteria' =>
  82. array (
  83. 'category' => 'SimpleSearch',
  84. ),
  85. 'object' =>
  86. array (
  87. 'id' => 40,
  88. 'parent' => 0,
  89. 'category' => 'SimpleSearch',
  90. 'rank' => 0,
  91. ),
  92. ),
  93. 'bd15e0c6180f37dd5623176fe6bb7071' =>
  94. array (
  95. 'criteria' =>
  96. array (
  97. 'name' => 'SearchForm',
  98. ),
  99. 'object' =>
  100. array (
  101. 'id' => 102,
  102. 'source' => 0,
  103. 'property_preprocess' => 0,
  104. 'name' => 'SearchForm',
  105. 'description' => '',
  106. 'editor_type' => 0,
  107. 'category' => 40,
  108. 'cache_type' => 0,
  109. 'snippet' => '<form class="simplesearch-search-form" action="[[~[[+landing]]]]" method="[[+method]]">
  110. <fieldset>
  111. <label for="[[+searchIndex]]">[[%simplesearch.search? &namespace=`simplesearch` &topic=`default`]]</label>
  112. <input class="form-control" type="text" name="[[+searchIndex]]" id="[[+searchIndex]]" value="[[+searchValue]]" placeholder="Search for..." />
  113. <input type="hidden" name="id" value="[[+landing]]" />
  114. <input class="btn-sm btn-secondary" type="submit" value="[[%simplesearch.search? &namespace=`simplesearch` &topic=`default`]]" />
  115. </fieldset>
  116. </form>',
  117. 'locked' => 0,
  118. 'properties' => 'a:0:{}',
  119. 'static' => 0,
  120. 'static_file' => '',
  121. 'content' => '<form class="simplesearch-search-form" action="[[~[[+landing]]]]" method="[[+method]]">
  122. <fieldset>
  123. <label for="[[+searchIndex]]">[[%simplesearch.search? &namespace=`simplesearch` &topic=`default`]]</label>
  124. <input class="form-control" type="text" name="[[+searchIndex]]" id="[[+searchIndex]]" value="[[+searchValue]]" placeholder="Search for..." />
  125. <input type="hidden" name="id" value="[[+landing]]" />
  126. <input class="btn-sm btn-secondary" type="submit" value="[[%simplesearch.search? &namespace=`simplesearch` &topic=`default`]]" />
  127. </fieldset>
  128. </form>',
  129. ),
  130. ),
  131. '6dace06a63419d8d8f6ce9d137f3aa8c' =>
  132. array (
  133. 'criteria' =>
  134. array (
  135. 'name' => 'SearchNoResults',
  136. ),
  137. 'object' =>
  138. array (
  139. 'id' => 103,
  140. 'source' => 0,
  141. 'property_preprocess' => 0,
  142. 'name' => 'SearchNoResults',
  143. 'description' => '',
  144. 'editor_type' => 0,
  145. 'category' => 40,
  146. 'cache_type' => 0,
  147. 'snippet' => '[[%simplesearch.no_results? &query=`[[+query]]`]]',
  148. 'locked' => 0,
  149. 'properties' => 'a:0:{}',
  150. 'static' => 0,
  151. 'static_file' => '',
  152. 'content' => '[[%simplesearch.no_results? &query=`[[+query]]`]]',
  153. ),
  154. ),
  155. '45fd9e5f94bc147cdfb1d62d28b037c9' =>
  156. array (
  157. 'criteria' =>
  158. array (
  159. 'name' => 'SearchResults',
  160. ),
  161. 'object' =>
  162. array (
  163. 'id' => 104,
  164. 'source' => 0,
  165. 'property_preprocess' => 0,
  166. 'name' => 'SearchResults',
  167. 'description' => '',
  168. 'editor_type' => 0,
  169. 'category' => 40,
  170. 'cache_type' => 0,
  171. 'snippet' => '<p class="simplesearch-results">[[+resultInfo]]</p>
  172. <div class="simplesearch-paging">
  173. <span class="simplesearch-result-pages">[[%simplesearch.result_pages? &namespace=`simplesearch` &topic=`default`]]</span>[[+paging]]
  174. </div>
  175. <div class="simplesearch-results-list">
  176. [[+results]]
  177. </div>
  178. <div class="simplesearch-paging">
  179. <span class="simplesearch-result-pages">[[%simplesearch.result_pages? &namespace=`simplesearch` &topic=`default`]]</span>
  180. [[+paging]]
  181. </div>',
  182. 'locked' => 0,
  183. 'properties' => 'a:0:{}',
  184. 'static' => 0,
  185. 'static_file' => '',
  186. 'content' => '<p class="simplesearch-results">[[+resultInfo]]</p>
  187. <div class="simplesearch-paging">
  188. <span class="simplesearch-result-pages">[[%simplesearch.result_pages? &namespace=`simplesearch` &topic=`default`]]</span>[[+paging]]
  189. </div>
  190. <div class="simplesearch-results-list">
  191. [[+results]]
  192. </div>
  193. <div class="simplesearch-paging">
  194. <span class="simplesearch-result-pages">[[%simplesearch.result_pages? &namespace=`simplesearch` &topic=`default`]]</span>
  195. [[+paging]]
  196. </div>',
  197. ),
  198. ),
  199. 'd3a26a5447593a2ccc6dd05b6f96a509' =>
  200. array (
  201. 'criteria' =>
  202. array (
  203. 'name' => 'SearchResult',
  204. ),
  205. 'object' =>
  206. array (
  207. 'id' => 105,
  208. 'source' => 0,
  209. 'property_preprocess' => 0,
  210. 'name' => 'SearchResult',
  211. 'description' => '',
  212. 'editor_type' => 0,
  213. 'category' => 40,
  214. 'cache_type' => 0,
  215. 'snippet' => '<div class="simplesearch-result">
  216. <h3>[[+idx]]. <a href="[[+link:is=``:then=`[[~[[+id]]]]`:else=`[[+link]]`]]" title="[[+longtitle]]">[[+pagetitle]]</a></h3>
  217. <div class="extract">
  218. <p>[[+extract]]</p>
  219. </div>
  220. </div>',
  221. 'locked' => 0,
  222. 'properties' => 'a:0:{}',
  223. 'static' => 0,
  224. 'static_file' => '',
  225. 'content' => '<div class="simplesearch-result">
  226. <h3>[[+idx]]. <a href="[[+link:is=``:then=`[[~[[+id]]]]`:else=`[[+link]]`]]" title="[[+longtitle]]">[[+pagetitle]]</a></h3>
  227. <div class="extract">
  228. <p>[[+extract]]</p>
  229. </div>
  230. </div>',
  231. ),
  232. ),
  233. '828fc6b1f94f467886f97b6a3a8b4e1d' =>
  234. array (
  235. 'criteria' =>
  236. array (
  237. 'name' => 'PageLink',
  238. ),
  239. 'object' =>
  240. array (
  241. 'id' => 106,
  242. 'source' => 0,
  243. 'property_preprocess' => 0,
  244. 'name' => 'PageLink',
  245. 'description' => '',
  246. 'editor_type' => 0,
  247. 'category' => 40,
  248. 'cache_type' => 0,
  249. 'snippet' => '<span class="simplesearch-page">
  250. <a href="[[+link]]">[[+text]]</a>
  251. </span>',
  252. 'locked' => 0,
  253. 'properties' => 'a:0:{}',
  254. 'static' => 0,
  255. 'static_file' => '',
  256. 'content' => '<span class="simplesearch-page">
  257. <a href="[[+link]]">[[+text]]</a>
  258. </span>',
  259. ),
  260. ),
  261. '059a536091982fab6fa24c0f0ae90c9e' =>
  262. array (
  263. 'criteria' =>
  264. array (
  265. 'name' => 'CurrentPageLink',
  266. ),
  267. 'object' =>
  268. array (
  269. 'id' => 107,
  270. 'source' => 0,
  271. 'property_preprocess' => 0,
  272. 'name' => 'CurrentPageLink',
  273. 'description' => '',
  274. 'editor_type' => 0,
  275. 'category' => 40,
  276. 'cache_type' => 0,
  277. 'snippet' => '<span class="simplesearch-page simplesearch-current-page">[[+text]]</span>',
  278. 'locked' => 0,
  279. 'properties' => 'a:0:{}',
  280. 'static' => 0,
  281. 'static_file' => '',
  282. 'content' => '<span class="simplesearch-page simplesearch-current-page">[[+text]]</span>',
  283. ),
  284. ),
  285. '1a94d5d43d18393c15fff257947fa5a0' =>
  286. array (
  287. 'criteria' =>
  288. array (
  289. 'name' => 'SearchResultLi',
  290. ),
  291. 'object' =>
  292. array (
  293. 'id' => 108,
  294. 'source' => 0,
  295. 'property_preprocess' => 0,
  296. 'name' => 'SearchResultLi',
  297. 'description' => '',
  298. 'editor_type' => 0,
  299. 'category' => 40,
  300. 'cache_type' => 0,
  301. 'snippet' => '<li>
  302. <a href="[[~[[+id]]]]" title="[[+longtitle]]">[[+pagetitle]]</a>
  303. </li>',
  304. 'locked' => 0,
  305. 'properties' => 'a:0:{}',
  306. 'static' => 0,
  307. 'static_file' => '',
  308. 'content' => '<li>
  309. <a href="[[~[[+id]]]]" title="[[+longtitle]]">[[+pagetitle]]</a>
  310. </li>',
  311. ),
  312. ),
  313. 'dca659985fa6446281ae0ea934dce1e1' =>
  314. array (
  315. 'criteria' =>
  316. array (
  317. 'name' => 'SimpleSearch',
  318. ),
  319. 'object' =>
  320. array (
  321. 'id' => 110,
  322. 'source' => 0,
  323. 'property_preprocess' => 0,
  324. 'name' => 'SimpleSearch',
  325. 'description' => '',
  326. 'editor_type' => 0,
  327. 'category' => 40,
  328. 'cache_type' => 0,
  329. 'snippet' => '/**
  330. * SimpleSearch snippet
  331. *
  332. * @var modX $modx
  333. * @var array $scriptProperties
  334. * @package simplesearch
  335. */
  336. require_once $modx->getOption(
  337. \'simplesearch.core_path\',
  338. null,
  339. $modx->getOption(\'core_path\') . \'components/simplesearch/\'
  340. ) . \'model/simplesearch/simplesearch.class.php\';
  341. $search = new SimpleSearch($modx, $scriptProperties);
  342. /* Find search index and toplaceholder setting */
  343. $searchIndex = $modx->getOption(\'searchIndex\', $scriptProperties, \'search\');
  344. $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
  345. $noResultsTpl = $modx->getOption(\'noResultsTpl\', $scriptProperties, \'SearchNoResults\');
  346. /* Get search string */
  347. if (empty($_REQUEST[$searchIndex])) {
  348. $output = $search->getChunk($noResultsTpl, array(
  349. \'query\' => \'\',
  350. ));
  351. return $search->output($output, $toPlaceholder);
  352. }
  353. $searchString = $search->parseSearchString($_REQUEST[$searchIndex]);
  354. if (!$searchString) {
  355. $output = $search->getChunk($noResultsTpl, array(
  356. \'query\' => $searchString,
  357. ));
  358. return $search->output($output, $toPlaceholder);
  359. }
  360. /* Setup default properties. */
  361. $tpl = $modx->getOption(\'tpl\', $scriptProperties, \'SearchResult\');
  362. $containerTpl = $modx->getOption(\'containerTpl\', $scriptProperties, \'SearchResults\');
  363. $showExtract = $modx->getOption(\'showExtract\', $scriptProperties, true);
  364. $extractSource = $modx->getOption(\'extractSource\', $scriptProperties, \'content\');
  365. $extractLength = $modx->getOption(\'extractLength\', $scriptProperties, 200);
  366. $extractEllipsis = $modx->getOption(\'extractEllipsis\', $scriptProperties, \'...\');
  367. $highlightResults = $modx->getOption(\'highlightResults\', $scriptProperties, true);
  368. $highlightClass = $modx->getOption(\'highlightClass\', $scriptProperties, \'simplesearch-highlight\');
  369. $highlightTag = $modx->getOption(\'highlightTag\', $scriptProperties, \'span\');
  370. $perPage = $modx->getOption(\'perPage\', $scriptProperties, 10);
  371. $pagingSeparator = $modx->getOption(\'pagingSeparator\', $scriptProperties, \' | \');
  372. $placeholderPrefix = $modx->getOption(\'placeholderPrefix\', $scriptProperties, \'simplesearch.\');
  373. $includeTVs = $modx->getOption(\'includeTVs\', $scriptProperties, \'\');
  374. $processTVs = $modx->getOption(\'processTVs\', $scriptProperties, \'\');
  375. $tvPrefix = $modx->getOption(\'tvPrefix\', $scriptProperties, \'\');
  376. $offsetIndex = $modx->getOption(\'offsetIndex\', $scriptProperties, \'simplesearch_offset\');
  377. $idx = isset($_REQUEST[$offsetIndex]) ? (int) $_REQUEST[$offsetIndex] + 1 : 1;
  378. $postHooks = $modx->getOption(\'postHooks\', $scriptProperties, \'\');
  379. $activeFacet = $modx->getOption(\'facet\',$_REQUEST,$modx->getOption(\'activeFacet\', $scriptProperties, \'default\'));
  380. $activeFacet = $modx->sanitizeString($activeFacet);
  381. $facetLimit = $modx->getOption(\'facetLimit\', $scriptProperties, 5);
  382. $outputSeparator = $modx->getOption(\'outputSeparator\', $scriptProperties, "\\n");
  383. $addSearchToLink = (int) $modx->getOption(\'addSearchToLink\', $scriptProperties, 0);
  384. $searchInLinkName = $modx->getOption(\'searchInLinkName\', $scriptProperties, \'search\');
  385. /* Get results */
  386. $response = $search->getSearchResults($searchString, $scriptProperties);
  387. $placeholders = array(\'query\' => $searchString);
  388. $resultsTpl = array(\'default\' => array(\'results\' => array(), \'total\' => $response[\'total\']));
  389. if (!empty($response[\'results\'])) {
  390. /* iterate through search results */
  391. foreach ($response[\'results\'] as $resourceArray) {
  392. $resourceArray[\'idx\'] = $idx;
  393. if (empty($resourceArray[\'link\'])) {
  394. $ctx = !empty($resourceArray[\'context_key\']) ? $resourceArray[\'context_key\'] : $modx->context->get(\'key\');
  395. $args = \'\';
  396. if ($addSearchToLink) {
  397. $args = array($searchInLinkName => $searchString);
  398. }
  399. $resourceArray[\'link\'] = $modx->makeUrl($resourceArray[\'id\'], $ctx, $args);
  400. }
  401. if ($showExtract) {
  402. $extract = $searchString;
  403. if (array_key_exists($extractSource, $resourceArray)) {
  404. $text = $resourceArray[$extractSource];
  405. } else {
  406. $text = $modx->runSnippet($extractSource, $resourceArray);
  407. }
  408. $extract = $search->createExtract($text,$extractLength,$extract,$extractEllipsis);
  409. /* Cleanup extract */
  410. $extract = strip_tags(preg_replace("#\\<!--(.*?)--\\>#si", \'\', $extract));
  411. $extract = preg_replace("#\\[\\[(.*?)\\]\\]#si", \'\', $extract);
  412. $extract = str_replace(array(\'[[\',\']]\'), \'\', $extract);
  413. $resourceArray[\'extract\'] = !empty($highlightResults) ? $search->addHighlighting($extract, $highlightClass, $highlightTag) : $extract;
  414. }
  415. $resultsTpl[\'default\'][\'results\'][] = $search->getChunk($tpl, $resourceArray);
  416. $idx++;
  417. }
  418. }
  419. /* Load postHooks to get faceted results. */
  420. if (!empty($postHooks)) {
  421. $limit = !empty($facetLimit) ? $facetLimit : $perPage;
  422. $search->loadHooks(\'post\');
  423. $search->postHooks->loadMultiple($postHooks, $response[\'results\'],
  424. array(
  425. \'hooks\' => $postHooks,
  426. \'search\' => $searchString,
  427. \'offset\' => !empty($_GET[$offsetIndex]) ? (int) $_GET[$offsetIndex] : 0,
  428. \'limit\' => $limit,
  429. \'perPage\' => $limit,
  430. )
  431. );
  432. if (!empty($search->postHooks->facets)) {
  433. foreach ($search->postHooks->facets as $facetKey => $facetResults) {
  434. if (empty($resultsTpl[$facetKey])) {
  435. $resultsTpl[$facetKey] = array();
  436. $resultsTpl[$facetKey][\'total\'] = $facetResults[\'total\'];
  437. $resultsTpl[$facetKey][\'results\'] = array();
  438. } else {
  439. $resultsTpl[$facetKey][\'total\'] = $resultsTpl[$facetKey][\'total\'] = $facetResults[\'total\'];
  440. }
  441. $idx = !empty($resultsTpl[$facetKey]) ? count($resultsTpl[$facetKey][\'results\']) + 1 : 1;
  442. foreach ($facetResults[\'results\'] as $r) {
  443. $r[\'idx\'] = $idx;
  444. $fTpl = !empty($scriptProperties[\'tpl\' . $facetKey]) ? $scriptProperties[\'tpl\' . $facetKey] : $tpl;
  445. $resultsTpl[$facetKey][\'results\'][] = $search->getChunk($fTpl,$r);
  446. $idx++;
  447. }
  448. }
  449. }
  450. }
  451. /* Set faceted results to placeholders for easy result positioning. */
  452. $output = array();
  453. foreach ($resultsTpl as $facetKey => $facetResults) {
  454. $resultSet = implode($outputSeparator,$facetResults[\'results\']);
  455. $placeholders[$facetKey.\'.results\'] = $resultSet;
  456. $placeholders[$facetKey.\'.total\'] = !empty($facetResults[\'total\']) ? $facetResults[\'total\'] : 0;
  457. $placeholders[$facetKey.\'.key\'] = $facetKey;
  458. }
  459. $placeholders[\'results\'] = $placeholders[$activeFacet . \'.results\']; /* Set active facet results. */
  460. $placeholders[\'total\'] = !empty($resultsTpl[$activeFacet][\'total\']) ? $resultsTpl[$activeFacet][\'total\'] : 0;
  461. $placeholders[\'page\'] = isset($_REQUEST[$offsetIndex]) ? ceil((int) $_REQUEST[$offsetIndex] / $perPage) + 1 : 1;
  462. $placeholders[\'pageCount\'] = !empty($resultsTpl[$activeFacet][\'total\']) ? ceil($resultsTpl[$activeFacet][\'total\'] / $perPage) : 1;
  463. if (!empty($response[\'results\'])) {
  464. /* add results found message */
  465. $placeholders[\'resultInfo\'] = $modx->lexicon(\'simplesearch.results_found\', array(
  466. \'count\' => $placeholders[\'total\'],
  467. \'text\' => !empty($highlightResults) ? $search->addHighlighting($searchString, $highlightClass, $highlightTag) : $searchString,
  468. ));
  469. /* If perPage set to >0, add paging */
  470. if ($perPage > 0) {
  471. $placeholders[\'paging\'] = $search->getPagination($searchString,$perPage,$pagingSeparator,$placeholders[\'total\']);
  472. }
  473. }
  474. $placeholders[\'query\'] = $searchString;
  475. $placeholders[\'facet\'] = $activeFacet;
  476. /* output */
  477. $modx->setPlaceholder($placeholderPrefix . \'query\', $searchString);
  478. $modx->setPlaceholder($placeholderPrefix . \'count\', $response[\'total\']);
  479. $modx->setPlaceholders($placeholders, $placeholderPrefix);
  480. if (empty($response[\'results\'])) {
  481. $output = $search->getChunk($noResultsTpl, array(
  482. \'query\' => $searchString,
  483. ));
  484. } else {
  485. $output = $search->getChunk($containerTpl, $placeholders);
  486. }
  487. return $search->output($output, $toPlaceholder);',
  488. 'locked' => 0,
  489. 'properties' => 'a:43:{s:3:"tpl";a:7:{s:4:"name";s:3:"tpl";s:4:"desc";s:21:"simplesearch.tpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:12:"SearchResult";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:12:"containerTpl";a:7:{s:4:"name";s:12:"containerTpl";s:4:"desc";s:30:"simplesearch.containertpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:13:"SearchResults";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"useAllWords";a:7:{s:4:"name";s:11:"useAllWords";s:4:"desc";s:29:"simplesearch.useallwords_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:0;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:8:"maxWords";a:7:{s:4:"name";s:8:"maxWords";s:4:"desc";s:26:"simplesearch.maxwords_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:7;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:8:"minChars";a:7:{s:4:"name";s:8:"minChars";s:4:"desc";s:26:"simplesearch.minchars_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:3;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"searchStyle";a:7:{s:4:"name";s:11:"searchStyle";s:4:"desc";s:29:"simplesearch.searchstyle_desc";s:4:"type";s:4:"list";s:7:"options";a:2:{i:0;a:2:{s:4:"text";s:20:"simplesearch.partial";s:5:"value";s:7:"partial";}i:1;a:2:{s:4:"text";s:18:"simplesearch.match";s:5:"value";s:5:"match";}}s:5:"value";s:7:"partial";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:7:"perPage";a:7:{s:4:"name";s:7:"perPage";s:4:"desc";s:25:"simplesearch.perpage_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:10;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"showExtract";a:7:{s:4:"name";s:11:"showExtract";s:4:"desc";s:29:"simplesearch.showextract_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:1;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:13:"extractLength";a:7:{s:4:"name";s:13:"extractLength";s:4:"desc";s:31:"simplesearch.extractlength_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:200;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:15:"extractEllipsis";a:7:{s:4:"name";s:15:"extractEllipsis";s:4:"desc";s:33:"simplesearch.extractellipsis_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:3:"...";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:10:"includeTVs";a:7:{s:4:"name";s:10:"includeTVs";s:4:"desc";s:28:"simplesearch.includetvs_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:0;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:10:"processTVs";a:7:{s:4:"name";s:10:"processTVs";s:4:"desc";s:28:"simplesearch.processtvs_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:0;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:16:"highlightResults";a:7:{s:4:"name";s:16:"highlightResults";s:4:"desc";s:34:"simplesearch.highlightresults_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:1;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:14:"highlightClass";a:7:{s:4:"name";s:14:"highlightClass";s:4:"desc";s:32:"simplesearch.highlightclass_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:22:"simplesearch-highlight";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:12:"highlightTag";a:7:{s:4:"name";s:12:"highlightTag";s:4:"desc";s:30:"simplesearch.highlighttag_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:4:"span";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:9:"pageLimit";a:7:{s:4:"name";s:9:"pageLimit";s:4:"desc";s:27:"simplesearch.pagelimit_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:1:"0";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:7:"pageTpl";a:7:{s:4:"name";s:7:"pageTpl";s:4:"desc";s:25:"simplesearch.pagetpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:8:"PageLink";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:12:"pageFirstTpl";a:7:{s:4:"name";s:12:"pageFirstTpl";s:4:"desc";s:30:"simplesearch.pagefirsttpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"pageLastTpl";a:7:{s:4:"name";s:11:"pageLastTpl";s:4:"desc";s:29:"simplesearch.pagelasttpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"pagePrevTpl";a:7:{s:4:"name";s:11:"pagePrevTpl";s:4:"desc";s:29:"simplesearch.pageprevtpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"pageNextTpl";a:7:{s:4:"name";s:11:"pageNextTpl";s:4:"desc";s:29:"simplesearch.pagenexttpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:14:"currentPageTpl";a:7:{s:4:"name";s:14:"currentPageTpl";s:4:"desc";s:32:"simplesearch.currentpagetpl_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:15:"CurrentPageLink";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:15:"pagingSeparator";a:7:{s:4:"name";s:15:"pagingSeparator";s:4:"desc";s:33:"simplesearch.pagingseparator_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:3:" | ";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:3:"ids";a:7:{s:4:"name";s:3:"ids";s:4:"desc";s:21:"simplesearch.ids_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:6:"idType";a:7:{s:4:"name";s:6:"idType";s:4:"desc";s:24:"simplesearch.idtype_desc";s:4:"type";s:4:"list";s:7:"options";a:2:{i:0;a:2:{s:4:"text";s:20:"simplesearch.parents";s:5:"value";s:7:"parents";}i:1;a:2:{s:4:"text";s:22:"simplesearch.documents";s:5:"value";s:9:"documents";}}s:5:"value";s:7:"parents";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:7:"exclude";a:7:{s:4:"name";s:7:"exclude";s:4:"desc";s:25:"simplesearch.exclude_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:5:"depth";a:7:{s:4:"name";s:5:"depth";s:4:"desc";s:23:"simplesearch.depth_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:10;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:8:"hideMenu";a:7:{s:4:"name";s:8:"hideMenu";s:4:"desc";s:26:"simplesearch.hidemenu_desc";s:4:"type";s:9:"textfield";s:7:"options";a:3:{i:0;a:2:{s:4:"text";s:29:"simplesearch.hidemenu_visible";s:5:"value";i:0;}i:1;a:2:{s:4:"text";s:28:"simplesearch.hidemenu_hidden";s:5:"value";i:1;}i:2;a:2:{s:4:"text";s:26:"simplesearch.hidemenu_both";s:5:"value";i:2;}}s:5:"value";i:2;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:8:"contexts";a:7:{s:4:"name";s:8:"contexts";s:4:"desc";s:26:"simplesearch.contexts_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"searchIndex";a:7:{s:4:"name";s:11:"searchIndex";s:4:"desc";s:29:"simplesearch.searchindex_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:6:"search";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"offsetIndex";a:7:{s:4:"name";s:11:"offsetIndex";s:4:"desc";s:29:"simplesearch.offsetindex_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:19:"simplesearch_offset";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:17:"placeholderPrefix";a:7:{s:4:"name";s:17:"placeholderPrefix";s:4:"desc";s:35:"simplesearch.placeholderprefix_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:13:"simplesearch.";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:13:"toPlaceholder";a:7:{s:4:"name";s:13:"toPlaceholder";s:4:"desc";s:31:"simplesearch.toplaceholder_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:8:"andTerms";a:7:{s:4:"name";s:8:"andTerms";s:4:"desc";s:26:"simplesearch.andterms_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:1;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:13:"matchWildcard";a:7:{s:4:"name";s:13:"matchWildcard";s:4:"desc";s:31:"simplesearch.matchwildcard_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";s:0:"";s:5:"value";b:1;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:9:"docFields";a:7:{s:4:"name";s:9:"docFields";s:4:"desc";s:27:"simplesearch.docfields_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:55:"pagetitle,longtitle,alias,description,introtext,content";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:12:"fieldPotency";a:7:{s:4:"name";s:12:"fieldPotency";s:4:"desc";s:30:"simplesearch.fieldpotency_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:9:"urlScheme";a:7:{s:4:"name";s:9:"urlScheme";s:4:"desc";s:27:"simplesearch.urlscheme_desc";s:4:"type";s:4:"list";s:7:"options";a:3:{i:0;a:2:{s:4:"text";s:25:"simplesearch.url_relative";s:5:"value";i:-1;}i:1;a:2:{s:4:"text";s:25:"simplesearch.url_absolute";s:5:"value";s:3:"abs";}i:2;a:2:{s:4:"text";s:21:"simplesearch.url_full";s:5:"value";s:4:"full";}}s:5:"value";i:-1;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:9:"postHooks";a:7:{s:4:"name";s:9:"postHooks";s:4:"desc";s:27:"simplesearch.posthooks_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"activeFacet";a:7:{s:4:"name";s:11:"activeFacet";s:4:"desc";s:29:"simplesearch.activefacet_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:7:"default";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:10:"facetLimit";a:7:{s:4:"name";s:10:"facetLimit";s:4:"desc";s:28:"simplesearch.facetlimit_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";i:5;s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:6:"sortBy";a:7:{s:4:"name";s:6:"sortBy";s:4:"desc";s:24:"simplesearch.sortby_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:7:"sortDir";a:7:{s:4:"name";s:7:"sortDir";s:4:"desc";s:25:"simplesearch.sortdir_desc";s:4:"type";s:4:"list";s:7:"options";a:2:{i:0;a:2:{s:4:"text";s:22:"simplesearch.ascending";s:5:"value";s:3:"ASC";}i:1;a:2:{s:4:"text";s:23:"simplesearch.descending";s:5:"value";s:4:"DESC";}}s:5:"value";s:4:"DESC";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}}',
  490. 'moduleguid' => '',
  491. 'static' => 0,
  492. 'static_file' => '',
  493. 'content' => '/**
  494. * SimpleSearch snippet
  495. *
  496. * @var modX $modx
  497. * @var array $scriptProperties
  498. * @package simplesearch
  499. */
  500. require_once $modx->getOption(
  501. \'simplesearch.core_path\',
  502. null,
  503. $modx->getOption(\'core_path\') . \'components/simplesearch/\'
  504. ) . \'model/simplesearch/simplesearch.class.php\';
  505. $search = new SimpleSearch($modx, $scriptProperties);
  506. /* Find search index and toplaceholder setting */
  507. $searchIndex = $modx->getOption(\'searchIndex\', $scriptProperties, \'search\');
  508. $toPlaceholder = $modx->getOption(\'toPlaceholder\', $scriptProperties, false);
  509. $noResultsTpl = $modx->getOption(\'noResultsTpl\', $scriptProperties, \'SearchNoResults\');
  510. /* Get search string */
  511. if (empty($_REQUEST[$searchIndex])) {
  512. $output = $search->getChunk($noResultsTpl, array(
  513. \'query\' => \'\',
  514. ));
  515. return $search->output($output, $toPlaceholder);
  516. }
  517. $searchString = $search->parseSearchString($_REQUEST[$searchIndex]);
  518. if (!$searchString) {
  519. $output = $search->getChunk($noResultsTpl, array(
  520. \'query\' => $searchString,
  521. ));
  522. return $search->output($output, $toPlaceholder);
  523. }
  524. /* Setup default properties. */
  525. $tpl = $modx->getOption(\'tpl\', $scriptProperties, \'SearchResult\');
  526. $containerTpl = $modx->getOption(\'containerTpl\', $scriptProperties, \'SearchResults\');
  527. $showExtract = $modx->getOption(\'showExtract\', $scriptProperties, true);
  528. $extractSource = $modx->getOption(\'extractSource\', $scriptProperties, \'content\');
  529. $extractLength = $modx->getOption(\'extractLength\', $scriptProperties, 200);
  530. $extractEllipsis = $modx->getOption(\'extractEllipsis\', $scriptProperties, \'...\');
  531. $highlightResults = $modx->getOption(\'highlightResults\', $scriptProperties, true);
  532. $highlightClass = $modx->getOption(\'highlightClass\', $scriptProperties, \'simplesearch-highlight\');
  533. $highlightTag = $modx->getOption(\'highlightTag\', $scriptProperties, \'span\');
  534. $perPage = $modx->getOption(\'perPage\', $scriptProperties, 10);
  535. $pagingSeparator = $modx->getOption(\'pagingSeparator\', $scriptProperties, \' | \');
  536. $placeholderPrefix = $modx->getOption(\'placeholderPrefix\', $scriptProperties, \'simplesearch.\');
  537. $includeTVs = $modx->getOption(\'includeTVs\', $scriptProperties, \'\');
  538. $processTVs = $modx->getOption(\'processTVs\', $scriptProperties, \'\');
  539. $tvPrefix = $modx->getOption(\'tvPrefix\', $scriptProperties, \'\');
  540. $offsetIndex = $modx->getOption(\'offsetIndex\', $scriptProperties, \'simplesearch_offset\');
  541. $idx = isset($_REQUEST[$offsetIndex]) ? (int) $_REQUEST[$offsetIndex] + 1 : 1;
  542. $postHooks = $modx->getOption(\'postHooks\', $scriptProperties, \'\');
  543. $activeFacet = $modx->getOption(\'facet\',$_REQUEST,$modx->getOption(\'activeFacet\', $scriptProperties, \'default\'));
  544. $activeFacet = $modx->sanitizeString($activeFacet);
  545. $facetLimit = $modx->getOption(\'facetLimit\', $scriptProperties, 5);
  546. $outputSeparator = $modx->getOption(\'outputSeparator\', $scriptProperties, "\\n");
  547. $addSearchToLink = (int) $modx->getOption(\'addSearchToLink\', $scriptProperties, 0);
  548. $searchInLinkName = $modx->getOption(\'searchInLinkName\', $scriptProperties, \'search\');
  549. /* Get results */
  550. $response = $search->getSearchResults($searchString, $scriptProperties);
  551. $placeholders = array(\'query\' => $searchString);
  552. $resultsTpl = array(\'default\' => array(\'results\' => array(), \'total\' => $response[\'total\']));
  553. if (!empty($response[\'results\'])) {
  554. /* iterate through search results */
  555. foreach ($response[\'results\'] as $resourceArray) {
  556. $resourceArray[\'idx\'] = $idx;
  557. if (empty($resourceArray[\'link\'])) {
  558. $ctx = !empty($resourceArray[\'context_key\']) ? $resourceArray[\'context_key\'] : $modx->context->get(\'key\');
  559. $args = \'\';
  560. if ($addSearchToLink) {
  561. $args = array($searchInLinkName => $searchString);
  562. }
  563. $resourceArray[\'link\'] = $modx->makeUrl($resourceArray[\'id\'], $ctx, $args);
  564. }
  565. if ($showExtract) {
  566. $extract = $searchString;
  567. if (array_key_exists($extractSource, $resourceArray)) {
  568. $text = $resourceArray[$extractSource];
  569. } else {
  570. $text = $modx->runSnippet($extractSource, $resourceArray);
  571. }
  572. $extract = $search->createExtract($text,$extractLength,$extract,$extractEllipsis);
  573. /* Cleanup extract */
  574. $extract = strip_tags(preg_replace("#\\<!--(.*?)--\\>#si", \'\', $extract));
  575. $extract = preg_replace("#\\[\\[(.*?)\\]\\]#si", \'\', $extract);
  576. $extract = str_replace(array(\'[[\',\']]\'), \'\', $extract);
  577. $resourceArray[\'extract\'] = !empty($highlightResults) ? $search->addHighlighting($extract, $highlightClass, $highlightTag) : $extract;
  578. }
  579. $resultsTpl[\'default\'][\'results\'][] = $search->getChunk($tpl, $resourceArray);
  580. $idx++;
  581. }
  582. }
  583. /* Load postHooks to get faceted results. */
  584. if (!empty($postHooks)) {
  585. $limit = !empty($facetLimit) ? $facetLimit : $perPage;
  586. $search->loadHooks(\'post\');
  587. $search->postHooks->loadMultiple($postHooks, $response[\'results\'],
  588. array(
  589. \'hooks\' => $postHooks,
  590. \'search\' => $searchString,
  591. \'offset\' => !empty($_GET[$offsetIndex]) ? (int) $_GET[$offsetIndex] : 0,
  592. \'limit\' => $limit,
  593. \'perPage\' => $limit,
  594. )
  595. );
  596. if (!empty($search->postHooks->facets)) {
  597. foreach ($search->postHooks->facets as $facetKey => $facetResults) {
  598. if (empty($resultsTpl[$facetKey])) {
  599. $resultsTpl[$facetKey] = array();
  600. $resultsTpl[$facetKey][\'total\'] = $facetResults[\'total\'];
  601. $resultsTpl[$facetKey][\'results\'] = array();
  602. } else {
  603. $resultsTpl[$facetKey][\'total\'] = $resultsTpl[$facetKey][\'total\'] = $facetResults[\'total\'];
  604. }
  605. $idx = !empty($resultsTpl[$facetKey]) ? count($resultsTpl[$facetKey][\'results\']) + 1 : 1;
  606. foreach ($facetResults[\'results\'] as $r) {
  607. $r[\'idx\'] = $idx;
  608. $fTpl = !empty($scriptProperties[\'tpl\' . $facetKey]) ? $scriptProperties[\'tpl\' . $facetKey] : $tpl;
  609. $resultsTpl[$facetKey][\'results\'][] = $search->getChunk($fTpl,$r);
  610. $idx++;
  611. }
  612. }
  613. }
  614. }
  615. /* Set faceted results to placeholders for easy result positioning. */
  616. $output = array();
  617. foreach ($resultsTpl as $facetKey => $facetResults) {
  618. $resultSet = implode($outputSeparator,$facetResults[\'results\']);
  619. $placeholders[$facetKey.\'.results\'] = $resultSet;
  620. $placeholders[$facetKey.\'.total\'] = !empty($facetResults[\'total\']) ? $facetResults[\'total\'] : 0;
  621. $placeholders[$facetKey.\'.key\'] = $facetKey;
  622. }
  623. $placeholders[\'results\'] = $placeholders[$activeFacet . \'.results\']; /* Set active facet results. */
  624. $placeholders[\'total\'] = !empty($resultsTpl[$activeFacet][\'total\']) ? $resultsTpl[$activeFacet][\'total\'] : 0;
  625. $placeholders[\'page\'] = isset($_REQUEST[$offsetIndex]) ? ceil((int) $_REQUEST[$offsetIndex] / $perPage) + 1 : 1;
  626. $placeholders[\'pageCount\'] = !empty($resultsTpl[$activeFacet][\'total\']) ? ceil($resultsTpl[$activeFacet][\'total\'] / $perPage) : 1;
  627. if (!empty($response[\'results\'])) {
  628. /* add results found message */
  629. $placeholders[\'resultInfo\'] = $modx->lexicon(\'simplesearch.results_found\', array(
  630. \'count\' => $placeholders[\'total\'],
  631. \'text\' => !empty($highlightResults) ? $search->addHighlighting($searchString, $highlightClass, $highlightTag) : $searchString,
  632. ));
  633. /* If perPage set to >0, add paging */
  634. if ($perPage > 0) {
  635. $placeholders[\'paging\'] = $search->getPagination($searchString,$perPage,$pagingSeparator,$placeholders[\'total\']);
  636. }
  637. }
  638. $placeholders[\'query\'] = $searchString;
  639. $placeholders[\'facet\'] = $activeFacet;
  640. /* output */
  641. $modx->setPlaceholder($placeholderPrefix . \'query\', $searchString);
  642. $modx->setPlaceholder($placeholderPrefix . \'count\', $response[\'total\']);
  643. $modx->setPlaceholders($placeholders, $placeholderPrefix);
  644. if (empty($response[\'results\'])) {
  645. $output = $search->getChunk($noResultsTpl, array(
  646. \'query\' => $searchString,
  647. ));
  648. } else {
  649. $output = $search->getChunk($containerTpl, $placeholders);
  650. }
  651. return $search->output($output, $toPlaceholder);',
  652. ),
  653. ),
  654. '181d70bf60cb4771b3b88222ac682ebb' =>
  655. array (
  656. 'criteria' =>
  657. array (
  658. 'name' => 'SimpleSearchForm',
  659. ),
  660. 'object' =>
  661. array (
  662. 'id' => 111,
  663. 'source' => 0,
  664. 'property_preprocess' => 0,
  665. 'name' => 'SimpleSearchForm',
  666. 'description' => '',
  667. 'editor_type' => 0,
  668. 'category' => 40,
  669. 'cache_type' => 0,
  670. 'snippet' => '/**
  671. * Show the search form
  672. *
  673. * @var modX $modx
  674. * @var array $scriptProperties
  675. * @package simplesearch
  676. */
  677. require_once $modx->getOption(
  678. \'simplesearch.core_path\',
  679. null,
  680. $modx->getOption(\'core_path\') . \'components/simplesearch/\'
  681. ) . \'model/simplesearch/simplesearch.class.php\';
  682. $search = new SimpleSearch($modx, $scriptProperties);
  683. /* Setup default options. */
  684. $scriptProperties = array_merge(
  685. array(
  686. \'tpl\' => \'SearchForm\',
  687. \'method\' => \'get\',
  688. \'searchIndex\' => \'search\',
  689. \'toPlaceholder\' => false,
  690. \'landing\' => $modx->resource->get(\'id\'),
  691. ), $scriptProperties);
  692. if (empty($scriptProperties[\'landing\'])) {
  693. $scriptProperties[\'landing\'] = $modx->resource->get(\'id\');
  694. }
  695. /* If get value already exists, set it as default. */
  696. $searchValue = isset($_REQUEST[$scriptProperties[\'searchIndex\']]) ? $_REQUEST[$scriptProperties[\'searchIndex\']] : \'\';
  697. $searchValues = explode(\' \', $searchValue);
  698. array_map(array($modx, \'sanitizeString\'), $searchValues);
  699. $searchValue = implode(\' \', $searchValues);
  700. $placeholders = array(
  701. \'method\' => $scriptProperties[\'method\'],
  702. \'landing\' => $scriptProperties[\'landing\'],
  703. \'searchValue\' => strip_tags(htmlspecialchars($searchValue, ENT_QUOTES, \'UTF-8\')),
  704. \'searchIndex\' => $scriptProperties[\'searchIndex\'],
  705. );
  706. $output = $search->getChunk($scriptProperties[\'tpl\'], $placeholders);
  707. return $search->output($output, $scriptProperties[\'toPlaceholder\']);',
  708. 'locked' => 0,
  709. 'properties' => 'a:5:{s:3:"tpl";a:7:{s:4:"name";s:3:"tpl";s:4:"desc";s:26:"simplesearch.tpl_form_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:10:"SearchForm";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:7:"landing";a:7:{s:4:"name";s:7:"landing";s:4:"desc";s:25:"simplesearch.landing_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:11:"searchIndex";a:7:{s:4:"name";s:11:"searchIndex";s:4:"desc";s:29:"simplesearch.searchindex_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:6:"search";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:6:"method";a:7:{s:4:"name";s:6:"method";s:4:"desc";s:24:"simplesearch.method_desc";s:4:"type";s:13:"combo-boolean";s:7:"options";a:2:{i:0;a:2:{s:4:"text";s:16:"simplesearch.get";s:5:"value";s:3:"get";}i:1;a:2:{s:4:"text";s:17:"simplesearch.post";s:5:"value";s:4:"post";}}s:5:"value";s:3:"get";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}s:13:"toPlaceholder";a:7:{s:4:"name";s:13:"toPlaceholder";s:4:"desc";s:31:"simplesearch.toplaceholder_desc";s:4:"type";s:9:"textfield";s:7:"options";s:0:"";s:5:"value";s:0:"";s:7:"lexicon";s:23:"simplesearch:properties";s:4:"area";s:0:"";}}',
  710. 'moduleguid' => '',
  711. 'static' => 0,
  712. 'static_file' => '',
  713. 'content' => '/**
  714. * Show the search form
  715. *
  716. * @var modX $modx
  717. * @var array $scriptProperties
  718. * @package simplesearch
  719. */
  720. require_once $modx->getOption(
  721. \'simplesearch.core_path\',
  722. null,
  723. $modx->getOption(\'core_path\') . \'components/simplesearch/\'
  724. ) . \'model/simplesearch/simplesearch.class.php\';
  725. $search = new SimpleSearch($modx, $scriptProperties);
  726. /* Setup default options. */
  727. $scriptProperties = array_merge(
  728. array(
  729. \'tpl\' => \'SearchForm\',
  730. \'method\' => \'get\',
  731. \'searchIndex\' => \'search\',
  732. \'toPlaceholder\' => false,
  733. \'landing\' => $modx->resource->get(\'id\'),
  734. ), $scriptProperties);
  735. if (empty($scriptProperties[\'landing\'])) {
  736. $scriptProperties[\'landing\'] = $modx->resource->get(\'id\');
  737. }
  738. /* If get value already exists, set it as default. */
  739. $searchValue = isset($_REQUEST[$scriptProperties[\'searchIndex\']]) ? $_REQUEST[$scriptProperties[\'searchIndex\']] : \'\';
  740. $searchValues = explode(\' \', $searchValue);
  741. array_map(array($modx, \'sanitizeString\'), $searchValues);
  742. $searchValue = implode(\' \', $searchValues);
  743. $placeholders = array(
  744. \'method\' => $scriptProperties[\'method\'],
  745. \'landing\' => $scriptProperties[\'landing\'],
  746. \'searchValue\' => strip_tags(htmlspecialchars($searchValue, ENT_QUOTES, \'UTF-8\')),
  747. \'searchIndex\' => $scriptProperties[\'searchIndex\'],
  748. );
  749. $output = $search->getChunk($scriptProperties[\'tpl\'], $placeholders);
  750. return $search->output($output, $scriptProperties[\'toPlaceholder\']);',
  751. ),
  752. ),
  753. );