Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -40,6 +40,26 @@ |
41 | 41 | /// No idea, apparently used by some other classes |
42 | 42 | protected $mPrefix; |
43 | 43 | |
| 44 | + /** |
| 45 | + * @var int |
| 46 | + */ |
| 47 | + protected $limit, $offset; |
| 48 | + |
| 49 | + /** |
| 50 | + * @var array |
| 51 | + */ |
| 52 | + protected $namespaces; |
| 53 | + |
| 54 | + /** |
| 55 | + * @var bool |
| 56 | + */ |
| 57 | + protected $searchRedirects; |
| 58 | + |
| 59 | + /** |
| 60 | + * @var string |
| 61 | + */ |
| 62 | + protected $didYouMeanHtml, $fulltext; |
| 63 | + |
44 | 64 | const NAMESPACES_CURRENT = 'sense'; |
45 | 65 | |
46 | 66 | public function __construct() { |
— | — | @@ -213,8 +233,9 @@ |
214 | 234 | $rewritten = $search->replacePrefixes($term); |
215 | 235 | |
216 | 236 | $titleMatches = $search->searchTitle( $rewritten ); |
217 | | - if( !($titleMatches instanceof SearchResultTooMany)) |
| 237 | + if( !( $titleMatches instanceof SearchResultTooMany ) ) { |
218 | 238 | $textMatches = $search->searchText( $rewritten ); |
| 239 | + } |
219 | 240 | |
220 | 241 | // did you mean... suggestions |
221 | 242 | if( $textMatches && $textMatches->hasSuggestion() ) { |
— | — | @@ -223,8 +244,9 @@ |
224 | 245 | # mirror Go/Search behaviour of original request .. |
225 | 246 | $didYouMeanParams = array( 'search' => $textMatches->getSuggestionQuery() ); |
226 | 247 | |
227 | | - if($this->fulltext != null) |
| 248 | + if( $this->fulltext != null ) { |
228 | 249 | $didYouMeanParams['fulltext'] = $this->fulltext; |
| 250 | + } |
229 | 251 | |
230 | 252 | $stParams = array_merge( |
231 | 253 | $didYouMeanParams, |
— | — | @@ -233,8 +255,9 @@ |
234 | 256 | |
235 | 257 | $suggestionSnippet = $textMatches->getSuggestionSnippet(); |
236 | 258 | |
237 | | - if( $suggestionSnippet == '' ) |
| 259 | + if( $suggestionSnippet == '' ) { |
238 | 260 | $suggestionSnippet = null; |
| 261 | + } |
239 | 262 | |
240 | 263 | $suggestLink = Linker::linkKnown( |
241 | 264 | $st, |
— | — | @@ -365,6 +388,9 @@ |
366 | 389 | wfProfileOut( __METHOD__ ); |
367 | 390 | } |
368 | 391 | |
| 392 | + /** |
| 393 | + * @param $t Title |
| 394 | + */ |
369 | 395 | protected function showCreateLink( $t ) { |
370 | 396 | // show direct page/create link if applicable |
371 | 397 | // Check DBkey !== '' in case of fragment link only. |
— | — | @@ -387,7 +413,7 @@ |
388 | 414 | } |
389 | 415 | |
390 | 416 | /** |
391 | | - * |
| 417 | + * @param $term string |
392 | 418 | */ |
393 | 419 | protected function setupPage( $term ) { |
394 | 420 | # Should advanced UI be used? |
— | — | @@ -441,6 +467,8 @@ |
442 | 468 | * Show whole set of results |
443 | 469 | * |
444 | 470 | * @param $matches SearchResultSet |
| 471 | + * |
| 472 | + * @return string |
445 | 473 | */ |
446 | 474 | protected function showMatches( &$matches ) { |
447 | 475 | global $wgContLang; |
— | — | @@ -470,6 +498,8 @@ |
471 | 499 | * |
472 | 500 | * @param $result SearchResult |
473 | 501 | * @param $terms Array: terms to highlight |
| 502 | + * |
| 503 | + * @return string |
474 | 504 | */ |
475 | 505 | protected function showHit( $result, $terms ) { |
476 | 506 | wfProfileIn( __METHOD__ ); |
— | — | @@ -650,6 +680,8 @@ |
651 | 681 | * |
652 | 682 | * @param $matches SearchResultSet |
653 | 683 | * @param $query String |
| 684 | + * |
| 685 | + * @return string |
654 | 686 | */ |
655 | 687 | protected function showInterwiki( &$matches, $query ) { |
656 | 688 | global $wgContLang; |
— | — | @@ -691,6 +723,8 @@ |
692 | 724 | * @param $terms Array |
693 | 725 | * @param $query String |
694 | 726 | * @param $customCaptions Array: iw prefix -> caption |
| 727 | + * |
| 728 | + * @return string |
695 | 729 | */ |
696 | 730 | protected function showInterwikiHit( $result, $lastInterwiki, $terms, $query, $customCaptions) { |
697 | 731 | wfProfileIn( __METHOD__ ); |
— | — | @@ -734,10 +768,10 @@ |
735 | 769 | $out = ""; |
736 | 770 | // display project name |
737 | 771 | if(is_null($lastInterwiki) || $lastInterwiki != $t->getInterwiki()) { |
738 | | - if( key_exists($t->getInterwiki(),$customCaptions) ) |
| 772 | + if( key_exists($t->getInterwiki(),$customCaptions) ) { |
739 | 773 | // captions from 'search-interwiki-custom' |
740 | 774 | $caption = $customCaptions[$t->getInterwiki()]; |
741 | | - else{ |
| 775 | + } else { |
742 | 776 | // default is to show the hostname of the other wiki which might suck |
743 | 777 | // if there are many wikis on one hostname |
744 | 778 | $parsed = parse_url($t->getFullURL()); |
— | — | @@ -763,6 +797,11 @@ |
764 | 798 | return $out; |
765 | 799 | } |
766 | 800 | |
| 801 | + /** |
| 802 | + * @param $profile |
| 803 | + * @param $term |
| 804 | + * @return String |
| 805 | + */ |
767 | 806 | protected function getProfileForm( $profile, $term ) { |
768 | 807 | // Hidden stuff |
769 | 808 | $opts = array(); |
— | — | @@ -782,6 +821,7 @@ |
783 | 822 | * Generates the power search box at [[Special:Search]] |
784 | 823 | * |
785 | 824 | * @param $term String: search term |
| 825 | + * @param $opts array |
786 | 826 | * @return String: HTML form |
787 | 827 | */ |
788 | 828 | protected function powerSearchBox( $term, $opts ) { |
— | — | @@ -872,6 +912,9 @@ |
873 | 913 | Xml::closeElement( 'fieldset' ); |
874 | 914 | } |
875 | 915 | |
| 916 | + /** |
| 917 | + * @return array |
| 918 | + */ |
876 | 919 | protected function getSearchProfiles() { |
877 | 920 | // Builds list of Search Types (profiles) |
878 | 921 | $nsAllSet = array_keys( SearchEngine::searchableNamespaces() ); |
— | — | @@ -920,6 +963,12 @@ |
921 | 964 | return $profiles; |
922 | 965 | } |
923 | 966 | |
| 967 | + /** |
| 968 | + * @param $term |
| 969 | + * @param $resultsShown |
| 970 | + * @param $totalNum |
| 971 | + * @return string |
| 972 | + */ |
924 | 973 | protected function formHeader( $term, $resultsShown, $totalNum ) { |
925 | 974 | $out = Xml::openElement('div', array( 'class' => 'mw-search-formheader' ) ); |
926 | 975 | |
— | — | @@ -990,6 +1039,10 @@ |
991 | 1040 | return $out; |
992 | 1041 | } |
993 | 1042 | |
| 1043 | + /** |
| 1044 | + * @param $term string |
| 1045 | + * @return string |
| 1046 | + */ |
994 | 1047 | protected function shortDialog( $term ) { |
995 | 1048 | $out = Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n"; |
996 | 1049 | // Term box |
— | — | @@ -1072,6 +1125,8 @@ |
1073 | 1126 | |
1074 | 1127 | /** |
1075 | 1128 | * @since 1.18 |
| 1129 | + * |
| 1130 | + * @return SearchEngine |
1076 | 1131 | */ |
1077 | 1132 | public function getSearchEngine() { |
1078 | 1133 | if ( $this->searchEngine === null ) { |
— | — | @@ -1085,6 +1140,9 @@ |
1086 | 1141 | * add more params to links to not lose selection when |
1087 | 1142 | * user navigates search results. |
1088 | 1143 | * @since 1.18 |
| 1144 | + * |
| 1145 | + * @param $key |
| 1146 | + * @param $value |
1089 | 1147 | */ |
1090 | 1148 | public function setExtraParam( $key, $value ) { |
1091 | 1149 | $this->extraParams[$key] = $value; |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -3513,7 +3513,7 @@ |
3514 | 3514 | * Format a size in bytes for output, using an appropriate |
3515 | 3515 | * unit (B, KB, MB or GB) according to the magnitude in question |
3516 | 3516 | * |
3517 | | - * @param $size Size to format |
| 3517 | + * @param $size int Size to format |
3518 | 3518 | * @return string Plain text (not HTML) |
3519 | 3519 | */ |
3520 | 3520 | function formatSize( $size ) { |