MediaWiki  1.23.15
SVG.php
Go to the documentation of this file.
1 <?php
29 class SvgHandler extends ImageHandler {
31 
36  private static $metaConversion = array(
37  'originalwidth' => 'ImageWidth',
38  'originalheight' => 'ImageLength',
39  'description' => 'ImageDescription',
40  'title' => 'ObjectName',
41  );
42 
43  function isEnabled() {
44  global $wgSVGConverters, $wgSVGConverter;
45  if ( !isset( $wgSVGConverters[$wgSVGConverter] ) ) {
46  wfDebug( "\$wgSVGConverter is invalid, disabling SVG rendering.\n" );
47 
48  return false;
49  } else {
50  return true;
51  }
52  }
53 
54  function mustRender( $file ) {
55  return true;
56  }
57 
58  function isVectorized( $file ) {
59  return true;
60  }
61 
66  function isAnimatedImage( $file ) {
67  # @todo Detect animated SVGs
68  $metadata = $file->getMetadata();
69  if ( $metadata ) {
70  $metadata = $this->unpackMetadata( $metadata );
71  if ( isset( $metadata['animated'] ) ) {
72  return $metadata['animated'];
73  }
74  }
75 
76  return false;
77  }
78 
91  public function getAvailableLanguages( File $file ) {
92  $metadata = $file->getMetadata();
93  $langList = array();
94  if ( $metadata ) {
95  $metadata = $this->unpackMetadata( $metadata );
96  if ( isset( $metadata['translations'] ) ) {
97  foreach ( $metadata['translations'] as $lang => $langType ) {
98  if ( $langType === SvgReader::LANG_FULL_MATCH ) {
99  $langList[] = $lang;
100  }
101  }
102  }
103  }
104  return $langList;
105  }
106 
112  public function getDefaultRenderLanguage( File $file ) {
113  return 'en';
114  }
115 
119  function canAnimateThumb( $file ) {
120  return false;
121  }
122 
128  function normaliseParams( $image, &$params ) {
129  global $wgSVGMaxSize;
130  if ( !parent::normaliseParams( $image, $params ) ) {
131  return false;
132  }
133  # Don't make an image bigger than wgMaxSVGSize on the smaller side
134  if ( $params['physicalWidth'] <= $params['physicalHeight'] ) {
135  if ( $params['physicalWidth'] > $wgSVGMaxSize ) {
136  $srcWidth = $image->getWidth( $params['page'] );
137  $srcHeight = $image->getHeight( $params['page'] );
138  $params['physicalWidth'] = $wgSVGMaxSize;
139  $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, $wgSVGMaxSize );
140  }
141  } else {
142  if ( $params['physicalHeight'] > $wgSVGMaxSize ) {
143  $srcWidth = $image->getWidth( $params['page'] );
144  $srcHeight = $image->getHeight( $params['page'] );
145  $params['physicalWidth'] = File::scaleHeight( $srcHeight, $srcWidth, $wgSVGMaxSize );
146  $params['physicalHeight'] = $wgSVGMaxSize;
147  }
148  }
149 
150  return true;
151  }
152 
161  function doTransform( $image, $dstPath, $dstUrl, $params, $flags = 0 ) {
162  if ( !$this->normaliseParams( $image, $params ) ) {
163  return new TransformParameterError( $params );
164  }
165  $clientWidth = $params['width'];
166  $clientHeight = $params['height'];
167  $physicalWidth = $params['physicalWidth'];
168  $physicalHeight = $params['physicalHeight'];
169  $lang = isset( $params['lang'] ) ? $params['lang'] : $this->getDefaultRenderLanguage( $image );
170 
171  if ( $flags & self::TRANSFORM_LATER ) {
172  return new ThumbnailImage( $image, $dstUrl, $dstPath, $params );
173  }
174 
175  $metadata = $this->unpackMetadata( $image->getMetadata() );
176  if ( isset( $metadata['error'] ) ) { // sanity check
177  $err = wfMessage( 'svg-long-error', $metadata['error']['message'] )->text();
178 
179  return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
180  }
181 
182  if ( !wfMkdirParents( dirname( $dstPath ), null, __METHOD__ ) ) {
183  return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight,
184  wfMessage( 'thumbnail_dest_directory' )->text() );
185  }
186 
187  $srcPath = $image->getLocalRefPath();
188  $status = $this->rasterize( $srcPath, $dstPath, $physicalWidth, $physicalHeight, $lang );
189  if ( $status === true ) {
190  return new ThumbnailImage( $image, $dstUrl, $dstPath, $params );
191  } else {
192  return $status; // MediaTransformError
193  }
194  }
195 
207  public function rasterize( $srcPath, $dstPath, $width, $height, $lang = false ) {
208  global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath;
209  $err = false;
210  $retval = '';
211  if ( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
212  if ( is_array( $wgSVGConverters[$wgSVGConverter] ) ) {
213  // This is a PHP callable
214  $func = $wgSVGConverters[$wgSVGConverter][0];
215  $args = array_merge( array( $srcPath, $dstPath, $width, $height, $lang ),
216  array_slice( $wgSVGConverters[$wgSVGConverter], 1 ) );
217  if ( !is_callable( $func ) ) {
218  throw new MWException( "$func is not callable" );
219  }
220  $err = call_user_func_array( $func, $args );
221  $retval = (bool)$err;
222  } else {
223  // External command
224  $cmd = str_replace(
225  array( '$path/', '$width', '$height', '$input', '$output' ),
226  array( $wgSVGConverterPath ? wfEscapeShellArg( "$wgSVGConverterPath/" ) : "",
227  intval( $width ),
228  intval( $height ),
229  wfEscapeShellArg( $srcPath ),
230  wfEscapeShellArg( $dstPath ) ),
231  $wgSVGConverters[$wgSVGConverter]
232  );
233 
234  $env = array();
235  if ( $lang !== false ) {
236  $env['LANG'] = $lang;
237  }
238 
239  wfProfileIn( 'rsvg' );
240  wfDebug( __METHOD__ . ": $cmd\n" );
241  $err = wfShellExecWithStderr( $cmd, $retval, $env );
242  wfProfileOut( 'rsvg' );
243  }
244  }
245  $removed = $this->removeBadFile( $dstPath, $retval );
246  if ( $retval != 0 || $removed ) {
247  $this->logErrorForExternalProcess( $retval, $err, $cmd );
248  return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
249  }
250 
251  return true;
252  }
253 
254  public static function rasterizeImagickExt( $srcPath, $dstPath, $width, $height ) {
255  $im = new Imagick( $srcPath );
256  $im->setImageFormat( 'png' );
257  $im->setBackgroundColor( 'transparent' );
258  $im->setImageDepth( 8 );
259 
260  if ( !$im->thumbnailImage( intval( $width ), intval( $height ), /* fit */ false ) ) {
261  return 'Could not resize image';
262  }
263  if ( !$im->writeImage( $dstPath ) ) {
264  return "Could not write to $dstPath";
265  }
266  }
267 
274  function getImageSize( $file, $path, $metadata = false ) {
275  if ( $metadata === false ) {
276  $metadata = $file->getMetaData();
277  }
278  $metadata = $this->unpackMetaData( $metadata );
279 
280  if ( isset( $metadata['width'] ) && isset( $metadata['height'] ) ) {
281  return array( $metadata['width'], $metadata['height'], 'SVG',
282  "width=\"{$metadata['width']}\" height=\"{$metadata['height']}\"" );
283  } else { // error
284  return array( 0, 0, 'SVG', "width=\"0\" height=\"0\"" );
285  }
286  }
287 
288  function getThumbType( $ext, $mime, $params = null ) {
289  return array( 'png', 'image/png' );
290  }
291 
301  function getLongDesc( $file ) {
302  global $wgLang;
303 
304  $metadata = $this->unpackMetadata( $file->getMetadata() );
305  if ( isset( $metadata['error'] ) ) {
306  return wfMessage( 'svg-long-error', $metadata['error']['message'] )->text();
307  }
308 
309  $size = $wgLang->formatSize( $file->getSize() );
310 
311  if ( $this->isAnimatedImage( $file ) ) {
312  $msg = wfMessage( 'svg-long-desc-animated' );
313  } else {
314  $msg = wfMessage( 'svg-long-desc' );
315  }
316 
317  $msg->numParams( $file->getWidth(), $file->getHeight() )->params( $size );
318 
319  return $msg->parse();
320  }
321 
327  function getMetadata( $file, $filename ) {
328  $metadata = array( 'version' => self::SVG_METADATA_VERSION );
329  try {
330  $metadata += SVGMetadataExtractor::getMetadata( $filename );
331  } catch ( MWException $e ) { // @todo SVG specific exceptions
332  // File not found, broken, etc.
333  $metadata['error'] = array(
334  'message' => $e->getMessage(),
335  'code' => $e->getCode()
336  );
337  wfDebug( __METHOD__ . ': ' . $e->getMessage() . "\n" );
338  }
339 
340  return serialize( $metadata );
341  }
342 
343  function unpackMetadata( $metadata ) {
345  $unser = unserialize( $metadata );
347  if ( isset( $unser['version'] ) && $unser['version'] == self::SVG_METADATA_VERSION ) {
348  return $unser;
349  } else {
350  return false;
351  }
352  }
353 
354  function getMetadataType( $image ) {
355  return 'parsed-svg';
356  }
357 
358  function isMetadataValid( $image, $metadata ) {
359  $meta = $this->unpackMetadata( $metadata );
360  if ( $meta === false ) {
361  return self::METADATA_BAD;
362  }
363  if ( !isset( $meta['originalWidth'] ) ) {
364  // Old but compatible
366  }
367 
368  return self::METADATA_GOOD;
369  }
370 
371  protected function visibleMetadataFields() {
372  $fields = array( 'objectname', 'imagedescription' );
373 
374  return $fields;
375  }
376 
381  function formatMetadata( $file ) {
382  $result = array(
383  'visible' => array(),
384  'collapsed' => array()
385  );
386  $metadata = $file->getMetadata();
387  if ( !$metadata ) {
388  return false;
389  }
390  $metadata = $this->unpackMetadata( $metadata );
391  if ( !$metadata || isset( $metadata['error'] ) ) {
392  return false;
393  }
394 
395  /* @todo Add a formatter
396  $format = new FormatSVG( $metadata );
397  $formatted = $format->getFormattedData();
398  */
399 
400  // Sort fields into visible and collapsed
401  $visibleFields = $this->visibleMetadataFields();
402 
403  $showMeta = false;
404  foreach ( $metadata as $name => $value ) {
405  $tag = strtolower( $name );
406  if ( isset( self::$metaConversion[$tag] ) ) {
407  $tag = strtolower( self::$metaConversion[$tag] );
408  } else {
409  // Do not output other metadata not in list
410  continue;
411  }
412  $showMeta = true;
414  in_array( $tag, $visibleFields ) ? 'visible' : 'collapsed',
415  'exif',
416  $tag,
417  $value
418  );
419  }
420 
421  return $showMeta ? $result : false;
422  }
423 
429  function validateParam( $name, $value ) {
430  if ( in_array( $name, array( 'width', 'height' ) ) ) {
431  // Reject negative heights, widths
432  return ( $value > 0 );
433  } elseif ( $name == 'lang' ) {
434  // Validate $code
435  if ( $value === '' || !Language::isValidBuiltinCode( $value ) ) {
436  wfDebug( "Invalid user language code\n" );
437 
438  return false;
439  }
440 
441  return true;
442  }
443 
444  // Only lang, width and height are acceptable keys
445  return false;
446  }
447 
452  function makeParamString( $params ) {
453  $lang = '';
454  if ( isset( $params['lang'] ) && $params['lang'] !== 'en' ) {
455  $params['lang'] = mb_strtolower( $params['lang'] );
456  $lang = "lang{$params['lang']}-";
457  }
458  if ( !isset( $params['width'] ) ) {
459  return false;
460  }
461 
462  return "$lang{$params['width']}px";
463  }
464 
465  function parseParamString( $str ) {
466  $m = false;
467  if ( preg_match( '/^lang([a-z]+(?:-[a-z]+)*)-(\d+)px$/', $str, $m ) ) {
468  return array( 'width' => array_pop( $m ), 'lang' => $m[1] );
469  } elseif ( preg_match( '/^(\d+)px$/', $str, $m ) ) {
470  return array( 'width' => $m[1], 'lang' => 'en' );
471  } else {
472  return false;
473  }
474  }
475 
476  function getParamMap() {
477  return array( 'img_lang' => 'lang', 'img_width' => 'width' );
478  }
479 
484  function getScriptParams( $params ) {
485  $scriptParams = array( 'width' => $params['width'] );
486  if ( isset( $params['lang'] ) ) {
487  $scriptParams['lang'] = $params['lang'];
488  }
489 
490  return $scriptParams;
491  }
492 
493  public function getCommonMetaArray( File $file ) {
494  $metadata = $file->getMetadata();
495  if ( !$metadata ) {
496  return array();
497  }
498  $metadata = $this->unpackMetadata( $metadata );
499  if ( !$metadata || isset( $metadata['error'] ) ) {
500  return array();
501  }
502  $stdMetadata = array();
503  foreach ( $metadata as $name => $value ) {
504  $tag = strtolower( $name );
505  if ( $tag === 'originalwidth' || $tag === 'originalheight' ) {
506  // Skip these. In the exif metadata stuff, it is assumed these
507  // are measured in px, which is not the case here.
508  continue;
509  }
510  if ( isset( self::$metaConversion[$tag] ) ) {
511  $tag = self::$metaConversion[$tag];
512  $stdMetadata[$tag] = $value;
513  }
514  }
515 
516  return $stdMetadata;
517  }
518 }
MediaHandler\removeBadFile
removeBadFile( $dstPath, $retval=0)
Check for zero-sized thumbnails.
Definition: MediaHandler.php:688
SvgHandler\validateParam
validateParam( $name, $value)
Definition: SVG.php:429
SvgHandler\rasterizeImagickExt
static rasterizeImagickExt( $srcPath, $dstPath, $width, $height)
Definition: SVG.php:254
MediaTransformError
Basic media transform error class.
Definition: MediaTransformOutput.php:409
ThumbnailImage
Media transform output for images.
Definition: MediaTransformOutput.php:250
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
$mime
usually copyright or history_copyright This message must be in HTML not wikitext $subpages will be ignored and the rest of subPageSubtitle() will run. 'SkinTemplateBuildNavUrlsNav_urlsAfterPermalink' whether MediaWiki currently thinks this is a CSS JS page Hooks may change this value to override the return value of Title::isCssOrJsPage(). 'TitleIsAlwaysKnown' whether MediaWiki currently thinks this page is known isMovable() always returns false. $title whether MediaWiki currently thinks this page is movable Hooks may change this value to override the return value of Title::isMovable(). 'TitleIsWikitextPage' whether MediaWiki currently thinks this is a wikitext page Hooks may change this value to override the return value of Title::isWikitextPage() 'TitleMove' use UploadVerification and UploadVerifyFile instead where the first element is the message key and the remaining elements are used as parameters to the message based on mime etc Preferred in most cases over UploadVerification object with all info about the upload string $mime
Definition: hooks.txt:2584
wfMkdirParents
wfMkdirParents( $dir, $mode=null, $caller=null)
Make directory, and make all parent directories if they don't exist.
Definition: GlobalFunctions.php:2637
SvgHandler\parseParamString
parseParamString( $str)
Parse a param string made with makeParamString back into an array.
Definition: SVG.php:465
SVGMetadataExtractor\getMetadata
static getMetadata( $filename)
Definition: SVGMetadataExtractor.php:32
SvgHandler\$metaConversion
static $metaConversion
Definition: SVG.php:36
SvgHandler\getMetadataType
getMetadataType( $image)
Get a string describing the type of metadata, for display purposes.
Definition: SVG.php:354
text
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
Definition: design.txt:12
wfProfileIn
wfProfileIn( $functionname)
Begin profiling of a function.
Definition: Profiler.php:33
SvgHandler\formatMetadata
formatMetadata( $file)
Definition: SVG.php:381
SvgHandler\canAnimateThumb
canAnimateThumb( $file)
We do not support making animated svg thumbnails.
Definition: SVG.php:119
wfSuppressWarnings
wfSuppressWarnings( $end=false)
Reference-counted warning suppression.
Definition: GlobalFunctions.php:2434
SvgHandler\isAnimatedImage
isAnimatedImage( $file)
Definition: SVG.php:66
SvgHandler\mustRender
mustRender( $file)
True if handled types cannot be displayed directly in a browser but can be rendered.
Definition: SVG.php:54
$params
$params
Definition: styleTest.css.php:40
wfShellExecWithStderr
wfShellExecWithStderr( $cmd, &$retval=null, $environ=array(), $limits=array())
Execute a shell command, returning both stdout and stderr.
Definition: GlobalFunctions.php:3084
SvgHandler\getThumbType
getThumbType( $ext, $mime, $params=null)
Get the thumbnail extension and MIME type for a given source MIME type.
Definition: SVG.php:288
$flags
it s the revision text itself In either if gzip is the revision text is gzipped $flags
Definition: hooks.txt:2124
SvgHandler\getScriptParams
getScriptParams( $params)
Definition: SVG.php:484
SvgHandler\getMetadata
getMetadata( $file, $filename)
Definition: SVG.php:327
SvgHandler\rasterize
rasterize( $srcPath, $dstPath, $width, $height, $lang=false)
Transform an SVG file to PNG This function can be called outside of thumbnail contexts.
Definition: SVG.php:207
SvgHandler\getLongDesc
getLongDesc( $file)
Subtitle for the image.
Definition: SVG.php:301
MediaHandler\METADATA_COMPATIBLE
const METADATA_COMPATIBLE
Definition: MediaHandler.php:33
File
Implements some public methods and some protected utility functions which are required by multiple ch...
Definition: File.php:50
MWException
MediaWiki exception.
Definition: MWException.php:26
wfRestoreWarnings
wfRestoreWarnings()
Restore error level to previous value.
Definition: GlobalFunctions.php:2464
SvgHandler\normaliseParams
normaliseParams( $image, &$params)
Definition: SVG.php:128
SvgHandler\isEnabled
isEnabled()
False if the handler is disabled for all files.
Definition: SVG.php:43
wfProfileOut
wfProfileOut( $functionname='missing')
Stop profiling of a function.
Definition: Profiler.php:46
ImageHandler
Media handler abstract base class for images.
Definition: ImageHandler.php:29
wfMessage
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form externallinks including delete and has completed for all link tables default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
MediaHandler\addMeta
static addMeta(&$array, $visibility, $type, $id, $value, $param=false)
This is used to generate an array element for each metadata value That array is then used to generate...
Definition: MediaHandler.php:555
SvgHandler
Handler for SVG images.
Definition: SVG.php:29
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
SvgHandler\doTransform
doTransform( $image, $dstPath, $dstUrl, $params, $flags=0)
Definition: SVG.php:161
wfDebug
wfDebug( $text, $dest='all')
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:980
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$size
$size
Definition: RandomTest.php:75
$value
$value
Definition: styleTest.css.php:45
TransformParameterError
Shortcut class for parameter validation errors.
Definition: MediaTransformOutput.php:452
wfEscapeShellArg
wfEscapeShellArg()
Windows-compatible version of escapeshellarg() Windows doesn't recognise single-quotes in the shell,...
Definition: GlobalFunctions.php:2752
SvgHandler\getAvailableLanguages
getAvailableLanguages(File $file)
Which languages (systemLanguage attribute) is supported.
Definition: SVG.php:91
SvgHandler\getImageSize
getImageSize( $file, $path, $metadata=false)
Definition: SVG.php:274
File\scaleHeight
static scaleHeight( $srcWidth, $srcHeight, $dstWidth)
Calculate the height of a thumbnail using the source and destination width.
Definition: File.php:1701
$file
if(PHP_SAPI !='cli') $file
Definition: UtfNormalTest2.php:30
$args
if( $line===false) $args
Definition: cdb.php:62
SvgHandler\getCommonMetaArray
getCommonMetaArray(File $file)
Get an array of standard (FormatMetadata type) metadata values.
Definition: SVG.php:493
$wgLang
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as $wgLang
Definition: design.txt:56
SvgHandler\getDefaultRenderLanguage
getDefaultRenderLanguage(File $file)
What language to render file in if none selected.
Definition: SVG.php:112
$ext
$ext
Definition: NoLocalSettings.php:34
MediaHandler\logErrorForExternalProcess
logErrorForExternalProcess( $retval, $err, $cmd)
Log an error that occurred in an external process.
Definition: MediaHandler.php:766
$path
$path
Definition: NoLocalSettings.php:35
SvgHandler\visibleMetadataFields
visibleMetadataFields()
Get a list of metadata items which should be displayed when the metadata table is collapsed.
Definition: SVG.php:371
as
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
Definition: distributors.txt:9
MediaHandler\METADATA_BAD
const METADATA_BAD
Definition: MediaHandler.php:32
SvgHandler\SVG_METADATA_VERSION
const SVG_METADATA_VERSION
Definition: SVG.php:30
SvgHandler\unpackMetadata
unpackMetadata( $metadata)
Definition: SVG.php:343
SvgHandler\makeParamString
makeParamString( $params)
Definition: SVG.php:452
SvgHandler\getParamMap
getParamMap()
Get an associative array mapping magic word IDs to parameter names.
Definition: SVG.php:476
$retval
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
Definition: hooks.txt:237
SvgHandler\isVectorized
isVectorized( $file)
The material is vectorized and thus scaling is lossless.
Definition: SVG.php:58
MediaHandler\METADATA_GOOD
const METADATA_GOOD
Definition: MediaHandler.php:31
SvgHandler\isMetadataValid
isMetadataValid( $image, $metadata)
Check if the metadata string is valid for this handler.
Definition: SVG.php:358
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:1632