Cleanup: Updated copyright comments
[Packages/TYPO3.CMS.git] / typo3 / sysext / indexed_search / example / class.pihook.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2001-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Index search frontend example hook
29 *
30 * $Id$
31 *
32 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
33 */
34 /**
35 * [CLASS/FUNCTION INDEX of SCRIPT]
36 *
37 *
38 *
39 * 59: class tx_indexedsearch_pihook
40 * 72: function initialize_postProc()
41 * 95: function prepareResultRowTemplateData_postProc($tmplContent, $row, $headerOnly)
42 *
43 * TOTAL FUNCTIONS: 2
44 * (This index is automatically created/updated by the extension "extdeveval")
45 *
46 */
47
48
49
50 /**
51 * Index search frontend - EXAMPLE hook for alternative searching / display etc.
52 * Hooks are configured in ext_localconf.php as key => hook-reference pairs in $TYPO3_CONF_VARS['EXTCONF']['indexed_search']['pi1_hooks']. See example in ext_localconf.php for "indexed_search"
53 * Each hook must have an entry, the key must match the hook-key in class.tx_indexed_search.php and generally the key equals the function name in the hook object (a convension used)
54 *
55 * @package TYPO3
56 * @subpackage tx_indexedsearch
57 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
58 */
59 class tx_indexedsearch_pihook {
60
61 var $pObj; // Is set to a reference to the parent object, "pi1/class.indexedsearch.php"
62
63 /**
64 * EXAMPLE of how you can post process the initialized values in the frontend plugin.
65 * The example reverses the order of elements in the ranking selector box. You can modify other values like this or add / remove items.
66 *
67 * This hook is activated by this key / value pair in ext_localconf.php
68 * 'initialize_postProc' => 'EXT:indexed_search/example/class.pihook.php:&tx_indexedsearch_pihook',
69 *
70 * @return void
71 */
72 function initialize_postProc() {
73 $this->pObj->optValues['order'] = array_reverse($this->pObj->optValues['order']);
74 }
75
76 /**
77 * Providing an alternative search algorithm!
78 *
79 * @param array Array of search words
80 * @return array Array of first row, result rows, count
81 */
82 # function getResultRows($sWArr) {
83
84 # }
85
86 /**
87 * Example of how the content displayed in the result rows can be post processed before rendered into HTML.
88 * This example simply shows how the description field is wrapped in italics and the path is hidden by setting it blank.
89 *
90 * @param array Template Content (generated from result row) being processed.
91 * @param array Result row
92 * @param boolean If set, the result row is a sub-row.
93 * @return array Template Content returned.
94 */
95 function prepareResultRowTemplateData_postProc($tmplContent, $row, $headerOnly) {
96 $tmplContent['description'] = '<em>'.$tmplContent['description'].'</em>';
97 $tmplContent['path'] = '';
98
99 return $tmplContent;
100 }
101 }
102
103
104 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/indexed_search/example/class.pihook.php'])) {
105 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/indexed_search/example/class.pihook.php']);
106 }
107
108 ?>