18 # List of default messages for the sidebar. The sidebar doesn't care at
19 # all whether they are full URLs, interwiki links or local titles.
29 # We're assuming that isValidURI works as advertised: it's also
30 # tested separately, in tests/phpunit/includes/HttpTest.php.
31 foreach ( $URL_messages as $m ) {
34 $this->messages[$m][
'href'] = $titleName;
36 $title = Title::newFromText( $titleName );
37 $this->messages[$m][
'href'] = $title->getLocalURL();
46 $this->
skin->getContext()->setLanguage( Language::factory(
'en' ) );
58 $this->
skin->addToSidebarPlain( $bar, $text );
59 $this->assertEquals( $expected, $bar, $message );
85 'href' => $this->messages[
'helppage'][
'href'],
101 'wgNoFollowLinks' =>
true,
102 'wgNoFollowDomainExceptions' => [],
103 'wgNoFollowNsExceptions' => [],
110 'href' =>
'https://www.mediawiki.org/',
116 # ... skipped since it is missing a pipe with a description
119** https://www.mediawiki.org/| Home
120** http://valid.no.desc.org/
133 # The first 2 are skipped
134 # Doesn
't really test the url properly
135 # because it will vary with $wgArticlePath et al.
139 'href' => Title::newFromText( 'Baz
' )->getLocalURL(),
144 'text
' => 'title-to-display
',
145 'href' => Title::newFromText( 'page-to-go-to
' )->getLocalURL(),
146 'id' => 'n-title-to-display
',
154** {{PLURAL:1|page-to-go-to{{int:pipe-separator/en}}title-to-display|branch not taken}}
159 #### Attributes for external links ##########################
160 private function getAttribs() {
161 # Sidebar text we will use everytime
166 $this->
skin->addToSidebarPlain( $bar, $text );
168 return $bar[
'Title'][0];
176 'wgNoFollowLinks' =>
true,
177 'wgNoFollowDomainExceptions' => [],
178 'wgNoFollowNsExceptions' => [],
179 'wgExternalLinkTarget' =>
false,
183 $this->assertArrayHasKey(
'rel',
$attribs );
184 $this->assertEquals(
'nofollow',
$attribs[
'rel'] );
186 $this->assertArrayNotHasKey(
'target',
$attribs );
197 $this->assertArrayNotHasKey(
'rel',
$attribs,
198 'External URL in sidebar do not have rel=nofollow when $wgNoFollowLinks = false'
208 $this->
setMwGlobals(
'wgExternalLinkTarget', $externalLinkTarget );
211 $this->assertArrayHasKey(
'target',
$attribs );
212 $this->assertEquals(
$attribs[
'target'], $externalLinkTarget );
static isValidURI( $uri)
Checks that the given URI is a valid one.
static singleton()
Get the signleton instance of this class.
Base class for template-based skins.
Represents a title within MediaWiki.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a skin(according to that user 's preference)
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at https
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Further assume MyExt::onFoo needs service Bar