Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | |
19 | 19 | protected $mPrefix, $mURL, $mLocal, $mTrans; |
20 | 20 | |
21 | | - function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ){ |
| 21 | + function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) { |
22 | 22 | $this->mPrefix = $prefix; |
23 | 23 | $this->mURL = $url; |
24 | 24 | $this->mLocal = $local; |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | * @return bool Whether it exists |
32 | 32 | * @param $prefix string Interwiki prefix to use |
33 | 33 | */ |
34 | | - static public function isValidInterwiki( $prefix ){ |
| 34 | + static public function isValidInterwiki( $prefix ) { |
35 | 35 | $result = self::fetch( $prefix ); |
36 | 36 | return (bool)$result; |
37 | 37 | } |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | return null; |
49 | 49 | } |
50 | 50 | $prefix = $wgContLang->lc( $prefix ); |
51 | | - if( isset( self::$smCache[$prefix] ) ){ |
| 51 | + if( isset( self::$smCache[$prefix] ) ) { |
52 | 52 | return self::$smCache[$prefix]; |
53 | 53 | } |
54 | 54 | global $wgInterwikiCache; |
— | — | @@ -55,11 +55,11 @@ |
56 | 56 | $iw = Interwiki::getInterwikiCached( $prefix ); |
57 | 57 | } else { |
58 | 58 | $iw = Interwiki::load( $prefix ); |
59 | | - if( !$iw ){ |
| 59 | + if( !$iw ) { |
60 | 60 | $iw = false; |
61 | 61 | } |
62 | 62 | } |
63 | | - if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ){ |
| 63 | + if( self::CACHE_LIMIT && count( self::$smCache ) >= self::CACHE_LIMIT ) { |
64 | 64 | reset( self::$smCache ); |
65 | 65 | unset( self::$smCache[ key( self::$smCache ) ] ); |
66 | 66 | } |
— | — | @@ -98,18 +98,18 @@ |
99 | 99 | * @param $prefix \type{\string} Database key |
100 | 100 | * @return \type{\string) The entry |
101 | 101 | */ |
102 | | - protected static function getInterwikiCacheEntry( $prefix ){ |
| 102 | + protected static function getInterwikiCacheEntry( $prefix ) { |
103 | 103 | global $wgInterwikiCache, $wgInterwikiScopes, $wgInterwikiFallbackSite; |
104 | 104 | static $db, $site; |
105 | 105 | |
106 | 106 | wfDebug( __METHOD__ . "( $prefix )\n" ); |
107 | | - if( !$db ){ |
| 107 | + if( !$db ) { |
108 | 108 | $db = dba_open( $wgInterwikiCache, 'r', 'cdb' ); |
109 | 109 | } |
110 | 110 | /* Resolve site name */ |
111 | 111 | if( $wgInterwikiScopes>=3 && !$site ) { |
112 | 112 | $site = dba_fetch( '__sites:' . wfWikiID(), $db ); |
113 | | - if ( $site == '' ){ |
| 113 | + if ( $site == '' ) { |
114 | 114 | $site = $wgInterwikiFallbackSite; |
115 | 115 | } |
116 | 116 | } |
— | — | @@ -141,9 +141,9 @@ |
142 | 142 | $key = wfMemcKey( 'interwiki', $prefix ); |
143 | 143 | $mc = $wgMemc->get( $key ); |
144 | 144 | $iw = false; |
145 | | - if( $mc && is_array( $mc ) ){ // is_array is hack for old keys |
| 145 | + if( $mc && is_array( $mc ) ) { // is_array is hack for old keys |
146 | 146 | $iw = Interwiki::loadFromArray( $mc ); |
147 | | - if( $iw ){ |
| 147 | + if( $iw ) { |
148 | 148 | return $iw; |
149 | 149 | } |
150 | 150 | } |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | * @static |
172 | 172 | */ |
173 | 173 | protected static function loadFromArray( $mc ) { |
174 | | - if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ){ |
| 174 | + if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) { |
175 | 175 | $iw = new Interwiki(); |
176 | 176 | $iw->mURL = $mc['iw_url']; |
177 | 177 | $iw->mLocal = $mc['iw_local']; |
— | — | @@ -186,19 +186,19 @@ |
187 | 187 | * @param $title string What text to put for the article name |
188 | 188 | * @return string The URL |
189 | 189 | */ |
190 | | - function getURL( $title = null ){ |
| 190 | + function getURL( $title = null ) { |
191 | 191 | $url = $this->mURL; |
192 | | - if( $title != null ){ |
| 192 | + if( $title != null ) { |
193 | 193 | $url = str_replace( "$1", $title, $url ); |
194 | 194 | } |
195 | 195 | return $url; |
196 | 196 | } |
197 | 197 | |
198 | | - function isLocal(){ |
| 198 | + function isLocal() { |
199 | 199 | return $this->mLocal; |
200 | 200 | } |
201 | 201 | |
202 | | - function isTranscludable(){ |
| 202 | + function isTranscludable() { |
203 | 203 | return $this->mTrans; |
204 | 204 | } |
205 | 205 | |