Index: trunk/extensions/PdfBook/PdfBook.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | */ |
18 | 18 | if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." ); |
19 | 19 | |
20 | | -define( 'PDFBOOK_VERSION', "1.0.5, 2010-09-19" ); |
| 20 | +define( 'PDFBOOK_VERSION', "1.0.6, 2010-10-28" ); |
21 | 21 | |
22 | 22 | $wgExtensionFunctions[] = 'wfSetupPdfBook'; |
23 | 23 | $wgHooks['LanguageGetMagic'][] = 'wfPdfBookLanguageGetMagic'; |
— | — | @@ -45,7 +45,7 @@ |
46 | 46 | $wgHooks['UnknownAction'][] = $this; |
47 | 47 | |
48 | 48 | # Hooks for pre-Vector and Vector addtabs. |
49 | | - if ( $wgPdfBookTab ) { |
| 49 | + if( $wgPdfBookTab ) { |
50 | 50 | $wgHooks['SkinTemplateTabs'][] = $this ; |
51 | 51 | $wgHooks['SkinTemplateNavigation'][] = $this; |
52 | 52 | } |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | if( $format == 'single' ) $articles = array( $title ); |
100 | 100 | else { |
101 | 101 | $articles = array(); |
102 | | - if ( $title->getNamespace() == NS_CATEGORY ) { |
| 102 | + if( $title->getNamespace() == NS_CATEGORY ) { |
103 | 103 | $db = wfGetDB( DB_SLAVE ); |
104 | 104 | $cat = $db->addQuotes( $title->getDBkey() ); |
105 | 105 | $result = $db->select( |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | 'PdfBook', |
110 | 110 | array( 'ORDER BY' => 'cl_sortkey' ) |
111 | 111 | ); |
112 | | - if ( $result instanceof ResultWrapper ) $result = $result->result; |
| 112 | + if( $result instanceof ResultWrapper ) $result = $result->result; |
113 | 113 | while ( $row = $db->fetchRow( $result ) ) $articles[] = Title::newFromID( $row[0] ); |
114 | 114 | } |
115 | 115 | else { |
— | — | @@ -126,22 +126,20 @@ |
127 | 127 | $wgScriptPath = $wgServer.$wgScriptPath; |
128 | 128 | $wgUploadPath = $wgServer.$wgUploadPath; |
129 | 129 | $wgScript = $wgServer.$wgScript; |
130 | | - foreach ( $articles as $title ) { |
| 130 | + foreach( $articles as $title ) { |
131 | 131 | $ttext = $title->getPrefixedText(); |
132 | | - if ( !in_array( $ttext, $exclude ) ) { |
| 132 | + if( !in_array( $ttext, $exclude ) ) { |
133 | 133 | $article = new Article( $title ); |
134 | 134 | $text = $article->fetchContent(); |
135 | 135 | $text = preg_replace( "/<!--([^@]+?)-->/s", "@@" . "@@$1@@" . "@@", $text ); # preserve HTML comments |
136 | | - if ( $format != 'single' ) $text .= "__NOTOC__"; |
| 136 | + if( $format != 'single' ) $text .= "__NOTOC__"; |
137 | 137 | $opt->setEditSection( false ); # remove section-edit links |
138 | | - $wgOut->setHTMLTitle( $ttext ); # use this so DISPLAYTITLE magic works |
139 | 138 | $out = $wgParser->parse( $text, $title, $opt, true, true ); |
140 | | - $ttext = $wgOut->getHTMLTitle(); |
141 | 139 | $text = $out->getText(); |
142 | 140 | $text = preg_replace( "|(<img[^>]+?src=\")(/.+?>)|", "$1$wgServer$2", $text ); # make image urls absolute |
143 | 141 | $text = preg_replace( "|<div\s*class=['\"]?noprint[\"']?>.+?</div>|s", "", $text ); # non-printable areas |
144 | 142 | $text = preg_replace( "|@{4}([^@]+?)@{4}|s", "<!--$1-->", $text ); # HTML comments hack |
145 | | - $ttext = basename($ttext); |
| 143 | + $ttext = basename( $ttext ); |
146 | 144 | $h1 = $notitle ? "" : "<center><h1>$ttext</h1></center>"; |
147 | 145 | $html .= utf8_decode( "$h1$text\n" ); |
148 | 146 | } |