Go to the documentation of this file.
23 use UtfNormal\Validator;
36 $this->mFilename = $filename;
50 $data = $this->retrieveMetadata();
51 $size = self::getPageSize( $data, 1 );
54 $width = $size[
'width'];
55 $height = $size[
'height'];
56 return [ $width, $height,
'Pdf',
57 "width=\"$width\" height=\"$height\"" ];
70 if ( isset( $data[
'pages'][$page][
'Page size'] ) ) {
71 $o = $data[
'pages'][$page][
'Page size'];
72 } elseif ( isset( $data[
'Page size'] ) ) {
73 $o = $data[
'Page size'];
79 if ( isset( $data[
'pages'][$page][
'Page rot'] ) ) {
80 $r = $data[
'pages'][$page][
'Page rot'];
81 } elseif ( isset( $data[
'Page rot'] ) ) {
82 $r = $data[
'Page rot'];
86 $size = explode(
'x', $o, 2 );
89 $width = intval( trim( $size[0] ) / 72 * $wgPdfHandlerDpi );
90 $height = explode(
' ', trim( $size[1] ), 2 );
91 $height = intval( trim( $height[0] ) / 72 * $wgPdfHandlerDpi );
92 if ( ( $r / 90 ) & 1 ) {
113 global $wgPdfInfo, $wgPdftoText;
120 " -enc UTF-8 " . # Report metadata
as UTF-8
text...
121 " -meta " . # Report XMP metadata
127 " -enc UTF-8 " . # Report metadata
as UTF-8
text...
128 " -l 9999999 " . # Report
page sizes
for all
pages
133 $dump = $resultMeta . $resultPages;
140 if ( isset( $wgPdftoText ) ) {
142 wfDebug( __METHOD__.
": $cmd\n" );
146 $txt = str_replace(
"\r\n",
"\n", $txt );
147 $pages = explode(
"\f", $txt );
148 foreach ( $pages
as $page => $pageText ) {
151 $pages[$page] = Validator::cleanUp( $pageText );
153 $data[
'text'] = $pages;
164 if ( strval( $dump ) ==
'' ) {
168 $lines = explode(
"\n", $dump );
180 $data[
'xmp'] .=
"\n$line";
183 $bits = explode(
':',
$line, 2 );
184 if (
count( $bits ) > 1 ) {
185 $key = trim( $bits[0] );
186 if ( $key ===
'Metadata' ) {
191 $value = trim( $bits[1] );
195 if ( preg_match(
'/^Page +(\d+) (size|rot)$/', $key,
$matches ) ) {
218 foreach ( $data
as $key => $val ) {
221 $items[
'ObjectName'] = $val;
224 $items[
'ImageDescription'] = $val;
230 $keyList = array_filter( explode(
' ', $val ) );
231 if (
count( $keyList ) > 0 ) {
232 $items[
'Keywords'] = $keyList;
236 $items[
'Artist'] = $val;
241 $items[
'Software'] = $val;
245 $items[
'pdf-Producer'] = $val;
251 $items[
'DateTime'] = $timestamp;
257 $items[
'DateTimeDigitized'] = $timestamp;
267 $items[
'pdf-Version'] = $val;
275 $items[
'pdf-Encrypted'] = $val;
286 foreach ( $val
as $page ) {
287 if ( isset( $page[
'Page size'] ) ) {
288 $pageSizes[$page[
'Page size']] =
true;
292 $pageSizeArray = array_keys( $pageSizes );
293 if (
count( $pageSizeArray ) > 0 ) {
294 $items[
'pdf-PageSize'] = $pageSizeArray;
300 $meta->addMetadata( $items,
'native' );
302 if ( isset( $data[
'xmp'] ) && function_exists(
'xml_parser_create_ns' ) ) {
307 $xmp =
new XMPReader( LoggerFactory::getInstance(
'XMP' ) );
308 $xmp->parse( $data[
'xmp'] );
309 $xmpRes = $xmp->getResults();
310 foreach ( $xmpRes
as $type => $xmpSection ) {
311 $meta->addMetadata( $xmpSection,
$type );
314 unset( $data[
'xmp'] );
315 $data[
'mergedMetadata'] = $meta->getMetadataArray();
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static getPageSize( $data, $page)
convertDumpToArray( $dump)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
The ContentHandler facility adds support for arbitrary content types on wiki pages
inspired by djvuimage from Brion Vibber modified and written by xarax
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Class for reading xmp data containing properties relevant to images, and spitting out an array that F...
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
wfEscapeShellArg()
Version of escapeshellarg() that works better on Windows.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method. MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances. The "Spi" in MediaWiki\Logger\Spi stands for "service provider interface". An SPI is an API intended to be implemented or extended by a third party. This software design pattern is intended to enable framework extension and replaceable components. It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki. The service provider interface allows the backend logging library to be implemented in multiple ways. The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime. This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance. Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
postProcessDump(array $data)
Postprocess the metadata (convert xmp into useful form, etc)
the array() calling protocol came about after MediaWiki 1.4rc1.
wfShellExec( $cmd, &$retval=null, $environ=[], $limits=[], $options=[])
Execute a shell command, with time and memory limits mirrored from the PHP configuration if supported...