| Index: branches/REL1_18/phase3/docs/hooks.txt |
| — | — | @@ -1684,6 +1684,11 @@ |
| 1685 | 1685 | &$query_options: array of options for the database request |
| 1686 | 1686 | &$select: Array of columns to select |
| 1687 | 1687 | |
| | 1688 | +'SpecialSearchCreateLink': called when making the message to create a page or |
| | 1689 | +go to the existing page |
| | 1690 | +$t: title object searched for |
| | 1691 | +&$params: an array of the default message name and page title (as parameter) |
| | 1692 | + |
| 1688 | 1693 | 'SpecialSearchGo': called when user clicked the "Go" |
| 1689 | 1694 | &$title: title object generated from the text entered by the user |
| 1690 | 1695 | &$term: the search term entered by the user |
| — | — | @@ -1692,6 +1697,12 @@ |
| 1693 | 1698 | target doesn't exist |
| 1694 | 1699 | &$title: title object generated from the text entered by the user |
| 1695 | 1700 | |
| | 1701 | +'SpecialSearchPowerBox': the equivalent of SpecialSearchProfileForm for |
| | 1702 | +the advanced form, a.k.a. power search box |
| | 1703 | +&$showSections: an array to add values with more options to |
| | 1704 | +$term: the search term (not a title object) |
| | 1705 | +$opts: an array of hidden options (containing 'redirs' and 'profile') |
| | 1706 | + |
| 1696 | 1707 | 'SpecialSearchProfiles': allows modification of search profiles |
| 1697 | 1708 | &$profiles: profiles, which can be modified. |
| 1698 | 1709 | |
| Property changes on: branches/REL1_18/phase3/docs/hooks.txt |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 1699 | 1710 | Merged /trunk/phase3/docs/hooks.txt:r97175 |
| Index: branches/REL1_18/phase3/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/REL1_18/phase3/includes/specials |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 892 | 904 | Merged /trunk/phase3/includes/specials:r97175 |
| Property changes on: branches/REL1_18/phase3/includes |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 893 | 905 | Merged /trunk/phase3/includes:r97175 |
| Property changes on: branches/REL1_18/phase3 |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 894 | 906 | Merged /trunk/phase3:r97175 |