Filip has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/326451 )
Change subject: Replaced "Article::getContent" deprecated in MediaWiki 1.21 ...................................................................... Replaced "Article::getContent" deprecated in MediaWiki 1.21 Replaced "Article" class with "WikiPage" Bug: T151973 Change-Id: I0dc43c8ed8e8cad56f0c5bb96feaefc601a26a11 --- M converters/DomPdfConverter.php 1 file changed, 16 insertions(+), 15 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PdfExport refs/changes/51/326451/1 diff --git a/converters/DomPdfConverter.php b/converters/DomPdfConverter.php index c3b9119..69b8224 100755 --- a/converters/DomPdfConverter.php +++ b/converters/DomPdfConverter.php @@ -4,19 +4,19 @@ /** * A DomPdf based conversion backend. - * + * * Installation: * DomPdf can be downloaded from here: http://code.google.com/p/dompdf/. Unzip the code into your * extension directory and set $wgPdfExportDomPdfConfigFile equal to the full path to the * dompdf_config.inc.php file. - * + * * @author Andreas Hagmann * @author Dumpydooby * @author Christian Neubauer */ class DomPdfConverter extends PdfConverter { /** - * Sets up any necessary command line options. + * Sets up any necessary command line options. * @param Array $options An array of options. */ function initialize (&$options) { @@ -78,12 +78,12 @@ $html = str_replace ('<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />', "", $html); // Work around slow PDF generation on large pages. - if( !ini_get('safe_mode') ) { - set_time_limit(120); - } - + if( !ini_get('safe_mode') ) { + set_time_limit(120); + } + // TODO disable warnings temporarily and then pipe them to the log. - + global $wgOut, $IP, $wgPdfExportAttach; $wgOut->disable(); #$old_error_level = error_reporting( 0 ); @@ -115,7 +115,7 @@ $dompdf->stream(utf8_decode($options['filename']) . ".pdf", array('Attachment'=>($wgPdfExportAttach?1:0))); #error_reporting( $old_error_level ); } - + /** * Get the HTML for a page. This function should filter out any code that the converter can't handle like <script> tags. * @param String $page The page name @@ -132,11 +132,12 @@ $title = Title::newFromText( $page ); if( is_null( $title ) || !$title->userCan( 'read' ) ) return null; - $article = new Article ($title); + $article = new Article( $title ); + $content = $article->getContentObject(); $parserOptions = ParserOptions::newFromUser( $wgUser ); $parserOptions->setEditSection( false ); $parserOptions->setTidy(true); - $parserOutput = $wgParser->parse( $article->preSaveTransform( "__NOTOC__\n\n".$article->getContent() ) ."\n\n", $title, $parserOptions ); + $parserOutput = $wgParser->parse( $article->preSaveTransform( "__NOTOC__\n\n". ContentHandler::getContentText( $content ) ."\n\n", $title, $parserOptions ); $bhtml = $parserOutput->getText(); // Hack to thread the EUR sign correctly @@ -159,7 +160,7 @@ $bhtml = preg_replace('/height="\d+"/', '', $bhtml); // set upper limit for width $bhtml = preg_replace('/width="(\d+)"/e', '"width=\"".($1> $wgPdfExportMaxImageWidth ? $wgPdfExportMaxImageWidth : $1)."\""', $bhtml); - + if ($wgPdfExportHttpsImages) { $bhtml = str_replace('img src=\"https:\/\/','img src=\"http:\/\/', $bhtml); } @@ -167,7 +168,7 @@ $css = $this->getPageCss( $page, $options ); return "<html><head><title>" . utf8_decode($page) . "</title>$css</head><body>" . $bhtml . "</body></html>"; } - + /** * Get any CSS that needs to be added to the page for the PDF tool. * @param String $page The page name @@ -175,9 +176,9 @@ */ function getPageCss($page, $options) { global $wgServer, $wgScriptPath; - + return '<link rel="stylesheet" href="'.$wgServer.$wgScriptPath.'/skins/vector/main-ltr.css?207" type="text/css" media="screen" />'. '<link rel="stylesheet" href="'.$wgServer.$wgScriptPath.'/skins/common/shared.css?207" type="text/css" media="screen" />'. '<link rel="stylesheet" href="'.$wgServer.$wgScriptPath.'/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=18000&action=raw&maxage=18000" type="text/css" media="all" />'; } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/326451 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0dc43c8ed8e8cad56f0c5bb96feaefc601a26a11 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PdfExport Gerrit-Branch: master Gerrit-Owner: Filip <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
