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 array( $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;
118 " -enc UTF-8 " . # Report metadata
as UTF-8
text...
119 " -l 9999999 " . # Report
page sizes
for all
pages
120 " -meta " . # Report XMP metadata
131 if ( isset( $wgPdftoText ) ) {
134 wfDebug( __METHOD__.
": $cmd\n" );
139 $txt = str_replace(
"\r\n",
"\n", $txt );
140 $pages = explode(
"\f", $txt );
141 foreach( $pages
as $page => $pageText ) {
142 # Get rid of invalid UTF-8, strip control characters
143 # Note we need to do this per page, as \f page feed would be stripped.
144 $pages[
$page] = Validator::cleanUp( $pageText );
146 $data[
'text'] = $pages;
157 if ( strval( $dump ) ==
'' ) {
161 $lines = explode(
"\n", $dump );
172 # Handle XMP differently due to diffence in line break
173 $data[
'xmp'] .=
"\n$line";
176 $bits = explode(
':',
$line, 2 );
177 if(
count( $bits ) > 1 ) {
178 $key = trim( $bits[0] );
179 if ( $key ===
'Metadata' ) {
184 $value = trim( $bits[1] );
188 if( preg_match(
'/^Page +(\d+) (size|rot)$/', $key,
$matches ) ) {
212 foreach( $data
as $key => $val ) {
215 $items[
'ObjectName'] = $val;
218 $items[
'ImageDescription'] = $val;
224 $keyList = array_filter( explode(
' ', $val ) );
225 if (
count( $keyList ) > 0 ) {
226 $items[
'Keywords'] = $keyList;
230 $items[
'Artist'] = $val;
235 $items[
'Software'] = $val;
239 $items[
'pdf-Producer'] = $val;
245 $items[
'DateTime'] = $timestamp;
251 $items[
'DateTimeDigitized'] = $timestamp;
261 $items[
'pdf-Version'] = $val;
269 $items[
'pdf-Encrypted'] = $val;
279 $pageSizes =
array();
281 if( isset(
$page[
'Page size'] ) ) {
282 $pageSizes[
$page[
'Page size'] ] =
true;
286 $pageSizeArray = array_keys( $pageSizes );
287 if (
count( $pageSizeArray ) > 0 ) {
288 $items[
'pdf-PageSize'] = $pageSizeArray;
294 $meta->addMetadata( $items,
'native' );
296 if ( isset( $data[
'xmp'] ) && function_exists(
'xml_parser_create_ns' ) ) {
301 $xmp =
new XMPReader( LoggerFactory::getInstance(
'XMP' ) );
302 $xmp->parse( $data[
'xmp'] );
303 $xmpRes = $xmp->getResults();
304 foreach ( $xmpRes
as $type => $xmpSection ) {
305 $meta->addMetadata( $xmpSection,
$type );
308 unset( $data[
'xmp'] );
309 $data[
'mergedMetadata'] = $meta->getMetadataArray();
wfProfileIn( $functionname)
Begin profiling of a function.
wfProfileOut( $functionname='missing')
Stop profiling of a function.
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)
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
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.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached my talk page
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...