r57276 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57275‎ | r57276 | r57277 >
Date:08:32, 2 October 2009
Author:thomasv
Status:ok
Tags:
Comment:
use generic text getter added in r56811
Modified paths:
  • /trunk/extensions/ProofreadPage/ProofreadPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ProofreadPage/ProofreadPage.php
@@ -32,10 +32,6 @@
3333 $wgSpecialPages['IndexPages'] = 'ProofreadPages';
3434 $wgSpecialPageGroups['IndexPages'] = 'pages';
3535
36 -
37 -# Allows for extracting text from djvu files. To enable, set to 'djvutxt' or similar
38 -$wgDjvutxt = null;
39 -
4036 # Bump the version number every time you change proofread.js
4137 $wgProofreadPageVersion = 24;
4238
@@ -1095,12 +1091,11 @@
10961092 }
10971093
10981094
1099 -/* preload Djvu Text */
 1095+/* Preload text layer from multipage formats */
11001096 function pr_preloadText( $textbox1, $mTitle ) {
1101 - global $wgDjvuTxt;
11021097
11031098 $page_namespace = pr_page_ns();
1104 - if ( $wgDjvuTxt && preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) {
 1099+ if ( preg_match( "/^$page_namespace:(.*?)\/([0-9]*)$/", $mTitle->getPrefixedText(), $m ) ) {
11051100 $imageTitle = Title::makeTitleSafe( NS_IMAGE, $m[1] );
11061101 if ( !$imageTitle ) {
11071102 return true;
@@ -1108,14 +1103,11 @@
11091104
11101105 $image = wfFindFile( $imageTitle );
11111106 if ( $image && $image->exists() ) {
1112 - $mime = $image->getMimeType();
1113 - if( $mime == 'image/vnd.djvu' /*|| $mime == 'application/pdf'*/ ) {
1114 - $text = $image->handler->getPageText($image, $m[2]);
1115 - if ( $text ) {
1116 - $text = preg_replace( "/(\\\\n)/", "\n", $text );
1117 - $text = preg_replace( "/(\\\\\d*)/", "", $text );
1118 - $textbox1 = $text;
1119 - }
 1107+ $text = $image->handler->getPageText($image, $m[2]);
 1108+ if ( $text ) {
 1109+ $text = preg_replace( "/(\\\\n)/", "\n", $text );
 1110+ $text = preg_replace( "/(\\\\\d*)/", "", $text );
 1111+ $textbox1 = $text;
11201112 }
11211113 }
11221114 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56811generic method to extract text layer of a documentthomasv12:28, 23 September 2009

Status & tagging log