Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php |
— | — | @@ -318,7 +318,7 @@ |
319 | 319 | # no permission if the wiki already exists |
320 | 320 | $link = self::getSubdomain( $prefixdata['lang'], |
321 | 321 | $prefixdata['project'], ( $title->getNsText() ? $title->getNsText() . ':' : '' ) . |
322 | | - preg_replace( '/ /', '_', $prefixdata['realtitle'] ) ); |
| 322 | + str_replace( ' ', '_', $prefixdata['realtitle'] ) ); |
323 | 323 | $result[] = array( 'wminc-error-wiki-exists', $link ); |
324 | 324 | return false; |
325 | 325 | } |
— | — | @@ -415,7 +415,7 @@ |
416 | 416 | return false; # shouldn't be, but you never know |
417 | 417 | } |
418 | 418 | global $wmincProjectDatabases; |
419 | | - return preg_replace('/-/', '_', $prefix['lang'] ) . |
| 419 | + return str_replace('-', '_', $prefix['lang'] ) . |
420 | 420 | $wmincProjectDatabases[$prefix['project']]; |
421 | 421 | } |
422 | 422 | |
— | — | @@ -565,7 +565,7 @@ |
566 | 566 | return $wgConf->get( 'wgServer', |
567 | 567 | self::getDB( $prefix ), $projectName, |
568 | 568 | array( 'lang' => str_replace( '_', '-', $lang ), 'site' => $projectName ) |
569 | | - ) . ( $title ? preg_replace( '/\$1/', $title, $wgArticlePath ) : '' ); |
| 569 | + ) . ( $title ? str_replace( '$1', $title, $wgArticlePath ) : '' ); |
570 | 570 | } |
571 | 571 | |
572 | 572 | /** |
— | — | @@ -652,14 +652,14 @@ |
653 | 653 | return false; |
654 | 654 | } |
655 | 655 | global $wgLogo; |
656 | | - $prefixForPageTitle = preg_replace('/\//', '-', strtolower( $setLogo['prefix'] ) ); |
| 656 | + $prefixForPageTitle = str_replace( '/', '-', strtolower( $setLogo['prefix'] ) ); |
657 | 657 | $file = wfFindFile( wfMsgForContentNoTrans( 'Incubator-logo-' . $prefixForPageTitle ) ); |
658 | 658 | if( !$file ) { |
659 | 659 | # if MediaWiki:Incubator-logo-wx-xx(x) doesn't exist, |
660 | 660 | # try a general, default logo for that project |
661 | 661 | global $wmincProjects; |
662 | 662 | $project = $setLogo['project']; |
663 | | - $projectForFile = preg_replace('/ /', '-', strtolower( $wmincProjects[$project] ) ); |
| 663 | + $projectForFile = str_replace( ' ', '-', strtolower( $wmincProjects[$project] ) ); |
664 | 664 | $imageobj = wfFindFile( wfMsg( 'wminc-logo-' . $projectForFile ) ); |
665 | 665 | if( $imageobj ) { |
666 | 666 | $thumb = $imageobj->transform( array( 'width' => 135, 'height' => 135 ) ); |
Index: trunk/extensions/WikimediaIncubator/InfoPage.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | /** |
48 | 48 | * Small convenience function to display a (clickable) logo |
49 | 49 | * @param $project Project name |
| 50 | + * @return String |
50 | 51 | */ |
51 | 52 | public function makeLogo( $project, $clickable = true, $width = 25, $height = '', $url = '', $args = array() ) { |
52 | 53 | global $wgUser; |
— | — | @@ -72,6 +73,10 @@ |
73 | 74 | ); |
74 | 75 | } |
75 | 76 | |
| 77 | + /** |
| 78 | + * @return String: list of clickable logos of other projects |
| 79 | + * (Wikipedia, Wiktionary, ...) |
| 80 | + */ |
76 | 81 | public function listOtherProjects() { |
77 | 82 | global $wmincProjects, $wmincSisterProjects; |
78 | 83 | $otherProjects = $wmincProjects + $wmincSisterProjects; |
— | — | @@ -84,6 +89,10 @@ |
85 | 90 | implode( '', $listOtherProjects ) . '</ul>'; |
86 | 91 | } |
87 | 92 | |
| 93 | + /** |
| 94 | + * @return String: list of clickable logos of multilingual projects |
| 95 | + * (Meta, Commons, ...) |
| 96 | + */ |
88 | 97 | public function listMultilingualProjects() { |
89 | 98 | global $wmincMultilingualProjects; |
90 | 99 | if( !is_array( $wmincMultilingualProjects ) ) { return; } |
— | — | @@ -95,11 +104,17 @@ |
96 | 105 | implode( '', $list ) . '</ul>'; |
97 | 106 | } |
98 | 107 | |
| 108 | + /** |
| 109 | + * @return String: "Welcome to Incubator" message |
| 110 | + */ |
99 | 111 | public function showWelcome() { |
100 | 112 | return Html::rawElement( 'div', array( 'class' => 'wminc-infopage-welcome' ), |
101 | 113 | wfMsgWikiHtml( 'wminc-infopage-welcome' ) ); |
102 | 114 | } |
103 | 115 | |
| 116 | + /** |
| 117 | + * @return String: the core HTML for the info page |
| 118 | + */ |
104 | 119 | public function StandardInfoPage( $beforetitle, $aftertitle, $content ) { |
105 | 120 | global $wgLang, $wgOut; |
106 | 121 | $wgOut->addModules( 'WikimediaIncubator.InfoPage' ); |
— | — | @@ -114,6 +129,9 @@ |
115 | 130 | $content ); |
116 | 131 | } |
117 | 132 | |
| 133 | + /** |
| 134 | + * @return String |
| 135 | + */ |
118 | 136 | public function showMissingWiki() { |
119 | 137 | $content = Html::rawElement( 'div', |
120 | 138 | array( 'class' => 'wminc-infopage-status' ), |
— | — | @@ -122,7 +140,7 @@ |
123 | 141 | ) . |
124 | 142 | Html::rawElement( 'ul', array( 'class' => 'wminc-infopage-options' ), |
125 | 143 | Html::rawElement( 'li', null, |
126 | | - wfMsgExt( 'wminc-infopage-option-' . ( $this->mIsSister ? 'startsister' : 'startwiki' ), |
| 144 | + wfMsgExt( $this->mIsSister ? 'wminc-infopage-option-startsister' : 'wminc-infopage-option-startwiki', |
127 | 145 | array( 'parseinline' ), $this->mProjectName, $this->mPortal ) ) . |
128 | 146 | Html::rawElement( 'li', null, |
129 | 147 | wfMsgExt( 'wminc-infopage-option-languages-existing', |
— | — | @@ -137,6 +155,9 @@ |
138 | 156 | return $this->StandardInfoPage( $this->showWelcome(), '', $content ); |
139 | 157 | } |
140 | 158 | |
| 159 | + /** |
| 160 | + * @return String |
| 161 | + */ |
141 | 162 | public function showIncubatingWiki() { |
142 | 163 | global $wgUser, $wgLang; |
143 | 164 | $substatus = $this->mSubStatus; |
— | — | @@ -164,6 +185,9 @@ |
165 | 186 | return $this->StandardInfoPage( '', $gotoMainPage, $content ); |
166 | 187 | } |
167 | 188 | |
| 189 | + /** |
| 190 | + * @return String |
| 191 | + */ |
168 | 192 | public function showExistingWiki() { |
169 | 193 | global $wgLang, $wgUser; |
170 | 194 | $created = isset( $this->mCreated ) ? $this->mCreated : ''; |