⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 class.tx_indexedsearch.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
	 * @param	array		Value/Labels pairs for search form selector boxes.	 * @return	string		Search form HTML	 */	function makeSearchForm($optValues)	{		$html = $this->cObj->getSubpart($this->templateCode, '###SEARCH_FORM###');			// Multilangual text		$substituteArray = array('searchFor', 'extResume', 'atATime', 'orderBy', 'fromSection', 'searchIn', 'match', 'style', 'freeIndexUid');		foreach ($substituteArray as $marker)	{			$markerArray['###FORM_'.strtoupper($marker).'###'] = $this->pi_getLL('form_'.$marker,'',1);		}		$markerArray['###FORM_SUBMIT###'] = $this->pi_getLL('submit_button_label','',1);			// Adding search field value		$markerArray['###SWORD_VALUE###'] = htmlspecialchars($this->piVars['sword']);			// Additonal keyword => "Add to current search words"		if ($this->conf['show.']['clearSearchBox'] && $this->conf['show.']['clearSearchBox.']['enableSubSearchCheckBox'])	{			$markerArray['###SWORD_PREV_VALUE###'] = htmlspecialchars($this->conf['show.']['clearSearchBox'] ? '' : $this->piVars['sword']);			$markerArray['###SWORD_PREV_INCLUDE_CHECKED###'] = $this->piVars['sword_prev_include'] ? ' checked="checked"':'';			$markerArray['###ADD_TO_CURRENT_SEARCH###'] = $this->pi_getLL('makerating_addToCurrentSearch','',1);		} else {			$html = $this->cObj->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');		}		$markerArray['###ACTION_URL###'] = htmlspecialchars($this->pi_getPageLink($GLOBALS['TSFE']->id, $GLOBALS['TSFE']->sPre));		$hiddenFieldCode = $this->cObj->getSubpart($this->templateCode, '###HIDDEN_FIELDS###');		$hiddenFieldCode = preg_replace('/^\n\t(.+)/ms', '$1', $hiddenFieldCode);		// Remove first newline and tab (cosmetical issue)		$hiddenFieldArr = array();		foreach (t3lib_div::trimExplode(',',$this->hiddenFieldList) as $fieldName)	{			$hiddenFieldMarkerArray = array();			$hiddenFieldMarkerArray['###HIDDEN_FIELDNAME###'] = $this->prefixId.'['.$fieldName.']';			$hiddenFieldMarkerArray['###HIDDEN_VALUE###'] = htmlspecialchars((string)$this->piVars[$fieldName]);			$hiddenFieldArr[$fieldName] = $this->cObj->substituteMarkerArrayCached($hiddenFieldCode, $hiddenFieldMarkerArray, array(), array());		}			// Extended search		if ($this->piVars['ext'])	{				// Search for			if ((!is_array($optValues['type']) && !is_array($optValues['defOp'])) || ($this->conf['blind.']['type'] && $this->conf['blind.']['defOp']))	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_FOR###', '');			} else {				if (is_array($optValues['type']) && !$this->conf['blind.']['type'])	{					unset($hiddenFieldArr['type']);					$markerArray['###SELECTBOX_TYPE_VALUES###'] = $this->renderSelectBoxValues($this->piVars['type'],$optValues['type']);				} else {					$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_TYPE###', '');				}				if (is_array($optValues['defOp']) || !$this->conf['blind.']['defOp'])	{					$markerArray['###SELECTBOX_DEFOP_VALUES###'] = $this->renderSelectBoxValues($this->piVars['defOp'],$optValues['defOp']);				} else {					$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_DEFOP###', '');				}			}				// Search in			if ((!is_array($optValues['media']) && !is_array($optValues['lang'])) || ($this->conf['blind.']['media'] && $this->conf['blind.']['lang']))	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_IN###', '');			} else {				if (is_array($optValues['media']) && !$this->conf['blind.']['media'])	{					unset($hiddenFieldArr['media']);					$markerArray['###SELECTBOX_MEDIA_VALUES###'] = $this->renderSelectBoxValues($this->piVars['media'],$optValues['media']);				} else {					$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_MEDIA###', '');				}				if (is_array($optValues['lang']) || !$this->conf['blind.']['lang'])	{					unset($hiddenFieldArr['lang']);					$markerArray['###SELECTBOX_LANG_VALUES###'] = $this->renderSelectBoxValues($this->piVars['lang'],$optValues['lang']);				} else {					$html = $this->cObj->substituteSubpart($html, '###SELECT_SEARCH_LANG###', '');				}			}				// Sections			if (!is_array($optValues['sections']) || $this->conf['blind.']['sections'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_SECTION###', '');			} else {				$markerArray['###SELECTBOX_SECTIONS_VALUES###'] = $this->renderSelectBoxValues($this->piVars['sections'],$optValues['sections']);			}				// Free Indexing Configurations:			if (!is_array($optValues['freeIndexUid']) || $this->conf['blind.']['freeIndexUid'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_FREEINDEXUID###', '');			} else {				$markerArray['###SELECTBOX_FREEINDEXUIDS_VALUES###'] = $this->renderSelectBoxValues($this->piVars['freeIndexUid'],$optValues['freeIndexUid']);			}				// Sorting			if (!is_array($optValues['order']) || !is_array($optValues['desc']) || $this->conf['blind.']['order'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_ORDER###', '');			} else {				unset($hiddenFieldArr['order']);				unset($hiddenFieldArr['desc']);				unset($hiddenFieldArr['results']);				$markerArray['###SELECTBOX_ORDER_VALUES###'] = $this->renderSelectBoxValues($this->piVars['order'],$optValues['order']);				$markerArray['###SELECTBOX_DESC_VALUES###'] = $this->renderSelectBoxValues($this->piVars['desc'],$optValues['desc']);				$markerArray['###SELECTBOX_RESULTS_VALUES###'] = $this->renderSelectBoxValues($this->piVars['results'],$optValues['results']);			}				// Limits			if (!is_array($optValues['results']) || !is_array($optValues['results']) || $this->conf['blind.']['results'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_RESULTS###', '');			} else {				$markerArray['###SELECTBOX_RESULTS_VALUES###'] = $this->renderSelectBoxValues($this->piVars['results'],$optValues['results']);			}				// Grouping			if (!is_array($optValues['group']) || $this->conf['blind.']['group'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_GROUP###', '');			} else {				unset($hiddenFieldArr['group']);				$markerArray['###SELECTBOX_GROUP_VALUES###'] = $this->renderSelectBoxValues($this->piVars['group'],$optValues['group']);			}			if ($this->conf['blind.']['extResume'])	{				$html = $this->cObj->substituteSubpart($html, '###SELECT_EXTRESUME###', '');			} else {				$markerArray['###EXT_RESUME_CHECKED###'] = $this->piVars['extResume'] ? ' checked="checked"' : '';			}		} else {	// Extended search			$html = $this->cObj->substituteSubpart($html, '###SEARCH_FORM_EXTENDED###', '');		}		if($this->conf['show.']['advancedSearchLink'])	{			$linkToOtherMode = ($this->piVars['ext'] ?				$this->pi_getPageLink($GLOBALS['TSFE']->id,$GLOBALS['TSFE']->sPre,array($this->prefixId.'[ext]'=>0)) :				$this->pi_getPageLink($GLOBALS['TSFE']->id,$GLOBALS['TSFE']->sPre,array($this->prefixId.'[ext]'=>1))			);			$markerArray['###LINKTOOTHERMODE###'] = '<a href="'.htmlspecialchars($linkToOtherMode).'">'.$this->pi_getLL($this->piVars['ext']?'link_regularSearch':'link_advancedSearch', '', 1).'</a>';		} else {			$markerArray['###LINKTOOTHERMODE###'] = '';		}			// Write all hidden fields		$html = $this->cObj->substituteSubpart($html, '###HIDDEN_FIELDS###', implode('',$hiddenFieldArr));		$substitutedContent = $this->cObj->substituteMarkerArrayCached($html, $markerArray, array(), array());		return $substitutedContent;	}	/**	 * Function, rendering selector box values.	 *	 * @param	string		Current value	 * @param	array		Array with the options as key=>value pairs	 * @return	string		<options> imploded.	 */	function renderSelectBoxValues($value,$optValues)	{		if (is_array($optValues))	{			$opt=array();			$isSelFlag=0;			foreach ($optValues as $k=>$v)	{				$sel = (!strcmp($k,$value) ? ' selected="selected"' : '');				if ($sel)	{ $isSelFlag++; }				$opt[]='<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>';			}			return implode('',$opt);		}	}	/**	 * Print the searching rules	 *	 * @return	string		Rules for the search	 */	function printRules()	{		if ($this->conf['show.']['rules'])	{			$html = $this->cObj->getSubpart($this->templateCode, '###RULES###');			$markerArray['###RULES_HEADER###'] = $this->pi_getLL('rules_header','',1);			$markerArray['###RULES_TEXT###'] = nl2br(trim($this->pi_getLL('rules_text','',1)));			$substitutedContent = $this->cObj->substituteMarkerArrayCached($html, $markerArray, array(), array());			return '<div'.$this->pi_classParam('rules').'>'.$this->cObj->stdWrap($substitutedContent, $this->conf['rules_stdWrap.']).'</div>';		}	}	/**	 * Returns the anchor-links to the sections inside the displayed result rows.	 *	 * @return	string	 */	function printResultSectionLinks()	{		if (count($this->resultSections))	{			$lines = array();			$html = $this->cObj->getSubpart($this->templateCode, '###RESULT_SECTION_LINKS###');			$item = $this->cObj->getSubpart($this->templateCode, '###RESULT_SECTION_LINKS_LINK###');			foreach ($this->resultSections as $id => $dat)	{				$markerArray = array();				$aBegin = '<a href="'.htmlspecialchars($GLOBALS['TSFE']->anchorPrefix.'#anchor_'.md5($id)).'">';				$aContent = htmlspecialchars(trim($dat[0]) ? trim($dat[0]) : $this->pi_getLL('unnamedSection')).						' ('.$dat[1].' '.$this->pi_getLL($dat[1]>1 ? 'word_pages' : 'word_page','',1).')';				$aEnd = '</a>';				$markerArray['###LINK###'] = $aBegin . $aContent . $aEnd;				$links[] = $this->cObj->substituteMarkerArrayCached($item, $markerArray, array(), array());			}			$html = $this->cObj->substituteMarkerArrayCached($html, array('###LINKS###' => implode('',$links)), array(), array());			return '<div'.$this->pi_classParam('sectionlinks').'>'.$this->cObj->stdWrap($html, $this->conf['sectionlinks_stdWrap.']).'</div>';		}	}	/**	 * Returns the section header of the search result.	 *	 * @param	string		ID for the section (used for anchor link)	 * @param	string		Section title with linked wrapped around	 * @param	integer		Number of results in section	 * @return	string		HTML output	 */	function makeSectionHeader($id, $sectionTitleLinked, $countResultRows)	{		$html = $this->cObj->getSubpart($this->templateCode, '###SECTION_HEADER###');		$markerArray['###ANCHOR_URL###'] = 'anchor_'.md5($id);		$markerArray['###SECTION_TITLE###'] = $sectionTitleLinked;		$markerArray['###RESULT_COUNT###'] = $countResultRows;		$markerArray['###RESULT_NAME###'] = $this->pi_getLL('word_page'.($countResultRows>1 ? 's' : ''));		$substitutedContent = $this->cObj->substituteMarkerArrayCached($html, $markerArray, array(), array());		return $substitutedContent;	}	/**	 * This prints a single result row, including a recursive call for subrows.	 *	 * @param	array		Search result row	 * @param	integer		1=Display only header (for sub-rows!), 2=nothing at all	 * @return	string		HTML code	 */	function printResultRow($row, $headerOnly=0)	{			// Get template content:		$tmplContent = $this->prepareResultRowTemplateData($row, $headerOnly);		if ($hookObj = &$this->hookRequest('printResultRow'))	{			return $hookObj->printResultRow($row, $headerOnly, $tmplContent);		} else {			$html = $this->cObj->getSubpart($this->templateCode, '###RESULT_OUTPUT###');			if (!is_array($row['_sub']))	{				$html = $this->cObj->substituteSubpart($html, '###ROW_SUB###', '');			}			if (!$headerOnly)	{				$html = $this->cObj->substituteSubpart($html, '###ROW_SHORT###', '');			} elseif ($headerOnly==1) {				$html = $this->cObj->substituteSubpart($html, '###ROW_LONG###', '');			} elseif ($headerOnly==2) {				$html = $this->cObj->substituteSubpart($html, '###ROW_SHORT###', '');				$html = $this->cObj->substituteSubpart($html, '###ROW_LONG###', '');			}			if (is_array($tmplContent))	{				foreach ($tmplContent AS $k => $v)	{					$markerArray['###'.strtoupper($k).'###'] = $v;				}			}				// Description text			$markerArray['###TEXT_ITEM_SIZE###'] = $this->pi_getLL('res_size','',1);			$markerArray['###TEXT_ITEM_CRDATE###'] = $this->pi_getLL('res_created','',1);			$markerArray['###TEXT_ITEM_MTIME###'] = $this->pi_getLL('res_modified','',1);			$markerArray['###TEXT_ITEM_PATH###'] = $this->pi_getLL('res_path','',1);			$html = $this->cObj->substituteMarkerArrayCached($html, $markerArray, array(), array());				// If there are subrows (eg. subpages in a PDF-file or if a duplicate page is selected due to user-login (phash_grouping))			if (is_array($row['_sub']))	{				if ($this->multiplePagesType($row['item_type']))	{					$html = str_replace('###TEXT_ROW_SUB###', $this->pi_getLL('res_otherMatching','',1), $html);					foreach ($row['_sub'] as $subRow)	{						$html .= $this->printResultRow($subRow,1);					}				} else {					$markerArray['###TEXT_ROW_SUB###'] = $this->pi_getLL('res_otherMatching','',1);					$html = str_replace('###TEXT_ROW_SUB###', $this->pi_getLL('res_otherPageAsWell','',1), $html);				}			}			return $html;		}	}	/**	 * Returns a results browser	 *	 * @param	boolean		Show result count	 * @param	string		String appended to "displaying results..." notice.	 * @param	string		String appended after section "displaying results..."	 * @param	string		List of integers pointing to free indexing configurations to search. -1 represents no filtering, 0 represents TYPO3 pages only, any number above zero is a uid of an indexing configuration!	 * @return	string		HTML output	 */	function pi_list_browseresults($showResultCount=1,$addString='',$addPart='',$freeIndexUid=-1)	{			// Initializing variables:		$pointer=$this->piVars['pointer'];		$count=$this->internal['res_count'];		$results_at_a_time = t3lib_div::intInRange($this->internal['results_at_a_time'],1,1000

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -