Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Global Search
|
||||
* Last Updated: $Date: 2010-02-22 17:06:11 +0000 (Mon, 22 Feb 2010) $
|
||||
* Last Updated: $Date: 2011-07-08 15:07:09 -0400 (Fri, 08 Jul 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Core
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5859 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 9189 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -37,7 +37,7 @@ class search_format
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry $registry
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -54,6 +54,9 @@ class search_format
|
||||
|
||||
/* Set up default wrapper */
|
||||
$this->templates = array( 'group' => 'search', 'template' => 'searchResults' );
|
||||
|
||||
// Need to setup this manually here, won't work in the template..
|
||||
$this->registry->templateStriping['searchResults'] = array( FALSE, "row1", "row2" );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,11 +70,24 @@ class search_format
|
||||
return $this->templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for processResults() when called from 'Content I follow' view
|
||||
*
|
||||
* @param array $ids Ids
|
||||
* @param array $followData Retrieve the follow meta data
|
||||
* @return array
|
||||
*/
|
||||
public function processFollowedResults( $ids, $followData=array() )
|
||||
{
|
||||
/* Per app class handles this */
|
||||
throw new Exception("NO_FORMAT_AVAILABLE");
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats / grabs extra data for results
|
||||
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
|
||||
*
|
||||
* @access public
|
||||
* @param array $ids Ids
|
||||
* @return array
|
||||
*/
|
||||
public function processResults( $ids )
|
||||
@@ -86,7 +102,7 @@ class search_format
|
||||
*
|
||||
* @param array $r
|
||||
* @return array
|
||||
**/
|
||||
*/
|
||||
public function genericizeResults( $r )
|
||||
{
|
||||
return $r;
|
||||
@@ -102,36 +118,41 @@ class search_format
|
||||
public function parseAndFetchHtmlBlocks( $rows )
|
||||
{
|
||||
/* Forum stuff */
|
||||
$sub = false;
|
||||
$isVnc = false;
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$results = array();
|
||||
$sub = false;
|
||||
$isVnc = false;
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$results = array();
|
||||
|
||||
/* loop and process */
|
||||
foreach( $rows as $id => $r )
|
||||
if( is_array($rows) AND count($rows) )
|
||||
{
|
||||
/* If basic search, strip the content */
|
||||
IPSText::getTextClass( 'bbcode' )->parse_wordwrap = 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 0;
|
||||
IPSText::getTextClass( 'bbcode' )->strip_quotes = 1;
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $r['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $r['mgroup_others'];
|
||||
|
||||
$r['content'] = strip_tags( IPSText::getTextClass( 'bbcode' )->stripAllTags( $r['content'] ) );
|
||||
$r['content'] = str_replace( array( '<br>', '<br />' ), '', $r['content'] );
|
||||
$r['content'] = trim( str_replace( array( "\n\n\n", "\n\n" ), "\n", str_replace( "\r", '', $r['content'] ) ) );
|
||||
|
||||
/* Highlight */
|
||||
$r['content'] = IPSText::searchHighlight( $this->searchTruncate( $r['content'], $search_term ), $search_term );
|
||||
foreach( $rows as $id => $r )
|
||||
{
|
||||
/* If basic search, strip the content - process only if we have content though */
|
||||
if ( $r['content'] )
|
||||
{
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 0;
|
||||
IPSText::getTextClass('bbcode')->strip_quotes = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'topics';
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup = $r['member_group_id'];
|
||||
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $r['mgroup_others'];
|
||||
|
||||
/* Format title */
|
||||
$r['content_title'] = IPSText::searchHighlight( $r['content_title'], $search_term );
|
||||
$r['content'] = strip_tags( IPSText::getTextClass( 'bbcode' )->stripAllTags( $r['content'] ) );
|
||||
$r['content'] = str_replace( array( '<br>', '<br />' ), '', $r['content'] );
|
||||
$r['content'] = trim( str_replace( array( "\n\n\n", "\n\n" ), "\n", str_replace( "\r", '', $r['content'] ) ) );
|
||||
|
||||
/* Format content */
|
||||
list( $html, $sub ) = $this->formatContent( $r );
|
||||
|
||||
$results[ $id ] = array( 'html' => $html, 'app' => $r['app'], 'type' => $r['type'], 'sub' => $sub );
|
||||
/* Highlight */
|
||||
$r['content'] = IPSText::searchHighlight( $this->searchTruncate( $r['content'], $search_term ), $search_term );
|
||||
}
|
||||
|
||||
/* Format title */
|
||||
$r['content_title'] = IPSText::searchHighlight( $r['content_title'], $search_term );
|
||||
|
||||
/* Format content */
|
||||
list( $html, $sub ) = $this->formatContent( $r );
|
||||
|
||||
$results[ $id ] = array( 'html' => $html, 'app' => $r['app'], 'type' => $r['type'], 'sub' => $sub, '_followData' => !empty($r['_followData']) ? $r['_followData'] : array() );
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
@@ -143,10 +164,10 @@ class search_format
|
||||
* @access public
|
||||
* @param array $search_row Array of data
|
||||
* @return mixed Formatted content, ready for display, or array containing a $sub section flag, and content
|
||||
**/
|
||||
*/
|
||||
public function formatContent( $data )
|
||||
{
|
||||
return array( $this->registry->output->getTemplate( 'search' )->searchRowGenericFormat( $data ), 0 );
|
||||
return array( $this->registry->output->getTemplate('search')->searchRowGenericFormat( $data ), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +177,7 @@ class search_format
|
||||
* @param string $haystack Full search result
|
||||
* @param string $needle The search term
|
||||
* @return string
|
||||
**/
|
||||
*/
|
||||
public function searchTruncate( $haystack, $needle )
|
||||
{
|
||||
/* Base on words */
|
||||
|
||||
Reference in new issue
Block a user