plugins/SpecialSearch.php
changeset 1367 c660cf54c045
parent 1227 bdac73ed481e
equal deleted inserted replaced
1366:23f89f989922 1367:c660cf54c045
   135 		{
   135 		{
   136 			$result =& $results[$i];
   136 			$result =& $results[$i];
   137 			$result['page_text'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="search-term">', '</span>'), $result['page_text']);
   137 			$result['page_text'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="search-term">', '</span>'), $result['page_text']);
   138 			if ( !empty($result['page_text']) )
   138 			if ( !empty($result['page_text']) )
   139 				$result['page_text'] .= '<br />';
   139 				$result['page_text'] .= '<br />';
   140 			$result['page_name'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="title-search-term">', '</span>'), $result['page_name']);
   140 			
       
   141 			// localize the title... if it comes back from the language code, replace the title, losing highlighting.
       
   142 			// otherwise, keep the highlighted title from the search backend
       
   143 			if ( ($l10n_title = $lang->get(strip_tags($result['page_name']))) !== strip_tags($result['page_name']) )
       
   144 			{
       
   145 				$result['page_name'] = $l10n_title;
       
   146 			}
       
   147 			else
       
   148 			{
       
   149 				$result['page_name'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="title-search-term">', '</span>'), $result['page_name']);
       
   150 			}
       
   151 			
   141 			$result['url_highlight'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="url-search-term">', '</span>'), $result['url_highlight']);
   152 			$result['url_highlight'] = str_replace(array('<highlight>', '</highlight>'), array('<span class="url-search-term">', '</span>'), $result['url_highlight']);
   142 			if ( $result['page_length'] >= 1048576 )
   153 			if ( $result['page_length'] >= 1048576 )
   143 			{
   154 			{
   144 				$result['page_length'] = round($result['page_length'] / 1048576, 1);
   155 				$result['page_length'] = round($result['page_length'] / 1048576, 1);
   145 				$length_unit = $lang->get('etc_unit_megabytes_short');
   156 				$length_unit = $lang->get('etc_unit_megabytes_short');