r75608 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75607‎ | r75608 | r75609 >
Date:10:00, 28 October 2010
Author:nad
Status:deferred
Tags:
Comment:
remove the out->htmlTitle stuff, was very old code and too specific to be useful
Modified paths:
  • /trunk/extensions/PdfBook/PdfBook.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PdfBook/PdfBook.php
@@ -16,7 +16,7 @@
1717 */
1818 if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." );
1919
20 -define( 'PDFBOOK_VERSION', "1.0.5, 2010-09-19" );
 20+define( 'PDFBOOK_VERSION', "1.0.6, 2010-10-28" );
2121
2222 $wgExtensionFunctions[] = 'wfSetupPdfBook';
2323 $wgHooks['LanguageGetMagic'][] = 'wfPdfBookLanguageGetMagic';
@@ -45,7 +45,7 @@
4646 $wgHooks['UnknownAction'][] = $this;
4747
4848 # Hooks for pre-Vector and Vector addtabs.
49 - if ( $wgPdfBookTab ) {
 49+ if( $wgPdfBookTab ) {
5050 $wgHooks['SkinTemplateTabs'][] = $this ;
5151 $wgHooks['SkinTemplateNavigation'][] = $this;
5252 }
@@ -98,7 +98,7 @@
9999 if( $format == 'single' ) $articles = array( $title );
100100 else {
101101 $articles = array();
102 - if ( $title->getNamespace() == NS_CATEGORY ) {
 102+ if( $title->getNamespace() == NS_CATEGORY ) {
103103 $db = wfGetDB( DB_SLAVE );
104104 $cat = $db->addQuotes( $title->getDBkey() );
105105 $result = $db->select(
@@ -108,7 +108,7 @@
109109 'PdfBook',
110110 array( 'ORDER BY' => 'cl_sortkey' )
111111 );
112 - if ( $result instanceof ResultWrapper ) $result = $result->result;
 112+ if( $result instanceof ResultWrapper ) $result = $result->result;
113113 while ( $row = $db->fetchRow( $result ) ) $articles[] = Title::newFromID( $row[0] );
114114 }
115115 else {
@@ -126,22 +126,20 @@
127127 $wgScriptPath = $wgServer.$wgScriptPath;
128128 $wgUploadPath = $wgServer.$wgUploadPath;
129129 $wgScript = $wgServer.$wgScript;
130 - foreach ( $articles as $title ) {
 130+ foreach( $articles as $title ) {
131131 $ttext = $title->getPrefixedText();
132 - if ( !in_array( $ttext, $exclude ) ) {
 132+ if( !in_array( $ttext, $exclude ) ) {
133133 $article = new Article( $title );
134134 $text = $article->fetchContent();
135135 $text = preg_replace( "/<!--([^@]+?)-->/s", "@@" . "@@$1@@" . "@@", $text ); # preserve HTML comments
136 - if ( $format != 'single' ) $text .= "__NOTOC__";
 136+ if( $format != 'single' ) $text .= "__NOTOC__";
137137 $opt->setEditSection( false ); # remove section-edit links
138 - $wgOut->setHTMLTitle( $ttext ); # use this so DISPLAYTITLE magic works
139138 $out = $wgParser->parse( $text, $title, $opt, true, true );
140 - $ttext = $wgOut->getHTMLTitle();
141139 $text = $out->getText();
142140 $text = preg_replace( "|(<img[^>]+?src=\")(/.+?>)|", "$1$wgServer$2", $text ); # make image urls absolute
143141 $text = preg_replace( "|<div\s*class=['\"]?noprint[\"']?>.+?</div>|s", "", $text ); # non-printable areas
144142 $text = preg_replace( "|@{4}([^@]+?)@{4}|s", "<!--$1-->", $text ); # HTML comments hack
145 - $ttext = basename($ttext);
 143+ $ttext = basename( $ttext );
146144 $h1 = $notitle ? "" : "<center><h1>$ttext</h1></center>";
147145 $html .= utf8_decode( "$h1$text\n" );
148146 }

Status & tagging log