Index: trunk/extensions/FileAttach/FileAttach.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' ); |
13 | | -define( 'FILEATTCH_VERSION', '1.0.1, 2010-04-16' ); |
| 13 | +define( 'FILEATTCH_VERSION', '1.0.2, 2010-04-24' ); |
14 | 14 | |
15 | 15 | $wgAttachmentHeading = 'Attachments'; |
16 | 16 | |
— | — | @@ -45,6 +45,9 @@ |
46 | 46 | function onBeforePageDisplay( &$out, &$skin ) { |
47 | 47 | global $wgParser, $wgAttachmentHeading; |
48 | 48 | |
| 49 | + # Bail if page inappropriate for attachments |
| 50 | + if( !is_object( $wgParser ) || !is_object( $wgParser->mOutput )|| !isset( $wgParser->mOutput->mSections ) ) return true; |
| 51 | + |
49 | 52 | # If the last section in the article is level 2 and "Attachments" then convert to file icons |
50 | 53 | $sections = $wgParser->mOutput->mSections; |
51 | 54 | if( is_array( $sections ) && count( $sections ) > 0 ) { |