|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2001-2011 Kasper Skårhøj (kasperYYYY@typo3.com) 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * A copy is found in the textfile GPL.txt and important notices to the license 00017 * from the author is found in LICENSE.txt distributed with these scripts. 00018 * 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 /** 00028 * Index search frontend example hook 00029 * 00030 * $Id: class.pihook.php 10120 2011-01-18 20:03:36Z ohader $ 00031 * 00032 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00033 */ 00034 /** 00035 * [CLASS/FUNCTION INDEX of SCRIPT] 00036 * 00037 * 00038 * 00039 * 59: class tx_indexedsearch_pihook 00040 * 72: function initialize_postProc() 00041 * 95: function prepareResultRowTemplateData_postProc($tmplContent, $row, $headerOnly) 00042 * 00043 * TOTAL FUNCTIONS: 2 00044 * (This index is automatically created/updated by the extension "extdeveval") 00045 * 00046 */ 00047 00048 00049 00050 /** 00051 * Index search frontend - EXAMPLE hook for alternative searching / display etc. 00052 * 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" 00053 * 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) 00054 * 00055 * @package TYPO3 00056 * @subpackage tx_indexedsearch 00057 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00058 */ 00059 class tx_indexedsearch_pihook { 00060 00061 var $pObj; // Is set to a reference to the parent object, "pi1/class.indexedsearch.php" 00062 00063 /** 00064 * EXAMPLE of how you can post process the initialized values in the frontend plugin. 00065 * The example reverses the order of elements in the ranking selector box. You can modify other values like this or add / remove items. 00066 * 00067 * This hook is activated by this key / value pair in ext_localconf.php 00068 * 'initialize_postProc' => 'EXT:indexed_search/example/class.pihook.php:&tx_indexedsearch_pihook', 00069 * 00070 * @return void 00071 */ 00072 function initialize_postProc() { 00073 $this->pObj->optValues['order'] = array_reverse($this->pObj->optValues['order']); 00074 } 00075 00076 /** 00077 * Providing an alternative search algorithm! 00078 * 00079 * @param array Array of search words 00080 * @return array Array of first row, result rows, count 00081 */ 00082 # function getResultRows($sWArr) { 00083 00084 # } 00085 00086 /** 00087 * Example of how the content displayed in the result rows can be post processed before rendered into HTML. 00088 * This example simply shows how the description field is wrapped in italics and the path is hidden by setting it blank. 00089 * 00090 * @param array Template Content (generated from result row) being processed. 00091 * @param array Result row 00092 * @param boolean If set, the result row is a sub-row. 00093 * @return array Template Content returned. 00094 */ 00095 function prepareResultRowTemplateData_postProc($tmplContent, $row, $headerOnly) { 00096 $tmplContent['description'] = '<em>'.$tmplContent['description'].'</em>'; 00097 $tmplContent['path'] = ''; 00098 00099 return $tmplContent; 00100 } 00101 } 00102 00103 00104 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/indexed_search/example/class.pihook.php'])) { 00105 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/indexed_search/example/class.pihook.php']); 00106 } 00107 00108 ?>
1.8.0