-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPdfExport.php
More file actions
49 lines (43 loc) · 2.08 KB
/
PdfExport.php
File metadata and controls
49 lines (43 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
if ( !defined( 'MEDIAWIKI' ) )
die ();
$wgExtensionCredits['specialpage'][] = array(
'name' => 'PdfExport',
'author' => array( 'Thomas Hempel', 'Anas Al-Mahdy', 'Muhammad Al-Syrwan' ),
'version' => '0.1 (2011-10-4)',
'description' => 'renders a page as pdf using TCPDF class',
'url' => 'http://www.mediawiki.org/wiki/Extension:Multilingual_Pdf_Export'
);
$dir = dirname(__FILE__) . '/';
# Internationalisation file
$wgExtensionMessagesFiles['PdfPrint'] = $dir . 'PdfExport.i18n.php';
$wgExtensionAliasesFiles['PdfPrint'] = $dir . 'PdfExport.i18n.alias.php';
$wgSpecialPageGroups['PdfPrint'] = 'pagetools';
# Add special page.
$wgSpecialPages['PdfPrint'] = 'SpecialPdf';
$wgAutoloadClasses['SpecialPdf'] = $dir . 'PdfExport_body.php';
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'wfSpecialPdfNav';
$wgHooks['SkinTemplateToolboxEnd'][] = 'wfSpecialPdfToolbox';
function wfSpecialPdfNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
wfLoadExtensionMessages( 'PdfPrint' );
$nav_urls['pdfprint'] = array(
'text' => wfMsg( 'pdf_print_link' ),
'href' => $skintemplate->makeSpecialUrl( 'PdfPrint', "page=" . wfUrlencode( "{$skintemplate->thispage}" ) )
);
return true;
}
function wfSpecialPdfToolbox( &$monobook ) {
wfLoadExtensionMessages( 'PdfPrint' );
if ( isset( $monobook->data['nav_urls']['pdfprint'] ) )
if ( $monobook->data['nav_urls']['pdfprint']['href'] == '' ) {
?><li id="t-ispdf"><?php echo $monobook->msg( 'pdf_print_link' ); ?></li><?php
} else {
?><li id="t-pdf">
<?php
?><a href="<?php echo htmlspecialchars( $monobook->data['nav_urls']['pdfprint']['href'] ) ?>"><?php
echo $monobook->msg( 'pdf_print_link' );
?></a><?php
?></li><?php
}
return true;
}