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

📄 class.tx_indexedsearch_modfunc1.php

📁 Typo3, 开源里边最强大的
💻 PHP
📖 第 1 页 / 共 3 页
字号:
					// Remove-indexing-link:				$lines[] = '<td>'.$cmdLinks.'</td>';					// Query:				$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(							'*',							'index_fulltext',							'phash = '.intval($row['phash'])						);				$lines[] = '<td style="white-space: normal;">'.							htmlspecialchars(t3lib_div::fixed_lgd_cs($this->utf8_to_currentCharset($ftrows[0]['fulltextdata']),3000)).							'<hr/><em>Size: '.strlen($ftrows[0]['fulltextdata']).'</em>'.							'</td>';					// Query:				$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(							'index_words.baseword, index_rel.*',							'index_rel, index_words',							'index_rel.phash = '.intval($row['phash']).								' AND index_words.wid = index_rel.wid',							'',							'',							'',							'baseword'						);				$wordList = '';				if (is_array($ftrows))	{					$indexed_words = array_keys($ftrows);					sort($indexed_words);					$wordList = htmlspecialchars($this->utf8_to_currentCharset(implode(' ',$indexed_words)));					$wordList.='<hr/><em>Count: '.count($indexed_words).'</em>';				}				$lines[] = '<td style="white-space: normal;">'.$wordList.'</td>';			break;			default:	// Overview					// Display icon:				if (!$grouping)	{					$lines[] = '<td>'.$this->makeItemTypeIcon($row['item_type'], $row['data_filename'] ? $row['data_filename'] : $row['item_title']).'</td>';				} else {					$lines[] = '<td>&nbsp;</td>';				}					// Title displayed:				$lines[] = '<td'.$titleCellAttribs.'>'.$elTitle.'</td>';					// Remove-indexing-link:				$lines[] = '<td>'.$cmdLinks.'</td>';				$lines[] = '<td style="white-space: normal;">'.htmlspecialchars($this->utf8_to_currentCharset($row['item_description'])).'...</td>';				$lines[] = '<td>'.t3lib_div::formatSize($row['item_size']).'</td>';				$lines[] = '<td>'.t3lib_BEfunc::dateTimeAge($row['tstamp']).'</td>';			break;		}		return $lines;	}	/**	 * Creates the header row for the table	 *	 * @return	string		HTML string (table row)	 */	function printPhashRowHeader()	{		$lines = array();		switch($this->pObj->MOD_SETTINGS['type'])	{			case 1:				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>Title</td>';				$lines[] = '<td bgcolor="red">'.$this->printRemoveIndexed('ALL','Clear ALL phash-rows below!').'</td>';				$lines[] = '<td>pHash</td>';				$lines[] = '<td>contentHash</td>';				$lines[] = '<td>&amp;id</td>';				$lines[] = '<td>&amp;type</td>';				$lines[] = '<td>&amp;L</td>';				$lines[] = '<td>&amp;MP</td>';				$lines[] = '<td>grlist</td>';				$lines[] = '<td>Rootline</td>';				$lines[] = '<td>page_id</td>';				$lines[] = '<td>phash_t3</td>';				$lines[] = '<td>CfgUid</td>';				$lines[] = '<td>RecUid</td>';				$lines[] = '<td>GET-parameters</td>';				$lines[] = '<td>&amp;cHash</td>';			break;			case 2:				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>Title</td>';				$lines[] = '<td bgcolor="red">'.$this->printRemoveIndexed('ALL','Clear ALL phash-rows below!').'</td>';				$lines[] = '<td>Content<br/>							<img src="clear.gif" width="300" height="1" alt="" /></td>';				$lines[] = '<td>Words<br/>							<img src="clear.gif" width="300" height="1" alt="" /></td>';			break;			default:				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>&nbsp;</td>';				$lines[] = '<td>Title</td>';				$lines[] = '<td bgcolor="red">'.$this->printRemoveIndexed('ALL','Clear ALL phash-rows below!').'</td>';				$lines[] = '<td>Description</td>';				$lines[] = '<td>Size</td>';				$lines[] = '<td>Indexed:</td>';			break;		}		$out = '<tr class="tableheader bgColor5">'.implode('',$lines).'</tr>';		return $out;	}	/**	 * Returns the number of columns depending on display type of list	 *	 * @return	integer		Number of columns in list:	 */	function returnNumberOfColumns()	{		switch($this->pObj->MOD_SETTINGS['type'])	{			case 1:				return 18;			break;			case 2:				return 6;			break;			default:				return 7;			break;		}	}	/*******************************	 *	 * Details display, phash row	 *	 *******************************/	/**	 * Showing details for a particular phash row	 *	 * @param	integer		phash value to display details for.	 * @return	string		HTML content	 */	function showDetailsForPhash($phash)	{		$content = '';			// Selects the result row:		$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(					'*',					'index_phash',					'phash = '.intval($phash)				);		$phashRecord = $ftrows[0];			// If found, display:		if (is_array($phashRecord))	{			$content.= '<h4>phash row content:</h4>'.						$this->utf8_to_currentCharset(t3lib_div::view_array($phashRecord));				// Getting debug information if any:			$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(						'*',						'index_debug',						'phash = '.intval($phash)					);			if (is_array($ftrows))	{				$debugInfo = unserialize($ftrows[0]['debuginfo']);				$lexer = $debugInfo['lexer'];				unset($debugInfo['lexer']);				$content.= '<h3>Debug information:</h3>'.						$this->utf8_to_currentCharset(t3lib_div::view_array($debugInfo));				$content.= '<h4>Debug information / lexer splitting:</h4>'.						'<hr/><b>'.						$this->utf8_to_currentCharset($lexer).						'</b><hr/>';			}			$content.='<h3>Word statistics</h3>';				// Finding all words for this phash:			$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(						'index_words.*, index_rel.*',						'index_rel, index_words',						'index_rel.phash = '.intval($phash).							' AND index_words.wid = index_rel.wid',						'',						'index_words.baseword',						''					);			$pageRec = t3lib_BEfunc::getRecord('pages', $phashRecord['data_page_id']);			$showStopWordCheckBox = $GLOBALS['BE_USER']->isAdmin();			$content.= $this->listWords($ftrows, 'All words found on page ('.count($ftrows).'):', $showStopWordCheckBox, $pageRec);				// Group metaphone hash:			$metaphone = array();			foreach($ftrows as $row)	{				$metaphone[$row['metaphone']][] = $row['baseword'];			}			$content.= $this->listMetaphoneStat($metaphone, 'Metaphone stats:');				// Finding top-20 on frequency for this phash:			$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(						'index_words.baseword, index_words.metaphone, index_rel.*',						'index_rel, index_words',						'index_rel.phash = '.intval($phash).							' AND index_words.wid = index_rel.wid							 AND index_words.is_stopword=0',						'',						'index_rel.freq DESC',						'20'					);			$content.= $this->listWords($ftrows, 'Top-20 words by frequency:', 2);				// Finding top-20 on count for this phash:			$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(						'index_words.baseword, index_words.metaphone, index_rel.*',						'index_rel, index_words',						'index_rel.phash = '.intval($phash).							' AND index_words.wid = index_rel.wid							 AND index_words.is_stopword=0',						'',						'index_rel.count DESC',						'20'					);			$content.= $this->listWords($ftrows, 'Top-20 words by count:', 2);			$content.='<h3>Section records for this phash</h3>';				// Finding sections for this record:			$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(						'*',						'index_section',						'index_section.phash = '.intval($phash),						'',						'',						''					);			$content.= t3lib_div::view_array($ftrows);				// Add go-back link:			$content = $this->linkList().$content.$this->linkList();		} else $content.= 'Error: No phash row found';		return $content;	}	/**	 * Create table with list of words from $ftrows	 *	 * @param	array		Array of records selected from index_rel/index_words	 * @param	string		Header string to show before table.	 * @param	boolean		If set, the stopWord checkboxes will be shown in the word list. Only for admins. (because it is a global setting, not per-site).	 * @param	array		The page record from which to load the keywords, if any.	 * @return	string		HTML table	 */	function listWords($ftrows,$header, $stopWordBoxes=FALSE, $page='')	{			// Prepare keywords:		$keywords = is_array($page) ? array_flip(t3lib_div::trimExplode(',',$page['keywords'], 1)) : '';			// Render list:		$trows = '';		$trows.= '			<tr class="tableheader bgColor5">				'.($stopWordBoxes ? '<td>'.htmlspecialchars('Stopword:').'</td>' : '').'				<td>'.htmlspecialchars('Word:').'</td>				<td>'.htmlspecialchars('Count:').'</td>				<td>'.htmlspecialchars('First:').'</td>				<td>'.htmlspecialchars('Frequency:').'</td>				<td>'.htmlspecialchars('Flags:').'</td>				'.(is_array($keywords) ? '<td>'.htmlspecialchars('Page keyword:').'</td>' : '').'			</tr>		';		foreach($ftrows as $row)	{			$hiddenField = $stopWordBoxes!=2 ? '<input type="hidden" name="stopWord['.$row['wid'].']" value="0" />' : '';			$trows.= '				<tr class="'.($row['is_stopword'] ? 'bgColor' : 'bgColor4').'">					'.($stopWordBoxes ? '<td align="center"'.($row['is_stopword'] ? ' style="background-color:red;"' : '').'>'.$hiddenField.'<input type="checkbox" name="stopWord['.$row['wid'].']" value="1"'.($row['is_stopword']?'checked="checked"':'').' /></td>' : '').'					<td>'.$this->linkWordDetails(htmlspecialchars($this->utf8_to_currentCharset($row['baseword'])), $row['wid']).'</td>					<td>'.htmlspecialchars($row['count']).'</td>					<td>'.htmlspecialchars($row['first']).'</td>					<td>'.htmlspecialchars($row['freq']).'</td>					<td>'.htmlspecialchars($this->flagsMsg($row['flags'])).'</td>					'.(is_array($keywords) ? '<td align="center"'.(isset($keywords[$row['baseword']]) ? ' class="bgColor2"' : '').'><input type="hidden" name="pageKeyword['.$row['baseword'].']" value="0" /><input type="checkbox" name="pageKeyword['.$row['baseword'].']" value="1"'.(isset($keywords[$row['baseword']])?'checked="checked"':'').' /></td>' : '').'				</tr>			';		}		return '<h4>'.htmlspecialchars($header).'</h4>'.					'					<table border="0" cellspacing="1" cellpadding="2" class="c-list">					'.$trows.'					</table>'.					($stopWordBoxes ? '<input type="submit" value="Change stop-word settings" name="_stopwords" onclick="document.webinfoForm.action=\''.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'\';" />' : '').					(is_array($keywords) ? '<input type="submit" value="Set page keywords" name="_pageKeywords" onclick="document.webinfoForm.action=\''.htmlspecialchars(t3lib_div::getIndpEnv('REQUEST_URI')).'\';" /><input type="hidden" name="pageKeyword_pageUid" value="'.$page['uid'].'" />'.										'<br/>Current keywords are: <em>'.htmlspecialchars(implode(', ',array_keys($keywords))).'</em>' : '');	}	/**	 * Displays table of metaphone groups larger than 1	 *	 * @param	array		Result from word selection (index_rel/index_words)	 * @param	string		Header string	 * @return	string		HTML table	 */	function listMetaphoneStat($ftrows,$header)	{		$trows = '';		$trows.= '			<tr class="tableheader bgColor5">				<td>'.htmlspecialchars('Metaphone:').'</td>				<td>'.htmlspecialchars('Hash:').'</td>				<td>'.htmlspecialchars('Count:').'</td>				<td>'.htmlspecialchars('Words:').'</td>			</tr>		';		foreach($ftrows as $metaphone => $words)	{			if (count($words)>1)	{				$trows.= '					<tr class="bgColor4">						<td>'.$this->linkMetaPhoneDetails($this->indexerObj->metaphone($words[0],1),$metaphone).'</td>						<td>'.htmlspecialchars($metaphone).'</td>						<td>'.htmlspecialchars(count($words)).'</td>						<td style="white-space: normal;">'.htmlspecialchars($this->utf8_to_currentCharset(implode(', ',$words))).'</td>					</tr>				';			}		}		return '<h4>'.htmlspecialchars($header).'</h4>'.					'<table border="0" cellspacing="1" cellpadding="2" class="c-list">					'.$trows.'					</table>';	}	/**	 * Wraps input string in a link that will display details for the word. Eg. which other pages has the word, metaphone associations etc.	 *	 * @param	string		String to wrap, possibly a title or so.	 * @param	integer		wid value to show details for	 * @return	string		Wrapped string	 */	function linkWordDetails($string,$wid)	{		return '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('wid'=>$wid,'phash'=>''))).'">'.$string.'</a>';	}	/**	 * Wraps input string in a link to see more details for metaphone value	 *	 * @param	string		String to wrap	 * @param	integer		Metaphone value	 * @return	string		Wrapped string	 */	function linkMetaPhoneDetails($string,$metaphone)	{		return '<a href="'.htmlspecialchars(t3lib_div::linkThisScript(array('metaphone'=>$metaphone,'wid'=>'','phash'=>''))).'">'.$string.'</a>';	}	/**	 * Creates message for flag value	 *	 * @param	integer		Flags integer	 * @return	string		Message string	 */	function flagsMsg($flags)	{		if ($flags > 0)	{			return				($flags & 128 ? '<title>' : '').	// pow(2,7)				($flags & 64 ? '<meta/keywords>' : '').	// pow(2,6)				($flags & 32 ? '<meta/description>' : '').	// pow(2,5)				' ('.$flags.')';		}	}	/*******************************	 *	 * Details display, words / metaphone	 *	 *******************************/	/**	 * Show details for words	 *	 * @param	integer		Word ID (wid)	 * @return	string		HTML content	 */	function showDetailsForWord($wid)	{			// Select references to this word		$ftrows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(					'index_phash.*, index_section.*, index_rel.*',					'index_rel, index_section, index_phash',					'index_rel.wid = '.intval($wid).						' AND index_rel.phash = index_section.phash'.						' AND index_section.phash = index_phash.phash',					'',					'index_rel.freq DESC',					''				);			// Headers:		$content.='			<tr class="tableheader bgColor5">				<td>phash</td>				<td>page_id</td>				<td>data_filename</td>				<td>count</td>				<td>first</td>				<td>freq</td>				<td>flags</td>			</tr>';		if (is_array($ftrows))	{			foreach($ftrows as $wDat)	{				$content.='					<tr class="bgColor4">						<td>'.$this->linkDetails(htmlspecialchars($wDat['phash']),$wDat['phash']).'</td>						<td>'.htmlspecialchars($wDat['page_id']).'</td>						<td>'.htmlspecialchars($wDat['data_filename']).'</td>						<td>'.htmlspecialchars($wDat['count']).'</td>						<td>'.htmlspecialchars($wDat['first']).'</td>						<td>'.htmlspecialchars($wDat['freq']).'</td>						<td>'.htmlspecialchars($wDat['flags']).'</td>					</tr>';			}		}			// Compile table:		$content = '			<table border="0" cellspacing="1" cellpadding="2" class="c-list">'.				$content.'			</table>';			// Add go-back link:

⌨️ 快捷键说明

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