Index: branches/wmf/1.18wmf1/docs/hooks.txt |
— | — | @@ -1689,6 +1689,11 @@ |
1690 | 1690 | &$query_options: array of options for the database request |
1691 | 1691 | &$select: Array of columns to select |
1692 | 1692 | |
| 1693 | +'SpecialSearchCreateLink': called when making the message to create a page or |
| 1694 | +go to the existing page |
| 1695 | +$t: title object searched for |
| 1696 | +&$params: an array of the default message name and page title (as parameter) |
| 1697 | + |
1693 | 1698 | 'SpecialSearchGo': called when user clicked the "Go" |
1694 | 1699 | &$title: title object generated from the text entered by the user |
1695 | 1700 | &$term: the search term entered by the user |
— | — | @@ -1697,6 +1702,12 @@ |
1698 | 1703 | target doesn't exist |
1699 | 1704 | &$title: title object generated from the text entered by the user |
1700 | 1705 | |
| 1706 | +'SpecialSearchPowerBox': the equivalent of SpecialSearchProfileForm for |
| 1707 | +the advanced form, a.k.a. power search box |
| 1708 | +&$showSections: an array to add values with more options to |
| 1709 | +$term: the search term (not a title object) |
| 1710 | +$opts: an array of hidden options (containing 'redirs' and 'profile') |
| 1711 | + |
1701 | 1712 | 'SpecialSearchProfiles': allows modification of search profiles |
1702 | 1713 | &$profiles: profiles, which can be modified. |
1703 | 1714 | |
Property changes on: branches/wmf/1.18wmf1/docs/hooks.txt |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1704 | 1715 | Merged /branches/REL1_18/phase3/docs/hooks.txt:r102560 |
1705 | 1716 | Merged /trunk/phase3/docs/hooks.txt:r97175 |
Index: branches/wmf/1.18wmf1/includes/specials/SpecialSearch.php |
— | — | @@ -382,19 +382,28 @@ |
383 | 383 | global $wgOut; |
384 | 384 | |
385 | 385 | // show direct page/create link if applicable |
| 386 | + |
386 | 387 | // Check DBkey !== '' in case of fragment link only. |
387 | | - $messageName = null; |
388 | | - if( !is_null($t) && $t->getDBkey() !== '' ) { |
389 | | - if( $t->isKnown() ) { |
390 | | - $messageName = 'searchmenu-exists'; |
391 | | - } elseif( $t->userCan( 'create' ) ) { |
392 | | - $messageName = 'searchmenu-new'; |
393 | | - } else { |
394 | | - $messageName = 'searchmenu-new-nocreate'; |
395 | | - } |
| 388 | + if( is_null( $t ) || $t->getDBkey() === '' ) { |
| 389 | + // invalid title |
| 390 | + // preserve the paragraph for margins etc... |
| 391 | + $this->getOutput()->addHtml( '<p></p>' ); |
| 392 | + return; |
396 | 393 | } |
| 394 | + $messageName = ''; |
| 395 | + if( $t->isKnown() ) { |
| 396 | + $messageName = 'searchmenu-exists'; |
| 397 | + } elseif( $t->userCan( 'create' ) ) { |
| 398 | + $messageName = 'searchmenu-new'; |
| 399 | + } else { |
| 400 | + $messageName = 'searchmenu-new-nocreate'; |
| 401 | + } |
| 402 | + $params = array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) ); |
| 403 | + wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) ); |
| 404 | + |
| 405 | + // Extensions using the hook might still return an empty $messageName |
397 | 406 | if( $messageName ) { |
398 | | - $wgOut->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) ) ); |
| 407 | + $this->getOutput()->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", $params ); |
399 | 408 | } else { |
400 | 409 | // preserve the paragraph for margins etc... |
401 | 410 | $wgOut->addHtml( '<p></p>' ); |
— | — | @@ -840,13 +849,17 @@ |
841 | 850 | } |
842 | 851 | $namespaceTables .= Xml::closeElement( 'table' ); |
843 | 852 | } |
| 853 | + |
| 854 | + $showSections = array( 'namespaceTables' => $namespaceTables ); |
| 855 | + |
844 | 856 | // Show redirects check only if backend supports it |
845 | | - $redirects = ''; |
846 | 857 | if( $this->getSearchEngine()->supports( 'list-redirects' ) ) { |
847 | | - $redirects = |
| 858 | + $showSections['redirects'] = |
848 | 859 | Xml::checkLabel( wfMsg( 'powersearch-redir' ), 'redirs', 'redirs', $this->searchRedirects ); |
849 | 860 | } |
850 | 861 | |
| 862 | + wfRunHooks( 'SpecialSearchPowerBox', array( &$showSections, $term, $opts ) ); |
| 863 | + |
851 | 864 | $hidden = ''; |
852 | 865 | unset( $opts['redirs'] ); |
853 | 866 | foreach( $opts as $key => $value ) { |
— | — | @@ -882,9 +895,8 @@ |
883 | 896 | ) |
884 | 897 | ) . |
885 | 898 | Xml::element( 'div', array( 'class' => 'divider' ), '', false ) . |
886 | | - $namespaceTables . |
887 | | - Xml::element( 'div', array( 'class' => 'divider' ), '', false ) . |
888 | | - $redirects . $hidden . |
| 899 | + implode( Xml::element( 'div', array( 'class' => 'divider' ), '', false ), $showSections ) . |
| 900 | + $hidden . |
889 | 901 | Xml::closeElement( 'fieldset' ); |
890 | 902 | } |
891 | 903 | |
Property changes on: branches/wmf/1.18wmf1/includes/specials |
___________________________________________________________________ |
Modified: svn:mergeinfo |
892 | 904 | Merged /branches/REL1_18/phase3/includes/specials:r102560 |
893 | 905 | Merged /trunk/phase3/includes/specials:r97175 |
Property changes on: branches/wmf/1.18wmf1/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
894 | 906 | Merged /branches/REL1_18/phase3/includes:r102560 |
895 | 907 | Merged /trunk/phase3/includes:r97175 |
Property changes on: branches/wmf/1.18wmf1 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
896 | 908 | Merged /branches/REL1_18/phase3:r102560 |
897 | 909 | Merged /trunk/phase3:r97175 |