Index: branches/RL2/extensions/Gadgets/SpecialGadgets.php |
— | — | @@ -122,50 +122,59 @@ |
123 | 123 | ) |
124 | 124 | |
125 | 125 | ); |
126 | | - if ( $user->isAllowed( 'gadgets-definition-edit' ) ) { |
127 | | - $extra[] = Linker::link( |
128 | | - GadgetsHooks::getDefinitionTitleFromID( $gadget->getId() ), |
129 | | - wfMessage( 'gadgets-gadget-modify' )->escaped(), |
130 | | - array( |
131 | | - 'title' => wfMessage( 'gadgets-gadget-modify-tooltip' )->plain(), |
132 | | - 'class' => 'mw-gadgets-modify', |
133 | | - ), |
134 | | - array( 'action' => 'edit' ) |
135 | | - ); |
136 | | - } |
| 126 | + $gadgetDefinitionTitle = GadgetsHooks::getDefinitionTitleFromID( $gadget->getId() ); |
137 | 127 | |
138 | | - if ( $user->isAllowed( 'gadgets-definition-delete' ) ) { |
139 | | - $extra[] = Linker::link( |
140 | | - GadgetsHooks::getDefinitionTitleFromID( $gadget->getId() ), |
141 | | - wfMessage( 'gadgets-gadget-delete' )->escaped(), |
142 | | - array( |
143 | | - 'title' => wfMessage( 'gadgets-gadget-delete-tooltip' )->plain(), |
144 | | - 'class' => 'mw-gadgets-delete', |
145 | | - ), |
146 | | - array( 'action' => 'delete' ) |
147 | | - ); |
| 128 | + if ( $gadgetDefinitionTitle instanceof Title ) { |
| 129 | + |
| 130 | + if ( $user->isAllowed( 'gadgets-definition-edit' ) ) { |
| 131 | + $extra[] = Linker::link( |
| 132 | + $gadgetDefinitionTitle, |
| 133 | + wfMessage( 'gadgets-gadget-modify' )->escaped(), |
| 134 | + array( |
| 135 | + 'title' => wfMessage( 'gadgets-gadget-modify-tooltip' )->plain(), |
| 136 | + 'class' => 'mw-gadgets-modify', |
| 137 | + ), |
| 138 | + array( 'action' => 'edit' ) |
| 139 | + ); |
| 140 | + } |
| 141 | + |
| 142 | + if ( $user->isAllowed( 'gadgets-definition-delete' ) ) { |
| 143 | + $extra[] = Linker::link( |
| 144 | + $gadgetDefinitionTitle, |
| 145 | + wfMessage( 'gadgets-gadget-delete' )->escaped(), |
| 146 | + array( |
| 147 | + 'title' => wfMessage( 'gadgets-gadget-delete-tooltip' )->plain(), |
| 148 | + 'class' => 'mw-gadgets-delete', |
| 149 | + ), |
| 150 | + array( 'action' => 'delete' ) |
| 151 | + ); |
| 152 | + } |
148 | 153 | } |
149 | 154 | |
150 | 155 | // Edit interface (gadget title and description) |
151 | 156 | $editTitle = $editDescription = ''; |
152 | 157 | if ( $user->isAllowed( 'editinterface' ) ) { |
153 | 158 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, $gadget->getTitleMessageKey() . $suffix ); |
154 | | - $editLink = Linker::link( |
155 | | - $t, |
156 | | - wfMessage( 'gadgets-message-edit' )->escaped(), |
157 | | - array( 'title' => wfMessage( 'gadgets-message-edit-tooltip', $t->getPrefixedText() ) ), |
158 | | - array( 'action' => 'edit' ) |
159 | | - ); |
160 | | - $editTitle = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 159 | + if ( $t ) { |
| 160 | + $editLink = Linker::link( |
| 161 | + $t, |
| 162 | + wfMessage( 'gadgets-message-edit' )->escaped(), |
| 163 | + array( 'title' => wfMessage( 'gadgets-message-edit-tooltip', $t->getPrefixedText() ) ), |
| 164 | + array( 'action' => 'edit' ) |
| 165 | + ); |
| 166 | + $editTitle = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 167 | + } |
161 | 168 | |
162 | 169 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, $gadget->getDescriptionMessageKey() . $suffix ); |
163 | | - $editLink = Linker::link( |
164 | | - $t, |
165 | | - wfMessage( $t->isKnown() ? 'gadgets-desc-edit' : 'gadgets-desc-add' )->escaped(), |
166 | | - array( 'title' => wfMessage( $t->isKnown() ? 'gadgets-desc-edit-tooltip' : 'gadgets-desc-add-tooltip', $t->getPrefixedText() ) ), |
167 | | - array( 'action' => 'edit' ) |
168 | | - ); |
169 | | - $editDescription = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 170 | + if ( $t ) { |
| 171 | + $editLink = Linker::link( |
| 172 | + $t, |
| 173 | + wfMessage( $t->isKnown() ? 'gadgets-desc-edit' : 'gadgets-desc-add' )->escaped(), |
| 174 | + array( 'title' => wfMessage( $t->isKnown() ? 'gadgets-desc-edit-tooltip' : 'gadgets-desc-add-tooltip', $t->getPrefixedText() ) ), |
| 175 | + array( 'action' => 'edit' ) |
| 176 | + ); |
| 177 | + $editDescription = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 178 | + } |
170 | 179 | } |
171 | 180 | |
172 | 181 | // Gadget heading |
— | — | @@ -262,13 +271,15 @@ |
263 | 272 | $editLink = ''; |
264 | 273 | if ( $user->isAllowed( 'editinterface' ) && $category !== '' ) { |
265 | 274 | $t = Title::makeTitleSafe( NS_MEDIAWIKI, "gadgetcategory-{$category}{$suffix}" ); |
266 | | - $editLink = Linker::link( |
267 | | - $t, |
268 | | - wfMessage( 'gadgets-message-edit' )->escaped(), |
269 | | - array( 'title' => wfMessage( 'gadgets-message-edit-tooltip', $t->getPrefixedText() ) ), |
270 | | - array( 'action' => 'edit' ) |
271 | | - ); |
272 | | - $editLink = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 275 | + if ( $t ) { |
| 276 | + $editLink = Linker::link( |
| 277 | + $t, |
| 278 | + wfMessage( 'gadgets-message-edit' )->escaped(), |
| 279 | + array( 'title' => wfMessage( 'gadgets-message-edit-tooltip', $t->getPrefixedText() ) ), |
| 280 | + array( 'action' => 'edit' ) |
| 281 | + ); |
| 282 | + $editLink = '<span class="mw-gadgets-messagelink">' . $editLink . '</span>'; |
| 283 | + } |
273 | 284 | } |
274 | 285 | |
275 | 286 | // Category heading |
— | — | @@ -369,7 +380,7 @@ |
370 | 381 | // from NS_MEDIAWIKI that don't exist but are 'isAlwaysKnown' |
371 | 382 | // due to their default value from PHP messages files |
372 | 383 | // (which we don't want to export) |
373 | | - if ( is_object( $exportTitle ) && $exportTitle->exists() ) { |
| 384 | + if ( $exportTitle && $exportTitle->exists() ) { |
374 | 385 | $exportList .= $exportTitle->getPrefixedDBkey() . "\n"; |
375 | 386 | $exportDisplayList .= '<li>'. Linker::link( $exportTitle ) . '</li>'; |
376 | 387 | } |