. "</script>\n";
}
- /** @todo document */
+ /**
+ * Used to generate section edit links that point to "other" pages
+ * (sections that are really part of included pages).
+ *
+ * @param $title Title string.
+ * @param $section Integer: section number.
+ */
public function editSectionLinkForOther( $title, $section ) {
- global $wgContLang;
$title = Title::newFromText( $title );
- $editurl = '§ion='.$section;
- $url = $this->makeKnownLinkObj( $title, wfMsg('editsection'), 'action=edit'.$editurl );
- $result = null;
- wfRunHooks( 'EditSectionLinkForOther', array( &$this, $title, $section, $url, &$result ) );
- return is_null( $result )
- ? "<span class=\"editsection\">[{$url}]</span>"
- : "<span class=\"editsection\">[{$result}]</span>";
+ return $this->doEditSectionLink( $title, $section, '', 'EditSectionLinkForOther' );
}
/**
- * @param $title Title object.
+ * @param $nt Title object.
* @param $section Integer: section number.
* @param $hint Link String: title, or default if omitted or empty
*/
- public function editSectionLink( $nt, $section, $hint='' ) {
+ public function editSectionLink( Title $nt, $section, $hint='' ) {
+ if( $hint != '' ) {
+ $hint = wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) );
+ $hint = " title=\"$hint\"";
+ }
+ return $this->doEditSectionLink( $nt, $section, $hint, 'EditSectionLink' );
+ }
+
+ /**
+ * Implement editSectionLink and editSectionLinkForOther.
+ *
+ * @param $nt Title object
+ * @param $section Integer, section number
+ * @param $hint String, for HTML title attribute
+ * @param $hook String, name of hook to run
+ * @return String, HTML to use for edit link
+ */
+ private function doEditSectionLink( Title $nt, $section, $hint, $hook ) {
global $wgContLang;
$editurl = '§ion='.$section;
- $hint = ( $hint=='' ) ? '' : ' title="' . wfMsgHtml( 'editsectionhint', htmlspecialchars( $hint ) ) . '"';
- $url = $this->makeKnownLinkObj( $nt, wfMsg('editsection'), 'action=edit'.$editurl, '', '', '', $hint );
+ $url = $this->makeKnownLinkObj(
+ $nt,
+ wfMsg('editsection'),
+ 'action=edit'.$editurl,
+ '', '', '', $hint
+ );
$result = null;
- wfRunHooks( 'EditSectionLink', array( &$this, $nt, $section, $hint, $url, &$result ) );
- return is_null( $result )
- ? "<span class=\"editsection\">[{$url}]</span>"
- : "<span class=\"editsection\">[{$result}]</span>";
+
+ // The two hooks have slightly different interfaces . . .
+ if( $hook == 'EditSectionLink' ) {
+ wfRunHooks( $hook, array( &$this, $nt, $section, $hint, $url, &$result ) );
+ } elseif( $hook == 'EditSectionLinkForOther' ) {
+ wfRunHooks( $hook, array( &$this, $nt, $section, $url, &$result ) );
+ }
+
+ // For reverse compatibility, add the brackets *after* the hook is run,
+ // and even add them to hook-provided text.
+ if( is_null( $result ) ) {
+ $result = wfMsg( 'editsection-brackets', $url );
+ } else {
+ $result = wfMsg( 'editsection-brackets', $result );
+ }
+ return "<span class=\"editsection\">$result</span>";
}
/**
'versionrequired' => 'Version $1 of MediaWiki required',
'versionrequiredtext' => 'Version $1 of MediaWiki is required to use this page. See [[Special:Version|version page]].',
-'ok' => 'OK',
-'sitetitle' => '{{SITENAME}}', # don't translate or duplicate this message to other languages
-'pagetitle' => '$1 - {{SITENAME}}',
-'sitesubtitle' => '', # don't translate or duplicate this message to other languages
-'retrievedfrom' => 'Retrieved from "$1"',
-'youhavenewmessages' => 'You have $1 ($2).',
-'newmessageslink' => 'new messages',
-'newmessagesdifflink' => 'last change',
-'editsection' => 'edit',
-'editold' => 'edit',
-'editsectionhint' => 'Edit section: $1',
-'toc' => 'Contents',
-'showtoc' => 'show',
-'hidetoc' => 'hide',
-'thisisdeleted' => 'View or restore $1?',
-'viewdeleted' => 'View $1?',
-'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}',
-'feedlinks' => 'Feed:',
-'feed-invalid' => 'Invalid subscription feed type.',
-'feed-atom' => 'Atom', # only translate this message to other languages if you have to change it
-'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it
-'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages
-'anonnotice' => '-', # don't translate or duplicate this message to other languages
+'ok' => 'OK',
+'sitetitle' => '{{SITENAME}}', # don't translate or duplicate this message to other languages
+'pagetitle' => '$1 - {{SITENAME}}',
+'sitesubtitle' => '', # don't translate or duplicate this message to other languages
+'retrievedfrom' => 'Retrieved from "$1"',
+'youhavenewmessages' => 'You have $1 ($2).',
+'newmessageslink' => 'new messages',
+'newmessagesdifflink' => 'last change',
+'editsection' => 'edit',
+'editsection-brackets' => '[$1]', # only translate this message to other languages if you have to change it
+'editold' => 'edit',
+'editsectionhint' => 'Edit section: $1',
+'toc' => 'Contents',
+'showtoc' => 'show',
+'hidetoc' => 'hide',
+'thisisdeleted' => 'View or restore $1?',
+'viewdeleted' => 'View $1?',
+'restorelink' => '{{PLURAL:$1|one deleted edit|$1 deleted edits}}',
+'feedlinks' => 'Feed:',
+'feed-invalid' => 'Invalid subscription feed type.',
+'feed-atom' => 'Atom', # only translate this message to other languages if you have to change it
+'feed-rss' => 'RSS', # only translate this message to other languages if you have to change it
+'sitenotice' => '-', # the equivalent to wgSiteNotice; don't translate or duplicate this message to other languages
+'anonnotice' => '-', # don't translate or duplicate this message to other languages
# Short words for each namespace, by default used in the 'article' tab in monobook
'nstab-main' => 'Article',
'files' => 'Files',
# User rights
-'userrights-lookup-user' => 'Manage user groups',
-'userrights-user-editname' => 'Enter a username:',
-'editusergroup' => 'Edit User Groups',
-'userrights-editusergroup' => 'Edit user groups',
-'saveusergroups' => 'Save User Groups',
-'userrights-groupsmember' => 'Member of:',
-'userrights-groupsavailable' => 'Available groups:',
-'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to.
+'userrights-lookup-user' => 'Manage user groups',
+'userrights-user-editname' => 'Enter a username:',
+'editusergroup' => 'Edit User Groups',
+'userrights-editusergroup' => 'Edit user groups',
+'saveusergroups' => 'Save User Groups',
+'userrights-groupsmember' => 'Member of:',
+'userrights-groupsavailable' => 'Available groups:',
+'userrights-groupshelp' => 'Select groups you want the user to be removed from or added to.
Unselected groups will not be changed. You can deselect a group with CTRL + Left Click',
-'userrights-reason' => 'Reason for change:',
-'userrights-available-none' => 'You may not alter group membership.',
-'userrights-available-add' => 'You can add users to $1.',
+'userrights-reason' => 'Reason for change:',
+'userrights-available-none' => 'You may not alter group membership.',
+'userrights-available-add' => 'You can add users to $1.',
'userrights-available-remove' => 'You can remove users from $1.',
# Groups